@bigbinary/neeto-editor 1.47.33 → 1.47.34
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 +20 -9
- package/dist/Editor.js.map +1 -1
- package/dist/cjs/Editor.cjs.js +20 -9
- package/dist/cjs/Editor.cjs.js.map +1 -1
- package/dist/editor-stats.html +1 -1
- package/package.json +1 -1
package/dist/Editor.js
CHANGED
|
@@ -10680,7 +10680,7 @@ var ImageExtension = Node.create({
|
|
|
10680
10680
|
var currentPos = pos;
|
|
10681
10681
|
images.forEach( /*#__PURE__*/function () {
|
|
10682
10682
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(image) {
|
|
10683
|
-
var emptyImageNode, id, tr, url,
|
|
10683
|
+
var emptyImageNode, id, tr, url, imageNode, _view$state2, _tr, doc, nodePos, _doc, _tr2;
|
|
10684
10684
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
10685
10685
|
while (1) switch (_context2.prev = _context2.next) {
|
|
10686
10686
|
case 0:
|
|
@@ -10698,13 +10698,24 @@ var ImageExtension = Node.create({
|
|
|
10698
10698
|
case 7:
|
|
10699
10699
|
url = _context2.sent;
|
|
10700
10700
|
if (url) {
|
|
10701
|
-
|
|
10701
|
+
imageNode = schema.nodes.image.create({
|
|
10702
10702
|
id: id,
|
|
10703
10703
|
src: url,
|
|
10704
10704
|
alt: "image"
|
|
10705
10705
|
});
|
|
10706
|
-
view.
|
|
10707
|
-
|
|
10706
|
+
_view$state2 = view.state, _tr = _view$state2.tr, doc = _view$state2.doc;
|
|
10707
|
+
nodePos = -1;
|
|
10708
|
+
doc.descendants(function (node, pos) {
|
|
10709
|
+
if (node.type.name === "image" && node.attrs.id === id) {
|
|
10710
|
+
nodePos = pos;
|
|
10711
|
+
return false;
|
|
10712
|
+
}
|
|
10713
|
+
return true;
|
|
10714
|
+
});
|
|
10715
|
+
if (nodePos !== -1) {
|
|
10716
|
+
_tr.replaceWith(nodePos, nodePos + emptyImageNode.nodeSize, imageNode).setMeta("addToHistory", false);
|
|
10717
|
+
view.dispatch(_tr);
|
|
10718
|
+
}
|
|
10708
10719
|
}
|
|
10709
10720
|
_context2.next = 19;
|
|
10710
10721
|
break;
|
|
@@ -10713,16 +10724,16 @@ var ImageExtension = Node.create({
|
|
|
10713
10724
|
_context2.t0 = _context2["catch"](1);
|
|
10714
10725
|
// eslint-disable-next-line no-console
|
|
10715
10726
|
console.error("Failed to insert the image", _context2.t0);
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10727
|
+
_doc = view.state.doc;
|
|
10728
|
+
_tr2 = view.state.tr;
|
|
10729
|
+
_doc.descendants(function (node, pos) {
|
|
10719
10730
|
if (node.type.name === "image" && node.attrs.id === id) {
|
|
10720
|
-
|
|
10731
|
+
_tr2["delete"](pos, pos + emptyImageNode.nodeSize).setMeta("addToHistory", false);
|
|
10721
10732
|
return false;
|
|
10722
10733
|
}
|
|
10723
10734
|
return true;
|
|
10724
10735
|
});
|
|
10725
|
-
view.dispatch(
|
|
10736
|
+
view.dispatch(_tr2);
|
|
10726
10737
|
if (_context2.t0.message === LARGE_IMAGE_ERROR) {
|
|
10727
10738
|
Toastr.error(t("neetoEditor.error.imageSizeIsShouldBeLess", {
|
|
10728
10739
|
limit: globalProps.endUserUploadedFileSizeLimitInMb
|