restores selection to last cursor position after preview end

This commit is contained in:
noumantahir 2022-08-09 17:26:17 +05:00
parent 8e91ee23d4
commit c408d88e03

View File

@ -108,9 +108,8 @@ const MarkdownEditorView = ({
}, []); }, []);
useEffect(() => { useEffect(() => {
let bodyLength = bodyText.length;
if (!isPreviewActive) { if (!isPreviewActive) {
_setTextAndSelection({ selection: { start: bodyLength, end: bodyLength }, text: bodyText }); _setTextAndSelection({ selection: bodySelection, text: bodyText });
} }
}, [isPreviewActive]); }, [isPreviewActive]);