fix: code editor tab close (#8863)

This commit is contained in:
2025-05-28 11:22:21 +08:00 committed by GitHub
parent 1771bc7dc8
commit a4d63434cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
};