Constructor
new ve.ce.TextStateChunk(text, elements, type)
#
Uniformly annotated chunk of text content
Parameters:
Name | Type | Description |
---|---|---|
text |
string | Plain text |
elements |
Array.<HTMLElement> | Annotation elements in force |
type |
string | If this is a unicorn then 'unicorn', else 'text' |
- Source:
Properties
elements
#
Properties:
Name | Type | Description |
---|---|---|
elements |
Array.<HTMLElement> | The annotation elements open at this chunk |
- Source:
text
#
Properties:
Name | Type | Description |
---|---|---|
text |
string | The plain text of this chunk |
- Source:
type
#
Properties:
Name | Type | Description |
---|---|---|
type |
string | The chunk type: 'text' or 'unicorn' |
- Source:
Methods
hasEqualElements(other) → {boolean}
#
Test whether this chunk has the same annotations (in order) as another
Parameters:
Name | Type | Description |
---|---|---|
other |
ve.ce.TextStateChunk | The other chunk |
- Source:
Returns:
True if the chunks have the same annotations
- Type
- boolean
isEqual(other) → {boolean}
#
Test whether this chunk is equal to another chunk in both elements and text.
Parameters:
Name | Type | Description |
---|---|---|
other |
ve.ce.TextStateChunk | The other chunk |
- Source:
Returns:
True if the chunks are equal
- Type
- boolean
compareElements(element1, element2) → {boolean}static
#
Test whether two elements are equal as annotations.
TODO: Improve this test. Currently annotations are compared by tag name and
certain attributes, which results in a stricter test than that of
ve.dm
.ModelRegistry#matchElement . That is, a element pair that tests unequal
here might still both match the same ve.dm
.Annotation object.
Parameters:
Name | Type | Description |
---|---|---|
element1 |
HTMLElement | An annotation element |
element2 |
HTMLElement | Another annotation element |
- Source:
Returns:
True if the elements are equal as annotations
- Type
- boolean