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, ''); getContent(selectTab.value, '');
}) })
.catch(() => { .catch(() => {
isEdit.value = false;
editor.setValue(oldFileContent.value);
updateTabs(); updateTabs();
isEdit.value = false;
if (fileTabs.value.length > 0) { if (fileTabs.value.length > 0) {
getContent(selectTab.value, ''); getContent(selectTab.value, '');
} }
@ -512,8 +511,10 @@ const removeAllTab = (targetPath: string, type: 'left' | 'right' | 'all') => {
}; };
const onCancel = () => { const onCancel = () => {
if (type === 'left' || type === 'right') {
editor.setValue(oldFileContent.value);
}
isEdit.value = false; isEdit.value = false;
editor.setValue(oldFileContent.value);
updateTabs(); updateTabs();
}; };
@ -550,8 +551,8 @@ const removeOtherTab = (targetPath: string) => {
}; };
const onCancel = () => { const onCancel = () => {
isEdit.value = false;
editor.setValue(oldFileContent.value); editor.setValue(oldFileContent.value);
isEdit.value = false;
updateTabs(); updateTabs();
}; };