Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents an indexer object which provides methods to help build backward relationship from DOM node to Content Model

Hierarchy

  • DomIndexer

Index

Properties

onBlockEntity

onBlockEntity: (entity: ContentModelEntity, group: ContentModelBlockGroup) => void

Type declaration

onMergeText

onMergeText: (targetText: Text, sourceText: Text) => void

Type declaration

    • (targetText: Text, sourceText: Text): void
    • Invoke when merge two continuous text nodes, we need to merge their indexes as well

      Parameters

      • targetText: Text

        Target text node to merge into

      • sourceText: Text

        Source text node to merge from

      Returns void

onParagraph

onParagraph: (paragraphElement: HTMLElement) => void

Type declaration

    • (paragraphElement: HTMLElement): void
    • Invoked when new paragraph node is created in DOM tree

      Parameters

      • paragraphElement: HTMLElement

        The new DOM node for this paragraph

      Returns void

onSegment

onSegment: (segmentNode: Node, paragraph: ContentModelParagraph, segments: ContentModelSegment[]) => void

Type declaration

onTable

onTable: (tableElement: HTMLTableElement, tableModel: ContentModelTable) => void

Type declaration

    • Invoked when new table node is created in DOM tree

      Parameters

      • tableElement: HTMLTableElement

        The new DOM node for this table

      • tableModel: ContentModelTable

      Returns void

reconcileChildList

reconcileChildList: (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>) => boolean

Type declaration

    • (addedNodes: ArrayLike<Node>, removedNodes: ArrayLike<Node>): boolean
    • When child list of editor content is changed, we can use this method to do sync the change from editor into content model. This is mostly used when user start to type in an empty line. In that case browser will remove the existing BR node in the empty line if any, and create a new TEXT node for the typed text. Here we use these information to remove original Br segment and create a new Text segment in content model. But if we find anything that cannot be handled, return false so caller will invalidate the cached model

      Parameters

      • addedNodes: ArrayLike<Node>

        Nodes added by browser during mutation

      • removedNodes: ArrayLike<Node>

        Nodes removed by browser during mutation

      Returns boolean

      True if the changed nodes are successfully reconciled, otherwise false

reconcileElementId

reconcileElementId: (element: HTMLElement) => boolean

Type declaration

    • (element: HTMLElement): boolean
    • When id is changed from DOM element, update the new ID to related content model if possible

      Parameters

      • element: HTMLElement

        The element that has id changed

      Returns boolean

      True if successfully updated, otherwise false

reconcileSelection

reconcileSelection: (model: ContentModelDocument, newSelection: DOMSelection, oldSelection?: CacheSelection) => boolean

Type declaration

    • When document content or selection is changed by user, we need to use this function to update the content model to reflect the latest document. This process can fail since the selected node may not have a related model data structure.

      Parameters

      Returns boolean

      True if reconcile successfully, otherwise false

Generated using TypeDoc