Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "wed/transformation"

Index

Type aliases

AttributeTable

AttributeTable: Record<string, string>

TransformationHandler

TransformationHandler: function
param

The editor.

param

The data for the transformation.

Type declaration

    • (editor: EditorAPI, data: Data): void
    • Parameters

      • editor: EditorAPI
      • data: Data

      Returns void

Variables

Const TYPE_TO_KIND

TYPE_TO_KIND: any = _.extend(Object.create(null), {// These are not actually type names. It is possible to use a kind name as a// type name if the transformation is not more specific. In this case the kind// === type.add: "add",delete: "delete",transform: "transform",insert: "add","delete-element": "delete","delete-parent": "delete",wrap: "wrap","wrap-content": "wrap","merge-with-next": "transform","merge-with-previous": "transform","swap-with-next": "transform","swap-with-previous": "transform",split: "transform",append: "add",prepend: "add",unwrap: "unwrap","add-attribute": "add","delete-attribute": "delete",})

Const TYPE_TO_NODE_TYPE

TYPE_TO_NODE_TYPE: any = _.extend(Object.create(null), {// These are not actually type names. These are here to handle the// case where the type is actually a kind name. Since they are not// more specific, the node type is set to "other". Note that// "wrap" and "unwrap" are always about elements so there is no// way to have a "wrap/unwrap" which has "other" for the node// type.add: "other",delete: "other",transform: "other",insert: "element","delete-element": "element","delete-parent": "element",wrap: "element","wrap-content": "element","merge-with-next": "element","merge-with-previous": "element","swap-with-next": "element","swap-with-previous": "element",split: "element",append: "element",prepend: "element",unwrap: "element","add-attribute": "attribute","delete-attribute": "attribute",})

Functions

_wie_splitTextNode

  • _wie_splitTextNode(dataUpdater: TreeUpdater, container: Text, offset: number): Caret
  • Utility function for wrapInElement.

    Parameters

    • dataUpdater: TreeUpdater

      A tree updater through which to update the DOM tree.

    • container: Text

      The text node to split.

    • offset: number

      Where to split the node

    Returns Caret

    A caret location marking where the split occurred.

computeIconHtml

  • computeIconHtml(iconHtml: string | undefined, transformationType: string): string | undefined
  • Parameters

    • iconHtml: string | undefined
    • transformationType: string

    Returns string | undefined

insertElement

  • insertElement(dataUpdater: TreeUpdater, parent: Node, index: number, ns: string, name: string, attrs?: AttributeTable): Element
  • Insert an element in a wed data tree.

    Parameters

    • dataUpdater: TreeUpdater

      A tree updater through which to update the DOM tree.

    • parent: Node

      The parent of the new node.

    • index: number

      Offset in the parent where to insert the new node.

    • ns: string

      The URI of the namespace to use for the new element.

    • name: string

      The name of the new element.

    • Optional attrs: AttributeTable

      An object whose fields will become attributes for the new element.

    Returns Element

    The new element.

makeElement

  • makeElement(doc: Document, ns: string, name: string, attrs?: AttributeTable): Element
  • Makes an element appropriate for a wed data tree.

    Parameters

    • doc: Document

      The document for which to make the element.

    • ns: string

      The URI of the namespace to use for the new element.

    • name: string

      The name of the new element.

    • Optional attrs: AttributeTable

      An object whose fields will become attributes for the new element.

    Returns Element

    The new element.

mergeWithNextHomogeneousSibling

  • mergeWithNextHomogeneousSibling(editor: EditorAPI, node: Element): void
  • This function merges an element with a next element of the same name. For the operation to go forward, the element must have a next sibling and this sibling must have the same name as the element being merged.

    Parameters

    • editor: EditorAPI

      The editor on which we are to perform the transformation.

    • node: Element

      The element to merge with next.

    Returns void

mergeWithPreviousHomogeneousSibling

  • mergeWithPreviousHomogeneousSibling(editor: EditorAPI, node: Element): void
  • This function merges an element with a previous element of the same name. For the operation to go forward, the element must have a previous sibling and this sibling must have the same name as the element being merged.

    Parameters

    • editor: EditorAPI

      The editor on which we are to perform the transformation.

    • node: Element

      The element to merge with previous.

    Returns void

removeMarkup

  • removeMarkup(editor: EditorAPI): void
  • Remove markup from the current selection. This turns mixed content into pure text. The selection must be well-formed, otherwise the transformation is aborted.

    Parameters

    • editor: EditorAPI

      The editor for which we are doing the transformation.

    Returns void

splitNode

  • splitNode(editor: EditorAPI, node: Node): void
  • This function splits a node at the position of the caret. If the caret is not inside the node or its descendants, an exception is raised.

    throws

    {Error} If the caret is not inside the node or its descendants.

    Parameters

    • editor: EditorAPI

      The editor on which we are to perform the transformation.

    • node: Node

      The node to split.

    Returns void

swapWithNextHomogeneousSibling

  • swapWithNextHomogeneousSibling(editor: EditorAPI, node: Element): void
  • This function swaps an element with a next element of the same name. For the operation to go forward, the element must have a next sibling and this sibling must have the same name as the element being merged.

    Parameters

    • editor: EditorAPI

      The editor on which we are to perform the transformation.

    • node: Element

      The element to swap with next.

    Returns void

swapWithPreviousHomogeneousSibling

  • swapWithPreviousHomogeneousSibling(editor: EditorAPI, node: Element): void
  • This function swaps an element with a previous element of the same name. For the operation to go forward, the element must have a previous sibling and this sibling must have the same name as the element being merged.

    Parameters

    • editor: EditorAPI

      The editor on which we are to perform the transformation.

    • node: Element

      The element to swap with previous.

    Returns void

unwrap

  • unwrap(dataUpdater: TreeUpdater, node: Element): Node[]
  • Replaces an element with its contents.

    Parameters

    • dataUpdater: TreeUpdater

      A tree updater through which to update the DOM tree.

    • node: Element

      The element to unwrap.

    Returns Node[]

    The contents of the element.

wrapInElement

  • wrapInElement(dataUpdater: TreeUpdater, startContainer: Node, startOffset: number, endContainer: Node, endOffset: number, ns: string, name: string, attrs?: AttributeTable): Element
  • Wraps a well-formed span in a new element. This span can contain text and element nodes.

    throws

    {Error} If the range is malformed or if there is an internal error.

    Parameters

    • dataUpdater: TreeUpdater

      A tree updater through which to update the DOM tree.

    • startContainer: Node

      The node where to start wrapping.

    • startOffset: number

      The offset where to start wrapping.

    • endContainer: Node

      The node where to end wrapping.

    • endOffset: number

      The offset where to end wrapping.

    • ns: string

      The URI of the namespace to use for the new element.

    • name: string

      The name of the new element.

    • Optional attrs: AttributeTable

    Returns Element

    The new element.

wrapTextInElement

  • wrapTextInElement(dataUpdater: TreeUpdater, node: Text, offset: number, endOffset: number, ns: string, name: string, attrs?: AttributeTable): Element
  • Wraps a span of text in a new element.

    Parameters

    • dataUpdater: TreeUpdater

      A tree updater through which to update the DOM tree.

    • node: Text

      The DOM node where to wrap. Must be a text node.

    • offset: number

      The offset in the node. This parameter specifies where to start wrapping.

    • endOffset: number

      Offset in the node. This parameter specifies where to end wrapping.

    • ns: string

      The URI of the namespace to use for the new element.

    • name: string

      The name of the wrapping element.

    • Optional attrs: AttributeTable

      An object whose fields will become attributes for the new element.

    Returns Element

    The new element.

Generated using TypeDoc