TokenList (engine/view)
@ckeditor/ckeditor5-engine/src/view/tokenlist
Token list. Allows handling (adding, removing, retrieving) a set of tokens (for example class names).
Filtering
Properties
-
Returns true if token list has no tokens set.
-
Number of tokens.
-
The set of tokens.
Methods
-
clear() → void
module:engine/view/tokenlist~TokenList#clear
-
has( name ) → boolean
module:engine/view/tokenlist~TokenList#has
-
isSimilar( other ) → boolean
module:engine/view/tokenlist~TokenList#isSimilar
-
keys() → Array<string>
module:engine/view/tokenlist~TokenList#keys
-
remove( tokens ) → void
module:engine/view/tokenlist~TokenList#remove
-
set( tokens ) → void
module:engine/view/tokenlist~TokenList#set
Sets a given token without affecting other tokens.
Parameters
tokens : ArrayOrItem<string>
Returns
void
-
-
toString() → string
module:engine/view/tokenlist~TokenList#toString
-
Used by
_canMergeAttributesFrom
to verify if the given attribute can be merged without conflicts into the attribute.This method is indirectly used by the
DowncastWriter
while downcasting anAttributeElement
to merge it with otherAttributeElement
.Returns
boolean
-
-
internal
_getConsumables( [ name ] ) → Array<string>
module:engine/view/tokenlist~TokenList#_getConsumables
Returns a list of consumables for the attribute.
Could be filtered by the given token name.
Parameters
[ name ] : string
Returns
Array<string>
-
internal
_getTokensMatch( tokenPattern ) → undefined | Array<string>
module:engine/view/tokenlist~TokenList#_getTokensMatch
Used by the Matcher to collect matching attribute tokens.
Parameters
tokenPattern : string | true | RegExp
The matched token name pattern.
Returns
undefined | Array<string>
An array of matching tokens.
-
Used by
_canSubtractAttributesOf
to verify if the given attribute can be fully subtracted from the attribute.This method is indirectly used by the
DowncastWriter
while down-casting anAttributeElement
to unwrap the AttributeElement.Parameters
other : TokenList
Returns
boolean
-
Used by
_mergeAttributesFrom
to merge a given attribute into the attribute.This method is indirectly used by the
DowncastWriter
while down-casting anAttributeElement
to merge it with other AttributeElement.Parameters
other : TokenList
Returns
void
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.