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
fix(client/lightweight): note content not rendering
Elian Doran3d1c93e58c19
diff --git a/apps/client/src/widgets/type_widgets/text/config.ts b/apps/client/src/widgets/type_widgets/text/config.tsindex 4457059273..2e61c39529 100644--- a/apps/client/src/widgets/type_widgets/text/config.ts+++ b/apps/client/src/widgets/type_widgets/text/config.ts@@ -134,11 +134,12 @@ export async function buildConfig(opts: BuildEditorOptions): Promise<EditorConfidefaultProtocol: "https://",allowedProtocols: ALLOWED_PROTOCOLS},- emoji: {- definitionsUrl: window.glob.isDev- ? new URL(import.meta.url).origin + emojiDefinitionsUrl- : emojiDefinitionsUrl- },+ // TODO: Disabled for now+ // emoji: {+ // definitionsUrl: window.glob.isDev+ // ? new URL(import.meta.url).origin + emojiDefinitionsUrl+ // : emojiDefinitionsUrl+ // },syntaxHighlighting: {loadHighlightJs: async () => {await ensureMimeTypesForHighlighting();diff --git a/apps/client/src/widgets/type_widgets/text/snippets.ts b/apps/client/src/widgets/type_widgets/text/snippets.tsindex 4a1479c3d3..a791dd75b4 100644--- a/apps/client/src/widgets/type_widgets/text/snippets.ts+++ b/apps/client/src/widgets/type_widgets/text/snippets.ts@@ -3,7 +3,6 @@ import froca from "../../../services/froca.js";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 type FNote from "../../../entities/fnote.js";interface TemplateData {@@ -21,20 +20,25 @@ const debouncedHandleContentUpdate = debounce(handleContentUpdate, 1000);* @returns the list of templates.*/export default async function getTemplates() {- // Build the definitions and populate the cache.- const snippets = await search.searchForNotes("#textSnippet");- const definitions: TemplateDefinition[] = [];- for (const snippet of snippets) {- const { description } = await invalidateCacheFor(snippet);+ try {+ // Build the definitions and populate the cache.+ const snippets = await search.searchForNotes("#textSnippet");+ const definitions: TemplateDefinition[] = [];+ for (const snippet of snippets) {+ const { description } = await invalidateCacheFor(snippet);- definitions.push({- title: snippet.title,- data: () => templateCache.get(snippet.noteId)?.content ?? "",- icon: buildIcon(snippet),- description- });+ definitions.push({+ title: snippet.title,+ data: () => templateCache.get(snippet.noteId)?.content ?? "",+ icon: buildIcon(snippet),+ description+ });+ }+ return definitions;+ } catch (e) {+ logError("Error while building text snippet templates: ", e);+ return [];}- return definitions;}async function invalidateCacheFor(snippet: FNote) {