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:
parent
92a11863a7
commit
e120bb0612
@ -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',
|
||||||
|
@ -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(() => {
|
||||||
|
@ -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: '' });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user