From 4bdb40904f4862c7eb498e4ee4adbed3e79d777b Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 12 Nov 2023 22:57:04 +0100 Subject: [PATCH] fix loading reference link titles in read-only text notes, closes #4404 --- src/public/app/services/link.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/public/app/services/link.js b/src/public/app/services/link.js index ee991b202..e42207839 100644 --- a/src/public/app/services/link.js +++ b/src/public/app/services/link.js @@ -268,7 +268,9 @@ function linkContextMenu(e) { } async function loadReferenceLinkTitle($el, href = null) { - href = href || $el.find("a").attr("href"); + const $link = $el[0].tagName === 'A' ? $el : $el.find("a"); + + href = href || $link.attr("href"); if (!href) { console.warn("Empty URL for parsing: " + $el[0].outerHTML); return; @@ -286,7 +288,7 @@ async function loadReferenceLinkTitle($el, href = null) { if (note) { const icon = await getLinkIcon(noteId, viewScope.viewMode); - +k $el.prepend($("").addClass(icon)); } }