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
feat(text_snippets): display actual note icon
Elian Dorand2761abd042f
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex a8a130341d..b2604614c5 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -982,6 +982,11 @@ div[data-notify="container"] {font-family: var(--monospace-font-family);}+svg.ck-icon .note-icon {+ color: var(--main-text-color);+ font-size: 20px;+}+.ck-content {--ck-content-font-family: var(--detail-font-family);--ck-content-font-size: 1.1em;diff --git a/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts b/apps/client/src/widgets/type_widgets/ckeditor/snippets.tsindex 7c29e58cc7..86dc8b0773 100644--- a/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts+++ b/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts@@ -4,7 +4,6 @@ import type LoadResults from "../../../services/load_results.js";import search from "../../../services/search.js";import type { TemplateDefinition } from "@triliumnext/ckeditor5";import appContext from "../../../components/app_context.js";-import TemplateIcon from "@ckeditor/ckeditor5-icons/theme/icons/template.svg?raw";import type FNote from "../../../entities/fnote.js";interface TemplateData {@@ -31,7 +30,7 @@ export default async function getTemplates() {definitions.push({title: snippet.title,data: () => templateCache.get(snippet.noteId)?.content ?? "",- icon: TemplateIcon,+ icon: buildIcon(snippet),description});}@@ -49,6 +48,15 @@ async function invalidateCacheFor(snippet: FNote) {return data;}+function buildIcon(snippet: FNote) {+ return /*xml*/`\+<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">+ <foreignObject x="0" y="0" width="20" height="20">+ <span class="note-icon ${snippet.getIcon()}" xmlns="http://www.w3.org/1999/xhtml"></span>+ </foreignObject>+</svg>`+}+function handleFullReload() {console.warn("Full text editor reload needed");appContext.triggerCommand("reloadTextEditor");