From 932dffb2b44dc5cf00a72717fca6679085eda148 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Wed, 6 Jul 2022 18:40:37 +0500 Subject: [PATCH] feat: ignore change events in readonly mode --- apps/web/src/components/editor/tiptap.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx index 4eb09449f..bef4cc440 100644 --- a/apps/web/src/components/editor/tiptap.tsx +++ b/apps/web/src/components/editor/tiptap.tsx @@ -82,7 +82,8 @@ function TipTap(props: TipTapProps) { }); }, onUpdate: ({ editor }) => { - if (onChange) onChange(editor.getHTML(), counter.current); + if (onChange && editor.isEditable) + onChange(editor.getHTML(), counter.current); }, onDestroy: () => { configure({