Skip to content

Build your personal knowledge base with Trilium Notes

feat(mermaid): show switcher only when note is empty

Elian Doran92f8459f286e
diff --git a/apps/client/src/widgets/layout/NoteContentSwitcher.tsx b/apps/client/src/widgets/layout/NoteContentSwitcher.tsx
index 37cd5df9b8..5465a174dd 100644
--- a/apps/client/src/widgets/layout/NoteContentSwitcher.tsx
+++ b/apps/client/src/widgets/layout/NoteContentSwitcher.tsx
@@ -3,6 +3,7 @@ import "./NoteContentSwitcher.css";
import FNote from "../../entities/fnote";
import server from "../../services/server";
import { Badge } from "../react/Badge";
+import { useNoteSavedData } from "../react/hooks";
export interface NoteContentTemplate {
name: string;
@@ -15,7 +16,9 @@ interface NoteContentSwitcherProps {
}
export default function NoteContentSwitcher({ note, templates }: NoteContentSwitcherProps) {
- return (
+ const blob = useNoteSavedData(note?.noteId);
+
+ return (blob?.length === 0 &&
<div className="note-content-switcher">
{templates.map(sample => (
<Badge