mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
* feat(plugins): let plugins contribute web fonts to the font pickers Plugins declare font families under contributes.fonts (WOFF/WOFF2 only). Install checks each file's signature against its extension and caps file size, family count and plugin total; main never parses a font. Files are served over the plugin image scheme only while the plugin is enabled, typed and nosniff. The renderer registers each family under a name that carries the plugin key, so a plugin font cannot shadow an installed or built-in font, and it applies only once the user picks it. Disabling or uninstalling removes the faces; uninstalling also resets font settings that named them. Refs #38607 * fix(plugins): harden plugin fonts and re-measure editors when they load - Refuse WOFF/WOFF2-wrapped font collections by checking the flavor bytes. - Check dev folders' font files at discovery, not only at install. - Re-check family, weight and style from the plugin list in the renderer. - Track loaded families (case-insensitively) from document font loads, so the code editor re-measures and terminals, previews, the SSH terminal and the dashboard popout re-apply only when their own font changes. - Register plugin fonts in the dashboard popout window. - Give dev-folder font URLs their change count so edits reload. - Keep monospace fallbacks unless the chosen family is exactly that font. * fix(terminal): keep every fallback only for plugin font families System font choices keep their existing fallback list unchanged. * fix(plugins): leave the dashboard popout's plugin list alone; add the font row string Registering fonts there started the plugin auto-update watcher in a window with no toaster, which could consume update notices. Adds the new contribution-row string to the English catalog and the fonts list to the RPC test manifest.
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import type { GlobalSettings } from './global-settings-types'
|
|
import { DEFAULT_APP_FONT_FAMILY } from './constants'
|
|
import { isPluginFontFamilyOf } from './plugins/contributions/plugin-font-contribution'
|
|
import { defaultTerminalFontFamily } from './terminal/appearance/terminal-platform-defaults'
|
|
|
|
/** Font choices that named a removed plugin's family go back to their defaults. */
|
|
export function pluginFontSettingsAfterRemoval(
|
|
settings: Pick<
|
|
GlobalSettings,
|
|
'appFontFamily' | 'terminalFontFamily' | 'editorFontFamily' | 'nativeChatAppearance'
|
|
>,
|
|
pluginKey: string
|
|
): Partial<GlobalSettings> {
|
|
const update: Partial<GlobalSettings> = {}
|
|
if (isPluginFontFamilyOf(settings.appFontFamily, pluginKey)) {
|
|
update.appFontFamily = DEFAULT_APP_FONT_FAMILY
|
|
}
|
|
if (isPluginFontFamilyOf(settings.terminalFontFamily, pluginKey)) {
|
|
update.terminalFontFamily = defaultTerminalFontFamily()
|
|
}
|
|
if (isPluginFontFamilyOf(settings.editorFontFamily, pluginKey)) {
|
|
update.editorFontFamily = ''
|
|
}
|
|
const chat = settings.nativeChatAppearance
|
|
if (chat && isPluginFontFamilyOf(chat.fontFamily, pluginKey)) {
|
|
const { fontFamily: _removed, ...rest } = chat
|
|
update.nativeChatAppearance = rest
|
|
}
|
|
return update
|
|
}
|