prosemirror-tables
Advanced tools
Comparing version 0.7.4 to 0.7.5
{ | ||
"name": "prosemirror-tables", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "ProseMirror's rowspan/colspan tables component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -10,3 +10,3 @@ import {Plugin, PluginKey} from "prosemirror-state" | ||
export function columnResizing({ handleWidth = 5, cellMinWidth = 25, View = TableView } = {}) { | ||
export function columnResizing({ handleWidth = 5, cellMinWidth = 25, View = TableView, lastColumnResizable = true } = {}) { | ||
let plugin = new Plugin({ | ||
@@ -31,3 +31,3 @@ key, | ||
handleDOMEvents: { | ||
mousemove(view, event) { handleMouseMove(view, event, handleWidth, cellMinWidth) }, | ||
mousemove(view, event) { handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable) }, | ||
mouseleave(view) { handleMouseLeave(view) }, | ||
@@ -69,3 +69,3 @@ mousedown(view, event) { handleMouseDown(view, event, cellMinWidth) } | ||
function handleMouseMove(view, event, handleWidth, cellMinWidth) { | ||
function handleMouseMove(view, event, handleWidth, cellMinWidth, lastColumnResizable) { | ||
let pluginState = key.getState(view.state) | ||
@@ -82,3 +82,16 @@ | ||
} | ||
if (cell != pluginState.activeHandle) updateHandle(view, cell) | ||
if (cell != pluginState.activeHandle) { | ||
if (!lastColumnResizable && cell !== -1) { | ||
let $cell = view.state.doc.resolve(cell) | ||
let table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1) | ||
let col = map.colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1 | ||
if (col == map.width - 1) { | ||
return | ||
} | ||
} | ||
updateHandle(view, cell) | ||
} | ||
} | ||
@@ -85,0 +98,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1013793
19025