Options
All
  • Public
  • Public/Protected
  • All
Menu

Module roosterjs-content-model-types

Index

Interfaces

Type aliases

Type aliases

AddUndoSnapshot

AddUndoSnapshot: (core: EditorCore, canUndoByBackspace: boolean, entityStates?: EntityState[]) => Snapshot | null

Type declaration

    • Add an undo snapshot to current undo snapshot stack

      Parameters

      • core: EditorCore

        The EditorCore object

      • canUndoByBackspace: boolean

        True if this action can be undone when user press Backspace key (aka Auto Complete).

      • Optional entityStates: EntityState[]

        @optional Entity states related to this snapshot. Each entity state will cause an EntityOperation event with operation = EntityOperation.UpdateEntityState when undo/redo to this snapshot

      Returns Snapshot | null

Announce

Announce: (core: EditorCore, announceData: AnnounceData) => void

Type declaration

ApplyMetadata

ApplyMetadata<TMetadata, TFormat>: (metadata: TMetadata | null, format: TFormat, context: ModelToDomContext) => void

Type parameters

Type declaration

    • Function type to apply metadata value into format

      Parameters

      • metadata: TMetadata | null

        The metadata object to apply

      • format: TFormat

        The format object to apply metadata to

      • context: ModelToDomContext

        Content Model to DOM context

      Returns void

ArrayItemType

ArrayItemType<T>: T extends infer U[] ? U : never

A type template to get item type of an array

Type parameters

  • T: any[]

AttachDomEvent

AttachDomEvent: (core: EditorCore, eventMap: Record<string, DOMEventRecord>) => () => void

Type declaration

    • Attach a DOM event to the editor content DIV

      Parameters

      Returns () => void

        • (): void
        • Returns void

BackgroundColorFormat

BackgroundColorFormat: { backgroundColor?: string }

Format of background color

Type declaration

  • Optional backgroundColor?: string

    Background color

BoldFormat

BoldFormat: { fontWeight?: string }

Format of bold

Type declaration

  • Optional fontWeight?: string

    Font weight of the element

BorderBoxFormat

BorderBoxFormat: { useBorderBox?: boolean }

Format of border box

Type declaration

  • Optional useBorderBox?: boolean

    Whether use border-box for this element

BorderFormat

BorderFormat: { borderBottom?: string; borderBottomLeftRadius?: string; borderBottomRightRadius?: string; borderLeft?: string; borderRadius?: string; borderRight?: string; borderTop?: string; borderTopLeftRadius?: string; borderTopRightRadius?: string }

Format of border

Type declaration

  • Optional borderBottom?: string

    Bottom border in format 'width style color'

  • Optional borderBottomLeftRadius?: string

    Radius to be applied in bottom left corner

  • Optional borderBottomRightRadius?: string

    Radius to be applied in bottom right corner

  • Optional borderLeft?: string

    Left border in format 'width style color'

  • Optional borderRadius?: string

    Radius to be applied in all borders corners

  • Optional borderRight?: string

    Right border in format 'width style color'

  • Optional borderTop?: string

    Top border in format 'width style color'

  • Optional borderTopLeftRadius?: string

    Radius to be applied in top left corner

  • Optional borderTopRightRadius?: string

    Radius to be applied in top right corner

BorderOperations

BorderOperations: "allBorders" | "noBorders" | "leftBorders" | "rightBorders" | "topBorders" | "bottomBorders" | "insideBorders" | "outsideBorders"

All Border operations

BoxShadowFormat

BoxShadowFormat: { boxShadow?: string }

Format of box shadow

Type declaration

  • Optional boxShadow?: string

    Box shadow in format "offset-x offset-y blur-radius spread-radius color"

CacheSelection

Represents a selection used for cache

CachedElementHandler

CachedElementHandler: (node: HTMLElement, type: "general" | "entity" | "cache") => HTMLElement | undefined

Type declaration

    • (node: HTMLElement, type: "general" | "entity" | "cache"): HTMLElement | undefined
    • Function type used for cloneModel API to specify how to handle cached element when clone a model

      Parameters

      • node: HTMLElement

        The cached node

      • type: "general" | "entity" | "cache"

        Type of the node, it can be

        • general: DOM element of ContentModelGeneralSegment or ContentModelGeneralBlock
        • entity: Wrapper element in ContentModelEntity
        • cache: Cached node in other model element that supports cache

      Returns HTMLElement | undefined

ColorTransformFunction

ColorTransformFunction: (lightColor: string, baseLValue?: number, colorType?: "text" | "background" | "border", element?: HTMLElement) => string

Type declaration

    • (lightColor: string, baseLValue?: number, colorType?: "text" | "background" | "border", element?: HTMLElement): string
    • A util function type to transform light mode color to dark mode color Default value is to return the original light color

      Parameters

      • lightColor: string

        Source color string in light mode

      • Optional baseLValue: number

        Base value of light used for dark value calculation

      • Optional colorType: "text" | "background" | "border"

        @optional Type of color, can be text, background, or border

      • Optional element: HTMLElement

        @optional Source HTML element of the color

      Returns string

ConflictFormatSolution

ConflictFormatSolution: "remove" | "keepFirst" | "returnMultiple"

Specify how to handle conflicts when retrieving format state remove: removes the conflicting key from the result keepFirst: retains the first value of the conflicting key returnMultiple: sets 'Multiple' as the value if the conflicting value's type is string

ContentModelBlock

A union type of Content Model Block

ContentModelBlockFormat

The format object for a paragraph in Content Model

