1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-13 17:24:44 +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 = [
{
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',

View File

@ -58,7 +58,7 @@ let loading = ref(false);
let config = reactive<EditorConfig>({
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(() => {

View File

@ -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: '' });