Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when Editing Converted Empty <b></b> Tags in Volto #30

Closed
shogunbr opened this issue May 22, 2023 · 0 comments
Closed

Error when Editing Converted Empty <b></b> Tags in Volto #30

shogunbr opened this issue May 22, 2023 · 0 comments
Assignees

Comments

@shogunbr
Copy link

When converting an HTML that contains an empty <b></b> tag into Slate format, like this:
<p>foo<b></b></p>
It generates the following JSON structure:

{
  "data": [
    {
      "@type": "slate",
      "value": [
        {
          "type": "p",
          "children": [
            {
              "text": "foo"
            },
            {
              "type": "strong",
              "children": []
            }
          ]
        }
      ],
      "plaintext": "foo"
    }
  ]
}

While it is displayed correctly in Volto, attempting to edit it triggers an error:

Sorry, something went wrong with your request 
Cannot get the end point in the node at path [0] because it has no end text node.

However, this issue does not occur when converting an empty <strong></strong> tag.
<p>foo<strong></strong></p>
The corresponding JSON structure for that case includes an empty text node within the <strong> tag:

{
  "data": [
    {
      "@type": "slate",
      "value": [
        {
          "type": "p",
          "children": [
            {
              "text": "foo"
            },
            {
              "type": "strong",
              "children": [
                {
                  "text": ""
                }
              ]
            }
          ]
        }
      ],
      "plaintext": "foo"
    }
  ]
}

Please note that the issue occurs specifically with the empty <b></b> tag and not with the empty <strong></strong> tag.

@ericof ericof self-assigned this Jun 1, 2023
@ericof ericof closed this as completed in e57b766 Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants