mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
feat(electron): add font list handlers
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
"dependencies": {
|
||||
"async-call-rpc": "^6.4.2",
|
||||
"electron-updater": "^6.2.1",
|
||||
"font-list": "^1.5.1",
|
||||
"link-preview-js": "^3.0.5",
|
||||
"yjs": "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { getFonts } from 'font-list';
|
||||
|
||||
import type { NamespaceHandlers } from '../type';
|
||||
|
||||
export const fontListHandlers = {
|
||||
getSystemFonts: async () => {
|
||||
try {
|
||||
const fonts = await getFonts();
|
||||
return fonts;
|
||||
} catch (error) {
|
||||
console.error('Failed to get system fonts:', error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
} satisfies NamespaceHandlers;
|
||||
@@ -0,0 +1 @@
|
||||
export * from './handlers';
|
||||
@@ -5,6 +5,7 @@ import { clipboardHandlers } from './clipboard';
|
||||
import { configStorageHandlers } from './config-storage';
|
||||
import { exportHandlers } from './export';
|
||||
import { findInPageHandlers } from './find-in-page';
|
||||
import { fontListHandlers } from './font-list';
|
||||
import { getLogFilePath, logger, revealLogFile } from './logger';
|
||||
import { sharedStorageHandlers } from './shared-storage';
|
||||
import { uiHandlers } from './ui/handlers';
|
||||
@@ -29,6 +30,7 @@ export const allHandlers = {
|
||||
configStorage: configStorageHandlers,
|
||||
findInPage: findInPageHandlers,
|
||||
sharedStorage: sharedStorageHandlers,
|
||||
fontList: fontListHandlers,
|
||||
};
|
||||
|
||||
export const registerHandlers = () => {
|
||||
|
||||
@@ -558,6 +558,7 @@ __metadata:
|
||||
electron-updater: "npm:^6.2.1"
|
||||
electron-window-state: "npm:^5.0.3"
|
||||
esbuild: "npm:^0.23.0"
|
||||
font-list: "npm:^1.5.1"
|
||||
fs-extra: "npm:^11.2.0"
|
||||
glob: "npm:^11.0.0"
|
||||
jotai: "npm:^2.8.0"
|
||||
@@ -21797,6 +21798,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"font-list@npm:^1.5.1":
|
||||
version: 1.5.1
|
||||
resolution: "font-list@npm:1.5.1"
|
||||
checksum: 10/e1500017b63e0a554348143f69d64d4f61dba8bd002456e161840e79454b67feea4bbd33b5fb1648f6f8d0415307616da14751f9289ceaabcbcd62414e0f3ff8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"foreground-child@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "foreground-child@npm:2.0.0"
|
||||
|
||||
Reference in New Issue
Block a user