@@ -22,7 +22,7 @@ import UpdateNotification from './components/UpdateNotification';
2222import CreateFromTemplateModal from './components/CreateFromTemplateModal' ;
2323import DocumentHistoryView from './components/PromptHistoryView' ;
2424import FolderOverview , { type FolderOverviewMetrics , type FolderSearchResult , type RecentDocumentSummary , type DocTypeCount , type LanguageCount } from './components/FolderOverview' ;
25- import { PlusIcon , FolderPlusIcon , TrashIcon , GearIcon , InfoIcon , TerminalIcon , DocumentDuplicateIcon , PencilIcon , CopyIcon , CommandIcon , CodeIcon , FolderDownIcon , FormatIcon , SparklesIcon , SaveIcon , CheckIcon , DatabaseIcon , ExpandAllIcon , CollapseAllIcon , ArrowUpIcon , ArrowDownIcon , LockClosedIcon , LockOpenIcon } from './components/Icons' ;
25+ import { PlusIcon , FolderPlusIcon , TrashIcon , GearIcon , InfoIcon , TerminalIcon , DocumentDuplicateIcon , PencilIcon , CopyIcon , CommandIcon , CodeIcon , FolderDownIcon , FormatIcon , SparklesIcon , SaveIcon , CheckIcon , DatabaseIcon , ExpandAllIcon , CollapseAllIcon , ArrowUpIcon , ArrowDownIcon , LockClosedIcon , LockOpenIcon , SearchIcon } from './components/Icons' ;
2626import AboutModal from './components/AboutModal' ;
2727import Header from './components/Header' ;
2828import CustomTitleBar from './components/CustomTitleBar' ;
@@ -367,6 +367,7 @@ export const MainApp: React.FC = () => {
367367 const isLoggerResizing = useRef ( false ) ;
368368 const commandPaletteTargetRef = useRef < HTMLDivElement > ( null ) ;
369369 const commandPaletteInputRef = useRef < HTMLInputElement > ( null ) ;
370+ const documentTreeSearchInputRef = useRef < HTMLInputElement > ( null ) ;
370371 const dragCounter = useRef ( 0 ) ;
371372 const ensureNodeVisibleRef = useRef < ( node : Pick < DocumentOrFolder , 'id' | 'type' | 'parentId' > ) => void > ( ) ;
372373
@@ -768,6 +769,14 @@ export const MainApp: React.FC = () => {
768769 setSelectedIds ( new Set ( navigableItems . map ( item => item . id ) ) ) ;
769770 } , [ navigableItems , setSelectedIds ] ) ;
770771
772+ const handleFocusDocumentTreeSearch = useCallback ( ( ) => {
773+ const input = documentTreeSearchInputRef . current ;
774+ if ( input ) {
775+ input . focus ( ) ;
776+ input . select ( ) ;
777+ }
778+ } , [ documentTreeSearchInputRef ] ) ;
779+
771780 const handleMoveSelectionUp = useCallback ( ( ) => {
772781 const primaryId = getPrimarySelectionId ( ) ;
773782 if ( ! primaryId ) {
@@ -2630,6 +2639,7 @@ export const MainApp: React.FC = () => {
26302639 { id : 'rename-item' , name : 'Rename Selected Item' , action : handleRenameSelection , category : 'File' , icon : PencilIcon , shortcut : [ 'F2' ] , keywords : 'rename edit title' } ,
26312640 { id : 'delete-item' , name : 'Delete Selection' , action : ( ) => handleDeleteSelection ( selectedIds ) , category : 'File' , icon : TrashIcon , shortcut : [ 'Delete' ] , keywords : 'remove discard' } ,
26322641 { id : 'document-tree-select-all' , name : 'Select All Tree Items' , action : handleDocumentTreeSelectAll , category : 'Document Tree' , icon : CheckIcon , shortcut : [ 'Control' , 'A' ] , keywords : 'select highlight all tree' } ,
2642+ { id : 'document-tree-focus-search' , name : 'Focus Document Tree Search' , action : handleFocusDocumentTreeSearch , category : 'Document Tree' , icon : SearchIcon , shortcut : [ 'F4' ] , keywords : 'focus search tree find' } ,
26332643 { id : 'document-tree-expand-all' , name : 'Expand All Tree Folders' , action : handleExpandAll , category : 'Document Tree' , icon : ExpandAllIcon , shortcut : [ 'Control' , 'Alt' , 'ArrowRight' ] , keywords : 'open folders tree expand' } ,
26342644 { id : 'document-tree-collapse-all' , name : 'Collapse All Tree Folders' , action : handleCollapseAll , category : 'Document Tree' , icon : CollapseAllIcon , shortcut : [ 'Control' , 'Alt' , 'ArrowLeft' ] , keywords : 'close folders tree collapse' } ,
26352645 { id : 'document-tree-move-selection-up' , name : 'Move Selection Up' , action : handleMoveSelectionUp , category : 'Document Tree' , icon : ArrowUpIcon , shortcut : [ 'Alt' , 'ArrowUp' ] , keywords : 'reorder move up tree' } ,
@@ -2644,7 +2654,7 @@ export const MainApp: React.FC = () => {
26442654 { id : 'toggle-info' , name : 'Toggle Info View' , action : ( ) => { addLog ( 'INFO' , 'Command: Toggle Info View.' ) ; setView ( v => v === 'info' ? 'editor' : 'info' ) ; } , category : 'View' , icon : InfoIcon , keywords : 'help docs readme' } ,
26452655 { id : 'open-about' , name : 'About DocForge' , action : handleOpenAbout , category : 'Help' , icon : SparklesIcon , keywords : 'about credits information' } ,
26462656 { id : 'toggle-logs' , name : 'Toggle Logs Panel' , action : ( ) => { addLog ( 'INFO' , 'Command: Toggle Logs Panel.' ) ; setIsLoggerVisible ( v => ! v ) ; } , category : 'View' , icon : TerminalIcon , keywords : 'debug console' } ,
2647- ] , [ handleNewDocument , handleOpenNewCodeFileModal , handleNewRootFolder , handleNewSubfolder , handleDeleteSelection , handleNewTemplate , toggleSettingsView , handleDuplicateSelection , handleRenameSelection , selectedIds , addLog , handleToggleCommandPalette , handleFormatDocument , handleOpenAbout , handleNewDocumentFromClipboard , handleDocumentTreeSelectAll , handleExpandAll , handleCollapseAll , handleMoveSelectionUp , handleMoveSelectionDown , handleCopySelectionContent , handleSaveSelectionToFile , activeDocument ?. locked , handleToggleActiveDocumentLock ] ) ;
2657+ ] , [ handleNewDocument , handleOpenNewCodeFileModal , handleNewRootFolder , handleNewSubfolder , handleDeleteSelection , handleNewTemplate , toggleSettingsView , handleDuplicateSelection , handleRenameSelection , selectedIds , addLog , handleToggleCommandPalette , handleFormatDocument , handleOpenAbout , handleNewDocumentFromClipboard , handleDocumentTreeSelectAll , handleFocusDocumentTreeSearch , handleExpandAll , handleCollapseAll , handleMoveSelectionUp , handleMoveSelectionDown , handleCopySelectionContent , handleSaveSelectionToFile , activeDocument ?. locked , handleToggleActiveDocumentLock ] ) ;
26482658
26492659 const enrichedCommands = useMemo ( ( ) => {
26502660 return commands . map ( command => {
@@ -2800,7 +2810,7 @@ export const MainApp: React.FC = () => {
28002810 return ;
28012811 }
28022812
2803- if ( command ?. category === 'Document Tree' ) {
2813+ if ( command ?. category === 'Document Tree' && command . id !== 'document-tree-focus-search' ) {
28042814 const target = e . target as HTMLElement | null ;
28052815 const isWithinSidebar = target ?. closest ( '[data-component="document-tree-sidebar"]' ) ;
28062816 if ( ! isWithinSidebar ) {
@@ -3022,6 +3032,7 @@ export const MainApp: React.FC = () => {
30223032 onCollapseAll = { handleCollapseAll }
30233033 searchTerm = { searchTerm }
30243034 setSearchTerm = { setSearchTerm }
3035+ searchInputRef = { documentTreeSearchInputRef }
30253036 onContextMenu = { handleContextMenu }
30263037 renamingNodeId = { renamingNodeId }
30273038 onRenameComplete = { ( ) => setRenamingNodeId ( null ) }
0 commit comments