fix(add_link): inserting link to selection not working properly (closes #6776)

This commit is contained in:
Elian Doran
2025-08-25 20:48:15 +03:00
parent 1aa6238288
commit 24fd898f0d

View File

@@ -30,6 +30,14 @@ function AddLinkDialogComponent() {
setShown(true);
});
useEffect(() => {
if (hasSelection) {
setLinkType("hyper-link");
} else {
setLinkType("reference-link");
}
}, [ hasSelection ])
async function setDefaultLinkTitle(noteId: string) {
const noteTitle = await tree.getNoteTitle(noteId);
setLinkTitle(noteTitle);
@@ -90,6 +98,7 @@ function AddLinkDialogComponent() {
}
const autocompleteRef = useRef<HTMLInputElement>(null);
console.log("Add link ", linkType, hasSelection);
return (
<Modal