Re-render causes caret to jump to beginning of codeblocks #7588
-
|
As you can see in the video that the caret was originally at "d" before "Underline" but when a re render happens, cursor jumps to the beginning of codeblocks(not sure why codeblocks specifically). Screencast.From.2025-05-30.22-51-00.mp4Relevant code: const onChange = (editorState: any) => {
editorState.read(() => {
const markdown = $convertToMarkdownString(
[...TRANSFORMERS, CHECK_LIST, INLINE_CODE, CODE],
undefined,
true,
);
if (markdown !== intitalContent) {
// setNewContent(markdown);
setIsSaved(false);
console.log(markdown);
}
});
};
Basically it forces the parent to render when a change is detected |
Beta Was this translation helpful? Give feedback.
Answered by
Doctorthe113
May 30, 2025
Replies: 1 comment 7 replies
-
|
That's not enough code to reproduce the issue, you have something else that's causing an editor update and/or change its selection. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay I fixed the issue by saving the editor state in a state hook. I still don't know if this is the intended behavior or not.