mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(react): note title not selecting text
This commit is contained in:
parent
1851336862
commit
06cea99b40
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user