-
Description I am trying to create comment inputs where if the user presses the Steps
Sandbox https://codesandbox.io/s/plate-error-u0d3g?file=/src/App.js Expectation I assume the error is related to me having to manually position the caret cursor after I reset the contents of the editor. It would be nice if there was either an explanation for this in the docs or there was a helper util function that I could use to facilitate this process. Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's not a bug and it is not from plate either, this is how slate intended to work. Try, to deselect the editor, before you clear it import { Transforms } from "slate";
import { useStoreEditorState, useEventEditorId, Plate } from "@udecode/plate";
// ...
const editor = useStoreEditorState(useEventEditorId("focus"));
// ...
Transforms.deselect(editor);
setValue(INITIAL_VALUE); |
Beta Was this translation helpful? Give feedback.
It's not a bug and it is not from plate either, this is how slate intended to work.
(If you change the content of the editor without using the Transforms API, you have to manage the selection too)
Try, to deselect the editor, before you clear it