mirror of
https://github.com/zadam/trilium.git
synced 2025-12-29 10:44:25 +01:00
chore(icon_packs): address requested changes
This commit is contained in:
parent
e730378b27
commit
02d42dc5ff
@ -2,6 +2,7 @@ import "./note_icon.css";
|
||||
|
||||
import { IconRegistry } from "@triliumnext/commons";
|
||||
import { Dropdown as BootstrapDropdown } from "bootstrap";
|
||||
import clsx from "clsx";
|
||||
import { t } from "i18next";
|
||||
import { RefObject } from "preact";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
@ -164,9 +165,9 @@ function NoteIconList({ note, dropdownRef }: {
|
||||
onClick={(e) => {
|
||||
// Make sure we are not clicking on something else than a button.
|
||||
const clickedTarget = e.target as HTMLElement;
|
||||
if (clickedTarget.tagName !== "SPAN" || clickedTarget.classList.length !== 2) return;
|
||||
if (!clickedTarget.classList.contains("tn-icon")) return;
|
||||
|
||||
const iconClass = Array.from(clickedTarget.classList.values()).join(" ");
|
||||
const iconClass = Array.from(clickedTarget.classList.values()).filter(c => c !== "tn-icon").join(" ");
|
||||
if (note) {
|
||||
const attributeToSet = note.hasOwnedLabel("workspace") ? "workspaceIconClass" : "iconClass";
|
||||
attributes.setLabel(note.noteId, attributeToSet, iconClass);
|
||||
@ -178,7 +179,7 @@ function NoteIconList({ note, dropdownRef }: {
|
||||
(iconData?.icons ?? []).map(({ id, terms, iconPack }) => (
|
||||
<span
|
||||
key={id}
|
||||
class={id}
|
||||
class={clsx(id, "tn-icon")}
|
||||
title={t("note_icon.icon_tooltip", { name: terms?.[0] ?? id, iconPack })}
|
||||
/>
|
||||
))
|
||||
|
||||
@ -10,6 +10,7 @@ import type BNote from "../../../becca/entities/bnote.js";
|
||||
import { getClientDir, getShareThemeAssetDir } from "../../../routes/assets";
|
||||
import { getDefaultTemplatePath, readTemplate, renderNoteForExport } from "../../../share/content_renderer";
|
||||
import { getIconPacks, MIME_TO_EXTENSION_MAPPINGS, ProcessedIconPack } from "../../icon_packs";
|
||||
import log from "../../log";
|
||||
import NoteMeta, { NoteMetaFile } from "../../meta/note_meta";
|
||||
import { RESOURCE_DIR } from "../../resource_dir";
|
||||
import { getResourceDir, isDev } from "../../utils";
|
||||
@ -152,7 +153,10 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
||||
fontData = becca.getAttachment(iconPack.fontAttachmentId)?.getContent();
|
||||
}
|
||||
|
||||
if (!fontData) continue;
|
||||
if (!fontData) {
|
||||
log.error(`Failed to find font data for icon pack ${iconPack.prefix} with attachment ID ${iconPack.fontAttachmentId}`);
|
||||
continue;
|
||||
};
|
||||
const fontFileName = `assets/icon-pack-${iconPack.prefix.toLowerCase()}.${extension}`;
|
||||
this.archive.append(fontData, { name: fontFileName });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user