From c408d88e035813e18216a79c9a20bc64730510fa Mon Sep 17 00:00:00 2001 From: noumantahir Date: Tue, 9 Aug 2022 17:26:17 +0500 Subject: [PATCH] restores selection to last cursor position after preview end --- src/components/markdownEditor/view/markdownEditorView.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/markdownEditor/view/markdownEditorView.tsx b/src/components/markdownEditor/view/markdownEditorView.tsx index ab6be1546..22c7145d5 100644 --- a/src/components/markdownEditor/view/markdownEditorView.tsx +++ b/src/components/markdownEditor/view/markdownEditorView.tsx @@ -108,9 +108,8 @@ const MarkdownEditorView = ({ }, []); useEffect(() => { - let bodyLength = bodyText.length; if (!isPreviewActive) { - _setTextAndSelection({ selection: { start: bodyLength, end: bodyLength }, text: bodyText }); + _setTextAndSelection({ selection: bodySelection, text: bodyText }); } }, [isPreviewActive]);