ViewTokenList (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~ViewTokenList#clear
-
has( name ) → boolean
module:engine/view/tokenlist~ViewTokenList#has
-
isSimilar( other ) → boolean
module:engine/view/tokenlist~ViewTokenList#isSimilar
Returns
true
if both attributes have the same tokens.Parameters
other : ViewTokenList
Returns
boolean
-
keys() → Array<string>
module:engine/view/tokenlist~ViewTokenList#keys
-
remove( tokens ) → void
module:engine/view/tokenlist~ViewTokenList#remove
-
set( tokens ) → void
module:engine/view/tokenlist~ViewTokenList#set
Sets a given token without affecting other tokens.
Parameters
tokens : ArrayOrItem<string>
Returns
void
-
setTo( value ) → this
module:engine/view/tokenlist~ViewTokenList#setTo
-
toString() → string
module:engine/view/tokenlist~ViewTokenList#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
ViewDowncastWriter
while downcasting anViewAttributeElement
to merge it with otherAttributeElement
.Returns
boolean
-
-
internal
_getConsumables( [ name ] ) → Array<string>
module:engine/view/tokenlist~ViewTokenList#_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~ViewTokenList#_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
ViewDowncastWriter
while down-casting anViewAttributeElement
to unwrap the ViewAttributeElement.Parameters
other : ViewTokenList
Returns
boolean
-
Used by
_mergeAttributesFrom
to merge a given attribute into the attribute.This method is indirectly used by the
ViewDowncastWriter
while down-casting anViewAttributeElement
to merge it with other ViewAttributeElement.Parameters
other : ViewTokenList
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.