Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions frontend/src/views/host/file-management/code-editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -568,18 +568,25 @@ const removeTab = (targetPath: TabPaneName) => {
.then(() => {
updateTabs();
saveContent();
getContent(selectTab.value, '');
saveTabsToStorage();
if (fileTabs.value.length > 0) {
getContent(selectTab.value, '');
}
})
.catch(() => {
updateTabs();
isEdit.value = false;
saveTabsToStorage();
if (fileTabs.value.length > 0) {
getContent(selectTab.value, '');
}
});
} else {
updateTabs();
getContent(selectTab.value, '');
saveTabsToStorage();
if (fileTabs.value.length > 0) {
getContent(selectTab.value, '');
}
}
};

Expand Down Expand Up @@ -613,6 +620,7 @@ const removeAllTab = (targetPath: string, type: 'left' | 'right' | 'all') => {
const onConfirm = () => {
updateTabs();
saveContent();
saveTabsToStorage();
};

const onCancel = () => {
Expand All @@ -622,6 +630,7 @@ const removeAllTab = (targetPath: string, type: 'left' | 'right' | 'all') => {
isEdit.value = false;
isCreate.value = 'none';
updateTabs();
saveTabsToStorage();
};

if (isEdit.value) {
Expand All @@ -635,6 +644,7 @@ const removeAllTab = (targetPath: string, type: 'left' | 'right' | 'all') => {
.catch(onCancel);
} else {
updateTabs();
saveTabsToStorage();
if (type === 'all') editor.dispose();
else getContent(activeName, '');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
<el-tabs
v-model="currentTab"
type="card"
:closable="props.fileTabs.length > 1"
:closable="props.fileTabs.length >= 1"
class="monaco-editor monaco-editor-background"
@tab-remove="props.onRemoveTab"
@tab-change="props.onChangeTab"
>
<el-tab-pane v-for="item in props.fileTabs" :key="item.path" :name="item.path">
<template #label>
<el-tooltip v-if="props.fileTabs.length == 1" :content="item.path" placement="bottom-start">
<span>{{ item.name }}</span>
</el-tooltip>
<template v-if="props.fileTabs.length > 1">
<template v-if="props.fileTabs.length >= 1">
<el-dropdown
size="small"
:id="item.path"
Expand Down Expand Up @@ -58,7 +55,7 @@
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { ref, watch } from 'vue';

interface FileTabs {
path: string;
Expand Down