Skip to content

JSON output instead of inline HTML #39

@Puspendert

Description

@Puspendert

Hello

Whole of the Editorjs creates output as raw JSON and no inline HTML is present. This helps in preventing XSS attacks. But with underline, the output text has inline HTML (sample below).

{
    "time": 1735526737550,
    "blocks": [
        {
            "id": "z5t-4fWC6H",
            "type": "paragraph",
            "data": {
                "text": "And I want to say that <u class=\"cdx-underline\">this is not fine</u> to work with."
            }
        }
    ],
    "version": "2.30.7"
}

Can we create output like below?

{

    "time": 1735526737550,
    "blocks": [
        {
            "id": "z5t-4fWC6H",
            "type": "paragraph",
            "data": {
                "items": [
                    {   
                        "id": "7-djd",
                        "style": null,
                        "text": "And I want to say that"
                    },
                    {
                        "id": "8-djd",
                        "style": underline,
                        "text": " this is not fine "
                    },
                    {
                        "id": "9-djd",
                        "style": null,
                        "text": "to work with."
                    },
                ]
            }
        }
    ],
    "version": "2.30.7"
}

This will help in preventing the XSS attacks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions