prosemirror-tables
Advanced tools
Comparing version 0.7.8 to 0.7.9
{ | ||
"name": "prosemirror-tables", | ||
"version": "0.7.8", | ||
"version": "0.7.9", | ||
"description": "ProseMirror's rowspan/colspan tables component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -134,4 +134,5 @@ import {Plugin, PluginKey} from "prosemirror-state" | ||
if (width) return width | ||
// Not fixed, read current width from DOM | ||
let domWidth = view.domAtPos(cellPos + 1).node.offsetWidth, parts = colspan | ||
let dom = view.domAtPos(cellPos) | ||
let node = dom.node.childNodes[dom.offset] | ||
let domWidth = node.offsetWidth, parts = colspan | ||
if (colwidth) for (let i = 0; i < colspan; i++) if (colwidth[i]) { | ||
@@ -138,0 +139,0 @@ domWidth -= colwidth[i] |
@@ -260,2 +260,13 @@ // This file defines a number of table-related commands. | ||
} | ||
// empty rows cleanup | ||
let pos = rect.tableStart | ||
let table = tr.doc.nodeAt(Math.max(pos - 1, 0)) | ||
for (let i = 0; i < table.childCount; i++) { | ||
let row = table.child(i) | ||
if (!row.childCount) { | ||
let rowPos = tr.mapping.map(pos) | ||
tr.delete(rowPos, rowPos + row.nodeSize) | ||
} | ||
pos += row.nodeSize | ||
} | ||
tr.setNodeMarkup(mergedPos + rect.tableStart, null, | ||
@@ -262,0 +273,0 @@ setAttr(addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, (rect.right - rect.left) - mergedCell.attrs.colspan), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1032173
24
19345