From 3cfc2ac768b13f1305a5bfd8a382f299ae1d321a Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Fri, 22 Nov 2024 17:24:06 +0800 Subject: [PATCH] Add reopen_last_tab and copy_tab_to_new_window to tab management --- src/public/app/components/tab_manager.js | 5 +++++ src/public/app/widgets/tab_row.js | 7 ++++++- src/public/translations/en/translation.json | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/public/app/components/tab_manager.js b/src/public/app/components/tab_manager.js index 235aa5cd1..80fe333a1 100644 --- a/src/public/app/components/tab_manager.js +++ b/src/public/app/components/tab_manager.js @@ -586,6 +586,11 @@ export default class TabManager extends Component { } } + async copyTabToNewWindowCommand({ntxId}) { + const {notePath, hoistedNoteId} = this.getNoteContextById(ntxId); + this.triggerCommand('openInWindow', {notePath, hoistedNoteId}); + } + async reopenLastTabCommand() { let closeLastEmptyTab = null; diff --git a/src/public/app/widgets/tab_row.js b/src/public/app/widgets/tab_row.js index d1cf62afb..3437660ee 100644 --- a/src/public/app/widgets/tab_row.js +++ b/src/public/app/widgets/tab_row.js @@ -259,14 +259,19 @@ export default class TabRowWidget extends BasicWidget { x: e.pageX, y: e.pageY, items: [ - {title: t('tab_row.close'), command: "closeTab", uiIcon: "bx bxs-x-circle"}, + {title: t('tab_row.close'), command: "closeTab", uiIcon: "bx bx-x"}, {title: t('tab_row.close_other_tabs'), command: "closeOtherTabs", uiIcon: "bx bx-empty", enabled: appContext.tabManager.noteContexts.length !== 1}, {title: t('tab_row.close_right_tabs'), command: "closeRightTabs", uiIcon: "bx bx-empty", enabled: appContext.tabManager.noteContexts.at(-1).ntxId !== ntxId}, {title: t('tab_row.close_all_tabs'), command: "closeAllTabs", uiIcon: "bx bx-empty"}, + {title: "----"}, + + {title: t('tab_row.reopen_last_tab'), command: "reopenLastTab", uiIcon: "bx bx-undo", enabled: appContext.tabManager.recentlyClosedTabs.length !== 0}, + {title: "----"}, {title: t('tab_row.move_tab_to_new_window'), command: "moveTabToNewWindow", uiIcon: "bx bx-window-open"}, + {title: t('tab_row.copy_tab_to_new_window'), command: "copyTabToNewWindow", uiIcon: "bx bx-empty"} ], selectMenuItemHandler: ({command}) => { this.triggerCommand(command, {ntxId}); diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index de2377124..fa18f9ee4 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1445,7 +1445,9 @@ "close_other_tabs": "Close other tabs", "close_right_tabs": "Close tabs to the right", "close_all_tabs": "Close all tabs", + "reopen_last_tab": "Reopen closed tab", "move_tab_to_new_window": "Move this tab to a new window", + "copy_tab_to_new_window": "Copy this tab to a new window", "new_tab": "New tab" }, "toc": {