mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	fix(react): note title not selecting text
This commit is contained in:
		@@ -53,9 +53,12 @@ export default function NoteTitleWidget() {
 | 
				
			|||||||
    // Manage focus.
 | 
					    // Manage focus.
 | 
				
			||||||
    const textBoxRef = useRef<HTMLInputElement>(null);
 | 
					    const textBoxRef = useRef<HTMLInputElement>(null);
 | 
				
			||||||
    const isNewNote = useRef<boolean>();
 | 
					    const isNewNote = useRef<boolean>();
 | 
				
			||||||
    useTriliumEvents([ "focusOnTitle", "focusAndSelectTitle" ], (e) => {
 | 
					    useTriliumEvents([ "focusOnTitle", "focusAndSelectTitle" ], (e, eventName) => {
 | 
				
			||||||
        if (noteContext?.isActive() && textBoxRef.current) {
 | 
					        if (noteContext?.isActive() && textBoxRef.current) {
 | 
				
			||||||
            textBoxRef.current.focus();
 | 
					            textBoxRef.current.focus();
 | 
				
			||||||
 | 
					            if (eventName === "focusAndSelectTitle") {
 | 
				
			||||||
 | 
					                textBoxRef.current.select();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            isNewNote.current = ("isNewNote" in e ? e.isNewNote : false);
 | 
					            isNewNote.current = ("isNewNote" in e ? e.isNewNote : false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user