From 5f0490ef6f18848bc0b99f0843fff331bd7c09b1 Mon Sep 17 00:00:00 2001 From: zhangxiaolong Date: Thu, 21 Apr 2022 10:58:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20:=20=E5=AE=9E=E7=8E=B0=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E9=80=89=E6=8B=A9=E5=80=BC=E6=98=BE=E7=A4=BA=20?= =?UTF-8?q?=E3=80=81save=E6=8F=90=E4=BA=A4=E6=AD=A3=E5=B8=B8=20=20edit?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E4=BB=8D=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../page/dashboard/explore/promqlInput.scss | 1 + .../page/dashboard/explore/promqlInput.vue | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/nezha-fronted/src/assets/css/components/page/dashboard/explore/promqlInput.scss b/nezha-fronted/src/assets/css/components/page/dashboard/explore/promqlInput.scss index d5593f4f7..c18236546 100644 --- a/nezha-fronted/src/assets/css/components/page/dashboard/explore/promqlInput.scss +++ b/nezha-fronted/src/assets/css/components/page/dashboard/explore/promqlInput.scss @@ -4,6 +4,7 @@ display: flex; #editor{ width: 100%; + border: 1px solid $--border-color-light; } .no-resize{ background: rgba(255,255,255,0); diff --git a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue index e6caa40e9..5866ced6e 100644 --- a/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue +++ b/nezha-fronted/src/components/page/dashboard/explore/promqlInput.vue @@ -572,7 +572,7 @@ export default { ...completionKeymap, ...lintKeymap ]), - placeholder('Expression (press Shift+Enter for newlines)'), + // placeholder('Expression (press Shift+Enter for newlines)'), dynamicConfigCompartment.of(dynamicConfig), // This keymap is added without precedence so that closing the autocomplete dropdown // via Escape works without blurring the editor. @@ -618,9 +618,11 @@ export default { self.newView = view } else { console.log('viewIsOk') + const { from, to } = self.newView.state.selection.ranges[0] self.newView.dispatch( self.newView.state.update({ - effects: dynamicConfigCompartment.reconfigure(dynamicConfig) + effects: dynamicConfigCompartment.reconfigure(dynamicConfig), + changes:{from,to,insert:self.codeMirrorValue} }) ) } @@ -777,6 +779,7 @@ export default { this.codeMirrorValue = value this.dropDownVisible = false this.$emit('change', value) + // this.initCodeMirror() this.$forceUpdate() this.cascaderValue = '' }, @@ -787,7 +790,6 @@ export default { this.$emit('change', value) this.$forceUpdate() this.cascaderValue = '' - this.initCodeMirror() }, logLabelChange (value) { if (!value || value.length === 0) return @@ -1079,7 +1081,16 @@ export default { this.metricOptions = JSON.parse(JSON.stringify(n)) } } - } + }, + // expressionList:{ + // deep: true, + // immediate: true, + // handler (n, o) { + // console.log(n,n[this.index]); + // this.codeMirrorValue = n[this.index]; + // this.initCodeMirror() + // } + // } } }