Skip to content

Build your personal knowledge base with Trilium Notes

feat(client): scroll childless code notes inside the editor

Claude7a0efbbc0aad
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 78e594e57f..a17fba9f44 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -2999,6 +2999,12 @@ iframe.print-iframe {
overflow: hidden;
}
+/* A full-height note fills the container instead of scrolling it, so the padding that lets
+ flowing content scroll past its end would only take height away from the note. */
+.scrolling-container:has(> .note-detail.full-height) > .scroll-padding-widget {
+ display: none;
+}
+
@media (max-width: 991px) {
body.mobile {
.split-note-container-widget {
diff --git a/apps/client/src/widgets/note_types.tsx b/apps/client/src/widgets/note_types.tsx
index 214d34d409..b298c05cb6 100644
--- a/apps/client/src/widgets/note_types.tsx
+++ b/apps/client/src/widgets/note_types.tsx
@@ -80,12 +80,14 @@ export const TYPE_MAPPINGS: Record<ExtendedNoteType, NoteTypeMapping> = {
readOnlyCode: {
view: async () => (await import("./type_widgets/code/Code")).ReadOnlyCode,
className: "note-detail-readonly-code",
- printable: true
+ printable: true,
+ isFullHeight: true
},
editableCode: {
view: async () => (await import("./type_widgets/code/Code")).EditableCode,
className: "note-detail-code",
- printable: true
+ printable: true,
+ isFullHeight: true
},
mermaid: {
view: () => import("./type_widgets/mermaid/Mermaid"),
diff --git a/apps/client/src/widgets/type_widgets/code/code.css b/apps/client/src/widgets/type_widgets/code/code.css
index ee0ae51419..ec18ee45e6 100644
--- a/apps/client/src/widgets/type_widgets/code/code.css
+++ b/apps/client/src/widgets/type_widgets/code/code.css
@@ -3,6 +3,12 @@
min-height: 50px;
position: relative;
}
+
+/* Fills the wrapper in the full-height layout so the editor's own scroller can scroll; resolves
+ to auto in the flowing layout, where the wrapper has no set height. */
+.note-detail-readonly-code .note-detail-readonly-code-content {
+ height: 100%;
+}
/* #endregion */
/* #region Editable code */