slate icon indicating copy to clipboard operation
slate copied to clipboard

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

Open rockyessel opened this issue 1 year ago • 1 comments

Description This error arises when all content is deleted, an image is uploaded with its position altered, and subsequent deletion of the modified image, followed by clicking the text editor and entering additional content, triggers another error.

Recording https://cdn.sanity.io/files/l4h1g3vt/production/65018cbcc15a34dc990621c14cc5bce25c2dc41a.webm

Sandbox This can be reproduced using the code from Slate Examples with images: Link. And live at this link

Steps To reproduce the behavior:

  1. Go to the live example provided by Slate
  2. Select all text and images, and delete them
  3. Then upload an image by copying any image URL, then pasting it into the prompt
  4. Then move/drag the image to the top-most of the editor, then delete the image when focused.
  5. Then click on the editor, then the error appears, and when you type additional error occurs.

Expectation When an image is inserted, and moved/dragged to the top-most of the editor, when deleted, users should be able to type text successfully without any error.

Environment

  • Slate Version: ["^0.101.5"]
  • Operating System: ["Linux"]
  • Browser: ["Chrome"]
  • TypeScript Version: ["5"]

rockyessel avatar Jan 05 '24 10:01 rockyessel

try replacing the node with a new one

const newNode = { type: "paragraph", children: [{ text: "" }] };

    if (isEmpty(value)) {
      Transforms.insertNodes(editor, newNode);
    }

ctakahob avatar Mar 11 '24 14:03 ctakahob