Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(collection/presentation): address requested changes
Elian Doran5d8ca1ecf7ba
diff --git a/apps/client/src/components/note_context.ts b/apps/client/src/components/note_context.tsindex 4b77e49659..79d1e148ba 100644--- a/apps/client/src/components/note_context.ts+++ b/apps/client/src/components/note_context.ts@@ -439,7 +439,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">}export function openInCurrentNoteContext(evt: MouseEvent | JQuery.ClickEvent | JQuery.MouseDownEvent | React.PointerEvent<HTMLCanvasElement> | null, notePath: string, viewScope?: ViewScope) {- const ntxId = $(evt?.target as any)+ const ntxId = $(evt?.target as Element).closest("[data-ntx-id]").attr("data-ntx-id");diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsxindex 6c8e530ffe..1d9896d35f 100644--- a/apps/client/src/widgets/collections/presentation/index.tsx+++ b/apps/client/src/widgets/collections/presentation/index.tsx@@ -119,11 +119,10 @@ function ButtonOverlay({ containerRef, api }: { containerRef: RefObject<HTMLDivEfunction Presentation({ presentation, setApi } : { presentation: PresentationModel, setApi: (api: Reveal.Api | undefined) => void }) {const containerRef = useRef<HTMLDivElement>(null);- const apiRef = useRef<Reveal.Api>(null);- const isFirstRenderRef = useRef(true);+ const [revealApi, setRevealApi] = useState<Reveal.Api>();useEffect(() => {- if (apiRef.current || !containerRef.current) return;+ if (!containerRef.current) return;const api = new Reveal(containerRef.current, {transition: "slide",@@ -138,23 +137,20 @@ function Presentation({ presentation, setApi } : { presentation: PresentationMod},});api.initialize().then(() => {- apiRef.current = api;+ setRevealApi(revealApi);setApi(api);});return () => {api.destroy();- apiRef.current = null;+ setRevealApi(undefined);setApi(undefined);}- }, [ ]);+ }, []);useEffect(() => {- if (!isFirstRenderRef.current) {- apiRef.current?.sync();- }- isFirstRenderRef.current = false;- }, [ presentation ]);+ revealApi?.sync();+ }, [ presentation, revealApi ]);return (<div ref={containerRef} className="reveal">diff --git a/apps/client/src/widgets/collections/presentation/themes.ts b/apps/client/src/widgets/collections/presentation/themes.tsindex a5422cef54..da706a658b 100644--- a/apps/client/src/widgets/collections/presentation/themes.ts+++ b/apps/client/src/widgets/collections/presentation/themes.ts@@ -1,11 +1,6 @@export const DEFAULT_THEME = "white";-interface ThemeDefinition {- name: string;- loadTheme: () => Promise<typeof import("*.css?raw")>;-}--const themes: Record<string, ThemeDefinition> = {+const themes = {black: {name: "Black",loadTheme: () => import("reveal.js/dist/theme/black.css?raw")diff --git a/apps/server/src/services/hidden_subtree.ts b/apps/server/src/services/hidden_subtree.tsindex 5472518182..1013d16fce 100644--- a/apps/server/src/services/hidden_subtree.ts+++ b/apps/server/src/services/hidden_subtree.ts@@ -359,7 +359,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtreebranch = note.getParentBranches().find((branch) => branch.parentNoteId === parentNoteId);if (item.content && note.getContent() !== item.content) {- console.log(`Updating content of ${item.id}.`);+ log.info(`Updating content of ${item.id}.`);note.setContent(item.content);}@@ -369,7 +369,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree// If the note exists but doesn't have a branch in the expected parent,// create the missing branch to ensure it's in the correct locationif (!branch) {- console.log("Creating missing branch for note", item.id, "under parent", parentNoteId);+ log.info(`Creating missing branch for note ${item.id} under parent ${parentNoteId}.`);branch = new BBranch({noteId: item.id,parentNoteId: parentNoteId,@@ -473,7 +473,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree}).save();} else if (attr.name === "docName" || (existingAttribute.noteId.startsWith("_help") && attr.name === "iconClass")) {if (existingAttribute.value !== attr.value) {- console.log(`Updating attribute ${attrId} from "${existingAttribute.value}" to "${attr.value}"`);+ log.info(`Updating attribute ${attrId} from "${existingAttribute.value}" to "${attr.value}"`);existingAttribute.value = attr.value ?? "";existingAttribute.save();}