ContentModelBlockGroup

The union type of Content Model Block Group

ContentModelBlockGroupType

ContentModelBlockGroupType: "Document" | "FormatContainer" | "ListItem" | "TableCell" | "General"

Type of Block Group in Content Model

ContentModelBlockHandler

ContentModelBlockHandler<T>: (doc: Document, parent: Node, model: T, context: ModelToDomContext, refNode: Node | null) => Node | null

Type parameters

Type declaration

    • (doc: Document, parent: Node, model: T, context: ModelToDomContext, refNode: Node | null): Node | null
    • Type of Content Model to DOM handler for block

      Parameters

      • doc: Document

        Target HTML Document object

      • parent: Node

        Parent HTML node to append the new node from the given model

      • model: T

        The Content Model to handle

      • context: ModelToDomContext

        The context object to provide related information

      • refNode: Node | null

        Reference node. This is the next node the new node to be inserted. It is used when write DOM tree onto existing DOM true. If there is no reference node, pass null.

      Returns Node | null

ContentModelBlockType

ContentModelBlockType: "BlockGroup" | "Table" | "Paragraph" | "Entity" | "Divider"

Type of Block in Content Model

ContentModelCodeFormat

ContentModelCodeFormat: FontFamilyFormat & DisplayFormat

The format object for a code element in Content Model

ContentModelDecorator

Union type for segment decorators

ContentModelDividerFormat

ContentModelDividerFormat: ContentModelBlockFormat & DisplayFormat & SizeFormat

The format object for a divider in Content Model

ContentModelEntityFormat

ContentModelEntityFormat: EntityInfoFormat & IdFormat

The format object for an entity in Content Model

ContentModelFormatBase

ContentModelFormatBase<V>: {}

Base type of content model format. All content model format should only have simple value type (string, number, boolean). So that we can use a single level copy ({...object}) to easily clone a format object

Type parameters

  • V: string | number | boolean | undefined | null = string | number | boolean | undefined | null

Type declaration

  • [key: string]: V

ContentModelFormatContainerFormat

Type for FormatContainer

ContentModelFormatter

ContentModelFormatter: (model: ShallowMutableContentModelDocument, context: FormatContentModelContext) => boolean

Type declaration

ContentModelHandler

ContentModelHandler<T>: (doc: Document, parent: Node, model: T, context: ModelToDomContext) => void

Type parameters

Type declaration

    • Type of Content Model to DOM handler

      Parameters

      • doc: Document

        Target HTML Document object

      • parent: Node

        Parent HTML node to append the new node from the given model

      • model: T

        The Content Model to handle

      • context: ModelToDomContext

        The context object to provide related information

      Returns void

ContentModelHandlerMap

Represents a map from content model handler name to its handle type

Type declaration

ContentModelHyperLinkFormat

The format object for a hyperlink in Content Model

ContentModelImageFormat

The format object for an image in Content Model

ContentModelListItemFormat

The format object for a list item in Content Model

ContentModelListItemLevelFormat

The format object for a list level in Content Model

ContentModelSegment

Union type of Content Model Segment

ContentModelSegmentFormat

The format object for a segment in Content Model

ContentModelSegmentHandler

ContentModelSegmentHandler<T>: (doc: Document, parent: Node, model: T, context: ModelToDomContext, segmentNodes: Node[]) => void

Type parameters

Type declaration

    • (doc: Document, parent: Node, model: T, context: ModelToDomContext, segmentNodes: Node[]): void
    • Type of Content Model to DOM handler for block

      Parameters

      • doc: Document

        Target HTML Document object

      • parent: Node

        Parent HTML node to append the new node from the given model

      • model: T

        The Content Model to handle

      • context: ModelToDomContext

        The context object to provide related information

      • segmentNodes: Node[]

        Nodes that created to represent this segment. In most cases there will be one node returned, except

        • For segments with decorators: decorator elements will also be included
        • For inline entity segment, the delimiter SPANs will also be included

      Returns void

ContentModelSegmentType

ContentModelSegmentType: "Text" | "Br" | "Image" | "SelectionMarker" | "General" | "Entity"

Type of Segment in Content Model

ContentModelTableCellFormat

Format of table cell

ContentModelTableFormat

Format of Table

ContentModelWithDataset

ContentModelWithDataset<T>: MutableMark & { dataset: DatasetFormat }

Represents base format of an element that supports dataset and/or metadata

Type parameters

  • T

CreateContentModel

CreateContentModel: (core: EditorCore, option?: DomToModelOptionForCreateModel, selectionOverride?: DOMSelection | "none") => ContentModelDocument

Type declaration

CreateEditorContext

CreateEditorContext: (core: EditorCore, saveIndex: boolean) => EditorContext

Type declaration

    • Create a EditorContext object used by ContentModel API

      Parameters

      • core: EditorCore

        The EditorCore object

      • saveIndex: boolean

        True to allow saving index info into node using domIndexer, otherwise false

      Returns EditorContext

DOMEventHandlerFunction

DOMEventHandlerFunction<E>: (event: E) => void

Type parameters

  • E = Event

Type declaration

    • (event: E): void
    • Handler function type of DOM event

      Parameters

      • event: E

      Returns void

DOMSelection

The union type of 3 selection types

DatasetFormat

DatasetFormat: Record<string, string>

Represents dataset format of Content Model

DefaultImplicitFormatMap

DefaultImplicitFormatMap: Record<string, Readonly<ContentModelSegmentFormat & ContentModelBlockFormat>>

Default implicit format map from tag name (lower case) to segment format

