Enum used to control the different types of bullet list
Possible change sources. Here are the predefined sources. It can also be other string if the change source can't fall into these sources.
List of deprecated colors
Provide a default empty instance of segment format with all its properties
Metadata definition for List
Minimum height for a table cell
Minimum width for a table cell
Enum used to control the different types of numbering list
Style map for ordered list
Table format border
Style map for unordered list
Add a given block to block group
The block group to add block into
The block to add
Add a code decorator into segment if any
The segment to add decorator to
The code decorator to add
Adds delimiters to the element provided. If the delimiters already exists, will not be added
the node to add the delimiters
format to set to the delimiters, so when typing inside of one the format is not lost
Model to Dom context to use.
Add a given segment into a paragraph from its parent group. If the last block of the given group is not paragraph, create a new paragraph.
The parent block group of the paragraph to add segment into
The segment to add
The block format used for creating a new paragraph when need
The parent paragraph where the segment is added to
Add a given segment into a paragraph from its parent group. If the last block of the given group is not paragraph, create a new paragraph. (Shallow mutable)
The parent block group of the paragraph to add segment into
The segment to add
The block format used for creating a new paragraph when need
The parent paragraph where the segment is added to
Add a new text segment to current paragraph
Current BlockGroup that the paragraph belong to
Text content of the text segment
Current DOM to Model context
A new Text segment, or undefined if the input text is empty
Apply table format from table metadata and the passed in new format
The table to apply format to
@optional New format to apply. When passed, this value will be merged into existing metadata format and default format
@optional When pass true, table cells with customized shade color will not be overwritten. @default false
Check if the two given formats object are equal. This is a check to value but not to reference
The first format object to check
The second format object to check
Build a new selection marker with correct format according to its parent paragraph
The BlockGroup that paragraph belongs to
Current DOM to Model context
@optional Container Node, used for retrieving pending format
@optional Container offset, used for retrieving pending format
A new selection marker
Gets the cached event data by cache key from event object if there is already one. Otherwise, call getter function to create one, and cache it.
The event object
Cache key string, need to be unique
Getter function to get the object when it is not in cache yet
Content Model Element Processor for child elements
The parent block group
DOM to Content Model context
Clone a content model
The content model to clone
@optional Options to specify customize the clone behavior
Combine border value array back to string
Create DOM tree fragment from Content Model document
Document object of the target DOM tree
Target node that will become the container of new DOM tree. When a DOM node with existing node is passed, it will be merged with content model so that unchanged blocks won't be touched.
The content model document to generate DOM tree from
The context object for Content Model to DOM conversion
The selection range created in DOM tree from this model, or null when there is no selection
Convert Content Model to plain text
The source Content Model
Callbacks to customize the behavior of contentModelToText function
Create a ContentModelBr model
@optional The format of this model
Create a ContentModelDocument model
@optional Default format of this model
Create a ContentModelDivider model
Tag name of this divider. Currently only hr and div are supported
@optional The format of this model
Create Dom to Content Model Config object
All customizations of content model creation
Create context object for DOM to Content Model conversion
Context of editor
Option array to customize the DOM to Model conversion behavior
Create context object for DOM to Content Model conversion with an existing configure
A full config object to define how to convert DOM tree to Content Model
Context of editor
Create an empty Content Model Document with initial empty line and insert point with default format
@optional The default format to be applied to this Content Model
Create a ContentModelEntity model
Wrapper element of this entity
Whether this is a readonly entity @default true
@optional Segment format of this entity
@optional Type of this entity
@optional Id of this entity
Create a ContentModelFormatContainer model
Tag name of this format container, in lower case
@optional The format of this model
Create a ContentModelGeneralBlock model
Original element of this model
Create a ContentModelGeneralSegment model
The original DOM element
@optional The format of this model
Create a ContentModelImage model
Image source
@optional The format of this model
Create a ContentModelListItem model
Existing list levels
@optional The format of this model
Create a ContentModelListLevel model
Tag name of the list, either OL or UL
@optional The format of this model
@optional The dataset of this model
Create Content Model to DOM Config object
All customizations of DOM creation
Create context object fro Content Model to DOM conversion
Context of editor
Option array to customize the Model to DOM conversion behavior
Create context object for Content Model to DOM conversion with an existing configure
A full config object to define how to convert Content Model to DOM tree
Context of editor
Create a ContentModelParagraph model
@optional Whether this is an implicit paragraph. An implicit paragraph is a paragraph that will not render with DOM element container
@optional Format of this paragraph
@optional Segment format applied to this block
@optional Decorator of this paragraph
Create a ContentModelParagraphDecorator model
Tag name of this decorator
@optional The format of this model
Create a ContentModelSelectionMarker model
@optional The format of this model
Create a ContentModelTable model
Count of rows of this table
@optional The format of this model
Create a ContentModelTableCell model
@optional Whether this is a table cell merged with its left cell, or colspan number @default false
Whether this is a table cell merged with its upper cell, or rowSpan number @default false
@optional Whether this is a header cell @default false
@optional The format of this model
Create a ContentModelTableRow model
@optional The format of this model
Create a ContentModelText model
Text of this model
@optional The format of this model
@optional The link decorator
@option The code decorator
Generate color key for dark color
The input light color
Key of the color
Delete a content model block from current selection
Array of the block to delete
The block to delete
@optional If specified, use this block to replace the deleted block
@optional Context object provided by formatContentModel API
@optional Whether this is deleting forward or backward. This is only used for deleting entity. If not specified, only selected entity will be deleted
Delete a content model segment from current selection
Parent paragraph of the segment to delete
The segment to delete
@optional Context object provided by formatContentModel API
@optional Whether this is deleting forward or backward. This is only used for deleting entity. If not specified, only selected entity will be deleted
Delete selected content from Content Model
The model to delete selected content from
@optional Addition delete steps
@optional A context object provided by formatContentModel API
A DeleteSelectionResult object to specify the deletion result
Create Content Model from DOM tree in this editor
Root element of DOM tree to create Content Model from
Context object for DOM to Content Model conversion
A ContentModelDocument object that contains all the models created from the give root element
Content Model Element Processor for entity
The parent block group
DOM to Content Model context
Extract an integrated border string with border width, style, color to value tuple
The integrated border style string
An array with the splitted values
Extract clipboard items to be a ClipboardData object for IE
The clipboard items retrieve from a DataTransfer object
Allowed custom content type when paste besides text/plain, text/html and images Only text types are supported, and do not add "text/" prefix to the type values
Find the closest block entity wrapper element from a given DOM node
The node to start looking for entity container
The DOM helper
Find the closest entity wrapper element from a given DOM node
The DOM helper to use
Generate Entity class names for an entity wrapper
The source entity format object
A combined CSS class name string for entity wrapper
Get all entity wrapper elements under the given root element
The root element to query from
An array of entity wrapper elements
Get automatic list style of a list item according to its lis type and metadata.
The list type, either OL or UL
Metadata of this list item from list item model
Depth of list level, start from 0
Existing list style type in format, if any
A number to represent list style type. This will be the value of either NumberingListType (when listType is OL) or BulletListType (when listType is UL). When there is a specified list style in its metadata, return this value, otherwise When specified "applyListStyleFromLevel" in metadata, calculate auto list type from its depth, otherwise When there is already listStyleType in list level format, find a related style type index, otherwise return undefined
Get index of closest ancestor block group of the expected block group type. If not found, return -1
The block group path, from the closest one to root
The expected block group types
@optional Block group types that will cause stop searching
Get color from given HTML element
The element to get color from
True to get background color, false to get text color
Whether element is in dark mode now
@optional The dark color handler object to help manager dark mode color
Get bounding rect of the given DOM insert point
The document object
The input DOM insert point
Get the first selected list item from content model
The Content Model to get selection from
Get the first selected list item from content model (Readonly)
The Content Model to get selection from
Get the first selected table from content model
The Content Model to get selection from
Get the first selected table from content model (Readonly)
The Content Model to get selection from
Get image metadata
The image Content Model
Get list metadata
The list Content Model (metadata holder)
Gets the list style type that the bullet is part of, using the Constant record
whether the list is ordered or unordered
bullet string
the number of the style override or undefined if was not found in the Record
Retrieve metadata from the given model.
The Content Model to retrieve metadata from
Definition of this metadata type, used for validate the metadata object
Metadata of the model, or null if it does not contain a valid metadata
Provide a strong-typed version of Object.keys()
The source object
Array of keys
Get an array of block group - block pair that is of the expected block group type from selection
The root block group to search
The expected block group types
Block group types that will stop searching when hit
True means search in deep first, otherwise wide first
Get an array of block group - block pair that is of the expected block group type from selection (Readonly)
The root block group to search
The expected block group types
Block group types that will stop searching when hit
True means search in deep first, otherwise wide first
Get the list number for a list item according to list style type and its index number
The list style number, should be a value of NumberingListType type
List number, start from 1
A string for this list item. For example, when pass in NumberingListType.LowerAlpha and 2, it returns "b"
Get offset numbers of a regular (range based) selection. If the selection start/end position is not in the given node, it will return -1 for the related value
DOM to Content Model context used for retrieve the selection
The container node to check
a tuple of start and end offsets. -1 means selection is not directly under the given node
Returns a safe Id to use in Native APIs. IDs that start with number or hyphen can throw errors if used.
Get the text format of a segment, this function will return only format that is applicable to text
The segment to get format from
When pass true, also get Bold/Italic/Underline format
Get selection coordinates of a table. If there is no selection, return null
The table model to get selection from
Get any array of selected paragraphs from a content model
The Content Model to get selection from
Get any array of selected paragraphs from a content model, return mutable paragraphs
The Content Model to get selection from
Set to true to indicate we will mutate the selected paragraphs
Get any array of selected paragraphs from a content model (Readonly)
The Content Model to get selection from
Get an array of selected segments from a content model
The Content Model to get selection from
True means also include format holder as segment from list item
Get an array of selected segments from a content model, return mutable segments
The Content Model to get selection from
True means also include format holder as segment from list item
Set to true to indicate we will mutate the selected paragraphs
Get an array of selected segments from a content model (Readonly)
The Content Model to get selection from
True means also include format holder as segment from list item
Get an array of selected parent paragraph and child segment pair
The Content Model to get selection from
True means also include format holder as segment from list item, in that case paragraph will be null
True to include entity in result as well
Get an array of selected parent paragraph and child segment pair, return mutable paragraph and segments
The Content Model to get selection from
True means also include format holder as segment from list item, in that case paragraph will be null
True to include entity in result as well
Set to true to indicate we will mutate the selected paragraphs
Get an array of selected parent paragraph and child segment pair (Readonly)
The Content Model to get selection from
True means also include format holder as segment from list item, in that case paragraph will be null
True to include entity in result as well
Get root node of a given DOM selection For table selection, root node is the selected table For image selection, root node is the selected image For range selection, root node is the common ancestor container node of the selection range
The selection to get root node from
Get table cell metadata
The table cell Content Model
Get table metadata
The table Content Model
Helper function to handle regular (range based) selection when process child node
Index of current child node in its parent
DOM to Content Model context
The parent block group
Start offset of current regular selection
End offset of current regular selection
The container node of this selection
Check if the given model has metadata
The content model to check
Check if there is selection within the given block
The block to check
Check if there is selection within the given block
Check if there is selection within the given segment
The segment to check
Check if the given element will be layout as a block
The element to check
Check if the given element is a container element of block entity
The element to check
True if the element is a block entity container, otherwise false
Check if the given content model block or block group is of the expected block group type
The object to check
The expected type
Check if the given content model block or block group is of the expected block group type (Readonly)
The object to check
The expected type
Check if the given bold style represents a bold style
The style to check
Returns true when the event was fired from a key that produces a character value, otherwise false This detection is not 100% accurate. event.key is not fully supported by all browsers, and in some browsers (e.g. IE), event.key is longer than 1 for num pad input. But here we just want to improve performance as much as possible. So if we missed some case here it is still acceptable.
The keyboard event object
Returns true if the given event is a cursor moving event (Left, Right, Up, Down, Home, End, Page Up, Page Down). This does not check modifier keys (Ctrl, Alt, Meta). So if there are modifier keys pressed, it can still return true if one of the modifier key is pressed
The keyboard event to check
Check if the given element is of the type that we are checking according to its tag name
The element to check
The HTML tag name to check
True if the element has the given tag, otherwise false
Get whether the model is empty.
true if the model is empty.
Checks whether the node provided is a Entity delimiter
True to match delimiter before entity only, false to match delimiter after entity, or undefined means match both
true if it is a delimiter
Check if the given DOM Node is an entity wrapper element
Check if the given block group is a general segment
The group to check
Check if the given block group is a general segment (Shallow mutable)
The group to check
Check if the given block group is a general segment (Readonly)
The group to check
Returns true when the event was fired from a modifier key, otherwise false
The keyboard event object
Type checker for Node. Return true if it of the specified node type
The node to check
The type to check
Check if the given character is punctuation
The character to check
Check if the give character is a space. A space can be normal ASCII pace (32) or non-break space (160) or other kinds of spaces such as ZeroWidthSpace, ...
The character to check
Check if the given white-space style value will cause preserving white space
The white-space style value to check
Iterate all selected elements in a given model
The given Content Model to iterate selection from
The callback function to access the selected element
Option to determine how to iterate
Iterate all selected elements in a given model (Readonly)
The given Content Model to iterate selection from
The callback function to access the selected element
Option to determine how to iterate
Merge source model into target mode
Target Content Model that will merge content into
Source Content Model will be merged to target model
Format context. When call this function inside formatContentModel, provide this context so that formatContentModel will do extra handling to the result
More options, see MergeModelOption
Insert point after merge, or null if there is no insert point
Find continuous text segments that have the same format and decorators, merge them, So we can reduce total count of segments
The parent paragraph to check.
Replace all child nodes of the given target node to the child nodes of source node.
Target node, all child nodes of this node will be removed if keepExistingChildren is not set to true
(Optional) source node, all child nodes of this node will be move to target node
(Optional) When set to true, all existing child nodes of target will be kept
Convert a readonly block to mutable block, clear cached element if exist
The block to convert from
The same block object of its related mutable type
Convert a readonly segment to be mutable, together with its owner paragraph If the segment does not belong to the given paragraph, return null for the segment
The readonly paragraph to convert from
The segment to convert from
Convert segments of a readonly paragraph to be mutable. Segments that are not belong to the given paragraph will be skipped
The readonly paragraph to convert from
The segments to convert from
For a given content model, normalize it to make the model be consistent. This process includes:
The root level block group of content model to normalize
The paragraph to normalize Normalize a paragraph. If it is empty, add a BR segment to make sure it can insert content
A ClientRect of all 0 is possible. i.e. chrome returns a ClientRect of 0 when the cursor is on an empty p We validate that and only return a rect when the passed in ClientRect is valid
Client rect object normally retrieved from getBoundingClientRect function
Normalize a given segment, make sure its spaces are correctly represented by space and non-break space
The segment to normalize
Whether we should ignore the trailing space of the text segment @default false
Normalize a Content Model table, make sure:
The table to normalize
@optional Default segment format to apply to cell
Normalize spaces of the given string. After normalization, all leading (for forward) or trailing (for backward) spaces will be replaces with non-break space (160)
The string to normalize
Whether normalize forward or backward
Parse color string to r/g/b value. If the given color is not in a recognized format, return null
The source color to parse
An array of Red/Green/Blue value, or null if fail to parse
Parse entity format from entity wrapper element
The wrapper element to parse entity format from
Entity format
Parse formats of the given HTML element using specified format parsers
The element to parse format from
The parses we are using to parse format
The format object to hold result format
DOM to Content Model context
Parse a table into a two dimensions array of TD elements. For those merged cells, the value will be null.
Input HTML Table element
Array of TD elements
Parse unit value with its unit
The source value to parse
The source element which has this unit value, or current font size (in px) from context.
Unit for result, can be px or pt. @default px
Helper function for processing child node
The parent block group
DOM to Content Model context
Read a file object and invoke a callback function with the data url of this file
The file to read
the callback to invoke with data url of the file. If fail to read, dataUrl will be null
Retrieve format state from the given Content Model
The Content Model to retrieve format state from
Existing pending format, if any
Existing format state object, used for receiving the result
The strategy for handling format conflicts
When set a DOM tree into editor, reuse the existing element in editor and no need to change it
Parent node of the reused element
The element to keep in parent node
Reference node, it is point to current node that is being processed. It must be a child of parent node, or null. We will start processing from this node, if it is not the same with element, remove it and keep processing its next sibling, until we see an element that is the same with the passed in element or null.
The new reference element
Run editing steps on top of a given context object which includes current insert point and previous editing result
The editing steps to run
Context for the editing steps.
Set color to given HTML element
The element to set color to
The color to set, always pass in color in light mode
True to set background color, false to set text color
Whether element is in dark mode now
@optional The dark color handler object to help manager dark mode color
Set the first column format borders for the table as well as header property
The rows of the table
The table metadata format
For a given block, if it is a paragraph, set it to be not-implicit
The block to check
Set selection into Content Model. If the Content Model already has selection, existing selection will be overwritten by the new one.
The root level group of Content Model
The start selected element. If not passed, existing selection of content model will be cleared
The end selected element. If not passed, only the start element will be selected. If passed, all elements between start and end elements will be selected
Set shade color of table cell
The cell to set shade color to
The color to set
@optional When pass true, it means this shade color is not part of table format, so it can be preserved when apply table format
@optional When pass true, we will also apply text color from table cell to its child blocks and segments
Content Model Element Processor for table
For Table with merged/splitted cells, HTML uses colSpan and rowSpan attributes to specify how it should be rendered. To make it easier to edit a table, we will use a different way to describe table.
The parent block group
DOM to Content Model context
Convert a named node map to an array
The map to convert
Convert a named node map to an array
The map to convert
Convert a collection to an array
The collection to convert
Convert a collection to an array
The collection to convert
Convert an array to an array. This is to satisfy typescript compiler. For some cases the object can be a collection at runtime, but the declaration is an array. e.g. ClipboardData.types
The array to convert
Edit and transform color of elements between light mode and dark mode
The root DOM node to transform
True to transform the root node as well, otherwise false
To specify the transform direction, light to dark, or dark to light
The dark color handler object to help do color transformation
Removes the node and keep all children in place, return the parentNode where the children are attached
the node to remove
Unwrap a given block group, move its child blocks to be under its parent group
Parent block group of the unwrapping group
The block group to unwrap
Update image metadata with a callback
The image Content Model
The callback function used for updating metadata
Update list metadata with a callback
The list Content Model (metadata holder)
The callback function used for updating metadata
Update metadata of the given model
The model to update metadata to
A callback function to update metadata
@optional Metadata definition used for verify the metadata object
The metadata object if any, or null
Update table cell metadata with a callback
The table cell Content Model
The callback function used for updating metadata
Update table metadata with a callback
The table Content Model
The callback function used for updating metadata
Wrap the given node with a new element, put the wrapper node under the parent of the first node and return the wrapper element.
Parent document object
The node to wrap
The tag of wrapper HTML element
The wrapper element
Wrap all child nodes of the given parent element using a new element with the given tag name
The parent element
The tag name of new wrapper
New wrapper element
Generated using TypeDoc
Keys of border items