mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: text selection moving when typing in between (#384)
This commit is contained in:
parent
09eab9e6bf
commit
388d5b054a
@ -153,12 +153,11 @@ const RemirrorRichTextEditor: FC<IRemirrorRichTextEditor> = (props) => {
|
|||||||
|
|
||||||
const updateState = useCallback(
|
const updateState = useCallback(
|
||||||
(value: any) => {
|
(value: any) => {
|
||||||
// Clear out old state when setting data from outside
|
|
||||||
// This prevents e.g. the user from using CTRL-Z to go back to the old state
|
|
||||||
manager.view.updateState(
|
manager.view.updateState(
|
||||||
manager.createState({
|
manager.createState({
|
||||||
content:
|
content:
|
||||||
!value || (typeof value === "object" && Object.keys(value).length === 0) ? "" : value,
|
!value || (typeof value === "object" && Object.keys(value).length === 0) ? "" : value,
|
||||||
|
selection: value === "" ? "start" : manager.view.state.selection,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user