A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: don't close pinned tab on ctrl+w (#7805)
01zulfi2b7b8d526ea4
diff --git a/apps/web/src/common/key-map.ts b/apps/web/src/common/key-map.tsindex 5fae830a1..f40d2ef39 100644--- a/apps/web/src/common/key-map.ts+++ b/apps/web/src/common/key-map.ts@@ -97,8 +97,16 @@ const KEYMAP = [},{keys: ["ctrl+w", "command+w"],- description: "Close active tab",- action: () => useEditorStore.getState().closeActiveTab()+ description:+ "Close active tab or focus previously activated tab if active tab pinned",+ action: () => {+ const activeTab = useEditorStore.getState().getActiveTab();+ if (activeTab?.pinned) {+ useEditorStore.getState().focusLastActiveTab();+ return;+ }+ useEditorStore.getState().closeActiveTab();+ }},{keys: ["ctrl+shift+w", "command+shift+w"],diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex 284cfcd49..1561ee78e 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -850,6 +850,16 @@ class EditorStore extends BaseStore<EditorStore> {return this.focusTab(tabs[index === 0 ? tabs.length - 1 : index - 1].id);};+ focusLastActiveTab = () => {+ const history = useEditorStore.getState().history;+ if (history.length < 2) return;++ const previousTab = history.at(-2);+ if (!previousTab) return;++ useEditorStore.getState().focusTab(previousTab);+ };+goBack = async () => {const activeTabId = this.get().activeTabId;if (!activeTabId || !tabSessionHistory.canGoBack(activeTabId)) return;