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
client/icon pack/preview: enable previews for disabled icon packs
Adorian Doran6c6bf4ce6e07
diff --git a/apps/client/src/entities/fnote.ts b/apps/client/src/entities/fnote.tsindex 9244233e52..5e05617846 100644--- a/apps/client/src/entities/fnote.ts+++ b/apps/client/src/entities/fnote.ts@@ -1076,8 +1076,9 @@ export default class FNote {isIconPack() {// Icon-pack manifests exist both as JSON `code` notes (created manually per the docs) and as- // `file` notes (produced by the icon-pack builder and shipped in distributable zips).- return (this.type === "code" || this.type === "file") && this.mime === "application/json" && this.hasLabel("iconPack");+ // `file` notes (produced by the icon-pack builder and shipped in distributable zips). Disabled+ // packs (#disabled:iconPack, e.g. from a safe import) still preview so the user can inspect them.+ return (this.type === "code" || this.type === "file") && this.mime === "application/json" && this.hasLabelOrDisabled("iconPack");}isTriliumScript() {diff --git a/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx b/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsxindex e577167461..1c75543dd2 100644--- a/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx+++ b/apps/client/src/widgets/type_widgets/icon_pack/IconPackPreview.tsx@@ -41,7 +41,9 @@ interface IconPackPreviewProps {* highlight and no tooltips.*/export function IconPackPreview({ note, content, interactive = true }: IconPackPreviewProps) {- const [ prefix ] = useNoteLabel(note, "iconPack");+ // Fall back to the disabled label so disabled packs (#disabled:iconPack) still show their class in tooltips.+ const [ enabledPrefix ] = useNoteLabel(note, "iconPack");+ const prefix = enabledPrefix ?? note.getLabelValue("disabled:iconPack");// The user isn't meant to see the preview update on every keystroke — it lags a beat behind.const debounced = useDebouncedValue(content, PREVIEW_DEBOUNCE_MS);const font = useIconPackFont(note);