RangeParser (engine/dev-utils)
@ckeditor/ckeditor5-engine/src/dev-utils/view
Private helper class used for converting ranges represented as text inside view text nodes.
Filtering
Methods
-
constructor( options = { [options.sameSelectionCharacters] } )
module:engine/dev-utils/view~RangeParser#constructor
Creates a range parser instance.
Parameters
options : Object
The range parser configuration.
Properties[ options.sameSelectionCharacters ] : Boolean
When set to
true
, the selection inside the text is marked as{
and}
and the selection outside the text as[
and]
. When set tofalse
, both are marked as[
and]
.Defaults to
false
-
Parses the view and returns ranges represented inside text nodes. The method will remove all occurrences of
{
,}
,[
and]
from found text nodes. If a text node is empty after the process, it will be removed, too.Parameters
node : Node
The starting node.
order : Array.<Number>
The order of ranges. Each element should represent the desired position of the range after sorting. For example:
[2, 3, 1]
means that the first range will be placed as the second, the second as the third and the third as the first.
Returns
Array.<Range>
An array with ranges found.
-
-
Gathers positions of brackets inside the view tree starting from the provided node. The method will remove all occurrences of
{
,}
,[
and]
from found text nodes. If a text node is empty after the process, it will be removed, too.Parameters
node : Node
Staring node.
-
private
_sortRanges( ranges, rangesOrder ) → Array
module:engine/dev-utils/view~RangeParser#_sortRanges
Sorts ranges in a given order. Range order should be an array and each element should represent the desired position of the range after sorting. For example:
[2, 3, 1]
means that the first range will be placed as the second, the second as the third and the third as the first.Parameters
ranges : Array.<Range>
Ranges to sort.
rangesOrder : Array.<Number>
An array with new range order.
Returns
Array
Sorted ranges array.
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.