Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/type_widget): fix sizing

Elian Dorane576fa03da85
diff --git a/apps/client/src/layouts/mobile_layout.tsx b/apps/client/src/layouts/mobile_layout.tsx
index a825d80614..5c79bb59fc 100644
--- a/apps/client/src/layouts/mobile_layout.tsx
+++ b/apps/client/src/layouts/mobile_layout.tsx
@@ -1,6 +1,5 @@
import FlexContainer from "../widgets/containers/flex_container.js";
import NoteTitleWidget from "../widgets/note_title.js";
-import NoteDetailWidget from "../widgets/note_detail.js";
import QuickSearchWidget from "../widgets/quick_search.js";
import NoteTreeWidget from "../widgets/note_tree.js";
import ScreenContainer from "../widgets/mobile_widgets/screen_container.js";
@@ -24,6 +23,7 @@ import CloseZenModeButton from "../widgets/close_zen_button.js";
import NoteWrapperWidget from "../widgets/note_wrapper.js";
import MobileDetailMenu from "../widgets/mobile_widgets/mobile_detail_menu.js";
import NoteList from "../widgets/collections/NoteList.jsx";
+import NoteDetail from "../widgets/NoteDetail.jsx";
const MOBILE_CSS = `
<style>
@@ -153,7 +153,7 @@ export default class MobileLayout {
new ScrollingContainer()
.filling()
.contentSized()
- .child(new NoteDetailWidget())
+ .child(<NoteDetail />)
.child(<NoteList />)
.child(<FilePropertiesWrapper />)
)
diff --git a/apps/client/src/widgets/NoteDetail.css b/apps/client/src/widgets/NoteDetail.css
index f51fb132ae..280fe2269f 100644
--- a/apps/client/src/widgets/NoteDetail.css
+++ b/apps/client/src/widgets/NoteDetail.css
@@ -1,9 +1,13 @@
-.note-detail {
+.component.note-detail {
font-family: var(--detail-font-family);
font-size: var(--detail-font-size);
+ contain: none;
}
.note-detail.full-height {
- contain: none;
height: 100%;
+}
+
+.note-detail > * {
+ contain: none;
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx
index c931b1e600..b351904b6a 100644
--- a/apps/client/src/widgets/NoteDetail.tsx
+++ b/apps/client/src/widgets/NoteDetail.tsx
@@ -25,6 +25,9 @@ type ExtendedNoteType = Exclude<NoteType, "launcher" | "text" | "code"> | "empty
/**
* The note detail is in charge of rendering the content of a note, by determining its type (e.g. text, code) and using the appropriate view widget.
+ *
+ * Apart from that:
+ * - It applies a full-height style depending on the content type (e.g. canvas notes).
*/
export default function NoteDetail() {
const { note, type, noteContext, parentComponent } = useNoteInfo();
diff --git a/apps/client/src/widgets/note_detail.ts.bak b/apps/client/src/widgets/note_detail.ts.bak
index a907cb43a1..8b66102013 100644
--- a/apps/client/src/widgets/note_detail.ts.bak
+++ b/apps/client/src/widgets/note_detail.ts.bak
@@ -81,11 +81,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
return true;
}
- doRender() {
- this.$widget = $(TPL);
- this.contentSized();
- }
-
async refresh() {
this.type = await this.getWidgetType();
this.mime = this.note?.mime;
diff --git a/apps/client/src/widgets/type_widgets_old/type_widget.ts b/apps/client/src/widgets/type_widgets_old/type_widget.ts
index 8631ceace3..7f72c87122 100644
--- a/apps/client/src/widgets/type_widgets_old/type_widget.ts
+++ b/apps/client/src/widgets/type_widgets_old/type_widget.ts
@@ -16,8 +16,6 @@ export default abstract class TypeWidget extends NoteContextAwareWidget {
static getType() {}
doRender() {
- this.contentSized();
-
return super.doRender();
}