TextNode class

A span of formatted text within a line in a Notus document.

TextNode is a leaf node of a document tree.

Parent of a text node is always a LineNode, and as a consequence text node's value cannot contain any line-break characters.

See also:

  • LineNode, a node representing a line of text.
  • BlockNode, a node representing a group of lines.
Inheritance

Constructors

TextNode([String content = ''])

Properties

documentOffset int
Offset in characters of this node in the document.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isFirst bool
Returns true if this node is the first node in the parent list.
no setterinherited
isLast bool
Returns true if this node is the last node in the parent list.
no setterinherited
length int
Length of this node in characters.
no setterinherited
list LinkedList<Node>?
The linked list containing this element.
no setterinherited
mounted bool
Returns true if this node is currently mounted, e.g. parent is not null.
no setterinherited
next Node?
The successor of this element in its linked list.
no setterinherited
offset int
Offset in characters of this node relative to parent node.
no setterinherited
parent LineNode?
Current parent of this node. May be null if this node is not mounted.
no setterinherited
previous Node?
The predecessor of this element in its linked list.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style NotusStyle
Style of this node.
no setterinherited
value String
Plain-text value of this node.
no setterinherited

Methods

applyAttribute(NotusAttribute attribute) → void
Applies style attribute to this node.
inherited
applyStyle(NotusStyle value) → void
Applies new style value to this node. Provided value is merged into current style.
inherited
clearStyle() → void
Clears style of this node.
inherited
containsOffset(int offset) bool
Returns true if this node contains character at specified offset in the document.
inherited
cutAt(int index) LeafNode?
Cuts a leaf node from index to the end of this node and returns new node in detached state (e.g. mounted returns false).
inherited
delete(int index, int? length) → void
Delete length characters of this node starting from index.
inherited
formatAndOptimize(NotusStyle? style) → void
Formats this node and optimizes it with adjacent leaf nodes if needed.
inherited
insert(int index, String value, NotusStyle? style) → void
Insert text at specified character index with style style.
inherited
insertAfter(Node entry) → void
Insert an element after this element in this element's linked list.
inherited
insertBefore(Node entry) → void
Insert an element before this element in this element's linked list.
inherited
isolate(int index, int length) LeafNode
Isolates a new leaf node starting at index with specified length.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optimize() → void
Optimizes this text node by merging it with adjacent nodes if they share the same style.
inherited
retain(int index, int? length, NotusStyle? style) → void
Format length characters of this node starting from index with specified style style.
inherited
splitAt(int index) LeafNode?
Splits this leaf node at index and returns new node.
inherited
toDelta() Delta
Returns Delta representation of this node.
inherited
toPlainText() String
Returns plain-text representation of this node.
inherited
toString() String
A string representation of this object.
inherited
Unlink the element from its linked list.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited