UNPKG

@atlaskit/editor-plugin-user-preferences

Version:

UserPreferences plugin for @atlaskit/editor-core

23 lines (22 loc) 1.3 kB
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin'; import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { ResolvedUserPreferences } from '@atlaskit/editor-common/user-preferences'; import { PluginKey } from '@atlaskit/editor-prosemirror/state'; import type { UserPreferencesPluginOptions, UserPreferencesPlugin } from '../userPreferencesPluginType'; /** * Given the current overrides and an override action `{ key, value }`, returns * the new overrides object: * - If `value` is `null` or `undefined`, the key is removed from overrides. * - Otherwise, the key is set to `value` in overrides. */ export declare const applyOverride: (currentOverrides: Partial<ResolvedUserPreferences>, override: { key: keyof ResolvedUserPreferences; value: ResolvedUserPreferences[keyof ResolvedUserPreferences] | null | undefined; }) => Partial<ResolvedUserPreferences>; export declare const userPreferencesPluginKey: PluginKey; type UserPreferencesPluginState = { overrides: Partial<ResolvedUserPreferences>; preferences: ResolvedUserPreferences; }; export declare const createPlugin: (pluginOptions: UserPreferencesPluginOptions, _api: ExtractInjectionAPI<UserPreferencesPlugin> | undefined) => SafePlugin<UserPreferencesPluginState>; export {};