Massively simplify and improve font input component

This commit is contained in:
Henry Jameson 2024-06-27 00:34:25 +03:00
commit 925fd863fe
4 changed files with 99 additions and 154 deletions

View file

@ -108,7 +108,6 @@ const interfaceMod = {
state.lastTimeline = value
},
setFontsList (state, value) {
console.log(value)
state.localFonts = new Set(value.map(font => font.family))
}
},
@ -184,10 +183,16 @@ const interfaceMod = {
commit('setLayoutType', wideLayout ? 'wide' : normalOrMobile)
}
},
queryLocalFonts ({ commit, dispatch }) {
queryLocalFonts ({ commit, dispatch, state }) {
if (state.localFonts !== null) return
commit('setFontsList', [])
if (!state.browserSupport.localFonts) {
return
}
window
.queryLocalFonts()
.then((fonts) => {
console.log(fonts)
commit('setFontsList', fonts)
})
.catch((e) => {