Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Docs fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2ciek committed Feb 28, 2018
1 parent 29e0ad3 commit a9cec6e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/model/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export default class Selection {
* const otherSelection = new Selection();
* selection.setTo( otherSelection );
*
* // Sets selection to the document selection.
* // Sets selection to the given document selection.
* // Note: It doesn't copies selection attributes.
* const documentSelection = new DocumentSelection( doc );
* selection.setTo( documentSelection );
Expand All @@ -337,15 +337,15 @@ export default class Selection {
* const paragraph = writer.createElement( 'paragraph' );
* selection.setTo( paragraph, offset );
*
* // Sets selection inside the node.
* // Sets selection inside the given node.
* const paragraph = writer.createElement( 'paragraph' );
* selection.setTo( paragraph, 'in', { backward } );
*
* // Sets selection on the node.
* // Sets selection on the given node.
* const paragraph = writer.createElement( 'paragraph' );
* selection.setTo( paragraph, 'on', { backward } );
*
* // Clears selection. Removes all ranges.
* // Removes all selection's ranges.
* selection.setTo( null );
*
* @param {module:engine/model/selection~Selection|module:engine/model/documentselection~DocumentSelection|
Expand Down
33 changes: 16 additions & 17 deletions src/model/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,55 +905,54 @@ export default class Writer {
* {@link module:engine/model/element~Node node}, {@link module:engine/model/position~Position position},
* {@link module:engine/model/range~Range range}, an iterable of {@link module:engine/model/range~Range ranges} or null.
*
* // Sets ranges from the given range.
* // Sets selection to the given range.
* const range = new Range( start, end );
* writer.setSelection( range, { backward } );
*
* // Sets ranges from the iterable of ranges.
* // Sets selection to given ranges.
* const ranges = [ new Range( start1, end2 ), new Range( star2, end2 ) ];
* writer.setSelection( range, { backward } );
*
* // Sets ranges from the other selection.
* // Sets selection to other selection.
* const otherSelection = new Selection();
* writer.setSelection( otherSelection );
*
* // Sets ranges from the given document selection's ranges.
* // Sets selection to the given document selection.
* const documentSelection = new DocumentSelection( doc );
* writer.setSelection( documentSelection );
*
* // Sets collapsed range at the given position.
* // Sets collapsed selection at the given position.
* const position = new Position( root, path );
* writer.setSelection( position );
*
* // Sets range at the position of given node and offset.
* // Sets collapsed selection at the position of the given node and an offset.
* const paragraph = writer.createElement( 'paragraph' );
* writer.setSelection( paragraph, offset );
*
* // Sets range inside the node.
* const paragraph = writer.createElement( 'paragraph', { backward } );
* writer.setSelection( paragraph, 'in' );
* // Sets selection inside the given node.
* const paragraph = writer.createElement( 'paragraph' );
* writer.setSelection( paragraph, 'in', { backward } );
*
* // Sets range on the node.
* const paragraph = writer.createElement( 'paragraph', { backward } );
* writer.setSelection( paragraph, 'on' );
* // Sets selection on the given node.
* const paragraph = writer.createElement( 'paragraph' );
* writer.setSelection( paragraph, 'on', { backward } );
*
* // Removes all ranges.
* // Removes all selection's ranges.
* writer.setSelection( null );
*
* Throws `writer-incorrect-use` error when the writer is used outside the `change()` block.
*
* @param {module:engine/model/selection~Selection|module:engine/model/documentselection~DocumentSelection|
* module:engine/model/position~Position|module:engine/model/node~Node|
* Iterable.<module:engine/model/range~Range>|module:engine/model/range~Range|null} selectable
* @param {Object|Number|'before'|'end'|'after'|'on'|'in'} [optionsOrPlaceOrOffset]
* @param {Boolean} [optionsOrPlaceOrOffset.backward]
* @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset]
* @param {Object} [options]
* @param {Boolean} [options.backward]
*/
setSelection( selectable, optionsOrPlaceOrOffset, options ) {
setSelection( selectable, placeOrOffset, options ) {
this._assertWriterUsedCorrectly();

this.model.document.selection._setTo( selectable, optionsOrPlaceOrOffset, options );
this.model.document.selection._setTo( selectable, placeOrOffset, options );
}

/**
Expand Down

0 comments on commit a9cec6e

Please sign in to comment.