Kaynağa Gözat

Updated docs.

Szymon Kupś 7 yıl önce
ebeveyn
işleme
bac2fdbdb4

+ 6 - 6
packages/ckeditor5-engine/src/conversion/downcast-selection-converters.js

@@ -5,7 +5,7 @@
 
 /**
  * Contains {@link module:engine/model/selection~Selection model selection} to
- * {@link module:engine/view/selection~Selection view selection} converters for
+ * {@link module:engine/view/documentselection~DocumentSelection view selection} converters for
  * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher}.
  *
  * @module engine/conversion/downcast-selection-converters
@@ -13,8 +13,8 @@
 
 /**
  * Function factory, creates a converter that converts non-collapsed {@link module:engine/model/selection~Selection model selection} to
- * {@link module:engine/view/selection~Selection view selection}. The converter consumes appropriate value from `consumable` object
- * and maps model positions from selection to view positions.
+ * {@link module:engine/view/documentselection~DocumentSelection view selection}. The converter consumes appropriate
+ * value from `consumable` object and maps model positions from selection to view positions.
  *
  *		modelDispatcher.on( 'selection', convertRangeSelection() );
  *
@@ -45,9 +45,9 @@ export function convertRangeSelection() {
 
 /**
  * Function factory, creates a converter that converts collapsed {@link module:engine/model/selection~Selection model selection} to
- * {@link module:engine/view/selection~Selection view selection}. The converter consumes appropriate value from `consumable` object,
- * maps model selection position to view position and breaks {@link module:engine/view/attributeelement~AttributeElement attribute elements}
- * at the selection position.
+ * {@link module:engine/view/documentselection~DocumentSelection view selection}. The converter consumes appropriate
+ * value from `consumable` object, maps model selection position to view position and breaks
+ * {@link module:engine/view/attributeelement~AttributeElement attribute elements} at the selection position.
  *
  *		modelDispatcher.on( 'selection', convertCollapsedSelection() );
  *

+ 3 - 3
packages/ckeditor5-engine/src/conversion/upcast-selection-converters.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * Contains {@link module:engine/view/selection~Selection view selection}
+ * Contains {@link module:engine/view/documentselection~DocumentSelection view selection}
  * to {@link module:engine/model/selection~Selection model selection} conversion helpers.
  *
  * @module engine/conversion/upcast-selection-converters
@@ -13,8 +13,8 @@
 import ModelSelection from '../model/selection';
 
 /**
- * Function factory, creates a callback function which converts a {@link module:engine/view/selection~Selection view selection} taken
- * from the {@link module:engine/view/document~Document#event:selectionChange} event
+ * Function factory, creates a callback function which converts a {@link module:engine/view/documentselection~DocumentSelection
+ * view selection} taken from the {@link module:engine/view/document~Document#event:selectionChange} event
  * and sets in on the {@link module:engine/model/document~Document#selection model}.
  *
  * **Note**: because there is no view selection change dispatcher nor any other advanced view selection to model

+ 16 - 14
packages/ckeditor5-engine/src/dev-utils/view.js

@@ -123,8 +123,8 @@ setData._parse = parse;
  *
  *		stringify( fragment ); // '<p style="color:red;"></p><b name="test">foobar</b>'
  *
- * Additionally, a {@link module:engine/view/selection~Selection selection} instance can be provided. Ranges from the selection
- * will then be included in output data.
+ * Additionally, a {@link module:engine/view/documentselection~DocumentSelection selection} instance can be provided.
+ * Ranges from the selection will then be included in output data.
  * If a range position is placed inside the element node, it will be represented with `[` and `]`:
  *
  *		const text = new Text( 'foobar' );
@@ -161,9 +161,9 @@ setData._parse = parse;
  *		stringify( text, selection ); // '{f}oo{ba}r'
  *
  * A {@link module:engine/view/range~Range range} or {@link module:engine/view/position~Position position} instance can be provided
- * instead of the {@link module:engine/view/selection~Selection selection} instance. If a range instance is provided, it will be
- * converted to a selection containing this range. If a position instance is provided, it will be converted to a selection
- * containing one range collapsed at this position.
+ * instead of the {@link module:engine/view/documentselection~DocumentSelection selection} instance. If a range instance
+ * is provided, it will be converted to a selection containing this range. If a position instance is provided, it will
+ * be converted to a selection containing one range collapsed at this position.
  *
  *		const text = new Text( 'foobar' );
  *		const range = Range.createFromParentsAndOffsets( text, 0, text, 1 );
@@ -197,7 +197,7 @@ setData._parse = parse;
  *
  * @param {module:engine/view/text~Text|module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment}
  * node The node to stringify.
- * @param {module:engine/view/selection~Selection|module:engine/view/position~Position|module:engine/view/range~Range}
+ * @param {module:engine/view/documentselection~DocumentSelection|module:engine/view/position~Position|module:engine/view/range~Range}
  * [selectionOrPositionOrRange = null ]
  * A selection instance whose ranges will be included in the returned string data. If a range instance is provided, it will be
  * converted to a selection containing this range. If a position instance is provided, it will be converted to a selection
@@ -246,7 +246,7 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
  *		parse( '<b>foo</b><i>bar</i>' ); // Returns a document fragment with two child elements.
  *
  * The method can parse multiple {@link module:engine/view/range~Range ranges} provided in string data and return a
- * {@link module:engine/view/selection~Selection selection} instance containing these ranges. Ranges placed inside
+ * {@link module:engine/view/documentselection~DocumentSelection selection} instance containing these ranges. Ranges placed inside
  * {@link module:engine/view/text~Text text} nodes should be marked using `{` and `}` brackets:
  *
  *		const { text, selection } = parse( 'f{ooba}r' );
@@ -267,8 +267,9 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
  * In the example above, the first range (`{fo}`) will be added to the selection as the second one, the second range (`{ar}`) will be
  * added as the third and the third range (`{ba}`) will be added as the first one.
  *
- * If the selection's last range should be added as a backward one (so the {@link module:engine/view/selection~Selection#anchor selection
- * anchor} is represented by the `end` position and {@link module:engine/view/selection~Selection#focus selection focus} is
+ * If the selection's last range should be added as a backward one
+ * (so the {@link module:engine/view/documentselection~DocumentSelection#anchor selection anchor} is represented
+ * by the `end` position and {@link module:engine/view/documentselection~DocumentSelection#focus selection focus} is
  * represented by the `start` position), use the `lastRangeBackward` flag:
  *
  *		const { root, selection } = parse( `{foo}bar{baz}`, { lastRangeBackward: true } );
@@ -287,11 +288,11 @@ export function stringify( node, selectionOrPositionOrRange = null, options = {}
  * @param {String} data An HTML-like string to be parsed.
  * @param {Object} options
  * @param {Array.<Number>} [options.order] An array with the order of parsed ranges added to the returned
- * {@link module:engine/view/selection~Selection Selection} instance. Each element should represent the desired position of each range in
- * 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
- * the third as the first.
+ * {@link module:engine/view/documentselection~DocumentSelection Selection} instance. Each element should represent the
+ * desired position of each range in 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 the third as the first.
  * @param {Boolean} [options.lastRangeBackward=false] If set to `true`, the last range will be added as backward to the returned
- * {@link module:engine/view/selection~Selection selection} instance.
+ * {@link module:engine/view/documentselection~DocumentSelection selection} instance.
  * @param {module:engine/view/element~Element|module:engine/view/documentfragment~DocumentFragment}
  * [options.rootElement=null] The default root to use when parsing elements.
  * When set to `null`, the root element will be created automatically. If set to
@@ -583,7 +584,8 @@ class ViewStringify {
 	 * Creates a view stringify instance.
 	 *
 	 * @param root
-	 * @param {module:engine/view/selection~Selection} selection A selection whose ranges should also be converted to a string.
+	 * @param {module:engine/view/documentselection~DocumentSelection} selection A selection whose ranges
+	 * should also be converted to a string.
 	 * @param {Object} options An options object.
 	 * @param {Boolean} [options.showType=false] When set to `true`, the type of elements will be printed (`<container:p>`
 	 * instead of `<p>`, `<attribute:b>` instead of `<b>` and `<empty:img>` instead of `<img>`).

+ 2 - 2
packages/ckeditor5-engine/src/view/document.js

@@ -14,7 +14,7 @@ import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 
 /**
  * Document class creates an abstract layer over the content editable area, contains a tree of view elements and
- * {@link module:engine/view/selection~Selection view selection} associated with this document.
+ * {@link module:engine/view/documentselection~DocumentSelection view selection} associated with this document.
  *
  * @mixes module:utils/observablemixin~ObservableMixin
  */
