forked from github/plane
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(
|
||||
(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.createState({
|
||||
content:
|
||||
!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