Skip to content

Build your personal knowledge base with Trilium Notes

link previews: improve appearance

Adorian Doran30880cd4ba30
diff --git a/apps/client/src/widgets/type_widgets/text/LinkEmbed.css b/apps/client/src/widgets/type_widgets/text/LinkEmbed.css
index 01c95435ae..63473c6ffc 100644
--- a/apps/client/src/widgets/type_widgets/text/LinkEmbed.css
+++ b/apps/client/src/widgets/type_widgets/text/LinkEmbed.css
@@ -13,16 +13,18 @@
}
.link-embed-mention {
- display: inline-flex;
- align-items: center;
- gap: 4px;
+ display: inline;
padding: 1px 6px 1px 4px;
text-decoration: none;
font-size: 0.92em;
line-height: 1.5;
- vertical-align: baseline;
transition: background-color 0.12s;
cursor: pointer;
+
+ /* inline (not inline-flex) so a long link wraps line-by-line through the paragraph;
+ clone keeps each wrapped fragment's padding/rounded corners where a background applies. */
+ box-decoration-break: clone;
+ -webkit-box-decoration-break: clone;
}
.link-embed-mention:hover {
@@ -45,6 +47,14 @@
flex-shrink: 0;
}
+/* Sits the favicon before the link text and spaces it off the title. Scoped to the mention so
+ it doesn't disturb the same favicon reused in the card's flex URL row. */
+.link-embed-mention > .link-embed-mention-favicon,
+.link-embed-mention > .link-embed-mention-dot {
+ vertical-align: -0.2em;
+ margin-right: 4px;
+}
+
.link-embed-mention-title {
white-space: normal;
word-break: break-word;
@@ -83,19 +93,19 @@
.link-embed-video {
position: relative;
width: 100%;
- max-height: 70vh;
border-radius: 8px;
overflow: hidden;
}
.link-embed-preview-wrapper > .link-embed-video {
padding: 8px;
- background: white;
+ background: var(--main-background-color);
}
.link-embed-video iframe {
width: 100%;
height: 100%;
+ max-height: 70vh;
aspect-ratio: 16 / 9;
border: none;
display: block;
@@ -112,18 +122,24 @@
display: block;
width: 100%;
height: 100%;
+ max-height: 70vh;
aspect-ratio: 16 / 9;
padding: 0;
border: none;
+ border-radius: 8px;
background: #000;
cursor: pointer;
overflow: hidden;
+
+ &:hover .link-embed-video-thumbnail {
+ filter: blur(20px) brightness(0.65);
+ }
}
-.link-embed-video-thumbnail {
+.link-embed-video-facade .link-embed-video-thumbnail {
width: 100%;
height: 100%;
- object-fit: cover;
+ object-fit: contain;
display: block;
filter: blur(20px) brightness(0.5);
}
diff --git a/packages/share-theme/src/styles/link-embed.css b/packages/share-theme/src/styles/link-embed.css
index 6089fc632d..9807300e2b 100644
--- a/packages/share-theme/src/styles/link-embed.css
+++ b/packages/share-theme/src/styles/link-embed.css
@@ -5,9 +5,7 @@
/* ---------- Inline mention (favicon + title) ---------- */
.link-embed-mention {
- display: inline-flex;
- align-items: center;
- gap: 4px;
+ display: inline;
padding: 1px 6px 1px 4px;
border-radius: 4px;
background: var(--background-highlight);
@@ -15,8 +13,12 @@
color: var(--text-primary);
font-size: 0.92em;
line-height: 1.5;
- vertical-align: baseline;
transition: background-color 0.12s;
+
+ /* inline (not inline-flex) so a long link wraps line-by-line through the paragraph;
+ clone keeps each wrapped fragment's padding/rounded corners and background. */
+ box-decoration-break: clone;
+ -webkit-box-decoration-break: clone;
}
.link-embed-mention:hover {
@@ -41,6 +43,14 @@
flex-shrink: 0;
}
+/* Sits the favicon before the link text and spaces it off the title. Scoped to the mention so
+ it doesn't disturb the same favicon reused in the card's flex URL row. */
+.link-embed-mention > .link-embed-mention-favicon,
+.link-embed-mention > .link-embed-mention-dot {
+ vertical-align: -0.2em;
+ margin-right: 4px;
+}
+
.link-embed-mention-title {
white-space: normal;
word-break: break-word;