From 7f7f2bccd032a08e796492cbf70692684502c3ae Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Wed, 9 Apr 2025 15:37:18 +0100 Subject: [PATCH] fix toggle node in non-edit mode --- packages/editor-ext/src/lib/details/details.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/editor-ext/src/lib/details/details.ts b/packages/editor-ext/src/lib/details/details.ts index 8a05f21c..1be9accf 100644 --- a/packages/editor-ext/src/lib/details/details.ts +++ b/packages/editor-ext/src/lib/details/details.ts @@ -111,6 +111,7 @@ export const Details = Node.create({ if (updatedNode.type !== this.type) { return false; } + if (!editor.isEditable) return true; if (updatedNode.attrs.open) { dom.setAttribute("open", "true"); } else { @@ -132,9 +133,10 @@ export const Details = Node.create({ } const slice = state.doc.slice(range.start, range.end); - - if(slice.content.firstChild.type.name === "detailsSummary") return false; - + + if (slice.content.firstChild.type.name === "detailsSummary") + return false; + if ( !state.schema.nodes.detailsContent.contentMatch.matchFragment( slice.content,