mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
965 B
31 lines
965 B
1 year ago
|
import { defineNuxtPlugin } from '#imports'
|
||
|
|
||
|
export default defineNuxtPlugin(() => {
|
||
|
// Listen when 'Material Symbols' font is loaded
|
||
|
// and remove 'nc-fonts-not-loaded' class from <html> element
|
||
|
|
||
|
try {
|
||
|
document.documentElement?.classList.add('nc-fonts-not-loaded')
|
||
|
|
||
|
const fontFaces = [...document.fonts.values()]
|
||
|
const materialFont = fontFaces.find((fontFace) => fontFace.family === 'Material Symbols')
|
||
|
|
||
|
if (!materialFont || !materialFont?.loaded) {
|
||
|
document.documentElement?.classList.remove('nc-fonts-not-loaded')
|
||
|
return
|
||
|
}
|
||
|
|
||
|
materialFont?.loaded
|
||
|
.then(function () {
|
||
|
document.documentElement?.classList.remove('nc-fonts-not-loaded')
|
||
|
})
|
||
|
.catch(function (error) {
|
||
|
document.documentElement?.classList.remove('nc-fonts-not-loaded')
|
||
|
console.error(error)
|
||
|
})
|
||
|
} catch (error) {
|
||
|
document.documentElement?.classList.remove('nc-fonts-not-loaded')
|
||
|
console.error(error)
|
||
|
}
|
||
|
})
|