@@ -24,8 +24,14 @@ import { PublishDialog, PublishShortNoteDialog } from "@/features/publishing";
2424import { SidebarPane } from "@/features/shell/sidebar-pane" ;
2525import { useRevealMainWindow } from "@/features/shell/use-reveal-main-window" ;
2626import { useShellController } from "@/features/shell/use-shell-controller" ;
27+ import { useShellStore } from "@/features/shell/store/use-shell-store" ;
2728import { useUIStore } from "@/features/settings/store/use-ui-store" ;
2829import {
30+ dispatchFocusEditor ,
31+ dispatchFocusNotesPane ,
32+ } from "@/shared/lib/pane-navigation" ;
33+ import {
34+ getPaneFocusShortcut ,
2935 isCommandPaletteShortcut ,
3036 isEditorFindShortcut ,
3137 isNotesSearchShortcut ,
@@ -77,6 +83,7 @@ function App() {
7783 useRevealMainWindow ( ! hasCompletedStartupReveal && ! readyToRevealWindow ) ;
7884
7985 const setSettingsOpen = useUIStore ( ( s ) => s . setSettingsOpen ) ;
86+ const setFocusedPane = useShellStore ( ( s ) => s . setFocusedPane ) ;
8087
8188 const openCommandPalette = useEffectEvent ( ( ) => {
8289 setCommandPaletteOpen ( true ) ;
@@ -90,6 +97,20 @@ function App() {
9097 window . dispatchEvent ( new CustomEvent ( OPEN_EDITOR_FIND_EVENT ) ) ;
9198 } ) ;
9299
100+ const focusPane = useEffectEvent ( ( pane : "sidebar" | "notes" | "editor" ) => {
101+ if ( pane === "editor" ) {
102+ dispatchFocusEditor ( ) ;
103+ return ;
104+ }
105+
106+ if ( pane === "notes" ) {
107+ dispatchFocusNotesPane ( ) ;
108+ return ;
109+ }
110+
111+ setFocusedPane ( pane ) ;
112+ } ) ;
113+
93114 const handleKeyDown = useEffectEvent ( ( event : KeyboardEvent ) => {
94115 if ( isCommandPaletteShortcut ( event ) ) {
95116 event . preventDefault ( ) ;
@@ -115,6 +136,15 @@ function App() {
115136 return ;
116137 }
117138
139+ const paneShortcut = getPaneFocusShortcut ( event ) ;
140+ if ( paneShortcut ) {
141+ event . preventDefault ( ) ;
142+ event . stopPropagation ( ) ;
143+ event . stopImmediatePropagation ( ) ;
144+ focusPane ( paneShortcut ) ;
145+ return ;
146+ }
147+
118148 if ( ! event . metaKey ) return ;
119149
120150 const key = event . key . toLowerCase ( ) ;
0 commit comments