fix: text selection moving when typing in between (#384)
This commit is contained in:
parent
09eab9e6bf
commit
388d5b054a
1 changed files with 1 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue