From df9da1a482676c052a593338ef8044da63b4cb8b Mon Sep 17 00:00:00 2001 From: yaoba <7156147@qq.com> Date: Mon, 7 Aug 2023 22:36:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=88=90=E5=8A=9F=E4=BA=8B=E4=BB=B6uploadsuc?= =?UTF-8?q?cess?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _src/plugins/simpleupload.js | 5 +++++ dialogs/attachment/attachment.js | 5 +++++ dialogs/image/image.js | 5 +++++ dialogs/scrawl/scrawl.js | 5 +++++ dialogs/video/video.js | 5 +++++ dialogs/wordimage/wordimage.html | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/_src/plugins/simpleupload.js b/_src/plugins/simpleupload.js index 5134c33..fb560bd 100644 --- a/_src/plugins/simpleupload.js +++ b/_src/plugins/simpleupload.js @@ -58,6 +58,11 @@ UE.plugin.register("simpleupload", function () { loader.setAttribute("alt", res.data.original || ""); loader.removeAttribute("id"); me.fireEvent("contentchange"); + // 触发上传图片事件 + me.fireEvent("uploadsuccess", { + res: res.data, + type: 'image' + }); }else{ UE.dialog.removeLoadingPlaceholder(me, loadingId); UE.dialog.tipError(me, res.data.state); diff --git a/dialogs/attachment/attachment.js b/dialogs/attachment/attachment.js index 8357f88..be340d8 100755 --- a/dialogs/attachment/attachment.js +++ b/dialogs/attachment/attachment.js @@ -511,6 +511,11 @@ if (json.state == 'SUCCESS') { _this.fileList.push(json); $file.append(''); + // 触发上传附件事件 + editor.fireEvent("uploadsuccess", { + res: json, + type: 'file' + }); } else { $file.find('.error').text(json.state).show(); } diff --git a/dialogs/image/image.js b/dialogs/image/image.js index 99eb906..1119171 100644 --- a/dialogs/image/image.js +++ b/dialogs/image/image.js @@ -769,6 +769,11 @@ if (json.state == 'SUCCESS') { _this.imageList.push(json); $file.append(''); + // 触发上传图片事件 + editor.fireEvent("uploadsuccess", { + res: json, + type: 'image' + }); } else { $file.find('.error').text(json.state).show(); } diff --git a/dialogs/scrawl/scrawl.js b/dialogs/scrawl/scrawl.js index 8c5a9bf..655ceb4 100755 --- a/dialogs/scrawl/scrawl.js +++ b/dialogs/scrawl/scrawl.js @@ -646,6 +646,11 @@ function exec(scrawlObj) { imgObj.alt = responseObj.original || ''; editor.execCommand("insertImage", imgObj); dialog.close(); + // 触发上传涂鸦事件 + editor.fireEvent("uploadsuccess", { + res: responseObj, + type: 'scrawl' + }); } else { alert(responseObj.state); } diff --git a/dialogs/video/video.js b/dialogs/video/video.js index de833a2..4b1b9f7 100755 --- a/dialogs/video/video.js +++ b/dialogs/video/video.js @@ -772,6 +772,11 @@ 'original':json.original }); $file.append(''); + // 触发上传视频事件 + editor.fireEvent("uploadsuccess", { + res: json, + type: 'video' + }); } else { $file.find('.error').text(json.state).show(); } diff --git a/dialogs/wordimage/wordimage.html b/dialogs/wordimage/wordimage.html index 64c1464..913a23e 100755 --- a/dialogs/wordimage/wordimage.html +++ b/dialogs/wordimage/wordimage.html @@ -195,6 +195,11 @@ } else { $('.image-tip').html('上传失败:' + JSON.stringify(res)) } + // 触发上传附件事件 + editor.fireEvent("uploadsuccess", { + res: res, + type: 'image' + }); } else { $('.image-tip').html('上传失败:' + JSON.stringify(res)) } -- Gitee From cc585ab971a23af179394ccba6b8a7e5d0c38086 Mon Sep 17 00:00:00 2001 From: yaoba <7156147@qq.com> Date: Mon, 7 Aug 2023 23:21:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=99=84=E4=BB=B6=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=97=B6=E5=A6=82=E5=90=8E=E5=8F=B0=E6=9C=89=E8=BF=94=E5=9B=9E?= =?UTF-8?q?original=EF=BC=8C=E6=96=87=E4=BB=B6=E5=90=8D=E5=88=99=E6=98=BE?= =?UTF-8?q?=E7=A4=BAoriginal=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BAurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dialogs/attachment/attachment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dialogs/attachment/attachment.js b/dialogs/attachment/attachment.js index be340d8..23048e5 100755 --- a/dialogs/attachment/attachment.js +++ b/dialogs/attachment/attachment.js @@ -698,7 +698,7 @@ } else { var ic = document.createElement('i'), textSpan = document.createElement('span'); - textSpan.innerHTML = list[i].url.substr(list[i].url.lastIndexOf('/') + 1); + textSpan.innerHTML = list[i].original || list[i].url.substr(list[i].url.lastIndexOf('/') + 1); preview = document.createElement('div'); preview.appendChild(ic); preview.appendChild(textSpan); -- Gitee