frontend: keep emoji if fontello is not loaded (for any reason)
Massimo Melina committed
Mar 18, 2022 at 20:05 UTC
0b4c7b68b9af1aef5195dfc5438e7d56c21ed8d2
1 file changed
+4
-3
frontend/src/icons.ts
+4
-3
@@ -25,9 +25,10 @@ const SYS_ICONS = {
25
}
26
27
document.fonts.ready.then(async ()=> {
28
- const fontName = 'fontello'
29
- await document.fonts.load(`9px "${fontName}"`) // force font to be loaded even if we didn't display anything with it yet
30
- state.iconsClass = ' ' // with fontello we don't need an additional class (unlike google material icons), but the empty space will cause reload
28
+ const fontTester = '9px "fontello"'
29
+ await document.fonts.load(fontTester) // force font to be loaded even if we didn't display anything with it yet
30
+ if (document.fonts.check(fontTester))
31
+ state.iconsClass = ' ' // with fontello we don't need an additional class (unlike google material icons), but the empty space will cause reload
32
})
33
34
export const Icon = memo(({ name, alt, className='', ...props }: { name:string, className?:string, alt?:string, style?:any }) => {