From e0bd225ac2e081c979bf59f019666554261630d3 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 7 Jun 2022 23:37:55 +0800 Subject: [PATCH] no message --- resources/assets/js/components/PreviewImage/state.vue | 5 ++++- resources/assets/js/components/TEditor.vue | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/components/PreviewImage/state.vue b/resources/assets/js/components/PreviewImage/state.vue index 92d39644c..412b68a45 100644 --- a/resources/assets/js/components/PreviewImage/state.vue +++ b/resources/assets/js/components/PreviewImage/state.vue @@ -22,7 +22,10 @@ export default { }, watch: { show(v) { - if (!v) { + if (v) { + this.$store.state.previewImageIndex = Math.max(this.$store.state.previewImageIndex, 0) + this.$store.state.previewImageIndex = Math.min(this.$store.state.previewImageIndex, this.$store.state.previewImageList.length - 1) + } else { this.$store.state.previewImageIndex = 0; this.$store.state.previewImageList = []; } diff --git a/resources/assets/js/components/TEditor.vue b/resources/assets/js/components/TEditor.vue index b8f4c7907..61b2846f9 100755 --- a/resources/assets/js/components/TEditor.vue +++ b/resources/assets/js/components/TEditor.vue @@ -306,7 +306,7 @@ let index = 0; const imgElm = editor.selection.getNode(); if (imgElm && imgElm.nodeName === "IMG") { - index = array.findIndex(item => item === imgElm.getAttribute("src")); + index = array.findIndex(item => item.src === imgElm.getAttribute("src")); } this.$store.state.previewImageIndex = index; this.$store.state.previewImageList = array;