From a4d63434cbaed332120523b0d059c3248154ab30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Wed, 28 May 2025 11:22:21 +0800 Subject: [PATCH] fix: code editor tab close (#8863) --- .../src/views/host/file-management/code-editor/index.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 b5fcb59fc..f6c74ac24 100644 --- a/frontend/src/views/host/file-management/code-editor/index.vue +++ b/frontend/src/views/host/file-management/code-editor/index.vue @@ -466,9 +466,8 @@ const removeTab = (targetPath: TabPaneName) => { getContent(selectTab.value, ''); }) .catch(() => { - isEdit.value = false; - editor.setValue(oldFileContent.value); updateTabs(); + isEdit.value = false; if (fileTabs.value.length > 0) { getContent(selectTab.value, ''); } @@ -512,8 +511,10 @@ const removeAllTab = (targetPath: string, type: 'left' | 'right' | 'all') => { }; const onCancel = () => { + if (type === 'left' || type === 'right') { + editor.setValue(oldFileContent.value); + } isEdit.value = false; - editor.setValue(oldFileContent.value); updateTabs(); }; @@ -550,8 +551,8 @@ const removeOtherTab = (targetPath: string) => { }; const onCancel = () => { - isEdit.value = false; editor.setValue(oldFileContent.value); + isEdit.value = false; updateTabs(); };