fix toggle node in non-edit mode

This commit is contained in:
Philipinho
2025-04-09 15:37:18 +01:00
parent a9f370660b
commit 7f7f2bccd0

View File

@ -111,6 +111,7 @@ export const Details = Node.create<DetailsOptions>({
if (updatedNode.type !== this.type) { if (updatedNode.type !== this.type) {
return false; return false;
} }
if (!editor.isEditable) return true;
if (updatedNode.attrs.open) { if (updatedNode.attrs.open) {
dom.setAttribute("open", "true"); dom.setAttribute("open", "true");
} else { } else {
@ -133,7 +134,8 @@ export const Details = Node.create<DetailsOptions>({
const slice = state.doc.slice(range.start, range.end); 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 ( if (
!state.schema.nodes.detailsContent.contentMatch.matchFragment( !state.schema.nodes.detailsContent.contentMatch.matchFragment(