prosemirror-tables
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -15,2 +15,3 @@ // This file defines a plugin that handles the drawing of cell | ||
var handleMouseDown = ref$1.handleMouseDown; | ||
var handleDrop = ref$1.handleDrop; | ||
var ref$2 = require("./util"); | ||
@@ -65,3 +66,5 @@ var key = ref$2.key; | ||
handlePaste: handlePaste | ||
handlePaste: handlePaste, | ||
handleDrop: handleDrop | ||
}, | ||
@@ -68,0 +71,0 @@ |
@@ -110,2 +110,11 @@ // This file defines a number of helpers for wiring up user input to | ||
exports.handleDrop = function (view, event, slice, moved) { | ||
var html = event.dataTransfer && event.dataTransfer.getData('text/html') | ||
// cancel dragging of table cells | ||
if (html && html.indexOf('<table>') > -1) { | ||
return true | ||
} | ||
return false | ||
}; | ||
exports.handlePaste = function(view, _, slice) { | ||
@@ -171,2 +180,3 @@ if (!isInTable(view.state)) { return false } | ||
view.root.removeEventListener("mousemove", move) | ||
view.root.removeEventListener("drop", drop) | ||
if (key.getState(view.state) != null) { view.dispatch(view.state.tr.setMeta(key, -1)) } | ||
@@ -187,4 +197,14 @@ } | ||
} | ||
function drop (event) { | ||
var html = event.dataTransfer && event.dataTransfer.getData('text/html') | ||
// cancel dragging of table cells | ||
if (html && html.indexOf('<table>') > -1) { | ||
view.root.removeEventListener("mouseup", stop) | ||
view.root.removeEventListener("mousemove", move) | ||
return false; | ||
} | ||
} | ||
view.root.addEventListener("mouseup", stop) | ||
view.root.addEventListener("mousemove", move) | ||
view.root.addEventListener("drop", drop) | ||
} | ||
@@ -191,0 +211,0 @@ |
{ | ||
"name": "prosemirror-tables", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "ProseMirror's rowspan/colspan tables component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,3 +30,3 @@ # ProseMirror table module | ||
* **`tableGroup`**`: ?string` | ||
A group name (something like `"block"`) to ad dto the table | ||
A group name (something like `"block"`) to add to the table | ||
node type. | ||
@@ -33,0 +33,0 @@ |
@@ -9,3 +9,3 @@ // This file defines a plugin that handles the drawing of cell | ||
const {handleTripleClick, handleKeyDown, handlePaste, handleMouseDown} = require("./input") | ||
const {handleTripleClick, handleKeyDown, handlePaste, handleMouseDown, handleDrop} = require("./input") | ||
const {key} = require("./util") | ||
@@ -51,3 +51,5 @@ const {drawCellSelection, CellSelection, normalizeSelection} = require("./cellselection") | ||
handlePaste | ||
handlePaste, | ||
handleDrop | ||
}, | ||
@@ -54,0 +56,0 @@ |
@@ -93,2 +93,11 @@ // This file defines a number of helpers for wiring up user input to | ||
exports.handleDrop = function (view, event, slice, moved) { | ||
const html = event.dataTransfer && event.dataTransfer.getData('text/html') | ||
// cancel dragging of table cells | ||
if (html && html.indexOf('<table>') > -1) { | ||
return true | ||
} | ||
return false | ||
}; | ||
exports.handlePaste = function(view, _, slice) { | ||
@@ -154,2 +163,3 @@ if (!isInTable(view.state)) return false | ||
view.root.removeEventListener("mousemove", move) | ||
view.root.removeEventListener("drop", drop) | ||
if (key.getState(view.state) != null) view.dispatch(view.state.tr.setMeta(key, -1)) | ||
@@ -170,4 +180,14 @@ } | ||
} | ||
function drop (event) { | ||
const html = event.dataTransfer && event.dataTransfer.getData('text/html') | ||
// cancel dragging of table cells | ||
if (html && html.indexOf('<table>') > -1) { | ||
view.root.removeEventListener("mouseup", stop) | ||
view.root.removeEventListener("mousemove", move) | ||
return false; | ||
} | ||
} | ||
view.root.addEventListener("mouseup", stop) | ||
view.root.addEventListener("mousemove", move) | ||
view.root.addEventListener("drop", drop) | ||
} | ||
@@ -174,0 +194,0 @@ |
Sorry, the diff of this file is too big to display
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
788195
18503