mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 14:44:25 +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
|
iconPackCss: iconPacks
|
||||||
.map(p => generateCss(p, p.builtin
|
.map(p => generateCss(p, p.builtin
|
||||||
? `${assetPath}/fonts/${p.fontAttachmentId}.${MIME_TO_EXTENSION_MAPPINGS[p.fontMime]}`
|
? `${assetPath}/fonts/${p.fontAttachmentId}.${MIME_TO_EXTENSION_MAPPINGS[p.fontMime]}`
|
||||||
: `api/notes/download/${p.manifestNoteId}`))
|
: `api/attachments/download/${p.fontAttachmentId}`))
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join("\n\n"),
|
.join("\n\n"),
|
||||||
iconRegistry: generateIconRegistry(iconPacks)
|
iconRegistry: generateIconRegistry(iconPacks)
|
||||||
|
|||||||
@ -128,23 +128,24 @@ export function determineBestFontAttachment(iconPackNote: BNote) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateCss({ manifest, fontMime }: ProcessedIconPack, fontUrl: string) {
|
export function generateCss({ manifest, fontMime, builtin, fontAttachmentId }: ProcessedIconPack, fontUrl: string) {
|
||||||
try {
|
try {
|
||||||
const iconDeclarations: string[] = [];
|
const iconDeclarations: string[] = [];
|
||||||
for (const [ key, mapping ] of Object.entries(manifest.icons)) {
|
for (const [ key, mapping ] of Object.entries(manifest.icons)) {
|
||||||
iconDeclarations.push(`.${manifest.prefix}.${key}::before { content: '\\${mapping.glyph.charCodeAt(0).toString(16)}'; }`);
|
iconDeclarations.push(`.${manifest.prefix}.${key}::before { content: '\\${mapping.glyph.charCodeAt(0).toString(16)}'; }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fontFamily = builtin ? fontAttachmentId : `trilium-icon-pack-${manifest.prefix}`;
|
||||||
return `\
|
return `\
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'trilium-icon-pack-${manifest.prefix}';
|
font-family: '${fontFamily}';
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
src: url('${fontUrl}') format('${MIME_TO_CSS_FORMAT_MAPPINGS[fontMime]}');
|
src: url('${fontUrl}') format('${MIME_TO_CSS_FORMAT_MAPPINGS[fontMime]}');
|
||||||
}
|
}
|
||||||
|
|
||||||
.${manifest.prefix} {
|
.${manifest.prefix} {
|
||||||
font-family: 'trilium-icon-pack-${manifest.prefix}' !important;
|
font-family: '${fontFamily}' !important;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-variant: normal;
|
font-variant: normal;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user