]> BookStack Code Mirror - bookstack/blob - resources/js/editor/node-views/TableView.js
Started work on details/summary blocks
[bookstack] / resources / js / editor / node-views / TableView.js
1 class TableView {
2     /**
3      * @param {PmNode} node
4      * @param {PmView} view
5      * @param {(function(): number)} getPos
6      */
7     constructor(node, view, getPos) {
8         this.dom = document.createElement("div")
9         this.dom.className = "ProseMirror-tableWrapper"
10         this.table = this.dom.appendChild(document.createElement("table"));
11         this.table.setAttribute('style', node.attrs.style);
12         this.colgroup = this.table.appendChild(document.createElement("colgroup"));
13         this.contentDOM = this.table.appendChild(document.createElement("tbody"));
14     }
15
16     ignoreMutation(record) {
17         return record.type == "attributes" && (record.target == this.table || this.colgroup.contains(record.target))
18     }
19 }
20
21 export default TableView;