Skip to content

Build your personal knowledge base with Trilium Notes

feat(share): show shared presentations with the app's presentation view

Elian Doranb5610e79fd53
diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx
index f1c834753b..e43e444aa0 100644
--- a/apps/client/src/widgets/collections/presentation/index.tsx
+++ b/apps/client/src/widgets/collections/presentation/index.tsx
@@ -10,7 +10,7 @@ import FNote from "../../../entities/fnote";
import { t } from "../../../services/i18n";
import CollectionProperties from "../../note_bars/CollectionProperties";
import ActionButton from "../../react/ActionButton";
-import { useNoteLabelWithDefault, useTriliumEvent } from "../../react/hooks";
+import { useEffectiveReadOnly, useNoteContext, useNoteLabelWithDefault, useTriliumEvent } from "../../react/hooks";
import ShadowDom from "../../react/ShadowDom";
import { ViewModeMedia, ViewModeProps } from "../interface";
import { buildPresentationModel, PresentationModel, PresentationSlideBaseModel } from "./model";
@@ -22,6 +22,8 @@ export default function PresentationView({ note, noteIds, media, onReady, onProg
const containerRef = useRef<HTMLDivElement>(null);
const [ api, setApi ] = useState<RevealApi>();
const stylesheets = usePresentationStylesheets(note, media);
+ const { noteContext } = useNoteContext();
+ const isReadOnly = useEffectiveReadOnly(note, noteContext);
function refresh() {
buildPresentationModel(note, onProgressChanged).then(setPresentation);
@@ -57,7 +59,7 @@ export default function PresentationView({ note, noteIds, media, onReady, onProg
<div class="presentation-view">
<CollectionProperties
note={note}
- rightChildren={<ButtonOverlay containerRef={containerRef} api={api} />}
+ rightChildren={<ButtonOverlay containerRef={containerRef} api={api} isReadOnly={isReadOnly} />}
/>
<ShadowDom
className="presentation-container"
@@ -98,7 +100,7 @@ function usePresentationStylesheets(note: FNote, media: ViewModeMedia) {
return stylesheets;
}
-function ButtonOverlay({ containerRef, api }: { containerRef: RefObject<HTMLDivElement | null>, api: RevealApi | undefined }) {
+function ButtonOverlay({ containerRef, api, isReadOnly }: { containerRef: RefObject<HTMLDivElement | null>, api: RevealApi | undefined, isReadOnly: boolean }) {
const [ isOverviewActive, setIsOverviewActive ] = useState(false);
useEffect(() => {
if (!api) return;
@@ -115,18 +117,20 @@ function ButtonOverlay({ containerRef, api }: { containerRef: RefObject<HTMLDivE
return (
<>
- <ActionButton
- icon="bx bx-edit"
- text={t("presentation_view.edit-slide")}
- onClick={e => {
- const currentSlide = api?.getCurrentSlide();
- const noteId = getNoteIdFromSlide(currentSlide);
-
- if (noteId) {
- openInCurrentNoteContext(e, noteId);
- }
- }}
- />
+ {!isReadOnly && (
+ <ActionButton
+ icon="bx bx-edit"
+ text={t("presentation_view.edit-slide")}
+ onClick={e => {
+ const currentSlide = api?.getCurrentSlide();
+ const noteId = getNoteIdFromSlide(currentSlide);
+
+ if (noteId) {
+ openInCurrentNoteContext(e, noteId);
+ }
+ }}
+ />
+ )}
<ActionButton
icon="bx bx-grid-horizontal"
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html
index 0ee7350707..a5873ce02e 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html
@@ -129,9 +129,8 @@ class="image">
</td>
<td>
<ul>
- <li>The calendar, table, board, geo map and dashboard view types are shown
- as in the app, but read-only. The presentation view type is not supported,
- and its child notes are shown as cards instead.</li>
+ <li>The calendar, table, board, geo map, dashboard and presentation view types
+ are shown as in the app, but read-only.</li>
</ul>
</td>
</tr>
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Presentation.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Presentation.html
index 5cdbe0593e..fd3ae927a3 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Presentation.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Presentation.html
@@ -20,7 +20,9 @@
<h2>Interaction and navigation</h2>
<p>In the floating toolbar (top-right):</p>
<ul>
- <li>Edit button to go to the corresponding note of the current slide.</li>
+ <li>Edit button to go to the corresponding note of the current slide. A <a
+ href="#root/_help_CoFPLs3dRlXc">read-only</a> presentation doesn't show
+ it.</li>
<li>Press Overview button (or the <kbd>O</kbd> key) to show a birds-eye view
of the slides. Press the button again to disable it.</li>
<li>Press the “Start presentation” button to show the presentation in full-screen.</li>
diff --git a/docs/User Guide/User Guide/Advanced Usage/Sharing.md b/docs/User Guide/User Guide/Advanced Usage/Sharing.md
index c4488b82fd..0f6ab0ef36 100644
--- a/docs/User Guide/User Guide/Advanced Usage/Sharing.md
+++ b/docs/User Guide/User Guide/Advanced Usage/Sharing.md
@@ -65,7 +65,7 @@ Trilium allows you to share selected notes as **publicly accessible** read-only
<tr>
<th><a class="reference-link" href="../Collections.md">Collections</a></th>
<td><ul><li>The child notes are shown as cards, or as a list when the view type of the collection is <em>List</em>. Each shows its icon and the start of its text (or its <code>#shareDescription</code>), or, for a child note without text, links to its own first child notes.</li></ul></td>
- <td><ul><li>The calendar, table, board, geo map and dashboard view types are shown as in the app, but read-only. The presentation view type is not supported, and its child notes are shown as cards instead.</li></ul></td>
+ <td><ul><li>The calendar, table, board, geo map, dashboard and presentation view types are shown as in the app, but read-only.</li></ul></td>
</tr>
<tr>
<th><a class="reference-link" href="../Note%20Types/Mermaid%20Diagrams.md">Mermaid Diagrams</a></th>
diff --git a/docs/User Guide/User Guide/Collections/Presentation.md b/docs/User Guide/User Guide/Collections/Presentation.md
index 8adf90bbb6..1bac4d1190 100644
--- a/docs/User Guide/User Guide/Collections/Presentation.md
+++ b/docs/User Guide/User Guide/Collections/Presentation.md
@@ -18,7 +18,7 @@ Right click on an existing note in the <a class="reference-link" href="../Basic
In the floating toolbar (top-right):
-* Edit button to go to the corresponding note of the current slide.
+* Edit button to go to the corresponding note of the current slide. A [read-only](../Basic%20Concepts%20and%20Features/Notes/Read-Only%20Notes.md) presentation doesn't show it.
* Press Overview button (or the <kbd>O</kbd> key) to show a birds-eye view of the slides. Press the button again to disable it.
* Press the “Start presentation” button to show the presentation in full-screen.
diff --git a/packages/trilium-core/src/share/content_renderer.ts b/packages/trilium-core/src/share/content_renderer.ts
index debd653ecf..dcb686d1b2 100644
--- a/packages/trilium-core/src/share/content_renderer.ts
+++ b/packages/trilium-core/src/share/content_renderer.ts
@@ -964,7 +964,7 @@ function hostInAppView(result: Result, note: SNote, container: string) {
}
/** The view types of the collections the share theme shows with the app's own view. */
-const HOSTED_VIEW_TYPES = new Set([ "board", "calendar", "dashboard", "geoMap", "table" ]);
+const HOSTED_VIEW_TYPES = new Set([ "board", "calendar", "dashboard", "geoMap", "presentation", "table" ]);
/**
* The options the app's views read to draw a note as the app does, which a shared page receives. Only