UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

31 lines (30 loc) 1.31 kB
import { type TypeTag } from '../slice'; import { SliceBehavior } from './SliceBehavior'; import type { PeritextMlElement } from '../block/types'; import type { JsonMlElement } from 'very-small-parser/lib/html/json-ml/types'; import type { ToHtmlConverter } from './types'; import type { Printable } from 'tree-dump'; /** * Slice registry contains a record of possible inline an block formatting * annotations. Each entry in the registry is a {@link SliceBehavior} that * specifies the behavior, tag, and other properties of the slice. * * @todo Consider moving the registry under the `/transfer` directory. Or maybe * `/slices` directory. */ export declare class SliceRegistry implements Printable { /** * Creates a new slice registry with common tag registered. */ static readonly withCommon: () => SliceRegistry; private map; private _fromHtml; clear(): void; add(entry: SliceBehavior<any, any, any>): void; get(tag: TypeTag): SliceBehavior | undefined; isContainer(tag: TypeTag): boolean; toHtml(el: PeritextMlElement): ReturnType<ToHtmlConverter<any>> | undefined; fromHtml(el: JsonMlElement): PeritextMlElement | undefined; /** ----------------------------------------------------- {@link Printable} */ toString(tab?: string): string; }