UNPKG

@platejs/caption

Version:

Primitive components for caption.

45 lines (41 loc) 1.63 kB
import * as platejs from 'platejs'; import { PluginConfig, Path, OverrideEditor } from 'platejs'; type CaptionConfig = PluginConfig<'caption', { /** When defined, focus end of caption textarea with the same path. */ focusEndPath: Path | null; /** When defined, focus start of caption textarea with the same path. */ focusStartPath: Path | null; query: { /** Plugin keys to enable caption. */ allow: string[]; }; visibleId: string | null; }, {}, {}, { isVisible?: (elementId: string) => boolean; }>; /** Enables support for caption. */ declare const BaseCaptionPlugin: platejs.SlatePlugin<PluginConfig<"caption", { /** When defined, focus end of caption textarea with the same path. */ focusEndPath: Path | null; /** When defined, focus start of caption textarea with the same path. */ focusStartPath: Path | null; query: { /** Plugin keys to enable caption. */ allow: string[]; }; visibleId: string | null; }, {}, {}, { isVisible?: (elementId: string) => boolean; }>>; /** TODO: tests https://github.com/udecode/editor-protocol/issues/79 */ /** * Selection table: * * - If anchor is in table, focus in a block before: set focus to start of table * - If anchor is in table, focus in a block after: set focus to end of table * - If focus is in table, anchor in a block before: set focus to end of table * - If focus is in table, anchor in a block after: set focus to the point before * start of table */ declare const withCaption: OverrideEditor<CaptionConfig>; export { BaseCaptionPlugin, type CaptionConfig, withCaption };