From d73263f7e8e38e8f78bf25b772bd0c5a09aff0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Tue, 31 Mar 2026 10:47:30 +0400 Subject: [PATCH] Handle disabled editor after version publishing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- packages/ui/src/RichEditor/RichEditor.tsx | 35 +++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/packages/ui/src/RichEditor/RichEditor.tsx b/packages/ui/src/RichEditor/RichEditor.tsx index d7a5d266e..5f545cd72 100644 --- a/packages/ui/src/RichEditor/RichEditor.tsx +++ b/packages/ui/src/RichEditor/RichEditor.tsx @@ -64,7 +64,13 @@ const extensions = [ ]; const richEditorVariants = tv({ - base: ["relative h-full pl-14"], + base: ["relative h-full"], + variants: { + disabled: { + true: "", + false: "pl-14", + }, + }, }); type RichEditorProps = ComponentProps<"div"> & { @@ -103,17 +109,28 @@ export function RichEditor(props: RichEditorProps) { } }, [content, watchedContent, onChangeContent]); + useEffect(() => { + if (!editor) return; + editor.setEditable(!disabled); + }, [editor, disabled]); + if (!editor) return null; return ( -
- - - - - - - +
+ {!disabled + && ( + <> + + + + + + + + + )} +
);