From e120bb0612f3e3e25c2fdfc43c89c02011d1839d Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Tue, 14 Mar 2023 14:42:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BC=96=E8=BE=91=E5=99=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20plaintext=20=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/global/mimetype.ts | 12 ++++++++---- .../views/host/file-management/code-editor/index.vue | 8 ++++---- frontend/src/views/host/file-management/index.vue | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/global/mimetype.ts b/frontend/src/global/mimetype.ts index 327846a60..8ac3c7c4e 100644 --- a/frontend/src/global/mimetype.ts +++ b/frontend/src/global/mimetype.ts @@ -17,6 +17,14 @@ export const Mimetypes = new Map([ ]); export const Languages = [ + { + label: 'plaintext', + value: 'plaintext', + }, + { + label: 'json', + value: 'json', + }, { label: 'go', value: 'go', @@ -65,10 +73,6 @@ export const Languages = [ label: 'yaml', value: 'yaml', }, - { - label: 'json', - value: 'json', - }, { label: 'css', value: 'css', diff --git a/frontend/src/views/host/file-management/code-editor/index.vue b/frontend/src/views/host/file-management/code-editor/index.vue index 5cc3c5565..9a67b1090 100644 --- a/frontend/src/views/host/file-management/code-editor/index.vue +++ b/frontend/src/views/host/file-management/code-editor/index.vue @@ -58,7 +58,7 @@ let loading = ref(false); let config = reactive({ theme: 'vs-dark', - language: 'json', + language: 'plaintext', }); const themes = [ @@ -97,13 +97,13 @@ const initEditor = () => { } const codeBox = document.getElementById('codeBox'); editor = monaco.editor.create(codeBox as HTMLElement, { - theme: config.theme, //官方自带三种主题vs, hc-black, or vs-dark + theme: config.theme, value: form.value.content, readOnly: false, automaticLayout: true, language: config.language, - folding: true, //代码折叠 - roundedSelection: false, // 右侧不显示编辑器预览框 + folding: true, + roundedSelection: false, }); editor.onDidChangeModelContent(() => { diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index dfbc6fe9f..82b70433f 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -196,7 +196,7 @@ let pathWidth = ref(0); const fileCreate = reactive({ path: '/', isDir: false, mode: 0o755 }); const fileCompress = reactive({ files: [''], name: '', dst: '', operate: 'compress' }); const fileDeCompress = reactive({ path: '', name: '', dst: '', mimeType: '' }); -const fileEdit = reactive({ content: '', path: '', name: '', language: 'json' }); +const fileEdit = reactive({ content: '', path: '', name: '', language: 'plaintext' }); const codeReq = reactive({ path: '', expand: false, page: 1, pageSize: 100 }); const fileUpload = reactive({ path: '' }); const fileRename = reactive({ path: '', oldName: '' });