]> BookStack Code Mirror - bookstack/blobdiff - resources/js/editor/schema-nodes.js
Started work on details/summary blocks
[bookstack] / resources / js / editor / schema-nodes.js
index 5ebf76a7f0ef7645883159406c8bedc0fc96c4dc..f930d11000058d3addbe20507e63d92ef9c63216 100644 (file)
@@ -1,5 +1,5 @@
 import {orderedList, bulletList, listItem} from "prosemirror-schema-list";
-import {tableNodes} from "prosemirror-tables";
+import {Fragment} from "prosemirror-model";
 
 /**
  * @param {HTMLElement} node
@@ -328,6 +328,35 @@ const table_header = {
     toDOM(node) { return ["th", setCellAttrs(node), 0] }
 };
 
+
+const details = {
+    content: "details_summary block*",
+    isolating: true,
+    group: "block",
+    parseDOM: [{
+        tag: "details",
+        getAttrs(domNode) {
+            return {}
+        },
+    }],
+    toDOM(node) {
+        return ["details",  0];
+    }
+};
+
+const details_summary = {
+    content: "inline*",
+    group: "block",
+    parseDOM: [{
+        tag: "details summary",
+    }],
+    toDOM(node) {
+        return ["summary",  0];
+    }
+};
+
+
+
 const nodes = {
     doc,
     paragraph,
@@ -347,6 +376,8 @@ const nodes = {
     table_row,
     table_cell,
     table_header,
+    details,
+    details_summary,
 };
 
 export default nodes;
\ No newline at end of file