From 9fd00a2d55ace0e1a436dbdc733b7537facafb9f Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sun, 22 May 2022 14:26:41 +0800 Subject: [PATCH] client: enable update in editor --- .../client/src/tiptap/editor/react/useEditor.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/client/src/tiptap/editor/react/useEditor.tsx b/packages/client/src/tiptap/editor/react/useEditor.tsx index cc844dc7..7994671d 100644 --- a/packages/client/src/tiptap/editor/react/useEditor.tsx +++ b/packages/client/src/tiptap/editor/react/useEditor.tsx @@ -22,13 +22,15 @@ export const useEditor = (options: Partial = {}, deps: Dependency setEditor(instance); - // instance.on('transaction', () => { - // requestAnimationFrame(() => { - // requestAnimationFrame(() => { - // forceUpdate(); - // }); - // }); - // }); + if (!options.editable) { + instance.on('transaction', () => { + requestAnimationFrame(() => { + requestAnimationFrame(() => { + forceUpdate(); + }); + }); + }); + } return () => { instance.destroy();