Skip to content

Commit 24fd898

Browse files
committed
fix(add_link): inserting link to selection not working properly (closes #6776)
1 parent 1aa6238 commit 24fd898

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

apps/client/src/widgets/dialogs/add_link.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ function AddLinkDialogComponent() {
3030
setShown(true);
3131
});
3232

33+
useEffect(() => {
34+
if (hasSelection) {
35+
setLinkType("hyper-link");
36+
} else {
37+
setLinkType("reference-link");
38+
}
39+
}, [ hasSelection ])
40+
3341
async function setDefaultLinkTitle(noteId: string) {
3442
const noteTitle = await tree.getNoteTitle(noteId);
3543
setLinkTitle(noteTitle);
@@ -90,6 +98,7 @@ function AddLinkDialogComponent() {
9098
}
9199

92100
const autocompleteRef = useRef<HTMLInputElement>(null);
101+
console.log("Add link ", linkType, hasSelection);
93102

94103
return (
95104
<Modal

0 commit comments

Comments
 (0)