|
|
@@ -125,8 +125,9 @@ setData._parse = parse;
|
|
|
* const text = new Text( 'foobar' );
|
|
|
* const b = new Element( 'b', null, text );
|
|
|
* const p = new Element( 'p', null, b );
|
|
|
- * const selection = new Selection();
|
|
|
- * selection.setTo( Range.createFromParentsAndOffsets( p, 0, p, 1 ) );
|
|
|
+ * const selection = new Selection(
|
|
|
+ * Range.createFromParentsAndOffsets( p, 0, p, 1 )
|
|
|
+ * );
|
|
|
*
|
|
|
* stringify( p, selection ); // '<p>[<b>foobar</b>]</p>'
|
|
|
*
|
|
|
@@ -135,7 +136,7 @@ setData._parse = parse;
|
|
|
* const text = new Text( 'foobar' );
|
|
|
* const b = new Element( 'b', null, text );
|
|
|
* const p = new Element( 'p', null, b );
|
|
|
- * const selection = new Selection( [ Range.createFromParentsAndOffsets( text, 1, text, 5 ) ] );
|
|
|
+ * const selection = new Selection( Range.createFromParentsAndOffsets( text, 1, text, 5 ) );
|
|
|
*
|
|
|
* stringify( p, selection ); // '<p><b>f{ooba}r</b></p>'
|
|
|
*
|
|
|
@@ -146,9 +147,8 @@ setData._parse = parse;
|
|
|
* Multiple ranges are supported:
|
|
|
*
|
|
|
* const text = new Text( 'foobar' );
|
|
|
- * const selection = new Selection();
|
|
|
- * selection.setTo( [
|
|
|
- Range.createFromParentsAndOffsets( text, 0, text, 1 ) ),
|
|
|
+ * const selection = new Selection( [
|
|
|
+ * Range.createFromParentsAndOffsets( text, 0, text, 1 ) ),
|
|
|
* Range.createFromParentsAndOffsets( text, 3, text, 5 ) )
|
|
|
* ] );
|
|
|
*
|
|
|
@@ -214,8 +214,7 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
|
|
|
selectionOrPositionOrRange instanceof Position ||
|
|
|
selectionOrPositionOrRange instanceof Range
|
|
|
) {
|
|
|
- selection = new Selection();
|
|
|
- selection.setTo( selectionOrPositionOrRange );
|
|
|
+ selection = new Selection( selectionOrPositionOrRange );
|
|
|
} else {
|
|
|
selection = selectionOrPositionOrRange;
|
|
|
}
|