@@ -15,7 +15,7 @@ import View from '../view/view';
1515import ViewDocumentFragment from '../view/documentfragment' ;
1616import XmlDataProcessor from '../dataprocessor/xmldataprocessor' ;
1717import ViewElement from '../view/element' ;
18- import Selection from '../view/selection ' ;
18+ import DocumentSelection from '../view/documentselection ' ;
1919import Range from '../view/range' ;
2020import Position from '../view/position' ;
2121import AttributeElement from '../view/attributeelement' ;
@@ -125,8 +125,8 @@ setData._parse = parse;
125125 *
126126 * stringify( fragment ); // '<p style="color:red;"></p><b name="test">foobar</b>'
127127 *
128- * Additionally, a {@link module:engine/view/selection~Selection selection} instance can be provided. Ranges from the selection
129- * will then be included in output data.
128+ * Additionally, a {@link module:engine/view/documentselection~DocumentSelection selection} instance can be provided.
129+ * Ranges from the selection will then be included in output data.
130130 * If a range position is placed inside the element node, it will be represented with `[` and `]`:
131131 *
132132 * const text = new Text( 'foobar' );
@@ -163,9 +163,9 @@ setData._parse = parse;
163163 * stringify( text, selection ); // '{f}oo{ba}r'
164164 *
165165 * A {@link module:engine/view/range~Range range} or {@link module:engine/view/position~Position position} instance can be provided
166- * instead of the {@link module:engine/view/selection~Selection selection} instance. If a range instance is provided, it will be
167- * converted to a selection containing this range. If a position instance is provided, it will be converted to a selection
168- * containing one range collapsed at this position.
166+ * instead of the {@link module:engine/view/documentselection~DocumentSelection selection} instance. If a range instance
167+ * is provided, it will be converted to a selection containing this range. If a position instance is provided, it will
168+ * be converted to a selection containing one range collapsed at this position.
169169 *
170170 * const text = new Text( 'foobar' );
171171 * const range = Range.createFromParentsAndOffsets( text, 0, text, 1 );
@@ -206,7 +206,7 @@ setData._parse = parse;
206206 *
207207 * @param {module:engine/view/text~Text|module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment }
208208 * node The node to stringify.
209- * @param {module:engine/view/selection~Selection |module:engine/view/position~Position|module:engine/view/range~Range }
209+ * @param {module:engine/view/documentselection~DocumentSelection |module:engine/view/position~Position|module:engine/view/range~Range }
210210 * [selectionOrPositionOrRange = null ]
211211 * A selection instance whose ranges will be included in the returned string data. If a range instance is provided, it will be
212212 * converted to a selection containing this range. If a position instance is provided, it will be converted to a selection
@@ -231,7 +231,7 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
231231 selectionOrPositionOrRange instanceof Position ||
232232 selectionOrPositionOrRange instanceof Range
233233 ) {
234- selection = new Selection ( selectionOrPositionOrRange ) ;
234+ selection = new DocumentSelection ( selectionOrPositionOrRange ) ;
235235 } else {
236236 selection = selectionOrPositionOrRange ;
237237 }
@@ -257,7 +257,7 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
257257 * parse( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
258258 *
259259 * The method can parse multiple {@link module:engine/view/range~Range ranges} provided in string data and return a
260- * {@link module:engine/view/selection~Selection selection} instance containing these ranges. Ranges placed inside
260+ * {@link module:engine/view/documentselection~DocumentSelection selection} instance containing these ranges. Ranges placed inside
261261 * {@link module:engine/view/text~Text text} nodes should be marked using `{` and `}` brackets:
262262 *
263263 * const { text, selection } = parse( 'f{ooba}r' );
@@ -278,8 +278,9 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
278278 * In the example above, the first range (`{fo}`) will be added to the selection as the second one, the second range (`{ar}`) will be
279279 * added as the third and the third range (`{ba}`) will be added as the first one.
280280 *
281- * If the selection's last range should be added as a backward one (so the {@link module:engine/view/selection~Selection#anchor selection
282- * anchor} is represented by the `end` position and {@link module:engine/view/selection~Selection#focus selection focus} is
281+ * If the selection's last range should be added as a backward one
282+ * (so the {@link module:engine/view/documentselection~DocumentSelection#anchor selection anchor} is represented
283+ * by the `end` position and {@link module:engine/view/documentselection~DocumentSelection#focus selection focus} is
283284 * represented by the `start` position), use the `lastRangeBackward` flag:
284285 *
285286 * const { root, selection } = parse( `{foo}bar{baz}`, { lastRangeBackward: true } );
@@ -298,11 +299,11 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
298299 * @param {String } data An HTML-like string to be parsed.
299300 * @param {Object } options
300301 * @param {Array.<Number> } [options.order] An array with the order of parsed ranges added to the returned
301- * {@link module:engine/view/selection~Selection Selection} instance. Each element should represent the desired position of each range in
302- * the selection instance. For example: `[2, 3, 1]` means that the first range will be placed as the second, the second as the third and
303- * the third as the first.
302+ * {@link module:engine/view/documentselection~DocumentSelection Selection} instance. Each element should represent the
303+ * desired position of each range in the selection instance. For example: `[2, 3, 1]` means that the first range will be
304+ * placed as the second, the second as the third and the third as the first.
304305 * @param {Boolean } [options.lastRangeBackward=false] If set to `true`, the last range will be added as backward to the returned
305- * {@link module:engine/view/selection~Selection selection} instance.
306+ * {@link module:engine/view/documentselection~DocumentSelection selection} instance.
306307 * @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment }
307308 * [options.rootElement=null] The default root to use when parsing elements.
308309 * When set to `null`, the root element will be created automatically. If set to
@@ -351,7 +352,7 @@ export function parse( data, options = {} ) {
351352
352353 // When ranges are present - return object containing view, and selection.
353354 if ( ranges . length ) {
354- const selection = new Selection ( ranges , { backward : ! ! options . lastRangeBackward } ) ;
355+ const selection = new DocumentSelection ( ranges , { backward : ! ! options . lastRangeBackward } ) ;
355356
356357 return {
357358 view,
@@ -594,7 +595,8 @@ class ViewStringify {
594595 * Creates a view stringify instance.
595596 *
596597 * @param root
597- * @param {module:engine/view/selection~Selection } selection A selection whose ranges should also be converted to a string.
598+ * @param {module:engine/view/documentselection~DocumentSelection } selection A selection whose ranges
599+ * should also be converted to a string.
598600 * @param {Object } options An options object.
599601 * @param {Boolean } [options.showType=false] When set to `true`, the type of elements will be printed (`<container:p>`
600602 * instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).
0 commit comments