From 59e0857bb5b40e48cc27744a73a582f80cb390a9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 17 Jun 2025 17:32:28 +0300 Subject: [PATCH] feat(text-snippets): add default icon for templates --- apps/client/src/types-assets.d.ts | 5 +++++ apps/client/src/widgets/type_widgets/ckeditor/snippets.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/client/src/types-assets.d.ts b/apps/client/src/types-assets.d.ts index 010ec6b44..e80532517 100644 --- a/apps/client/src/types-assets.d.ts +++ b/apps/client/src/types-assets.d.ts @@ -8,4 +8,9 @@ declare module "*?url" { export default path; } +declare module "*?raw" { + var content: string; + export default content; +} + declare module "boxicons/css/boxicons.min.css" { } diff --git a/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts b/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts index 2c0870c60..74cf2b0fd 100644 --- a/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts +++ b/apps/client/src/widgets/type_widgets/ckeditor/snippets.ts @@ -4,6 +4,7 @@ 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"; interface TemplateData { title: string; @@ -30,7 +31,8 @@ export default async function getTemplates() { definitions.push({ title: snippet.title, - data: () => templateCache.get(snippet.noteId)?.content ?? "" + data: () => templateCache.get(snippet.noteId)?.content ?? "", + icon: TemplateIcon }) } return definitions;