From b84eab469882aeae30feee9ec307d65a09977758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Tue, 17 Mar 2026 18:42:06 +0400 Subject: [PATCH] Disable RichEditor on non draft version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- .../documents/description/DocumentDescriptionPage.tsx | 3 +++ packages/ui/src/RichEditor/RichEditor.tsx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/console/src/pages/organizations/documents/description/DocumentDescriptionPage.tsx b/apps/console/src/pages/organizations/documents/description/DocumentDescriptionPage.tsx index a49d2c4e8..fe07586ab 100644 --- a/apps/console/src/pages/organizations/documents/description/DocumentDescriptionPage.tsx +++ b/apps/console/src/pages/organizations/documents/description/DocumentDescriptionPage.tsx @@ -31,6 +31,7 @@ export const documentDescriptionPageQuery = graphql` ... on DocumentVersion { id content + status } } document: node(id: $documentId) { @@ -42,6 +43,7 @@ export const documentDescriptionPageQuery = graphql` node { id content + status } } } @@ -118,6 +120,7 @@ export function DocumentDescriptionPage(props: { queryRef: PreloadedQuery {/* */} diff --git a/packages/ui/src/RichEditor/RichEditor.tsx b/packages/ui/src/RichEditor/RichEditor.tsx index 94fbad135..4471bc86c 100644 --- a/packages/ui/src/RichEditor/RichEditor.tsx +++ b/packages/ui/src/RichEditor/RichEditor.tsx @@ -79,13 +79,15 @@ function MenuButton({ label, active, onClick }: MenuButtonProps) { interface RichEditorProps { content: string; + disabled?: boolean; onChange: (content: string) => void; } export function RichEditor(props: RichEditorProps) { - const { content, onChange } = props; + const { content, disabled = false, onChange } = props; const editor = useEditor({ + editable: !disabled, extensions, content: (content ? JSON.parse(content) : "") as Content, });