From a7d99d79e9c27638421ee19600e8dd8e3903e605 Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 15 May 2023 16:44:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=EF=BC=8C=E5=9C=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=AE=8C=E6=88=90=E4=B9=8B=E5=89=8D=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/preview/SimTextPreview.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/preview/SimTextPreview.vue b/src/components/preview/SimTextPreview.vue index 9e81be9..a29b6f0 100644 --- a/src/components/preview/SimTextPreview.vue +++ b/src/components/preview/SimTextPreview.vue @@ -66,7 +66,7 @@
-
+
-
+
- +
@@ -181,6 +181,7 @@ defalutLanguage: 'redis', lineWrapping: false, moblie: false, + panelReadOnly: true, options: { fontSize: 14, contextmenu: true, @@ -358,6 +359,8 @@ }, async requestStream(request, params, index) { try { + const readOnly = this.panelReadOnly + this.options.readOnly = true this.abortControllerAbort(index) const queryString = this.buildQueryString(params); let url = "/api/preview/text/stream" @@ -386,6 +389,7 @@ throttledUpdateContent.cancel(); this.content = result; this.setEditMap(index, this.content) + this.options.readOnly = readOnly return; } result += decoder.decode(value, { stream: true }); @@ -648,11 +652,13 @@ checkReadOnly(fileUserId){ if(this.$store.state.user.token && this.$store.state.user.userId === fileUserId){ this.options.readOnly = false + this.panelReadOnly = false } if (!this.$pc) { this.options.readOnly = true + this.panelReadOnly = false } - if(this.options.readOnly || this.moblie){ + if(this.panelReadOnly || this.moblie){ this.$nextTick(()=> { this.editorWidth += this.contentsWidth this.contentsHide = true