@setoelkahfi / svara / commits / 86fd032

feat: added function to close only the active tab

mellbacon committed Jun 30, 2023 at 09:49 UTC 86fd03252b1cbd0c258a572c9ba7a4b7ac50de59
1 file changed +5
src/lib/EditorTabList.svelte
+5
@@ -5,6 +5,7 @@
5 import { Tab } from "./Tab/Tab";
6 </script>
7 <script lang="ts" context="module">
8 + let activetabid = null;
9 class EditorTab {
10 id: number;
11 label: string;
@@ -29,6 +30,7 @@
30 }
31 setActive(id) {
32 editorTab.setActive(id);
33 + activetabid = id;
34 }
35 }
36
@@ -43,6 +45,9 @@
45 export async function closeTab(tabid: number) {
46 await editorTab.closeTab(tabid);
47 }
48 + export async function closeActiveTab() {
49 + await editorTab.closeTab(activetabid);
50 + }
51 export function renameTab(tab, label, path) {
52 if (tab) {
53 tab.label = label;