Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
close right tabs
SiriusXT7b24f7e3325e
diff --git a/src/public/app/components/tab_manager.js b/src/public/app/components/tab_manager.jsindex 861a545026..235aa5cd11 100644--- a/src/public/app/components/tab_manager.js+++ b/src/public/app/components/tab_manager.js@@ -551,7 +551,7 @@ export default class TabManager extends Component {await this.removeNoteContext(ntxIdToRemove);}}-+async closeOtherTabsCommand({ntxId}) {for (const ntxIdToRemove of this.mainNoteContexts.map(nc => nc.ntxId)) {if (ntxIdToRemove !== ntxId) {@@ -560,6 +560,18 @@ export default class TabManager extends Component {}}+ async closeRightTabsCommand({ntxId}) {+ const ntxIds = this.mainNoteContexts.map(nc => nc.ntxId);+ const index = ntxIds.indexOf(ntxId);++ if (index !== -1) {+ const idsToRemove = ntxIds.slice(index + 1);+ for (const ntxIdToRemove of idsToRemove) {+ await this.removeNoteContext(ntxIdToRemove);+ }+ }+ }+async closeTabCommand({ntxId}) {await this.removeNoteContext(ntxId);}diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.jsindex 395dd51d51..cc6f8a22bc 100644--- a/src/public/app/widgets/tab_row.js+++ b/src/public/app/widgets/tab_row.js@@ -260,7 +260,8 @@ export default class TabRowWidget extends BasicWidget {y: e.pageY,items: [{title: t('tab_row.close'), command: "closeTab", uiIcon: "bx bx-x"},- {title: t('tab_row.close_other_tabs'), command: "closeOtherTabs", uiIcon: "bx bx-x"},+ {title: t('tab_row.close_other_tabs'), command: "closeOtherTabs", uiIcon: "bx bx-x", enabled: appContext.tabManager.noteContexts.length !== 1},+ {title: t('tab_row.close_right_tabs'), command: "closeRightTabs", uiIcon: "bx bx-x", enabled: appContext.tabManager.noteContexts.at(-1).ntxId !== ntxId},{title: t('tab_row.close_all_tabs'), command: "closeAllTabs", uiIcon: "bx bx-x"},{title: t('tab_row.move_tab_to_new_window'), command: "moveTabToNewWindow", uiIcon: "bx bx-window-open"}],diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.jsonindex 06604c638c..dd170d30aa 100644--- a/src/public/translations/en/translation.json+++ b/src/public/translations/en/translation.json@@ -1434,6 +1434,7 @@"add_new_tab": "Add new tab","close": "Close","close_other_tabs": "Close other tabs",+ "close_right_tabs": "Close right tabs","close_all_tabs": "Close all tabs","move_tab_to_new_window": "Move this tab to a new window","new_tab": "New tab"