From 1e2c85e7717a6439b7c1cdeeeb3a3bcde5fcaa3b Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:30:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E8=AE=B0=E4=BD=8F=E4=B8=8A=E6=AC=A1=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20(#4445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/4397 Refs https://github.com/1Panel-dev/1Panel/issues/4266 --- .../src/views/host/file-management/code-editor/index.vue | 7 +++++++ 1 file changed, 7 insertions(+) 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 6a6fafc1e..ced318807 100644 --- a/frontend/src/views/host/file-management/code-editor/index.vue +++ b/frontend/src/views/host/file-management/code-editor/index.vue @@ -93,6 +93,8 @@ interface EditorConfig { const open = ref(false); const loading = ref(false); const fileName = ref(''); +const codeThemeKey = 'code-theme'; +const warpKey = 'code-warp'; type WordWrapOptions = 'off' | 'on' | 'wordWrapColumn' | 'bounded'; @@ -149,6 +151,7 @@ const changeLanguage = () => { const changeTheme = () => { monaco.editor.setTheme(config.theme); + localStorage.setItem(codeThemeKey, config.theme); }; const changeEOL = () => { @@ -156,6 +159,7 @@ const changeEOL = () => { }; const changeWarp = () => { + localStorage.setItem(warpKey, config.wordWrap); editor.updateOptions({ wordWrap: config.wordWrap, }); @@ -217,6 +221,9 @@ const acceptParams = (props: EditProps) => { config.language = props.language; fileName.value = props.name; config.eol = monaco.editor.EndOfLineSequence.LF; + + config.theme = localStorage.getItem(codeThemeKey) || 'vs-dark'; + config.wordWrap = (localStorage.getItem(warpKey) as WordWrapOptions) || 'on'; open.value = true; };