Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
link previews/card links: prevent navigating to the thumbnail when double clicking it
Adorian Doran7078eae22ce9
diff --git a/apps/client/src/services/link_embed.tsx b/apps/client/src/services/link_embed.tsxindex 6d5dc86ad0..e233522783 100644--- a/apps/client/src/services/link_embed.tsx+++ b/apps/client/src/services/link_embed.tsx@@ -99,6 +99,7 @@ function CardImage({ src }: { src?: string }) {src={src}alt=""loading="lazy"+ draggable={false}onError={() => setFailed(true)}/>);@@ -124,7 +125,7 @@ function VideoEmbed({ meta, videoId }: { meta: EmbedMetadata; videoId: string })title={t("link_embed.play_video")}onClick={() => setPlaying(true)}>- {meta.image && <img className="link-embed-video-thumbnail" src={meta.image} alt="" />}+ {meta.image && <img className="link-embed-video-thumbnail" src={meta.image} alt="" draggable={false} />}<span className="link-embed-video-play" aria-hidden="true" /></button></div>diff --git a/apps/client/src/widgets/type_widgets/text/LinkEmbed.css b/apps/client/src/widgets/type_widgets/text/LinkEmbed.cssindex e22bd3aa11..e8395b7fff 100644--- a/apps/client/src/widgets/type_widgets/text/LinkEmbed.css+++ b/apps/client/src/widgets/type_widgets/text/LinkEmbed.css@@ -266,6 +266,17 @@ section.link-embed:has(+ section.link-embed) {object-fit: cover;}+/* Let a click/double-click land on the wrapping anchor (card) or button (facade), not the image+ itself. Without this, Firefox treats an inline data: image in a contenteditable as a draggable,+ openable resource and a double-click navigates the tab to the base64 URI instead of following+ the card's link. The wrappers carry the interaction; the images never need pointer events. */+.link-embed-card-image,+.link-embed-video-thumbnail {+ pointer-events: none;+ -webkit-user-drag: none;+ user-select: none;+}+.link-embed-card-image-placeholder {display: flex;align-items: center;