From 8682011c33f6459e346ae1ad17048d2b81a00a44 Mon Sep 17 00:00:00 2001 From: cdswyda Date: Wed, 10 Nov 2021 10:45:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=92=A9=E5=AD=90=20imageDeleteBefore=20imag?= =?UTF-8?q?eDeleteAfter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可用于清理单独上传的图片附件 --- src/controllers/imageCtrl.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/controllers/imageCtrl.js b/src/controllers/imageCtrl.js index 6fcb720..97841ec 100644 --- a/src/controllers/imageCtrl.js +++ b/src/controllers/imageCtrl.js @@ -9,6 +9,7 @@ import { replaceHtml } from '../utils/util'; import Store from '../store'; import locale from '../locale/locale'; import tooltip from '../global/tooltip'; +import method from '../global/method'; const imageCtrl = { imgItem: { @@ -877,15 +878,24 @@ const imageCtrl = { }, removeImgItem: function() { let _this = this; + let imgItem = _this.images[_this.currentImgId]; + + // 钩子 imageDeleteBefore + if(!method.createHookFunction('imageDeleteBefore', imgItem)){ + return; + } $("#luckysheet-modal-dialog-activeImage").hide(); $("#luckysheet-modal-dialog-cropping").hide(); $("#luckysheet-modal-dialog-slider-imageCtrl").hide(); $("#" + _this.currentImgId).remove(); + delete _this.images[_this.currentImgId]; _this.currentImgId = null; + // 钩子 imageDeleteAfter + method.createHookFunction('imageDeleteAfter', imgItem); _this.ref(); }, copyImgItem: function(e) {