Browse Source

fix: Undo on rich popup open will not clear the content

pull/7046/head
Muhammed Mustafa 1 year ago
parent
commit
b722a077c9
  1. 7
      packages/nc-gui/components/cell/RichText.vue

7
packages/nc-gui/components/cell/RichText.vue

@ -110,8 +110,6 @@ const editor = useEditor({
const setEditorContent = (contentMd: any) => {
if (!editor.value) return
;(editor.value.state as any).history$.prevRanges = null
;(editor.value.state as any).history$.done.eventCount = 0
const selection = editor.value.view.state.selection
@ -120,6 +118,11 @@ const setEditorContent = (contentMd: any) => {
const content = generateJSON(contentHtml, tiptapExtensions)
editor.value.chain().setContent(content).setTextSelection(selection.to).run()
setTimeout(() => {
;(editor.value!.state as any).history$.prevRanges = null
;(editor.value!.state as any).history$.done.eventCount = 0
}, 100)
}
if (props.syncValueChange) {

Loading…
Cancel
Save