fix(icon-pack): non-BMP icons not rendering
Some checks are pending
Checks / main (push) Waiting to run

This commit is contained in:
Elian Doran 2025-12-28 17:33:12 +02:00
parent 035a311e4d
commit 46e5090445
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -7,14 +7,14 @@ export function extractClassNamesFromCss(css: string, prefix: string): IconPackM
while ((match = regex.exec(css)) !== null) {
let name = match[1];
if (prefix && name.startsWith(prefix + "-")) {
if (prefix && name.startsWith(`${prefix}-`)) {
name = name.substring(prefix.length + 1);
}
icons[match[1]] = {
glyph: String.fromCharCode(parseInt(match[2], 16)),
glyph: String.fromCodePoint(parseInt(match[2], 16)),
terms: [ name ]
}
};
}
return icons;
}

View File

@ -157,7 +157,7 @@ export function generateCss({ manifest, fontMime, builtin, fontAttachmentId, pre
try {
const iconDeclarations: string[] = [];
for (const [ key, mapping ] of Object.entries(manifest.icons)) {
iconDeclarations.push(`.${prefix}.${key}::before { content: '\\${mapping.glyph.charCodeAt(0).toString(16)}'; }`);
iconDeclarations.push(`.${prefix}.${key}::before { content: "${mapping.glyph}"; }`);
}
const fontFamily = builtin ? fontAttachmentId : `trilium-icon-pack-${prefix}`;