Proxy to manipulate text nodes. General contract is, that all modifications are temporary, until you decide to persist the changes. Note, that a persisted proxy should not be re-used as it may cause unexpected results or may even fail.

Hierarchy (view full)

Implements

Constructors

  • Constructor.

    Parameters

    • delegate: Text

      the original text node to wrap

    • editor: default

      CKEditor instance

    • mutable: boolean = true

      signals, if this proxy should be mutable; trying to modify an immutable proxy will raise an error.

    Returns TextProxy

Properties

editor: default

Represents the editor instance. May be used to access configuration options for example.

Mimics TextFilterParams, which helps to deal with rule processing.

node: TextProxy = ...

Represents the node instance. For TextProxy this is just the proxy class itself.

Mimics TextFilterParams, which helps to deal with rule processing.

parentRule: TextFilterRule = ...

Represents the parent rule. No-Operation rule for TextProxy.

Mimics TextFilterParams, which helps to deal with rule processing.

Accessors

  • get delegate(): N
  • Returns the wrapped delegate.

    This delegate should not be used for directly manipulating the DOM, as nested rules may not veto applied changes.

    If a manipulation is done, it must be ensured, that previously run rules on this node may be rerun. It is generally considered safe to do manipulation to child elements, as these are processed after this node, so that all applicable rules have a chance to modify these nodes again.

    Returns N

  • get empty(): boolean
  • Signals, if this node is empty, thus, has no child nodes.

    Returns boolean

    See

    isEmpty

  • get lastNode(): boolean
  • Signals, if this is the last node in parent. Always false if no parent exists.

    Returns boolean

  • get mutable(): boolean
  • Signals, if this element is mutable.

    Returns boolean

  • get name(): string
  • Retrieves the name of the node (lower case).

    Returns string

  • get ownerDocument(): Document
  • Access owner document.

    Returns Document

  • get parentElement(): null | NodeProxy<HTMLElement>
  • Access to the parent element of this node.

    Returns null | NodeProxy<HTMLElement>

  • get parentNode(): null | NodeProxy<Node & ParentNode>
  • Access to the parent node of this node.

    Returns null | NodeProxy<Node & ParentNode>

  • get realName(): string
  • Retrieves the name of the node (lower case). If renaming is supported by this instance, it may differ from name, otherwise, it is the same.

    Returns string

  • get remove(): boolean
  • Signals, if this node is meant to be removed. This includes recursive removal (including children) as well as just removing this node (replacing it by its children).

    Returns boolean

  • set remove(remove): void
  • Signals, if this mutable element represents a state, where the element shall be removed, including all its children.

    It is important to note, that setting this modifies the NodeProxy#state, thus setting this overrides any other decisions upon the state of the node.

    Duplicate Spaces: If you apply this modification, it may end up having duplicate space characters in your DOM. For example if removing the `` element (and all its children) in this scenario:

    Lorem Ipsum Dolor
    
    you will end up having:
    Lorem  Dolor
    
    with two white space characters in the middle. You may want to detect such states, and remove the duplicate space. You shouldn't do this, though, if you are within a space preserving context such as `
    `.

    Parameters

    • remove: boolean

    Returns void

  • get removeChildren(): boolean
  • Signals, if this node represents a state, where the children of the node should be removed.

    Returns boolean

  • set removeChildren(remove): void
  • Sets, if this node represents a state, where the children of the node shall be removed.

    It is important to note, that setting this modifies the NodeProxy#state, thus setting this overrides any other decisions upon the state of the node.

    Parameters

    • remove: boolean

      true to mark as remove children; false otherwise.

    Returns void

  • get replaceByChildren(): boolean
  • Signals, if this node represents a state, where the node shall be removed, while attaching the children to the parent node.

    Returns boolean

  • set replaceByChildren(replace): void
  • Sets, if this node represents a state, where the node shall be removed, while attaching the children to the parent node.

    It is important to note, that setting this modifies the NodeProxy#state, thus setting this overrides any other decisions upon the state of the node.

    Parameters

    • replace: boolean

      true to mark as replace with children; false otherwise.

    Returns void

  • get singleton(): boolean
  • Signals, if this is the only child node at parent node.

    Returns boolean

  • get textContent(): string
  • Gets the text content, which may be overridden.

    Returns string

  • set textContent(value): void
  • Sets the text content. Only allowed in mutable state.

    Parameters

    • value: string

      text content to set.

    Returns void

Methods

  • Apply given rules. If any of the rules will invalidate this node either by deletion or by replacing it, no further rules will be applied.

    Parameters

    • Rest ...rules: (undefined | TextFilterRule)[]

      rules to apply in given order

    Returns null | Node

    a node, if filtering should be restarted from this node; null otherwise.

  • Get first (matching) child node of the given element.

    Parameters

    • Optional condition: string | ChildPredicate

      string: the node name to match (ignoring case), predicate: the predicate to apply.

    Returns null | NodeProxy<ChildNode>

  • Signals, if this element is empty.

    Parameters

    • Optional considerChildNode: ChildPredicate

      signals, if a given node shall be considered while determining empty state

    Returns boolean

  • Wraps the given node into a NodeProxy. If the node is falsy, null will be returned.

    Type Parameters

    • T extends Node

    Parameters

    • node: undefined | null | T

      node to wrap

    • mutable: boolean = true

      signals, if this representation is mutable or not

    Returns null | NodeProxy<T>

    NodeProxy for given node; null for falsy values