Skip to content

Commit a4d6343

Browse files
authored
fix: code editor tab close (#8863)
1 parent 1771bc7 commit a4d6343

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • frontend/src/views/host/file-management/code-editor

frontend/src/views/host/file-management/code-editor/index.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,8 @@ const removeTab = (targetPath: TabPaneName) => {
466466
getContent(selectTab.value, '');
467467
})
468468
.catch(() => {
469-
isEdit.value = false;
470-
editor.setValue(oldFileContent.value);
471469
updateTabs();
470+
isEdit.value = false;
472471
if (fileTabs.value.length > 0) {
473472
getContent(selectTab.value, '');
474473
}
@@ -512,8 +511,10 @@ const removeAllTab = (targetPath: string, type: 'left' | 'right' | 'all') => {
512511
};
513512
514513
const onCancel = () => {
514+
if (type === 'left' || type === 'right') {
515+
editor.setValue(oldFileContent.value);
516+
}
515517
isEdit.value = false;
516-
editor.setValue(oldFileContent.value);
517518
updateTabs();
518519
};
519520
@@ -550,8 +551,8 @@ const removeOtherTab = (targetPath: string) => {
550551
};
551552
552553
const onCancel = () => {
553-
isEdit.value = false;
554554
editor.setValue(oldFileContent.value);
555+
isEdit.value = false;
555556
updateTabs();
556557
};
557558

0 commit comments

Comments
 (0)