Skip to content

Build your personal knowledge base with Trilium Notes

feat(text): style include note like the grid/list card view

Elian Doraned0d25cfadc9
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 60c0cba94b..f0f3dc7ce1 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1305,10 +1305,11 @@ body.mobile .modal-content-with-sidebar > .modal-main > .modal-header > .modal-t
.include-note {
margin-bottom: 10px;
- padding: 10px;
- border-radius: 10px;
- background-color: var(--accented-background-color);
+ border-radius: 8px;
+ border: 1px solid var(--card-border-color, var(--main-border-color));
+ background-color: var(--card-background-color, var(--accented-background-color));
display: flex; /* see https://github.com/zadam/trilium/issues/1590 */
+ transition: background-color 200ms ease-out;
}
/* CKEditor counts only non-UIElements as content (see `hasContent` in the
@@ -1345,18 +1346,54 @@ body.mobile .modal-content-with-sidebar > .modal-main > .modal-header > .modal-t
.include-note-wrapper {
width: 100%;
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
}
-/* Expandable include note styles */
+/* Header: the standalone title (non-expandable) and the title row (expandable)
+ both act as the card header, mirroring the grid/list note-book-card header. */
+.include-note-wrapper > .include-note-title,
.include-note-title-row {
display: flex;
align-items: center;
- gap: 5px;
+ gap: 8px;
+ margin: 0;
+ padding: .5rem 1rem;
+ font-size: 1em;
+ font-weight: 500;
+ border-bottom: 1px solid var(--card-border-color, var(--main-border-color));
+}
+
+.include-note-title .bx {
+ flex-shrink: 0;
+ font-size: 1.2em;
+ color: var(--note-list-view-icon-color, var(--muted-text-color));
+}
+
+/* Neutralize the default link color and pill hover so the title reads as a
+ plain card header (matching .note-book-title in the grid/list view). */
+.include-note-title a {
+ --link-hover-background: transparent;
+ --link-hover-color: currentColor;
+ color: inherit;
+ font-weight: 500;
+ text-decoration: none;
+}
+
+/* Expandable include note styles */
+.include-note-title-row {
cursor: pointer;
}
+/* The title inside the expandable row defers its header styling to the row. */
.include-note-title-row .include-note-title {
- margin: 0;
+ padding: 0;
+ border-bottom: none;
+ font-weight: inherit;
+ font-size: inherit;
+ min-width: 0;
+ flex-grow: 1;
}
.include-note-toggle {
@@ -1365,11 +1402,12 @@ body.mobile .modal-content-with-sidebar > .modal-main > .modal-header > .modal-t
padding: 2px;
cursor: pointer;
font-size: 1.2em;
- color: var(--main-text-color);
+ color: var(--muted-text-color);
transition: transform 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
+ flex-shrink: 0;
}
.include-note-toggle:hover {
@@ -1380,8 +1418,24 @@ body.mobile .modal-content-with-sidebar > .modal-main > .modal-header > .modal-t
transform: rotate(90deg);
}
+.include-note-content {
+ padding: .75rem 1rem;
+}
+
+.include-note-content > .rendered-content > *:last-child {
+ margin-bottom: 0;
+}
+
+/* Media that renders edge-to-edge (iframes, images, video) shouldn't be inset. */
+.include-note-content.type-pdf,
+.include-note-content.type-image,
+.include-note-content.type-video,
+.include-note-content.type-canvas {
+ padding: 0;
+}
+
.include-note[data-box-size="expandable"] .include-note-content {
- margin-top: 10px;
+ padding-top: 0;
}
.alert {
diff --git a/apps/client/src/widgets/type_widgets/text/utils.ts b/apps/client/src/widgets/type_widgets/text/utils.ts
index 07aa18085b..db5dc48b14 100644
--- a/apps/client/src/widgets/type_widgets/text/utils.ts
+++ b/apps/client/src/widgets/type_widgets/text/utils.ts
@@ -15,7 +15,8 @@ export async function loadIncludedNote(noteId: string, $el: JQuery<HTMLElement>,
const $wrapper = $('<div class="include-note-wrapper">');
const $link = await link.createLink(note.noteId, {
- showTooltip: false
+ showTooltip: false,
+ showNoteIcon: true
});
if (isExpandable) {