MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / getSystemFonts

Function getSystemFonts

examples/dashboard/src/editor/utils.ts:8–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6}
7
8export const getSystemFonts = async () => {
9 try {
10 // @ts-ignore
11 const availableFonts = await window.queryLocalFonts()
12 return Array.from(new Set(availableFonts.map((font: any) => font.family))).map((font: any) => ({
13 label: font,
14 value: font,
15 }))
16 } catch {
17 console.error('浏览器不支持 queryLocalFonts API')
18 return []
19 }
20}
21
22export const systemFonts = await getSystemFonts()

Callers 1

utils.tsFile · 0.70

Calls 3

mapMethod · 0.45
fromMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected