slate
slate copied to clipboard
Cannot get the start point in the node at path [] because it has no start text node.
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:
- Go to the live example provided by Slate
- Select all text and images, and delete them
- Then upload an image by copying any image URL, then pasting it into the prompt
- Then move/drag the image to the top-most of the editor, then delete the image when focused.
- 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"]
try replacing the node with a new one
const newNode = { type: "paragraph", children: [{ text: "" }] };
if (isEmpty(value)) {
Transforms.insertNodes(editor, newNode);
}