aden-editor-vue 0.1.3 → 0.1.4
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/index.cjs +20 -4
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +20 -4
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7459,10 +7459,11 @@ var ImageController = class {
|
|
|
7459
7459
|
return;
|
|
7460
7460
|
}
|
|
7461
7461
|
const msg = (e == null ? void 0 : e.message) || "\u672A\u77E5\u9519\u8BEF";
|
|
7462
|
-
|
|
7462
|
+
const userMessage = this.opts.upload ? `\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF1A${msg}\u3002\u8BF7\u68C0\u67E5 uploadImage \u63A5\u53E3\u5730\u5740\u3001\u9274\u6743\u548C\u670D\u52A1\u7AEF\u54CD\u5E94` : `\u56FE\u7247\u5904\u7406\u5931\u8D25\uFF1A${msg}\u3002\u8BF7\u914D\u7F6E uploadImage \u56FE\u7247\u4E0A\u4F20\u63A5\u53E3\u540E\u91CD\u8BD5`;
|
|
7463
|
+
showToast(userMessage, 6500);
|
|
7463
7464
|
const blockId = this.uploadToBlock.get(uploadId);
|
|
7464
7465
|
const blockStillExists = !!blockId && this.opts.editor.getDoc().blocks.some((block) => block.id === blockId);
|
|
7465
|
-
resolveImageUpload(this.opts.editor, uploadId, { error:
|
|
7466
|
+
resolveImageUpload(this.opts.editor, uploadId, { error: userMessage });
|
|
7466
7467
|
if (!blockStillExists) {
|
|
7467
7468
|
this.pending.delete(uploadId);
|
|
7468
7469
|
this.uploadToBlock.delete(uploadId);
|
|
@@ -9384,7 +9385,7 @@ var WebAdapter = class {
|
|
|
9384
9385
|
}
|
|
9385
9386
|
if (images.length) {
|
|
9386
9387
|
e.preventDefault();
|
|
9387
|
-
const
|
|
9388
|
+
const existingImageIds2 = new Set(
|
|
9388
9389
|
this.editor.getDoc().blocks.filter((block) => block.type === "image").map((block) => block.id)
|
|
9389
9390
|
);
|
|
9390
9391
|
if (pasteHtml2) {
|
|
@@ -9393,7 +9394,7 @@ var WebAdapter = class {
|
|
|
9393
9394
|
this.runCommand((cmd) => cmd.pastePlainText(this.editor, pasteText));
|
|
9394
9395
|
}
|
|
9395
9396
|
const pastedImages = this.editor.getDoc().blocks.filter(
|
|
9396
|
-
(block) => block.type === "image" && !
|
|
9397
|
+
(block) => block.type === "image" && !existingImageIds2.has(block.id)
|
|
9397
9398
|
);
|
|
9398
9399
|
images.forEach((file, index) => {
|
|
9399
9400
|
const target = pastedImages[index];
|
|
@@ -9402,10 +9403,25 @@ var WebAdapter = class {
|
|
|
9402
9403
|
});
|
|
9403
9404
|
return;
|
|
9404
9405
|
}
|
|
9406
|
+
const clipboardContainsImageMarkup = /<img\b|v:imagedata|w:drawing/i.test(pasteHtml2);
|
|
9407
|
+
const existingImageIds = new Set(
|
|
9408
|
+
this.editor.getDoc().blocks.filter((block) => block.type === "image").map((block) => block.id)
|
|
9409
|
+
);
|
|
9405
9410
|
e.preventDefault();
|
|
9406
9411
|
this.runCommand((cmd) => {
|
|
9407
9412
|
if (pasteHtml2) cmd.pasteHtml(this.editor, pasteHtml2);
|
|
9408
9413
|
else if (pasteText) cmd.pastePlainText(this.editor, pasteText);
|
|
9414
|
+
if (clipboardContainsImageMarkup) {
|
|
9415
|
+
const pastedImages = this.editor.getDoc().blocks.filter(
|
|
9416
|
+
(block) => block.type === "image" && !existingImageIds.has(block.id)
|
|
9417
|
+
);
|
|
9418
|
+
if (!pastedImages.some((block) => {
|
|
9419
|
+
var _a22, _b2;
|
|
9420
|
+
return sanitizeUrl(String((_b2 = (_a22 = block.attrs) == null ? void 0 : _a22.src) != null ? _b2 : ""), "media");
|
|
9421
|
+
})) {
|
|
9422
|
+
showToast("\u672A\u80FD\u4ECE\u526A\u8D34\u677F\u8BFB\u53D6\u56FE\u7247\u6587\u4EF6\u6216\u6709\u6548\u56FE\u7247\u5730\u5740\u3002\u8BF7\u68C0\u67E5 Word \u590D\u5236\u5185\u5BB9\uFF0C\u6216\u5728 options \u4E2D\u914D\u7F6E uploadImage \u56FE\u7247\u4E0A\u4F20\u63A5\u53E3\u3002", 6500);
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9409
9425
|
});
|
|
9410
9426
|
};
|
|
9411
9427
|
this.handleDragOver = (e) => {
|