@@ -27,7 +27,7 @@ export default class Document {
 		 * Selection done on this document.
 		 *
 		 * @readonly
-		 * @member {module:engine/view/selection~Selection} module:engine/view/document~Document#selection
+		 * @member {module:engine/view/documentselection~DocumentSelection} module:engine/view/document~Document#selection
 		 */
 		this.selection = new DocumentSelection();
 

+ 1 - 1
packages/ckeditor5-engine/src/view/documentselection.js

@@ -674,7 +674,7 @@ export default class DocumentSelection {
 mix( DocumentSelection, EmitterMixin );
 
 /**
- * Fired whenever selection ranges are changed through {@link ~Selection Selection API}.
+ * Fired whenever selection ranges are changed through {@link ~DocumentSelection Selection API}.
  *
  * @event change
  */

+ 9 - 9
packages/ckeditor5-engine/src/view/domconverter.js

@@ -103,23 +103,23 @@ export default class DomConverter {
 	}
 
 	/**
-	 * Binds given DOM element that represents fake selection to {@link module:engine/view/selection~Selection view selection}.
-	 * View selection copy is stored and can be retrieved by {@link module:engine/view/domconverter~DomConverter#fakeSelectionToView}
-	 * method.
+	 * Binds given DOM element that represents fake selection to {@link module:engine/view/documentselection~DocumentSelection
+	 * view selection}. View selection copy is stored and can be retrieved by
+	 * {@link module:engine/view/domconverter~DomConverter#fakeSelectionToView} method.
 	 *
 	 * @param {HTMLElement} domElement
-	 * @param {module:engine/view/selection~Selection} viewSelection
+	 * @param {module:engine/view/documentselection~DocumentSelection} viewSelection
 	 */
 	bindFakeSelection( domElement, viewSelection ) {
 		this._fakeSelectionMapping.set( domElement, new ViewDocumentSelection( viewSelection ) );
 	}
 
 	/**
-	 * Returns {@link module:engine/view/selection~Selection view selection} instance corresponding to given DOM element that represents
-	 * fake selection. Returns `undefined` if binding to given DOM element does not exists.
+	 * Returns {@link module:engine/view/documentselection~DocumentSelection view selection} instance corresponding to
+	 * given DOM element that represents fake selection. Returns `undefined` if binding to given DOM element does not exists.
 	 *
 	 * @param {HTMLElement} domElement
-	 * @returns {module:engine/view/selection~Selection|undefined}
+	 * @returns {module:engine/view/documentselection~DocumentSelection|undefined}
 	 */
 	fakeSelectionToView( domElement ) {
 		return this._fakeSelectionMapping.get( domElement );
@@ -450,11 +450,11 @@ export default class DomConverter {
 	}
 
 	/**
-	 * Converts DOM selection to view {@link module:engine/view/selection~Selection}.
+	 * Converts DOM selection to view {@link module:engine/view/documentselection~DocumentSelection}.
 	 * Ranges which cannot be converted will be omitted.
 	 *
 	 * @param {Selection} domSelection DOM selection.
-	 * @returns {module:engine/view/selection~Selection} View selection.
+	 * @returns {module:engine/view/documentselection~DocumentSelection} View selection.
 	 */
 	domSelectionToView( domSelection ) {
 		// DOM selection might be placed in fake selection container.

+ 8 - 6
packages/ckeditor5-engine/src/view/observer/selectionobserver.js

@@ -42,10 +42,12 @@ export default class SelectionObserver extends Observer {
 		this.mutationObserver = view.getObserver( MutationObserver );
 
 		/**
-		 * Reference to the view {@link module:engine/view/selection~Selection} object used to compare new selection with it.
+		 * Reference to the view {@link module:engine/view/documentselection~DocumentSelection} object used to compare
+		 * new selection with it.
 		 *
 		 * @readonly
-		 * @member {module:engine/view/selection~Selection} module:engine/view/observer/selectionobserver~SelectionObserver#selection
+		 * @member {module:engine/view/documentselection~DocumentSelection}
+		 * module:engine/view/observer/selectionobserver~SelectionObserver#selection
 		 */
 		this.selection = this.document.selection;
 
@@ -205,9 +207,9 @@ export default class SelectionObserver extends Observer {
  * @see module:engine/view/observer/selectionobserver~SelectionObserver
  * @event module:engine/view/document~Document#event:selectionChange
  * @param {Object} data
- * @param {module:engine/view/selection~Selection} data.oldSelection Old View selection which is
+ * @param {module:engine/view/documentselection~DocumentSelection} data.oldSelection Old View selection which is
  * {@link module:engine/view/document~Document#selection}.
- * @param {module:engine/view/selection~Selection} data.newSelection New View selection which is converted DOM selection.
+ * @param {module:engine/view/documentselection~DocumentSelection} data.newSelection New View selection which is converted DOM selection.
  * @param {Selection} data.domSelection Native DOM selection.
  */
 
@@ -222,8 +224,8 @@ export default class SelectionObserver extends Observer {
  * @see module:engine/view/observer/selectionobserver~SelectionObserver
  * @event module:engine/view/document~Document#event:selectionChangeDone
  * @param {Object} data
- * @param {module:engine/view/selection~Selection} data.oldSelection Old View selection which is
+ * @param {module:engine/view/documentselection~DocumentSelection} data.oldSelection Old View selection which is
  * {@link module:engine/view/document~Document#selection}.
- * @param {module:engine/view/selection~Selection} data.newSelection New View selection which is converted DOM selection.
+ * @param {module:engine/view/documentselection~DocumentSelection} data.newSelection New View selection which is converted DOM selection.
  * @param {Selection} data.domSelection Native DOM selection.
  */

+ 2 - 2
packages/ckeditor5-engine/src/view/renderer.js

@@ -37,7 +37,7 @@ export default class Renderer {
 	 * Creates a renderer instance.
 	 *
 	 * @param {module:engine/view/domconverter~DomConverter} domConverter Converter instance.
-	 * @param {module:engine/view/selection~Selection} selection View selection.
+	 * @param {module:engine/view/documentselection~DocumentSelection} selection View selection.
 	 */
 	constructor( domConverter, selection ) {
 		/**
@@ -84,7 +84,7 @@ export default class Renderer {
 		 * View selection. Renderer updates DOM selection based on the view selection.
 		 *
 		 * @readonly
-		 * @member {module:engine/view/selection~Selection}
+		 * @member {module:engine/view/documentselection~DocumentSelection}
 		 */
 		this.selection = selection;
 

+ 6 - 6
packages/ckeditor5-engine/src/view/writer.js

@@ -35,10 +35,10 @@ export default class Writer {
 	}
 
 	/**
-	 * Sets {@link module:engine/view/selection~Selection selection's} ranges and direction to the specified location based on the given
-	 * {@link module:engine/view/selection~Selection selection}, {@link module:engine/view/position~Position position},
-	 * {@link module:engine/view/item~Item item}, {@link module:engine/view/range~Range range},
-	 * an iterable of {@link module:engine/view/range~Range ranges} or null.
+	 * Sets {@link module:engine/view/documentselection~DocumentSelection selection's} ranges and direction to the
+	 * specified location based on the given {@link module:engine/view/documentselection~DocumentSelection selection},
+	 * {@link module:engine/view/position~Position position}, {@link module:engine/view/item~Item item},
+	 * {@link module:engine/view/range~Range range}, an iterable of {@link module:engine/view/range~Range ranges} or null.
 	 *
 	 * ### Usage:
 	 *
@@ -92,7 +92,7 @@ export default class Writer {
 	 * 		// (and be  properly handled by screen readers).
 	 *		writer.setSelection( range, { fake: true, label: 'foo' } );
 	 *
-	 * @param {module:engine/view/selection~Selection|module:engine/view/position~Position|
+	 * @param {module:engine/view/documentselection~DocumentSelection|module:engine/view/position~Position|
 	 * Iterable.<module:engine/view/range~Range>|module:engine/view/range~Range|module:engine/view/item~Item|null} selectable
 	 * @param {Number|'before'|'end'|'after'|'on'|'in'} [placeOrOffset] Sets place or offset of the selection.
 	 * @param {Object} [options]
@@ -105,7 +105,7 @@ export default class Writer {
 	}
 
 	/**
-	 * Moves {@link module:engine/view/selection~Selection#focus selection's focus} to the specified location.
+	 * Moves {@link module:engine/view/documentselection~DocumentSelection#focus selection's focus} to the specified location.
 	 *
 	 * The location can be specified in the same form as {@link module:engine/view/position~Position.createAt} parameters.
 	 *