Options
All
  • Public
  • Public/Protected
  • All
Menu

The main editor class based on Content Model

Hierarchy

Implements

Index

Constructors

constructor

Methods

announce

attachDomEvent

  • attachDomEvent(eventMap: Record<string, DOMEventRecord<Event>>): () => void

dispose

  • dispose(): void

focus

  • focus(): void

formatContentModel

getColorManager

getContentModelCopy

  • Create Content Model from DOM tree in this editor

    Parameters

    • mode: "connected" | "disconnected" | "clean"

      What kind of Content Model we want. Currently we support the following values:

      • disconnected: Returns a disconnected clone of Content Model from editor which you can do any change on it and it won't impact the editor content. If there is any entity in editor, the returned object will contain cloned copy of entity wrapper element. If editor is in dark mode, the cloned entity will be converted back to light mode.
      • clean: Similar with disconnected, this will return a disconnected model, the difference is "clean" mode will not include any selection info. This is usually used for exporting content

    Returns ContentModelDocument

Protected getCore

getDOMHelper

getDOMSelection

getDocument

  • getDocument(): Document

getEnvironment

getPendingFormat

getScrollContainer

  • getScrollContainer(): HTMLElement

getSnapshotsManager

getTrustedHTMLHandler

getVisibleViewport

  • getVisibleViewport(): Rect

hasFocus

  • hasFocus(): boolean

isDarkMode

  • isDarkMode(): boolean

isDisposed

  • isDisposed(): boolean

isInShadowEdit

  • isInShadowEdit(): boolean

restoreSnapshot

  • restoreSnapshot(snapshot: Snapshot): void

setDOMSelection

setDarkModeState

  • setDarkModeState(isDarkMode?: boolean): void

setEditorStyle

  • setEditorStyle(key: string, cssRule: string, subSelectors?: string[] | "before" | "after"): void
  • Add CSS rules for editor

    Parameters

    • 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

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

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

      @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.

    Returns void

setLogicalRoot

  • setLogicalRoot(logicalRoot: HTMLDivElement): void

startShadowEdit

  • startShadowEdit(): void
  • 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.

    Returns void

stopShadowEdit

  • stopShadowEdit(): void

takeSnapshot

triggerEvent

  • Trigger an event to be dispatched to all plugins

    Type parameters

    Parameters

    • eventType: T

      Type of the event

    • data: PluginEventData<T>

      data of the event with given type, this is the rest part of PluginEvent with the given type

    • broadcast: boolean = false

      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

    Returns PluginEventFromType<T>

    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