DefaultStyleMap

DefaultStyleMap: {[ key in keyof HTMLElementDeprecatedTagNameMap]: Readonly<Partial<CSSStyleDeclaration>> } & {[ key in keyof HTMLElementTagNameMap]: Readonly<Partial<CSSStyleDeclaration>> } & { center?: Partial<CSSStyleDeclaration>; strike?: Partial<CSSStyleDeclaration> }

A type of Default style map, from tag name string (in upper case) to a static style object

Definition

Definition<T>: T extends any[] ? ArrayDefinition<T> : T extends Record<string, any> ? ObjectDefinition<T> : T extends String ? StringDefinition : T extends Number ? NumberDefinition : T extends Boolean ? BooleanDefinition : never

A combination of all definition types

Type parameters

  • T

DefinitionType

DefinitionType: "boolean" | "number" | "string" | "array" | "object"

Types of definitions, used by Definition type

DeleteResult

DeleteResult: "notDeleted" | "singleChar" | "range" | "nothingToDelete"

Delete selection result

DeleteSelectionStep

DeleteSelectionStep: (context: ValidDeleteSelectionContext) => void

Type declaration

DirectionFormat

DirectionFormat: { direction?: "ltr" | "rtl" }

Format of direction

Type declaration

  • Optional direction?: "ltr" | "rtl"

    Text direction

DisplayFormat

DisplayFormat: { display?: string }

Format of display

Type declaration

  • Optional display?: string

    Display of this element

ElementFormatAppliersPerCategory

ElementFormatAppliersPerCategory: {[ Key in keyof ContentModelFormatMap]: (FormatApplier<ContentModelFormatMap[Key]> | null)[] }

A map from format parser category name to an array of parsers. This is for HTMLElement only

ElementFormatParserPerCategory

ElementFormatParserPerCategory: {[ Key in keyof ContentModelFormatMap]: (FormatParser<ContentModelFormatMap[Key]> | null)[] }

A map from format parser category name to an array of parsers. This is for HTML Element only

ElementProcessor

ElementProcessor<T>: (group: ContentModelBlockGroup, element: T, context: DomToModelContext) => void

Type parameters

  • T: Node

Type declaration

ElementProcessorMap

