mirror of
https://github.com/zadam/trilium.git
synced 2025-12-30 03:04:29 +01:00
fix(icon_packs): use right name for boxicons for compatibility
This commit is contained in:
parent
9f6c07f5cc
commit
61e96f91d0
@ -65,7 +65,7 @@ function index(req: Request, res: Response) {
|
||||
iconPackCss: iconPacks
|
||||
.map(p => generateCss(p, p.builtin
|
||||
? `${assetPath}/fonts/${p.fontAttachmentId}.${MIME_TO_EXTENSION_MAPPINGS[p.fontMime]}`
|
||||
: `api/notes/download/${p.manifestNoteId}`))
|
||||
: `api/attachments/download/${p.fontAttachmentId}`))
|
||||
.filter(Boolean)
|
||||
.join("\n\n"),
|
||||
iconRegistry: generateIconRegistry(iconPacks)
|
||||
|
||||
@ -128,23 +128,24 @@ export function determineBestFontAttachment(iconPackNote: BNote) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function generateCss({ manifest, fontMime }: ProcessedIconPack, fontUrl: string) {
|
||||
export function generateCss({ manifest, fontMime, builtin, fontAttachmentId }: ProcessedIconPack, fontUrl: string) {
|
||||
try {
|
||||
const iconDeclarations: string[] = [];
|
||||
for (const [ key, mapping ] of Object.entries(manifest.icons)) {
|
||||
iconDeclarations.push(`.${manifest.prefix}.${key}::before { content: '\\${mapping.glyph.charCodeAt(0).toString(16)}'; }`);
|
||||
}
|
||||
|
||||
const fontFamily = builtin ? fontAttachmentId : `trilium-icon-pack-${manifest.prefix}`;
|
||||
return `\
|
||||
@font-face {
|
||||
font-family: 'trilium-icon-pack-${manifest.prefix}';
|
||||
font-family: '${fontFamily}';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
src: url('${fontUrl}') format('${MIME_TO_CSS_FORMAT_MAPPINGS[fontMime]}');
|
||||
}
|
||||
|
||||
.${manifest.prefix} {
|
||||
font-family: 'trilium-icon-pack-${manifest.prefix}' !important;
|
||||
font-family: '${fontFamily}' !important;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user