From c748d8f5f60d23e9ac1c93e7dba876ba78bb1a30 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 25 Apr 2022 07:58:17 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=8F=B3=E9=94=AE=E9=A2=84=E8=A7=88=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/components/TEditor.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/components/TEditor.vue b/resources/assets/js/components/TEditor.vue index 5d857b660..e3b57e7d8 100755 --- a/resources/assets/js/components/TEditor.vue +++ b/resources/assets/js/components/TEditor.vue @@ -303,7 +303,12 @@ $A.messageWarning("没有可预览的图片") return; } - this.$store.state.previewImageIndex = 0; + let index = 0; + const imgElm = editor.selection.getNode(); + if (imgElm && imgElm.nodeName === "IMG") { + index = array.findIndex(item => item === imgElm.getAttribute("src")); + } + this.$store.state.previewImageIndex = index; this.$store.state.previewImageList = array; } });