ElementProcessorMap: {[ key in keyof HTMLElementDeprecatedTagNameMap]: ElementProcessor<HTMLElementDeprecatedTagNameMap[key]> } & {[ key in keyof HTMLElementTagNameMap]: ElementProcessor<HTMLElementTagNameMap[key]> } & { #text: ElementProcessor<Text>; *: ElementProcessor<HTMLElement>; center?: ElementProcessor<HTMLElement>; child: ElementProcessor<ParentNode>; delimiter?: ElementProcessor<Node>; element: ElementProcessor<HTMLElement>; entity: ElementProcessor<HTMLElement>; strike?: ElementProcessor<HTMLElement>; textWithSelection: ElementProcessor<Text> }

A map from element processor name to its processor type

EntityInfoFormat

EntityInfoFormat: { entityType?: string; isFakeEntity?: boolean; isReadonly?: boolean }

Format of entity type

Type declaration

  • Optional entityType?: string

    Type of this entity

  • Optional isFakeEntity?: boolean

    For a readonly DOM element, we also treat it as entity, with isFakeEntity set to true

  • Optional isReadonly?: boolean

    Whether the entity is readonly

EntityLifecycleOperation

EntityLifecycleOperation: "newEntity" | "replaceTemporaryContent" | "snapshotEntityState" | "updateEntityState" | "click"

Define entity lifecycle related operations

EntityOperation

Define possible operations to an entity

EntityRemovalOperation

EntityRemovalOperation: "removeFromStart" | "removeFromEnd" | "overwrite"

Define entity removal related operations

ExperimentalFeature

ExperimentalFeature: "PersistCache" | "LegacyImageSelection" | "HandleEnterKey"

Predefined experiment features By default these features are not enabled. To enable them, pass the feature name into EditorOptions.experimentalFeatures when create editor

ExportContentMode

ExportContentMode: "HTML" | "PlainText" | "PlainTextFast"

The mode parameter type for exportContent API

FloatFormat

FloatFormat: { float?: string }

Format of float

Type declaration

  • Optional float?: string

    Float style

Focus

Focus: (core: EditorCore) => void

Type declaration

    • Focus to editor. If there is a cached selection range, use it as current selection

      Parameters

      Returns void

FontFamilyFormat

FontFamilyFormat: { fontFamily?: string }

Format of font family

Type declaration

  • Optional fontFamily?: string

    Font family

FontSizeFormat

FontSizeFormat: { fontSize?: string }

Format of font size

Type declaration

  • Optional fontSize?: string

    Font size

FormatApplier

FormatApplier<TFormat>: (format: TFormat, element: HTMLElement, context: ModelToDomContext) => void

Type parameters

Type declaration

    • Apply format to the given HTML element

      Parameters

      • format: TFormat

        The format object to apply

      • element: HTMLElement

        The HTML element to apply format to

      • context: ModelToDomContext

        The context object that provide related context information

      Returns void

FormatAppliers

FormatAppliers: {[ Key in FormatKey]: FormatApplier<FormatHandlerTypeMap[Key]> | null }

All format appliers

FormatAppliersPerCategory

FormatAppliersPerCategory: ElementFormatAppliersPerCategory & { text: TextFormatApplier[] }

A map from format parser category name to an array of parsers

FormatContentModel

FormatContentModel: (core: EditorCore, formatter: ContentModelFormatter, options?: FormatContentModelOptions, domToModelOptions?: DomToModelOptionForCreateModel) => void

Type declaration

FormatKey

FormatKey: keyof FormatHandlerTypeMap

Key of all format handler

FormatParser

FormatParser<TFormat>: (format: TFormat, element: HTMLElement, context: DomToModelContext, defaultStyle: Readonly<Partial<CSSStyleDeclaration>>) => void

Type parameters

Type declaration

    • (format: TFormat, element: HTMLElement, context: DomToModelContext, defaultStyle: Readonly<Partial<CSSStyleDeclaration>>): void
    • Parse format from the given HTML element and default style

      Parameters

      • format: TFormat

        The format object to parse into

      • element: HTMLElement

        The HTML element to parse format from

      • context: DomToModelContext

        The context object that provide related context information

      • defaultStyle: Readonly<Partial<CSSStyleDeclaration>>

        Default CSS style of the given HTML element

      Returns void

FormatParsers

FormatParsers: {[ Key in FormatKey]: FormatParser<FormatHandlerTypeMap[Key]> | null }

All format parsers

FormatParsersPerCategory

FormatParsersPerCategory: ElementFormatParserPerCategory & { text: TextFormatParser[] }

A map from format parser category name to an array of parsers

GenericPluginState

GenericPluginState<Key>: {[ P in StatePluginKeys<Key>]: TypeOfStatePlugin<P> }

A type map from name of plugin with state to its plugin type

Type parameters

GetDOMSelection

GetDOMSelection: (core: EditorCore) => DOMSelection | null

Type declaration

GetVisibleViewport

GetVisibleViewport: (core: EditorCore) => Rect | null

Type declaration

    • Retrieves the rect of the visible viewport of the editor.

      Parameters

      Returns Rect | null

HtmlAlignFormat

HtmlAlignFormat: { htmlAlign?: "start" | "center" | "end" | "justify" | "initial" }

Format of HTML align attribute

Type declaration

  • Optional htmlAlign?: "start" | "center" | "end" | "justify" | "initial"

    Horizontal alignment, from HTML attribute "align"

IdFormat

IdFormat: { id?: string }

Format for element with Id

Type declaration

  • Optional id?: string

    Id of the element

ImageCropMetadataFormat

ImageCropMetadataFormat: { bottomPercent?: number; leftPercent?: number; rightPercent?: number; topPercent?: number }

Metadata for inline image crop

Type declaration

  • Optional bottomPercent?: number

    Bottom cropped percentage. Rotation or resizing won't impact this percentage value

    default

    0

  • Optional leftPercent?: number

    Left cropped percentage. Rotation or resizing won't impact this percentage value

    default

    0

  • Optional rightPercent?: number

    Right cropped percentage. Rotation or resizing won't impact this percentage value

    default

    0

  • Optional topPercent?: number

    Top cropped percentage. Rotation or resizing won't impact this percentage value

    default

    0

ImageEditOperation

ImageEditOperation: "resize" | "rotate" | "crop" | "flip"

Type of image editing operations

ImageMetadataFormat

ImageMetadataFormat: ImageResizeMetadataFormat & ImageCropMetadataFormat & ImageRotateMetadataFormat & ImageFlipMetadataFormat & { naturalHeight?: number; naturalWidth?: number; src?: string }

Metadata for inline image

ImageResizeMetadataFormat

ImageResizeMetadataFormat: { heightPx?: number; widthPx?: number }

Metadata for inline image resize

Type declaration

  • Optional heightPx?: number

    Height after resize, in px. If image is cropped, this is the height of visible part If image is rotated, this is the height before rotation

    default

    clientHeight of the image

  • Optional widthPx?: number

    Width after resize, in px. If image is cropped, this is the width of visible part If image is rotated, this is the width before rotation

    default

    clientWidth of the image

ImageRotateMetadataFormat

ImageRotateMetadataFormat: { angleRad?: number }

Metadata for inline image rotate

Type declaration

  • Optional angleRad?: number

    Rotated angle of inline image, in radian. Cropping or resizing won't impact this percentage value

    default

    0

InsertEntityPosition

InsertEntityPosition: "focus" | "begin" | "end" | "root"

Define the position of the entity to insert. It can be: "focus": insert at current focus. If insert a block entity, it will be inserted under the paragraph where focus is "begin": insert at beginning of content. When insert an inline entity, it will be wrapped with a paragraph. "end": insert at end of content. When insert an inline entity, it will be wrapped with a paragraph. "root": insert at the root level of current region

ItalicFormat

ItalicFormat: { italic?: boolean }

Format of italic

Type declaration

  • Optional italic?: boolean

    Whether it is in italic

IterateSelectionsCallback

IterateSelectionsCallback: (path: ContentModelBlockGroup[], tableContext?: TableSelectionContext, block?: ContentModelBlock, segments?: ContentModelSegment[]) => void | boolean

Type declaration

KeyOfStatePlugin

KeyOfStatePlugin<Key>: EditorCorePlugins[Key] extends PluginWithState<infer U> ? Key : never

Names of the core plugins that have plugin state

Type parameters

KnownAnnounceStrings

KnownAnnounceStrings: "announceListItemNumbering" | "announceListItemBullet" | "announceOnFocusLastCell"

Known announce strings

LetterSpacingFormat

LetterSpacingFormat: { letterSpacing?: string }

Format of letter spacing

Type declaration

  • Optional letterSpacing?: string

    letter-spacing style

LineHeightFormat

LineHeightFormat: { lineHeight?: string }

Format of line height

Type declaration

  • Optional lineHeight?: string

    Line height of this block

LinkFormat

LinkFormat: { anchorClass?: string; anchorId?: string; anchorTitle?: string; href?: string; name?: string; relationship?: string; target?: string }

Format of hyper link

Type declaration

  • Optional anchorClass?: string

    Class attribute of anchor element

  • Optional anchorId?: string

    Id of anchor element

  • Optional anchorTitle?: string

    Title attribute of anchor element

  • Optional href?: string

    Href of the hyper link

  • Optional name?: string

    Name of this link

  • Optional relationship?: string

    Rel attribute of anchor element

  • Optional target?: string

    Target of the hyper link

ListMetadataFormat

ListMetadataFormat: { applyListStyleFromLevel?: boolean; orderedStyleType?: number; unorderedStyleType?: number }

Format of list / list item that stored as metadata

Type declaration

  • Optional applyListStyleFromLevel?: boolean

    When set to true, if there is no orderedStyleType (for OL) or unorderedStyleType (for UL) specified, use the list from its level For ordered list, the default list styles from levels are: 'decimal', 'lower-alpha', 'lower-roman', then loop For unordered list, the default list styles from levels are: 'disc', 'circle', 'square', then loop

  • Optional orderedStyleType?: number

    Style type for Ordered list. Use value of constant NumberingListType as value.

  • Optional unorderedStyleType?: number

    Style type for Unordered list. Use value of constant BulletListType as value.

ListStyleFormat

ListStyleFormat: { listStylePosition?: string; listStyleType?: string }

Format of list-style

Type declaration

  • Optional listStylePosition?: string

    list-style-position

  • Optional listStyleType?: string

    list-style-type

ListThreadFormat

ListThreadFormat: { displayForDummyItem?: string; startNumberOverride?: number }

Format of list thread id

Type declaration

  • Optional displayForDummyItem?: string

    For a list item, it should have "list-item" (default value) for display style. In those case, we will leave displayForDummyItem as undefined. But if there is other value than "list-item" in display style, we store it here and treat this item as a dummy item. Dummy item won't have list bullet or number, and we won't add 1 for list number for such items

  • Optional startNumberOverride?: number

    When restart a new list thread, set this value to be the restart number. Otherwise, leave it undefined to continue last list

MarginFormat

MarginFormat: { marginBottom?: string; marginLeft?: string; marginRight?: string; marginTop?: string }

Format of margin

Type declaration

  • Optional marginBottom?: string

    Margin bottom value

  • Optional marginLeft?: string

    Margin left value

  • Optional marginRight?: string

    Margin right value

  • Optional marginTop?: string

    Margin top value

MergePastedContentFunc

MergePastedContentFunc: (target: ShallowMutableContentModelDocument, source: ContentModelDocument) => InsertPoint | null

Type declaration

MetadataAppliers

Map of metadata handlers

Type declaration

ModelToTextCallback

ModelToTextCallback<T>: (model: T) => string

Type parameters

  • T

Type declaration

    • (model: T): string
    • Callback function type for converting a given Content Model object to plain text

      Parameters

      • model: T

        The source model object to be converted to plain text

      Returns string

ModelToTextChecker

ModelToTextChecker<T>: (model: T) => boolean

Type parameters

  • T

Type declaration

    • (model: T): boolean
    • Callback function type for checking if we should convert to text for the given content model object

      Parameters

      • model: T

        The source model to check if we should convert it to plain text

      Returns boolean

MutableMark

MutableMark: { dummy1?: never[]; dummy2?: never[] }

Mark an object as mutable

Type declaration

  • Optional Readonly dummy1?: never[]

    The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build due to this member does not exist from source type.

  • Optional Readonly dummy2?: never[]

    The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build due to this member does not exist from source type.

MutableType

Get mutable type from its related readonly type

Type parameters

  • T

ObjectPropertyDefinition

ObjectPropertyDefinition<T>: {[ Key in keyof T]: Definition<T[Key]> }

Object property definition type used by Object Definition

Type parameters

  • T: Object

OnNodeCreated

Type declaration

OperationalBlocks

OperationalBlocks<T>: { block: ContentModelBlock | T; parent: ContentModelBlockGroup; path: ContentModelBlockGroup[] }

Represent a pair of parent block group and child block

Type parameters

Type declaration

PaddingFormat

PaddingFormat: { paddingBottom?: string; paddingLeft?: string; paddingRight?: string; paddingTop?: string }

Format of padding

Type declaration

  • Optional paddingBottom?: string

    Padding bottom value

  • Optional paddingLeft?: string

    Padding left value

  • Optional paddingRight?: string

    Padding right value

  • Optional paddingTop?: string

    Padding top value

ParsedTable

ParsedTable: ParsedTableCell[][]

Represents a parsed table with its table cells

ParsedTableCell

ParsedTableCell: HTMLTableCellElement | "spanLeft" | "spanTop" | "spanBoth"

Parse a table, this type represents a parsed table cell. It can be a cell element, or a string to indicate where it is spanned from

PasteType

PasteType: "normal" | "asPlainText" | "mergeFormat" | "asImage"

Specify what type of content to paste

PasteTypeOrGetter

PasteTypeOrGetter: PasteType | ((document: Document | null, clipboardData: ClipboardData) => PasteType)

Represents the PasteType parameter used to set the paste type to use. It can be either the Paste Type value or a callback that retuns the Paste Type to use.

PluginEvent

Editor plugin event interface

PluginEventData

PluginEventData<T>: PluginEventDataGeneric<PluginEvent, T>

A type to extract data part of a plugin event type. Data part is the plugin event without eventType field.

Type parameters

PluginEventDataGeneric

PluginEventDataGeneric<E, T>: E extends BasePluginEvent<T> ? Pick<E, Exclude<keyof E, "eventType">> : never

A type to extract data part of a plugin event type. Data part is the plugin event without eventType field. This type is a middle result and only used by PluginEventData type

Type parameters

PluginEventFromType

PluginEventFromType<T>: PluginEventFromTypeGeneric<PluginEvent, T>

A type to get specify plugin event type from eventType parameter.

Type parameters

PluginEventFromTypeGeneric

PluginEventFromTypeGeneric<E, T>: E extends BasePluginEvent<T> ? E : never

A type to get specify plugin event type from eventType parameter. This type is a middle result and only used by PluginEventFromType type

Type parameters

PluginEventType

PluginEventType: "keyDown" | "keyPress" | "keyUp" | "input" | "compositionEnd" | "mouseDown" | "mouseUp" | "contentChanged" | "extractContentWithDom" | "beforeCutCopy" | "beforePaste" | "editorReady" | "beforeDispose" | "scroll" | "entityOperation" | "contextMenu" | "enteredShadowEdit" | "leavingShadowEdit" | "editImage" | "beforeSetContent" | "zoomChanged" | "selectionChanged" | "logicalRootChanged" | "beforeKeyboardEditing"

Type of plugin events

PluginKey

PluginKey: keyof EditorCorePlugins

Names of core plugins

PluginState

Auto-calculated State object type for plugin with states

ReadonlyContentModelBlock

A union type of Content Model Block (Readonly)

ReadonlyContentModelBlockGroup

The union type of Content Model Block Group (Readonly)

ReadonlyContentModelDecorator

Union type for segment decorators (Readonly)

ReadonlyContentModelSegment

Union type of Content Model Segment (Readonly)

ReadonlyContentModelWithDataset

ReadonlyContentModelWithDataset<T>: ReadonlyMark & { dataset: ReadonlyDatasetFormat }

Represents base format of an element that supports dataset and/or metadata (Readonly)

Type parameters

  • T

ReadonlyDatasetFormat

ReadonlyDatasetFormat: Readonly<Record<string, string>>

Represents dataset format of Content Model (Readonly)

ReadonlyIterateSelectionsCallback

ReadonlyIterateSelectionsCallback: (path: ReadonlyContentModelBlockGroup[], tableContext?: ReadonlyTableSelectionContext, block?: ReadonlyContentModelBlock, segments?: ReadonlyContentModelSegment[]) => void | boolean

Type declaration

ReadonlyMark

ReadonlyMark: { dummy1?: ReadonlyArray<never>; dummy2?: ReadonlyArray<never> }

Mark an object as readonly

Type declaration

  • Optional Readonly dummy1?: ReadonlyArray<never>

    The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build due to this member does not exist from source type. This is used for preventing assigning ReadonlyMark to ShallowMutableMark or MutableMark

  • Optional Readonly dummy2?: ReadonlyArray<never>

    The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build due to this member does not exist from source type.

ReadonlyOperationalBlocks

ReadonlyOperationalBlocks<T>: { block: ReadonlyContentModelBlock | T; parent: ReadonlyContentModelBlockGroup; path: ReadonlyContentModelBlockGroup[] }

Represent a pair of parent block group and child block (Readonly)

Type parameters

Type declaration

RestoreUndoSnapshot

RestoreUndoSnapshot: (core: EditorCore, snapshot: Snapshot) => void

Type declaration

SelectionType

SelectionType: "range" | "table" | "image"

Type of DOM selection, it can be one of the 3 below: range: A regular selection that can be represented by a DOM Range object with start and end container and offset table: A table selection that can be defined using the Table element and first/last row and column number. Table selection can cover multiple table cells, it does not need to be continuous, but it should be a rectangle image: A image selection that can be defined with an image element. Not like a regular range selection with an image, image selection is created when user single click the image, then we will show a selection border rather the blue background to show the selection

SetContentModel

SetContentModel: (core: EditorCore, model: ContentModelDocument, option?: ModelToDomOption, onNodeCreated?: OnNodeCreated) => DOMSelection | null

Type declaration

SetDOMSelection

SetDOMSelection: (core: EditorCore, selection: DOMSelection | null, skipSelectionChangedEvent?: boolean) => void

Type declaration

    • Set current DOM selection from editor. This is the replacement of core API select

      Parameters

      • core: EditorCore

        The EditorCore object

      • selection: DOMSelection | null

        The selection to set

      • Optional skipSelectionChangedEvent: boolean

        @param Pass true to skip triggering a SelectionChangedEvent

      Returns void

SetEditorStyle

SetEditorStyle: (core: EditorCore, key: string, cssRule: string | null, subSelectors?: "before" | "after" | string[], maxRuleLength?: number) => void

Type declaration

    • (core: EditorCore, key: string, cssRule: string | null, subSelectors?: "before" | "after" | string[], maxRuleLength?: number): void
    • Add CSS rules for editor

      Parameters

      • core: EditorCore

        The EditorCore object

      • key: string

        A string to identify the CSS rule type. When set CSS rules with the same key again, existing rules with the same key will be replaced.

      • cssRule: string | null

        The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to remove existing rules

      • Optional subSelectors: "before" | "after" | string[]

        @optional If the rule is used for child element under editor, use this parameter to specify the child elements. Each item will be combined with root selector together to build a separate rule. It also accepts pseudo classes "before" and "after" to create pseudo class rule "::before" and "::after" to the editor root element itself

      • Optional maxRuleLength: number

        @optional Set maximum length for a single rule. This is used by test code only

      Returns void

SetLogicalRoot

SetLogicalRoot: (core: EditorCore, logicalRoot: HTMLDivElement | null) => void

Type declaration

    • (core: EditorCore, logicalRoot: HTMLDivElement | null): void
    • Set a new logical root (most likely due to focus change)

      Parameters

      • core: EditorCore

        The EditorCore object

      • logicalRoot: HTMLDivElement | null

        The new logical root (has to be child of physicalRoot or null to use physicalRoot as logical root)

      Returns void

ShallowMutableContentModelBlock

A union type of Content Model Block (Shallow mutable)

ShallowMutableContentModelBlockGroup

The union type of Content Model Block Group (Shallow mutable)

ShallowMutableContentModelSegment

Union type of Content Model Segment (Shallow mutable)

ShallowMutableContentModelWithDataset

ShallowMutableContentModelWithDataset<T>: ShallowMutableMark & { dataset: DatasetFormat }

Represents base format of an element that supports dataset and/or metadata (Readonly)

Type parameters

  • T

ShallowMutableMark

ShallowMutableMark: { dummy1?: never[]; dummy2?: ReadonlyArray<never> }

Mark an object as single level mutable (child models are still readonly)

Type declaration

  • Optional Readonly dummy1?: never[]

    The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build due to this member does not exist from source type.

  • Optional Readonly dummy2?: ReadonlyArray<never>

    The mutable marker to mark an object as mutable. When assign readonly object to a mutable type, compile will fail to build due to this member does not exist from source type. This is used for preventing assigning ShallowMutableMark to MutableMark

SizeFormat

SizeFormat: { height?: string; maxHeight?: string; maxWidth?: string; minHeight?: string; minWidth?: string; width?: string }

Format of element size

Type declaration

  • Optional height?: string

    Height of the element

  • Optional maxHeight?: string

    Maximum height of the element

  • Optional maxWidth?: string

    Maximum width of the element

  • Optional minHeight?: string

    Minimum height of the element

  • Optional minWidth?: string

    Minimum width of the element

  • Optional width?: string

    Width of the element

SnapshotSelection

Union type for all 3 selection types for Undo Snapshot

SpacingFormat

SpacingFormat: { borderCollapse?: boolean; borderSeparate?: boolean }

Format of spacing

Type declaration

  • Optional borderCollapse?: boolean

    Whether borders of cells are collapsed together

  • Optional borderSeparate?: boolean

    Whether borders of cells are separated

StatePluginKeys

StatePluginKeys<Key>: {[ P in Key]: KeyOfStatePlugin<P> }[Key]

All names of plugins with plugin state

Type parameters

StrikeFormat

StrikeFormat: { strikethrough?: boolean }

Format of strikethrough

Type declaration

  • Optional strikethrough?: boolean

    Whether it has strike through

SuperOrSubScriptFormat

SuperOrSubScriptFormat: { superOrSubScriptSequence?: string }

Format of superscript/subscript

Type declaration

  • Optional superOrSubScriptSequence?: string

    Sequence of superscript/subscript e.g. sub super sub

SwitchShadowEdit

SwitchShadowEdit: (core: EditorCore, isOn: boolean) => void

Type declaration

    • Switch the Shadow Edit mode of editor On/Off

      Parameters

      • core: EditorCore

        The EditorCore object

      • isOn: boolean

        True to switch On, False to switch Off

      Returns void

TableAlignOperation

TableAlignOperation: "alignCenter" | "alignLeft" | "alignRight"

Operations used by editTable() API for align table

TableCellHorizontalAlignOperation

TableCellHorizontalAlignOperation: "alignCellLeft" | "alignCellCenter" | "alignCellRight"

Operations used by editTable() API for align table cell horizontally

TableCellMergeOperation

TableCellMergeOperation: "mergeCells"

Operations used by editTable() API for merge selected table cells

TableCellMetadataFormat

TableCellMetadataFormat: { bgColorOverride?: boolean; borderOverride?: boolean; vAlignOverride?: boolean }

Format of table cell that stored as metadata

Type declaration

  • Optional bgColorOverride?: boolean

    Override default background color

  • Optional borderOverride?: boolean

    Override default border value

  • Optional vAlignOverride?: boolean

    Override default vertical align value

TableCellVerticalAlignOperation

TableCellVerticalAlignOperation: "alignCellTop" | "alignCellMiddle" | "alignCellBottom"

Operations used by editTable() API for align table cell vertically

TableDeleteOperation

TableDeleteOperation: "deleteTable" | "deleteColumn" | "deleteRow"

Operations used by editTable() API for delete table cells

TableHorizontalInsertOperation

TableHorizontalInsertOperation: "insertLeft" | "insertRight"

Operations used by editTable() API for insert table cell horizontally

TableHorizontalMergeOperation

TableHorizontalMergeOperation: "mergeLeft" | "mergeRight"

Operations used by editTable() API for merge table cells horizontally

TableLayoutFormat

TableLayoutFormat: { tableLayout?: string }

Format of Table Layout

Type declaration

  • Optional tableLayout?: string

    Whether borders of cells are collapsed together

TableMetadataFormat

TableMetadataFormat: { bgColorEven?: string | null; bgColorOdd?: string | null; bottomBorderColor?: string | null; hasBandedColumns?: boolean; hasBandedRows?: boolean; hasFirstColumn?: boolean; hasHeaderRow?: boolean; headerRowColor?: string | null; tableBorderFormat?: number; topBorderColor?: string | null; verticalAlign?: "top" | "middle" | "bottom" | null; verticalBorderColor?: string | null }

Format of table that stored as metadata

Type declaration

  • Optional bgColorEven?: string | null

    Background color for even row or even columns

  • Optional bgColorOdd?: string | null

    Background color for odd row or odd columns

  • Optional bottomBorderColor?: string | null

    Bottom border color for each row

  • Optional hasBandedColumns?: boolean

    Set banded columns

  • Optional hasBandedRows?: boolean

    Set banded rows

  • Optional hasFirstColumn?: boolean

    Set first column

  • Optional hasHeaderRow?: boolean

    Set header row

  • Optional headerRowColor?: string | null

    Header row background color for even cells

  • Optional tableBorderFormat?: number

    Table Borders Type. Use value of constant TableBorderFormat as value

  • Optional topBorderColor?: string | null

    Top border color for each row

  • Optional verticalAlign?: "top" | "middle" | "bottom" | null

    Vertical alignment for each row

  • Optional verticalBorderColor?: string | null

    Vertical border color for each row

TableOperation

Operations used by editTable() API

TableSplitOperation

TableSplitOperation: "splitHorizontally" | "splitVertically"

Operations used by editTable() API for split table cells

TableVerticalInsertOperation

TableVerticalInsertOperation: "insertAbove" | "insertBelow"

Operations used by editTable() API for insert table cell vertically

TableVerticalMergeOperation

TableVerticalMergeOperation: "mergeAbove" | "mergeBelow"

Operations used by editTable() API for merge table cells vertically

TextAlignFormat

TextAlignFormat: { textAlign?: "start" | "center" | "end" | "justify" | "initial" }

Format of text-align

Type declaration

  • Optional textAlign?: "start" | "center" | "end" | "justify" | "initial"

    Horizontal alignment, from CSS "text-align"

TextColorFormat

TextColorFormat: { textColor?: string }

Format of text color

Type declaration

  • Optional textColor?: string

    Text color

TextFormatApplier

TextFormatApplier<TFormat>: (format: TFormat, textNode: Text, context: ModelToDomContext) => void

Type parameters

Type declaration

    • Apply format to the given text node

      Parameters

      • format: TFormat

        The format object to apply

      • textNode: Text

        The text node to apply format to

      • context: ModelToDomContext

        The context object that provide related context information

      Returns void

TextFormatParser

TextFormatParser<TFormat>: (format: TFormat, textNode: Text, context: DomToModelContext) => void

Type parameters

Type declaration

    • Parse format from the given text node

      Parameters

      • format: TFormat

        The format object to parse into

      • textNode: Text

        The text node to parse format from

      • context: DomToModelContext

        The context object that provide related context information

      Returns void

TextIndentFormat

TextIndentFormat: { isTextIndentApplied?: boolean; textIndent?: string }

Format of text-indent

Type declaration

  • Optional isTextIndentApplied?: boolean

    Due to the special behavior of text-indent style, we need to know if this text-indent style is already applied to any child block. Then after that, we can ignore it for the block at the same level.

  • Optional textIndent?: string

    Text indent of a paragraph

TriggerEvent

TriggerEvent: (core: EditorCore, pluginEvent: PluginEvent, broadcast: boolean) => void

Type declaration

    • Trigger a plugin event

      Parameters

      • core: EditorCore

        The EditorCore object

      • pluginEvent: PluginEvent

        The event object to trigger

      • broadcast: boolean

        Set to true to skip the shouldHandleEventExclusively check

      Returns void

TrustedHTMLHandler

TrustedHTMLHandler: (html: string) => string

Type declaration

    • (html: string): string
    • A handler type to convert HTML string to a trust HTML string

      Parameters

      • html: string

      Returns string

TypeOfBlockGroup

TypeOfBlockGroup<T>: T extends ContentModelBlockGroupBase<infer U> | ReadonlyContentModelBlockGroupBase<infer U> ? U : never

Retrieve block group type string from a given block group

Type parameters

TypeOfStatePlugin

TypeOfStatePlugin<Key>: EditorCorePlugins[Key] extends PluginWithState<infer U> ? U : never

Get type of a plugin with state

Type parameters

UnderlineFormat

UnderlineFormat: { underline?: boolean }

Format of underline

Type declaration

  • Optional underline?: boolean

    Whether it has underline

ValueSanitizer

ValueSanitizer: ((value: string, tagName: string) => string | null) | boolean

Specify how to sanitize a value, can be a callback function or a boolean value. True: Keep this value False: Remove this value A callback: Let the callback function to decide how to deal this value.

param

The original value

param

Tag name of the element of this value

returns

Return a non-empty string means use this value to replace the original value. Otherwise remove this value

VerticalAlignFormat

VerticalAlignFormat: { verticalAlign?: "top" | "middle" | "bottom" }

Format of vertical alignment

Type declaration

  • Optional verticalAlign?: "top" | "middle" | "bottom"

    Vertical alignment

WhiteSpaceFormat

WhiteSpaceFormat: { whiteSpace?: string }

Format of white space

Type declaration

  • Optional whiteSpace?: string

    White space

WordBreakFormat

WordBreakFormat: { wordBreak?: string }

Format of word break

Type declaration

  • Optional wordBreak?: string

    Word break CSS value

Generated using TypeDoc