11import { Dialog } from "../../../../components/dialog" ;
2+ import { onNewDraft , onOpen , onSave } from "../../../../pages/_sub_window/AppMenuWindow" ;
23import ColorWindow from "../../../../pages/_sub_window/ColorWindow" ;
34import FindWindow from "../../../../pages/_sub_window/FindWindow" ;
5+ import RecentFilesWindow from "../../../../pages/_sub_window/RecentFilesWindow" ;
46import SettingsWindow from "../../../../pages/_sub_window/SettingsWindow" ;
57import TagWindow from "../../../../pages/_sub_window/TagWindow" ;
68import { Direction } from "../../../../types/directions" ;
@@ -734,30 +736,7 @@ export namespace ShortcutKeysRegister {
734736 shift : true ,
735737 } )
736738 ) . down ( ( ) => {
737- const isRecentFilePanelOpening = document . getElementById ( "recent-files-panel-open-mark-div" ) !== null ;
738- if ( isRecentFilePanelOpening ) {
739- const closeButton = document . getElementById ( "recent-files-panel-close-btn" ) ;
740- const event = new MouseEvent ( "click" , {
741- bubbles : true ,
742- cancelable : true ,
743- view : window ,
744- } ) ;
745- closeButton ?. dispatchEvent ( event ) ;
746- setTimeout ( ( ) => {
747- Controller . pressingKeySet . clear ( ) ;
748- } , 200 ) ;
749- } else {
750- const button = document . getElementById ( "app-menu-recent-file-btn" ) ;
751- const event = new MouseEvent ( "click" , {
752- bubbles : true ,
753- cancelable : true ,
754- view : window ,
755- } ) ;
756- button ?. dispatchEvent ( event ) ;
757- setTimeout ( ( ) => {
758- Controller . pressingKeySet . clear ( ) ;
759- } , 200 ) ;
760- }
739+ RecentFilesWindow . open ( ) ;
761740 } ) ;
762741 (
763742 await KeyBinds . create ( "clickStartFilePanelButton" , "$" , {
@@ -784,14 +763,8 @@ export namespace ShortcutKeysRegister {
784763 alt : false ,
785764 shift : false ,
786765 } )
787- ) . down ( ( ) => {
788- const button = document . getElementById ( "app-menu-save-btn" ) ;
789- const event = new MouseEvent ( "click" , {
790- bubbles : true ,
791- cancelable : true ,
792- view : window ,
793- } ) ;
794- button ?. dispatchEvent ( event ) ;
766+ ) . down ( async ( ) => {
767+ onSave ( ) ;
795768 } ) ;
796769 (
797770 await KeyBinds . create ( "newDraft" , "n" , {
@@ -801,13 +774,7 @@ export namespace ShortcutKeysRegister {
801774 shift : false ,
802775 } )
803776 ) . down ( ( ) => {
804- const button = document . getElementById ( "app-menu-new-draft-btn" ) ;
805- const event = new MouseEvent ( "click" , {
806- bubbles : true ,
807- cancelable : true ,
808- view : window ,
809- } ) ;
810- button ?. dispatchEvent ( event ) ;
777+ onNewDraft ( ) ;
811778 } ) ;
812779 (
813780 await KeyBinds . create ( "openFile" , "o" , {
@@ -817,13 +784,7 @@ export namespace ShortcutKeysRegister {
817784 shift : false ,
818785 } )
819786 ) . down ( ( ) => {
820- const button = document . getElementById ( "app-menu-open-btn" ) ;
821- const event = new MouseEvent ( "click" , {
822- bubbles : true ,
823- cancelable : true ,
824- view : window ,
825- } ) ;
826- button ?. dispatchEvent ( event ) ;
787+ onOpen ( ) ;
827788 } ) ;
828789
829790 (
0 commit comments