1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

feat: 编辑器增加 plaintext 类型

This commit is contained in:
zhengkunwang223 2023-03-14 14:42:09 +08:00 committed by zhengkunwang223
parent 92a11863a7
commit e120bb0612
3 changed files with 13 additions and 9 deletions

View File

@ -17,6 +17,14 @@ export const Mimetypes = new Map([
]); ]);
export const Languages = [ export const Languages = [
{
label: 'plaintext',
value: 'plaintext',
},
{
label: 'json',
value: 'json',
},
{ {
label: 'go', label: 'go',
value: 'go', value: 'go',
@ -65,10 +73,6 @@ export const Languages = [
label: 'yaml', label: 'yaml',
value: 'yaml', value: 'yaml',
}, },
{
label: 'json',
value: 'json',
},
{ {
label: 'css', label: 'css',
value: 'css', value: 'css',

View File

@ -58,7 +58,7 @@ let loading = ref(false);
let config = reactive<EditorConfig>({ let config = reactive<EditorConfig>({
theme: 'vs-dark', theme: 'vs-dark',
language: 'json', language: 'plaintext',
}); });
const themes = [ const themes = [
@ -97,13 +97,13 @@ const initEditor = () => {
} }
const codeBox = document.getElementById('codeBox'); const codeBox = document.getElementById('codeBox');
editor = monaco.editor.create(codeBox as HTMLElement, { editor = monaco.editor.create(codeBox as HTMLElement, {
theme: config.theme, //vs, hc-black, or vs-dark theme: config.theme,
value: form.value.content, value: form.value.content,
readOnly: false, readOnly: false,
automaticLayout: true, automaticLayout: true,
language: config.language, language: config.language,
folding: true, // folding: true,
roundedSelection: false, // roundedSelection: false,
}); });
editor.onDidChangeModelContent(() => { editor.onDidChangeModelContent(() => {

View File

@ -196,7 +196,7 @@ let pathWidth = ref(0);
const fileCreate = reactive({ path: '/', isDir: false, mode: 0o755 }); const fileCreate = reactive({ path: '/', isDir: false, mode: 0o755 });
const fileCompress = reactive({ files: [''], name: '', dst: '', operate: 'compress' }); const fileCompress = reactive({ files: [''], name: '', dst: '', operate: 'compress' });
const fileDeCompress = reactive({ path: '', name: '', dst: '', mimeType: '' }); 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 codeReq = reactive({ path: '', expand: false, page: 1, pageSize: 100 });
const fileUpload = reactive({ path: '' }); const fileUpload = reactive({ path: '' });
const fileRename = reactive({ path: '', oldName: '' }); const fileRename = reactive({ path: '', oldName: '' });