Skip to content

Commit 1440d6f

Browse files
committed
fix: improve CodeViewer stability and update ProxiesEditor to use JSON language
1 parent 1d336e1 commit 1440d6f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

frontend/src/components/CodeViewer/index.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ watch(
9090
)
9191
9292
watch(model, (content) => {
93-
if (content != editorView.state.doc.toString()) {
93+
if (editorView && content != editorView.state.doc.toString()) {
9494
editorView.dispatch({
9595
changes: {
9696
from: 0,
@@ -140,7 +140,7 @@ const initEditor = () => {
140140
...(props.lang === 'json' ? [linter(jsonParseLinter())] : []),
141141
// lang
142142
...(['javascript', 'json', 'yaml'].includes(props.lang)
143-
? [{ javascript: javascript(), json: json(), yaml: yaml() }[props.lang]]
143+
? [{ javascript, json, yaml }[props.lang]()]
144144
: []),
145145
EditorView.updateListener.of((update) => {
146146
if (update.docChanged) {
@@ -159,6 +159,9 @@ const initEditor = () => {
159159
</template>
160160

161161
<style lang="less" scoped>
162+
:deep(.cm-editor) {
163+
height: 100%;
164+
}
162165
:deep(.cm-scroller) {
163166
font-family: monaco, Consolas, Menlo, Courier, monospace;
164167
font-size: 14px;

frontend/src/views/SubscribesView/components/ProxiesEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ initProxiesText()
6262

6363
<template>
6464
<div class="proxies-view">
65-
<CodeViewer v-model="proxiesText" lang="javascript" editable class="code" />
65+
<CodeViewer v-model="proxiesText" lang="json" editable class="code" />
6666
<div class="form-action">
6767
<Button @click="handleCancel" :disabled="loading">
6868
{{ t('common.cancel') }}

0 commit comments

Comments
 (0)