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

Cannot get the end point in the node at path [] because it has no end text node. #5647

Open
JoseVov opened this issue May 7, 2024 · 0 comments
Labels

Comments

@JoseVov
Copy link

JoseVov commented May 7, 2024

Description
I'm trying to insert a text in a specific path by using Transform.insertText and I'm receiving the Cannot get the end point in the node at path [] because it has no end text node.

This is the editor's children's structure

[
  {
    "type": "page",
    "id": "WlaRyAtiz",
    "children": [
      {
        "type": "paragraph",
        "id": "HZTuvdih9-",
        "children": [
          {
            "text": "My example text"
          }
        ]
      }
    ]
  },
  {
    "type": "page",
    "id": "bkp8qniab",
    "children": []
  }
]

I'm inserting a custom text in the paragraph

Transforms.insertText(editor, 'Insert custom text', { at: [0, 0] })

Based on this path I'm extracting the endpoint manually to confirm the path using -> Editor.end(editor, path) and the result is `[ 0, 0, 0], which I think is expected since that points directly to the text inside the paragraph.

After spending days on this I realized that if I remove the new/second page from the nodes the error disappears. I think that Slate is ignoring the path that I'm passing [0,0] and Transforms.insertText its always getting the latest node from the editor.children.

Any idea why is this happening?

Environment

  • Slate Version: 0.81.1
  • Slate-react: 0.81.0
  • Operating System: OS
  • Browser: Chrome
@JoseVov JoseVov added the bug label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant