From 695832a6d013e1988b63e9f7cc649a84dfe8c51c Mon Sep 17 00:00:00 2001 From: CF3B5 Date: Sun, 8 Sep 2024 06:23:19 +0800 Subject: [PATCH] feat: adds a file structure sidebar in the editor (#1943) Co-authored-by: Stefan Dej --- src/components/TheEditor.vue | 141 +++++++++++++++++++++++++-- src/components/inputs/Codemirror.vue | 26 +++-- src/locales/en.json | 1 + src/locales/zh.json | 1 + src/store/files/types.ts | 10 ++ 5 files changed, 164 insertions(+), 15 deletions(-) diff --git a/src/components/TheEditor.vue b/src/components/TheEditor.vue index e740c7db8..215ed1ccd 100644 --- a/src/components/TheEditor.vue +++ b/src/components/TheEditor.vue @@ -31,6 +31,10 @@ {{ mdiHelp }} {{ $t('Editor.ConfigReference') }} + + {{ mdiFormatListCheckbox }} + {{ $t('Editor.FileStructure') }} + {{ mdiCloseThick }} - + + :file-extension="fileExtension" + class="codemirror" + @lineChange="lineChanges" /> +
+ + + + +
- +
{{ snackbarHeadline }}
@@ -123,7 +160,7 @@ diff --git a/src/locales/en.json b/src/locales/en.json index 002e964e7..b12da347f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -203,6 +203,7 @@ "Downloading": "Downloading", "FailedSave": "{filename} could not be uploaded!", "FileReadOnly": "read-only", + "FileStructure": "File Structure", "SaveClose": "Save & close", "SaveRestart": "Save & Restart", "SuccessfullySaved": "{filename} successfully saved.", diff --git a/src/locales/zh.json b/src/locales/zh.json index 884c60b6d..9b522bb45 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -197,6 +197,7 @@ "Downloading": "正在下载", "FailedSave": "上传{filename}失败!", "FileReadOnly": "只读文件", + "FileStructure": "结构", "SaveClose": "保存并关闭", "SaveRestart": "保存并重启", "SuccessfullySaved": "{filename}保存成功!", diff --git a/src/store/files/types.ts b/src/store/files/types.ts index 55197c159..e862daf16 100644 --- a/src/store/files/types.ts +++ b/src/store/files/types.ts @@ -97,3 +97,13 @@ export interface ApiGetDirectoryReturnFile { filename: string permissions: string } + +export interface ConfigFileKey { + name: string + type: string + line: number +} + +export interface ConfigFileSection extends ConfigFileKey { + children: ConfigFileKey[] +}