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) {
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<DetailsOptions>({
}
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,