Options
All
  • Public
  • Public/Protected
  • All
Menu

An interface of Editor, built on top of Content Model

Hierarchy

  • IEditor

Implemented by

Index

Methods

announce

attachDomEvent

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

dispose

  • dispose(): void

focus

  • focus(): void

formatContentModel

getColorManager

getContentModelCopy

  • deprecated

    Use formatContentModel() instead

    Parameters

    • mode: "connected"

    Returns ContentModelDocument

  • Create Content Model from DOM tree in this editor

    Parameters

    • mode: "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

getDOMHelper

getDOMSelection

getDocument

  • getDocument(): Document

getEnvironment

getPendingFormat

getScrollContainer

  • getScrollContainer(): HTMLElement

getSnapshotsManager

getTrustedHTMLHandler

getVisibleViewport

  • getVisibleViewport(): Rect

hasFocus

  • hasFocus(): boolean

isDarkMode

  • isDarkMode(): boolean

isDisposed

  • isDisposed(): boolean

isExperimentalFeatureEnabled

  • isExperimentalFeatureEnabled(featureName: string): boolean

isInShadowEdit

  • isInShadowEdit(): boolean

restoreSnapshot

  • restoreSnapshot(snapshot: Snapshot): void

setDOMSelection

setDarkModeState

  • setDarkModeState(isDarkMode?: boolean): void
  • Set the dark mode state and transforms the content to match the new state.

    Parameters

    • Optional isDarkMode: boolean

      The next status of dark mode. True if the editor should be in dark mode, false if not.

    Returns 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
  • Set a new logical root (most likely due to focus change)

    Parameters

    • logicalRoot: HTMLDivElement

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

    Returns 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

    • Optional broadcast: boolean

      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