Skip to content

Build your personal knowledge base with Trilium Notes

client/text editor/include notes: enable the fullscreen button for included notes too, not just attachments

Adorian Doranad5c71255911
diff --git a/apps/client/src/widgets/type_widgets/text/IncludeNote.spec.tsx b/apps/client/src/widgets/type_widgets/text/IncludeNote.spec.tsx
index 6879591839..77806cc40a 100644
--- a/apps/client/src/widgets/type_widgets/text/IncludeNote.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/text/IncludeNote.spec.tsx
@@ -125,20 +125,18 @@ describe("IncludeNote", () => {
it("lays out the title row for each box size", () => {
const plain = [ "title", "open", "menu" ];
const withFullscreen = [ "title", "open", "fullscreen", "menu" ];
- const layouts: [ string | undefined, boolean, string[] ][] = [
- [ undefined, false, plain ],
- [ "small", true, plain ],
- [ "medium", false, plain ],
- [ "medium", true, withFullscreen ],
- [ "full", true, withFullscreen ],
- [ "expandable", true, [ "toggle", "title", "open", "menu" ] ]
+ const layouts: [ string | undefined, string[] ][] = [
+ [ undefined, plain ],
+ [ "small", plain ],
+ [ "medium", withFullscreen ],
+ [ "full", withFullscreen ],
+ [ "expandable", [ "toggle", "title", "open", "menu" ] ]
];
- for (const [ boxSize, isFullscreenOffered, expected ] of layouts) {
+ for (const [ boxSize, expected ] of layouts) {
act(() => render(null, container));
- renderBox({ boxSize, isFullscreenOffered });
- expect(titleRow(), `${boxSize} ${isFullscreenOffered}`)
- .toEqual(expected.map((name) => `include-note-${name}`));
+ renderBox({ boxSize });
+ expect(titleRow(), boxSize).toEqual(expected.map((name) => `include-note-${name}`));
}
});
@@ -221,7 +219,7 @@ describe("IncludeNote", () => {
value: exitFullscreen,
configurable: true
});
- renderBox({ boxSize: "medium", isFullscreenOffered: true });
+ renderBox({ boxSize: "medium" });
const box = contentBox();
box.requestFullscreen = vi.fn(async () => {});
@@ -257,7 +255,7 @@ describe("IncludeNote", () => {
});
it("leaves the fullscreen controls out of a box that offers no fullscreen", () => {
- renderBox({ boxSize: "full" });
+ renderBox({ boxSize: "small" });
expect(container.querySelector(".include-note-fullscreen-controls")).toBeNull();
});
});
diff --git a/apps/client/src/widgets/type_widgets/text/IncludeNote.tsx b/apps/client/src/widgets/type_widgets/text/IncludeNote.tsx
index 1672ca889c..becd16a465 100644
--- a/apps/client/src/widgets/type_widgets/text/IncludeNote.tsx
+++ b/apps/client/src/widgets/type_widgets/text/IncludeNote.tsx
@@ -27,8 +27,6 @@ export interface IncludeNoteProps {
/** The note opened by the buttons in the title row. */
notePath: string;
viewScope?: ViewScope;
- /** Whether a medium or full box offers to show its content in fullscreen. */
- isFullscreenOffered?: boolean;
}
export interface TinyIncludeNoteProps {
@@ -46,12 +44,12 @@ export interface TinyIncludeNoteProps {
/** The title row and the content of an included note or embedded attachment. */
export default function IncludeNote({
- boxSize, title, content, contentType, notePath, viewScope, isFullscreenOffered
+ boxSize, title, content, contentType, notePath, viewScope
}: IncludeNoteProps) {
const contentRef = useRef<HTMLDivElement>(null);
const [ isExpanded, setIsExpanded ] = useState(false);
const isExpandable = boxSize === "expandable";
- const hasFullscreen = !!isFullscreenOffered && (boxSize === "medium" || boxSize === "full");
+ const hasFullscreen = boxSize === "medium" || boxSize === "full";
useLayoutEffect(() => {
contentRef.current?.append(content);
diff --git a/apps/client/src/widgets/type_widgets/text/utils.spec.ts b/apps/client/src/widgets/type_widgets/text/utils.spec.ts
index 44ad019c34..cce820969b 100644
--- a/apps/client/src/widgets/type_widgets/text/utils.spec.ts
+++ b/apps/client/src/widgets/type_widgets/text/utils.spec.ts
@@ -154,7 +154,7 @@ describe("loadIncludedNote", () => {
});
describe("loadIncludedAttachment", () => {
- it("mounts a box with the attachment, opened in its note and offered fullscreen", async () => {
+ it("mounts a box with the attachment, opened in its note", async () => {
const wrapper = createWrapper();
await loadIncludedAttachment("att1", $(wrapper), "full");
@@ -176,8 +176,7 @@ describe("loadIncludedAttachment", () => {
content,
contentType: "pdf",
notePath: "owner",
- viewScope: ATTACHMENT_SCOPE,
- isFullscreenOffered: true
+ viewScope: ATTACHMENT_SCOPE
});
});
diff --git a/apps/client/src/widgets/type_widgets/text/utils.ts b/apps/client/src/widgets/type_widgets/text/utils.ts
index a80f5ac9d8..8df6567387 100644
--- a/apps/client/src/widgets/type_widgets/text/utils.ts
+++ b/apps/client/src/widgets/type_widgets/text/utils.ts
@@ -105,8 +105,7 @@ export async function loadIncludedAttachment(
content: $renderedContent[0],
contentType: type,
notePath: attachment.ownerId,
- viewScope,
- isFullscreenOffered: true
+ viewScope
});
await content_renderer.mountInteractiveWidget(box, getWrapper(el));
}
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html
index 0924f3d389..ac443872a6 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Include Note.html
@@ -39,6 +39,10 @@
at the end of the title row opens the same menu as right-clicking the title:
the other places to open the note in and, for an embedded attachment, the
actions on the attachment.</p>
+<p>To show an include of size <em>Medium</em> or <em>Full</em> on the whole screen,
+ press the <span class="tn-icon bx bx-fullscreen"></span> <em>Fullscreen</em> button
+ at the end of its title. To return, press <span class="tn-icon bx bx-exit"></span> <em>Exit fullscreen</em> in
+ the top-right corner, or <kbd>Esc</kbd>.</p>
<p>A <em>Tiny</em> include has these buttons instead, followed by the same <em>More actions</em> button:</p>
<ul>
<li>For a note, <span class="tn-icon bx bx-edit"></span> <em>Quick edit</em> opens
diff --git a/docs/User Guide/User Guide/Note Types/Text/Include Note.md b/docs/User Guide/User Guide/Note Types/Text/Include Note.md
index 2a118313e7..464bf1ada2 100644
--- a/docs/User Guide/User Guide/Note Types/Text/Include Note.md
+++ b/docs/User Guide/User Guide/Note Types/Text/Include Note.md
@@ -33,6 +33,8 @@ To open an included note in a new tab, press the <span class="tn-icon bx bx-link
The <span class="tn-icon bx bx-dots-vertical-rounded"></span> _More actions_ button at the end of the title row opens the same menu as right-clicking the title: the other places to open the note in and, for an embedded attachment, the actions on the attachment.
+To show an include of size _Medium_ or _Full_ on the whole screen, press the <span class="tn-icon bx bx-fullscreen"></span> _Fullscreen_ button at the end of its title. To return, press <span class="tn-icon bx bx-exit"></span> _Exit fullscreen_ in the top-right corner, or <kbd>Esc</kbd>.
+
A _Tiny_ include has these buttons instead, followed by the same _More actions_ button:
* For a note, <span class="tn-icon bx bx-edit"></span> _Quick edit_ opens the note in <a class="reference-link" href="../../Basic%20Concepts%20and%20Features/Navigation/Quick%20edit.md">Quick edit</a>, and <span class="tn-icon bx bx-link-external"></span> _Open in new tab_ opens it in a new tab.