Creates an instance of Editor
The DIV HTML element which will be the container element of editor
An optional options object to customize the editor
Announce the given data
Data to announce
Attach a DOM event to the editor content DIV
A map from event name to its handler
Dispose this editor, dispose all plugins and custom data
Focus to this editor, the selection was restored to where it was before, no unexpected scroll.
The general API to do format change with Content Model It will grab a Content Model for current editor content, and invoke a callback function to do format change. Then according to the return value, write back the modified content model into editor. If there is cached model, it will be used and updated.
Formatter function, see ContentModelFormatter
More options, see FormatContentModelOptions
Get a color manager object for this editor.
Create Content Model from DOM tree in this editor
What kind of Content Model we want. Currently we support the following values:
the current EditorCore object
Get a DOM Helper object to help access DOM tree in editor
Get current DOM selection
Get document which contains this editor
The HTML document which contains this editor
Get current running environment, such as if editor is running on Mac
Get pending format of editor if any, or return null
Get the scroll container of the editor
Get undo snapshots manager
Get a function to convert HTML string to trusted HTML string. By default it will just return the input HTML directly. To override this behavior, pass your own trusted HTML handler to EditorOptions.trustedHTMLHandler See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
Retrieves the rect of the visible viewport of the editor.
Check if focus is in editor now
true if focus is in editor, otherwise false
Check if the editor is in dark mode
True if the editor is in dark mode, otherwise false
Get whether this editor is disposed
True if editor is disposed, otherwise false
Check if a given feature is enabled
The name of feature to check
Check if editor is in Shadow Edit mode
Restore an undo snapshot into editor
The snapshot to restore
Set DOMSelection into editor content.
The selection to set
Set the dark mode state and transforms the content to match the new state.
The next status of dark mode. True if the editor should be in dark mode, false if not.
Add CSS rules for editor
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.
The CSS rule string, must be a valid CSS rule string, or browser may throw exception. Pass null to clear existing rules
@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.
Set a new logical root (most likely due to focus change)
The new logical root (has to be child of physicalRoot)
Make the editor in "Shadow Edit" mode. In Shadow Edit mode, all format change will finally be ignored. This can be used for building a live preview feature for format button, to allow user see format result without really apply it. This function can be called repeated. If editor is already in shadow edit mode, we can still use this function to do more shadow edit operation.
Leave "Shadow Edit" mode, all changes made during shadow edit will be discarded
Add a single undo snapshot to undo stack
@optional State for entity if we want to add entity state for this snapshot
Trigger an event to be dispatched to all plugins
Type of the event
data of the event with given type, this is the rest part of PluginEvent with the given type
indicates if the event needs to be dispatched to all plugins True means to all, false means to allow exclusive handling from one plugin unless no one wants that
the event object which is really passed into plugins. Some plugin may modify the event object so the result of this function provides a chance to read the modified result
Generated using TypeDoc
The main editor class based on Content Model