@bigbinary/neeto-editor 1.45.7 → 1.45.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor.js +15 -2
- package/dist/Editor.js.map +1 -1
- package/dist/cjs/Editor.cjs.js +15 -2
- package/dist/cjs/Editor.cjs.js.map +1 -1
- package/dist/editor-stats.html +19 -1
- package/package.json +1 -1
package/dist/cjs/Editor.cjs.js
CHANGED
|
@@ -10598,12 +10598,25 @@ var ImageExtension = Menu$3.Node.create({
|
|
|
10598
10598
|
props: {
|
|
10599
10599
|
handleDOMEvents: {
|
|
10600
10600
|
paste: function paste(view, event) {
|
|
10601
|
-
var _event$clipboardData;
|
|
10601
|
+
var _event$clipboardData, _event$clipboardData2;
|
|
10602
10602
|
var _view$state = view.state,
|
|
10603
10603
|
schema = _view$state.schema,
|
|
10604
10604
|
pos = _view$state.selection.$anchor.pos;
|
|
10605
|
-
|
|
10605
|
+
|
|
10606
|
+
// Microsoft Excel and a few other products might copy content as
|
|
10607
|
+
// both `text/plain` and `text/html`. If `text/plain` exists,
|
|
10608
|
+
// an early return will ensure that it fallbacks to tiptap's
|
|
10609
|
+
// default paste behavior.
|
|
10610
|
+
var text = event === null || event === void 0 || (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData("text/plain");
|
|
10611
|
+
var hasFiles = (_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 || (_event$clipboardData2 = _event$clipboardData2.files) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.length;
|
|
10606
10612
|
if (!hasFiles) return;
|
|
10613
|
+
if (hasFiles && text) {
|
|
10614
|
+
var _DOMParser$parseFromS;
|
|
10615
|
+
event.preventDefault();
|
|
10616
|
+
var plainText = (_DOMParser$parseFromS = new DOMParser().parseFromString(text, "text/html").body.textContent) !== null && _DOMParser$parseFromS !== void 0 ? _DOMParser$parseFromS : "";
|
|
10617
|
+
view.pasteText(plainText);
|
|
10618
|
+
return;
|
|
10619
|
+
}
|
|
10607
10620
|
var images = Array.from(event.clipboardData.files).filter(function (file) {
|
|
10608
10621
|
return /image/i.test(file.type);
|
|
10609
10622
|
});
|