浏览代码

Docs polishing.

Piotr Jasiun 7 年之前
父节点
当前提交
0f2c598c3e
共有 2 个文件被更改,包括 26 次插入32 次删除
  1. 7 10
      packages/ckeditor5-engine/src/model/selection.js
  2. 19 22
      packages/ckeditor5-engine/src/view/selection.js

+ 7 - 10
packages/ckeditor5-engine/src/model/selection.js

@@ -56,21 +56,18 @@ export default class Selection {
 	 *		const position = new Position( root, path );
 	 *		const selection = new Selection( position );
 	 *
-	 * Creates a range inside an {@link module:engine/model/element~Element element} which starts before the first child of
- 	 * that element and ends after the last child of that element.
-	 *
+	 * 		// Creates selection at the start position of the given element.
 	 *		const paragraph = writer.createElement( 'paragraph' );
-	 *		const selection = new Selection( paragraph, 'in' );
+	 *		const selection = new Selection( paragraph, offset );
 	 *
-	 * Creates a range on an {@link module:engine/model/item~Item item} which starts before the item and ends just after the item.
+	 * 		// Creates a range inside an {@link module:engine/model/element~Element element} which starts before the
+	 * 		// first child of that element and ends after the last child of that element.
+	 *		const selection = new Selection( paragraph, 'in' );
 	 *
-	 *		const paragraph = writer.createElement( 'paragraph' );
+	 * 		// Creates a range on an {@link module:engine/model/item~Item item} which starts before the item and ends
+	 * 		// just after the item.
 	 *		const selection = new Selection( paragraph, 'on' );
 	 *
-	 * 		// Creates selection at the start position of the given element.
-	 *		const paragraph = writer.createElement( 'paragraph' );
-	 *		const selection = new Selection( paragraph, offset );
-	 *
 	 * `Selection`'s constructor allow passing additional options (`backward`) as the last argument.
 	 *
 	 * 		// Creates backward selection.

+ 19 - 22
packages/ckeditor5-engine/src/view/selection.js

@@ -55,19 +55,16 @@ export default class Selection {
 	 *		const position = new Position( root, path );
 	 *		const selection = new Selection( position );
 	 *
-	 * 		// Creates collapsed selection at the position of given item and offset.
+	 *		// Creates collapsed selection at the position of given item and offset.
 	 *		const paragraph = writer.createElement( 'paragraph' );
 	 *		const selection = new Selection( paragraph, offset );
 	 *
-	 * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
- 	 * that element and ends after the last child of that element.
-	 *
-	 *		const paragraph = writer.createElement( 'paragraph' );
+	 *		// Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
+	 *		// first child of that element and ends after the last child of that element.
 	 *		const selection = new Selection( paragraph, 'in' );
 	 *
-	 * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.
-	 *
-	 *		const paragraph = writer.createElement( 'paragraph' );
+	 *		// Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
+	 *		// just after the item.
 	 *		const selection = new Selection( paragraph, 'on' );
 	 *
 	 * `Selection`'s constructor allow passing additional options (`backward`, `fake` and `label`) as the last argument.
@@ -75,14 +72,14 @@ export default class Selection {
 	 *		// Creates backward selection.
 	 *		const selection = new Selection( range, { backward: true } );
 	 *
-	 *		// Creates fake selection.
-	 *		// Fake selection does not render as browser native selection over selected elements and is hidden to the user.
-	 * 		// This way, no native selection UI artifacts are displayed to the user and selection over elements can be
-	 * 		// represented in other way, for example by applying proper CSS class.
-	 *		const selection = new Selection( range, { fake: true } );
+	 * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
+	 * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
+	 * represented in other way, for example by applying proper CSS class.
 	 *
-	 * 		// Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
-	 * 		// (and be  properly handled by screen readers).
+	 * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
+	 * (and be  properly handled by screen readers).
+	 *
+	 *		// Creates fake selection with label.
 	 *		const selection = new Selection( range, { fake: true, label: 'foo' } );
 	 *
 	 * @param {module:engine/view/selection~Selection|module:engine/view/position~Position|
@@ -458,14 +455,14 @@ export default class Selection {
 	 *		// Sets selection as backward.
 	 *		selection.setTo( range, { backward: true } );
 	 *
-	 *		// Sets selection as fake.
-	 *		// Fake selection does not render as browser native selection over selected elements and is hidden to the user.
-	 * 		// This way, no native selection UI artifacts are displayed to the user and selection over elements can be
-	 * 		// represented in other way, for example by applying proper CSS class.
-	 *		selection.setTo( range, { fake: true } );
+	 * Fake selection does not render as browser native selection over selected elements and is hidden to the user.
+	 * This way, no native selection UI artifacts are displayed to the user and selection over elements can be
+	 * represented in other way, for example by applying proper CSS class.
+	 *
+	 * Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
+	 * (and be  properly handled by screen readers).
 	 *
-	 * 		// Additionally fake's selection label can be provided. It will be used to describe fake selection in DOM
-	 * 		// (and be  properly handled by screen readers).
+	 *		// Creates fake selection with label.
 	 *		selection.setTo( range, { fake: true, label: 'foo' } );
 	 *
 	 * @protected