Skip to content

@astrolabe/editor-tiptap

<astl-editor>, the authoring kit around a TipTap surface, and defineEditor. This entry never imports TipTap: the surface is a dynamic import, made only when no other editor is plugged in.

  • LitElement
new AstlEditor(): AstlEditor;

AstlEditor

LitElement.constructor
Property Type Description
adapter EditorAdapter | null The editor the kit drives. Default: TipTap, on a surface this element creates when it first renders without an adapter and without a slot="surface" child. Setting another adapter swaps the editor; null brings the TipTap surface back (with its document), unless a slot="surface" child is there.
components readonly string[] | null The component types authors can use (space-separated tags in the attribute); null: every registered type. Others stay in the document, reported as unknown elements.
locale string | null UI locale (en, pl); default: the lang attribute, else the browser languages, else en.
theme ThemeSetting | null light, dark, hc or auto (the system's light or dark), passed on as data-theme.
get authoring(): Authoring;

The kit's logic, built from the registrations, the UI locale and components.

Authoring

get value(): string;

The source HTML (<astl-doc>): the adapter's, or a value waiting for it, or an empty document.

string

set value(source): void;
Parameter Type
source string

void

The same option names, types and meanings as createEngine and definePlayer; the editor makes its own secret.

Property Modifier Type Description
catalogs? readonly readonly MessageCatalog[] Extra or replacement message catalogs (e.g. more locales) for describe.
components readonly readonly ComponentDefinition[] -
editors readonly readonly EditorDescriptor[] Insert menu and inspector entries: one per type authors can add.
elements readonly readonly ElementEntry[] Player elements for the preview, eager or lazy.
profile? readonly Partial<NormalisationProfile> Overrides of the default text comparison profile.
registry? readonly CustomElementRegistry Default: the global customElements.
slotKinds? readonly readonly SlotKind<JsonObject>[] Added to the built-in slot kinds (text, number, choice, flag). Same kind twice = error.
styleTemplates? readonly readonly StyleTemplate[] Style templates the hosts' players register, so style-template values can be checked: a name that is not registered, or not allowed at its scope or for its tag, gives the warning STYLE_TEMPLATE_UNKNOWN (the attribute stays in the view). Same name twice = error.
uploadAsset? readonly UploadAsset Stores a picture file and returns its address (it must pass urlPolicy): the picture dialog, pasted and dropped pictures and picture fields use it. Without it, pictures are added by address only.
urlPolicy? readonly UrlPolicy Which URLs stay in sources and views (UrlPolicy). Default isSafeUrl.
function defineEditor(options): void;

Registers components, editor descriptors, preview elements and looks for every <astl-editor>, and defines <astl-editor> and the kit elements (nothing is defined on import). A second call adds to the first; a tag or a look name already registered by another object throws, as two copies would otherwise mix silently.

Parameter Type
options DefineEditorOptions

void