Kaynağa Gözat

Renamed VirtualSelection to Highlight.

Szymon Kupś 8 yıl önce
ebeveyn
işleme
c735ddbd84

+ 35 - 36
packages/ckeditor5-engine/src/conversion/buildmodelconverter.js

@@ -58,11 +58,11 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
  *
  *		buildModelConverter().for( dispatcher ).fromAttribute( 'bold' ).toElement( 'strong' );
  *
- * 4. Model marker to virtual selection converter. This is a converter that converts model markers to virtual
- * selection described by {@link module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor} object passed to
- * {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#toVirtualSelection} method.
+ * 4. Model marker to view highlight converter. This is a converter that converts model markers to view highlight
+ * described by {@link module:engine/conversion/buildmodelconverter~HighlightDescriptor} object passed to
+ * {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#toHighlight} method.
  *
- *		buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toVirtualSelection( {
+ *		buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toHighlight( {
  *			class: 'search',
  *			priority: 20
  *		} );
@@ -76,7 +76,7 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
  * It is possible to provide various different parameters for
  * {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#toElement},
  * {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#toAttribute} and
- * {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#toVirtualSelection} methods.
+ * {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#toHighlight} methods.
  * See their descriptions to learn more.
  *
  * It is also possible to {@link module:engine/conversion/buildmodelconverter~ModelConverterBuilder#withPriority change default priority}
@@ -274,66 +274,65 @@ class ModelConverterBuilder {
 	}
 
 	/**
-	 * Registers that marker should be converted to virtual selection. Markers, basically,
-	 * are {@link module:engine/model/liverange~LiveRange} instances, that are named. Virtual selection is
+	 * Registers that marker should be converted to view highlight. Markers, basically,
+	 * are {@link module:engine/model/liverange~LiveRange} instances, that are named. View highlight is
 	 * a representation of the model marker in the view:
 	 * * each {@link module:engine/view/text~Text view text node} in the marker's range will be wrapped with `span`
 	 * {@link module:engine/view/attributeelement~AttributeElement},
 	 * * each {@link module:engine/view/containerelement~ContainerElement container view element} in the marker's
-	 * range can handle the virtual selection individually by providing `setVirtualSelection` and `removeVirtualSelection`
+	 * range can handle highlighting individually by providing `setHighlight` and `removeHighlight`
 	 * custom properties:
 	 *
-	 *		viewElement.setCustomProperty( 'setVirtualSelection', ( element, descriptor ) => {} );
-	 *		viewElement.setCustomProperty( 'removeVirtualSelection', ( element, descriptor ) => {} );
+	 *		viewElement.setCustomProperty( 'setHighlight', ( element, descriptor ) => {} );
+	 *		viewElement.setCustomProperty( 'removeHighlight', ( element, descriptor ) => {} );
 	 *
-	 * {@link module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor Descriptor} will be used to create
-	 * spans over text nodes and also will be provided to `setVirtualSelection` and `removeVirtualSelection` methods
-	 * each time virtual selection should be set or removed from view elements.
-	 * NOTE: When `setVirtualSelection` and `removeVirtualSelection` custom properties are present, converter assumes
-	 * that element itself is taking care of presenting virtual selection on its child nodes, so it won't convert virtual
-	 * selection on them.
+	 * {@link module:engine/conversion/buildmodelconverter~HighlightDescriptor} will be used to create
+	 * spans over text nodes and also will be provided to `setHighlight` and `removeHighlight` methods
+	 * each time highlight should be set or removed from view elements.
+	 * NOTE: When `setHighlight` and `removeHighlight` custom properties are present, converter assumes
+	 * that element itself is taking care of presenting highlight on its child nodes, so it won't convert them.
 	 *
-	 * Virtual selection descriptor can be provided as plain object:
+	 * Highlight descriptor can be provided as plain object:
 	 *
-	 *		buildModelConverter.for( dispatcher ).fromMarker( 'search' ).toVirtualSelection( { class: 'search-mark' } );
+	 *		buildModelConverter.for( dispatcher ).fromMarker( 'search' ).toHighlight( { class: 'search-highlight' } );
  	 *
 	 * Also, descriptor creator function can be provided:
 	 *
-	 *		buildModelConverter.for( dispatcher ).fromMarker( 'search:blue' ).toVirtualSelection( data => {
+	 *		buildModelConverter.for( dispatcher ).fromMarker( 'search:blue' ).toHighlight( data => {
 	 *			const color = data.markerName.split( ':' )[ 1 ];
 	 *
 	 *			return { class: 'search-' + color };
 	 *		} );
 	 *
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError}
-	 * `build-model-converter-non-marker-to-virtual-selection` when trying to convert not from marker.
+	 * `build-model-converter-non-marker-to-highlight` when trying to convert not from marker.
 	 *
-	 * @param {function|module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor} selectionDescriptor
+	 * @param {function|module:engine/conversion/buildmodelconverter~HighlightDescriptor} highlightDescriptor
 	 */
-	toVirtualSelection( selectionDescriptor ) {
+	toHighlight( highlightDescriptor ) {
 		const priority = this._from.priority === null ? 'normal' : this._from.priority;
 
 		if ( this._from.type != 'marker' ) {
 			/**
-			 * To virtual selection conversion is supported only for model markers.
+			 * To highlight conversion is supported only for model markers.
 			 *
-			 * @error build-model-converter-non-marker-to-virtual-selection
+			 * @error build-model-converter-non-marker-to-highlight
 			 */
 			throw new CKEditorError(
-				'build-model-converter-non-marker-to-virtual-selection: Conversion to virtual selection is supported ' +
+				'build-model-converter-non-marker-to-highlight: Conversion to highlight is supported ' +
 				'only from model markers.'
 			);
 		}
 
 		for ( const dispatcher of this._dispatchers ) {
 			// Separate converters for converting texts and elements inside marker's range.
-			dispatcher.on( 'addMarker:' + this._from.name, convertTextsInsideMarker( selectionDescriptor ), { priority } );
-			dispatcher.on( 'addMarker:' + this._from.name, convertElementsInsideMarker( selectionDescriptor ), { priority } );
+			dispatcher.on( 'addMarker:' + this._from.name, convertTextsInsideMarker( highlightDescriptor ), { priority } );
+			dispatcher.on( 'addMarker:' + this._from.name, convertElementsInsideMarker( highlightDescriptor ), { priority } );
 
-			dispatcher.on( 'removeMarker:' + this._from.name, convertTextsInsideMarker( selectionDescriptor ), { priority } );
-			dispatcher.on( 'removeMarker:' + this._from.name, convertElementsInsideMarker( selectionDescriptor ), { priority } );
+			dispatcher.on( 'removeMarker:' + this._from.name, convertTextsInsideMarker( highlightDescriptor ), { priority } );
+			dispatcher.on( 'removeMarker:' + this._from.name, convertElementsInsideMarker( highlightDescriptor ), { priority } );
 
-			dispatcher.on( 'selectionMarker:' + this._from.name, convertSelectionMarker( selectionDescriptor ), { priority } );
+			dispatcher.on( 'selectionMarker:' + this._from.name, convertSelectionMarker( highlightDescriptor ), { priority } );
 		}
 	}
 
@@ -434,16 +433,16 @@ export default function buildModelConverter() {
  */
 
 /**
- * @typedef VirtualSelectionDescriptor
- * Object describing how virtual selection should be created in the view. Each text node in virtual selection
+ * @typedef HighlightDescriptor
+ * Object describing how content highlight should be created in the view. Each text node contained in highlight
  * will be wrapped with `span` element with CSS class, attributes and priority described by this object. Each element
- * can handle virtual selection separately by providing `setVirtualSelection` and `removeVirtualSelection` custom
+ * can handle displaying highlight separately by providing `setHighlight` and `removeHighlight` custom
  * properties.
  *
  * @property {String} class CSS class that will be added to `span`
- * {@link module:engine/view/attributeelement~AttributeElement} wrapping each text node in the virtual selection.
+ * {@link module:engine/view/attributeelement~AttributeElement} wrapping each text node in the highlighted content.
  * @property {Number} [priority] {@link module:engine/view/attributeelement~AttributeElement#priority} of the `span`
- * wrapping each text node in the virtual selection. If not provided, default 10 priority will be used.
+ * wrapping each text node in the highlighted content. If not provided, default 10 priority will be used.
  * @property {Object} [attributes] Attributes that will be added to `span`
- * {@link module:engine/view/attributeelement~AttributeElement} wrapping each text node it the virtual selection.
+ * {@link module:engine/view/attributeelement~AttributeElement} wrapping each text node it the highlighted content.
  */

+ 8 - 8
packages/ckeditor5-engine/src/conversion/model-selection-to-view-converters.js

@@ -6,7 +6,7 @@
 import ViewElement from '../view/element';
 import ViewRange from '../view/range';
 import viewWriter from '../view/writer';
-import { virtualSelectionDescriptorToAttributeElement } from './model-to-view-converters';
+import { highlightDescriptorToAttributeElement } from './model-to-view-converters';
 
 /**
  * Contains {@link module:engine/model/selection~Selection model selection} to
@@ -162,21 +162,21 @@ export function convertSelectionAttribute( elementCreator ) {
  *		modelDispatcher.on( 'selectionMarker:searchResult', convertSelectionMarker( { class: 'search' } ) );
  *
  * @see module:engine/conversion/model-selection-to-view-converters~convertSelectionAttribute
- * @param {module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor|Function} selectionDescriptor Virtual
- * selection descriptor object or function returning a descriptor object.
+ * @param {module:engine/conversion/buildmodelconverter~HighlightDescriptor|Function} highlightDescriptor Highlight
+ * descriptor object or function returning a descriptor object.
  * @returns {Function} Selection converter.
  */
-export function convertSelectionMarker( selectionDescriptor ) {
+export function convertSelectionMarker( highlightDescriptor ) {
 	return ( evt, data, consumable, conversionApi ) => {
-		const descriptor = typeof selectionDescriptor == 'function' ?
-			selectionDescriptor( data, consumable, conversionApi ) :
-			selectionDescriptor;
+		const descriptor = typeof highlightDescriptor == 'function' ?
+			highlightDescriptor( data, consumable, conversionApi ) :
+			highlightDescriptor;
 
 		if ( !descriptor ) {
 			return;
 		}
 
-		const viewElement = virtualSelectionDescriptorToAttributeElement( descriptor );
+		const viewElement = highlightDescriptorToAttributeElement( descriptor );
 		const consumableName = 'selectionMarker:' + data.markerName;
 
 		wrapCollapsedSelectionPosition( data.selection, conversionApi.viewSelection, viewElement, consumable, consumableName );

+ 23 - 23
packages/ckeditor5-engine/src/conversion/model-to-view-converters.js

@@ -407,16 +407,16 @@ export function remove() {
 /**
  * Function factory, creates converter that converts all texts inside marker's range. Converter wraps each text with
  * {@link module:engine/view/attributeelement~AttributeElement} created from provided descriptor.
- * See {link module:engine/conversion/model-to-view-converters~virtualSelectionDescriptorToAttributeElement}.
+ * See {link module:engine/conversion/model-to-view-converters~highlightDescriptorToAttributeElement}.
  *
- * @param {module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor|Function} selectionDescriptor
+ * @param {module:engine/conversion/buildmodelconverter~HighlightDescriptor|Function} highlightDescriptor
  * @return {Function}
  */
-export function convertTextsInsideMarker( selectionDescriptor ) {
+export function convertTextsInsideMarker( highlightDescriptor ) {
 	return ( evt, data, consumable, conversionApi ) => {
-		const descriptor = typeof selectionDescriptor == 'function' ?
-			selectionDescriptor( data, consumable, conversionApi ) :
-			selectionDescriptor;
+		const descriptor = typeof highlightDescriptor == 'function' ?
+			highlightDescriptor( data, consumable, conversionApi ) :
+			highlightDescriptor;
 
 		const modelItem = data.item;
 
@@ -428,7 +428,7 @@ export function convertTextsInsideMarker( selectionDescriptor ) {
 			return;
 		}
 
-		const viewElement = virtualSelectionDescriptorToAttributeElement( descriptor );
+		const viewElement = highlightDescriptorToAttributeElement( descriptor );
 		const viewRange = conversionApi.mapper.toViewRange( data.range );
 
 		if ( evt.name.split( ':' )[ 0 ] == 'addMarker' ) {
@@ -441,23 +441,23 @@ export function convertTextsInsideMarker( selectionDescriptor ) {
 
 /**
  * Function factory, creates converter that converts all elements inside marker's range. Converter checks if element has
- * functions stored under `setVirtualSelection` and `removeVirtualSelection` custom properties and calls them passing
- * {@link module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor}. In such case converter will consume
- * all element's children, assuming that they were handled by element itself. If selection descriptor will not provide
+ * functions stored under `setHighlight` and `removeHighlight` custom properties and calls them passing
+ * {@link module:engine/conversion/buildmodelconverter~HighlightDescriptor}. In such case converter will consume
+ * all element's children, assuming that they were handled by element itself. If highlight descriptor will not provide
  * priority, priority 10 will be used as default, to be compliant with
  * {@link module:engine/conversion/model-to-view-converters~convertTextsInsideMarker} method which uses default priority of
  * {@link module:engine/view/attributeelement~AttributeElement}.
- * When `setVirtualSelection` and `removeVirtualSelection` custom properties are not present, element is not converted
+ * When `setHighlight` and `removeHighlight` custom properties are not present, element is not converted
  * in any special way. This means that converters will proceed to convert element's child nodes.
  *
- * @param {module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor|Function} selectionDescriptor
+ * @param {module:engine/conversion/buildmodelconverter~HighlightDescriptor|Function} highlightDescriptor
  * @return {Function}
  */
-export function convertElementsInsideMarker( selectionDescriptor ) {
+export function convertElementsInsideMarker( highlightDescriptor ) {
 	return ( evt, data, consumable, conversionApi ) => {
-		const descriptor = typeof selectionDescriptor == 'function' ?
-			selectionDescriptor( data, consumable, conversionApi ) :
-			selectionDescriptor;
+		const descriptor = typeof highlightDescriptor == 'function' ?
+			highlightDescriptor( data, consumable, conversionApi ) :
+			highlightDescriptor;
 
 		const modelItem = data.item;
 
@@ -475,9 +475,9 @@ export function convertElementsInsideMarker( selectionDescriptor ) {
 
 		const viewElement = conversionApi.mapper.toViewElement( modelItem );
 		const addMarker = evt.name.split( ':' )[ 0 ] == 'addMarker';
-		const selectionHandlingMethod = addMarker ? 'setVirtualSelection' : 'removeVirtualSelection';
+		const highlightHandlingMethod = addMarker ? 'setHighlight' : 'removeHighlight';
 
-		if ( viewElement && viewElement.getCustomProperty( selectionHandlingMethod ) ) {
+		if ( viewElement && viewElement.getCustomProperty( highlightHandlingMethod ) ) {
 			// Consume element itself.
 			consumable.consume( data.item, evt.name );
 
@@ -486,7 +486,7 @@ export function convertElementsInsideMarker( selectionDescriptor ) {
 				consumable.consume( value.item, evt.name );
 			}
 
-			viewElement.getCustomProperty( selectionHandlingMethod )( viewElement, descriptor );
+			viewElement.getCustomProperty( highlightHandlingMethod )( viewElement, descriptor );
 		}
 	};
 }
@@ -559,13 +559,13 @@ export function eventNameToConsumableType( evtName ) {
 
 /**
  * Creates `span` {@link module:engine/view/attributeelement~AttributeElement view attribute element} from information
- * provided by {@link module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor} object. If priority
- * is not provided in selection descriptor - default priority will be used.
+ * provided by {@link module:engine/conversion/buildmodelconverter~HighlightDescriptor} object. If priority
+ * is not provided in descriptor - default priority will be used.
  *
- * @param {module:engine/conversion/buildmodelconverter~VirtualSelectionDescriptor } descriptor
+ * @param {module:engine/conversion/buildmodelconverter~HighlightDescriptor } descriptor
  * @return {module:engine/view/attributeelement~AttributeElement}
  */
-export function virtualSelectionDescriptorToAttributeElement( descriptor ) {
+export function highlightDescriptorToAttributeElement( descriptor ) {
 	const attributeElement = new ViewAttributeElement( 'span', descriptor.attributes );
 
 	if ( descriptor.class ) {

+ 20 - 20
packages/ckeditor5-engine/tests/conversion/buildmodelconverter.js

@@ -343,7 +343,7 @@ describe( 'Model converter builder', () => {
 		} );
 	} );
 
-	describe( 'model marker to virtual selection converter', () => {
+	describe( 'model marker to highlight converter', () => {
 		let modelText, modelElement;
 
 		beforeEach( () => {
@@ -358,11 +358,11 @@ describe( 'Model converter builder', () => {
 			mapper.bindElements( modelElement, viewElement );
 		} );
 
-		it( 'using passed virtual selection descriptor object', () => {
-			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toVirtualSelection( {
-				class: 'virtual-selection',
+		it( 'using passed highlight descriptor object', () => {
+			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toHighlight( {
+				class: 'highlight',
 				priority: 3,
-				attributes: { title: 'marker' }
+				attributes: { title: 'highlight title' }
 			} );
 
 			dispatcher.convertMarker( 'addMarker', 'search', ModelRange.createFromParentsAndOffsets( modelElement, 2, modelElement, 4 ) );
@@ -371,7 +371,7 @@ describe( 'Model converter builder', () => {
 				'<div>' +
 					'<p>' +
 						'fo' +
-						'<span class="virtual-selection" title="marker">ob</span>' +
+						'<span class="highlight" title="highlight title">ob</span>' +
 						'ar' +
 					'</p>' +
 				'</div>' );
@@ -385,11 +385,11 @@ describe( 'Model converter builder', () => {
 			expect( viewToString( viewRoot ) ).to.equal( '<div><p>foobar</p></div>' );
 		} );
 
-		it( 'using passed virtual selection descriptor object creator', () => {
-			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toVirtualSelection( () => ( {
-				class: 'virtual-selection',
+		it( 'using passed highlight descriptor object creator', () => {
+			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toHighlight( () => ( {
+				class: 'highlight',
 				priority: 12,
-				attributes: { title: 'marker' }
+				attributes: { title: 'highlight title' }
 			} ) );
 
 			dispatcher.convertMarker( 'addMarker', 'search', ModelRange.createFromParentsAndOffsets( modelElement, 2, modelElement, 4 ) );
@@ -398,7 +398,7 @@ describe( 'Model converter builder', () => {
 				'<div>' +
 					'<p>' +
 						'fo' +
-						'<span class="virtual-selection" title="marker">ob</span>' +
+						'<span class="highlight" title="highlight title">ob</span>' +
 						'ar' +
 					'</p>' +
 				'</div>' );
@@ -413,8 +413,8 @@ describe( 'Model converter builder', () => {
 		} );
 
 		it( 'should do nothing when marker range is collapsed', () => {
-			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toVirtualSelection( {
-				class: 'virtual-selection'
+			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toHighlight( {
+				class: 'highlight'
 			} );
 
 			dispatcher.convertMarker( 'addMarker', 'search', ModelRange.createFromParentsAndOffsets( modelElement, 2, modelElement, 2 ) );
@@ -429,11 +429,11 @@ describe( 'Model converter builder', () => {
 		} );
 
 		it( 'should create converters with provided priority', () => {
-			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toVirtualSelection( {
-				class: 'virtual-selection'
+			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).toHighlight( {
+				class: 'highlight'
 			} );
 
-			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).withPriority( 'high' ).toVirtualSelection( {
+			buildModelConverter().for( dispatcher ).fromMarker( 'search' ).withPriority( 'high' ).toHighlight( {
 				class: 'override'
 			} );
 
@@ -451,14 +451,14 @@ describe( 'Model converter builder', () => {
 
 		it( 'should throw if trying to convert from attribute', () => {
 			expect( () => {
-				buildModelConverter().for( dispatcher ).fromAttribute( 'bold' ).toVirtualSelection( { class: 'foo' } );
-			} ).to.throw( CKEditorError, /^build-model-converter-non-marker-to-virtual-selection/ );
+				buildModelConverter().for( dispatcher ).fromAttribute( 'bold' ).toHighlight( { class: 'foo' } );
+			} ).to.throw( CKEditorError, /^build-model-converter-non-marker-to-highlight/ );
 		} );
 
 		it( 'should throw if trying to convert from element', () => {
 			expect( () => {
-				buildModelConverter().for( dispatcher ).fromElement( 'paragraph' ).toVirtualSelection( { class: 'foo' } );
-			} ).to.throw( CKEditorError, /^build-model-converter-non-marker-to-virtual-selection/ );
+				buildModelConverter().for( dispatcher ).fromElement( 'paragraph' ).toHighlight( { class: 'foo' } );
+			} ).to.throw( CKEditorError, /^build-model-converter-non-marker-to-highlight/ );
 		} );
 	} );
 

+ 7 - 7
packages/ckeditor5-engine/tests/conversion/model-selection-to-view-converters.js

@@ -36,7 +36,7 @@ import {
 import { stringify as stringifyView } from '../../src/dev-utils/view';
 import { setData as setModelData } from '../../src/dev-utils/model';
 
-const virtualSelectionDescriptor = { class: 'marker', priority: 1 };
+const highlightDescriptor = { class: 'marker', priority: 1 };
 
 describe( 'model-selection-to-view-converters', () => {
 	let dispatcher, mapper, modelDoc, modelRoot, modelSelection, viewDoc, viewRoot, viewSelection;
@@ -60,10 +60,10 @@ describe( 'model-selection-to-view-converters', () => {
 		dispatcher.on( 'insert:$text', insertText() );
 		dispatcher.on( 'addAttribute:bold', wrapItem( new ViewAttributeElement( 'strong' ) ) );
 
-		dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( virtualSelectionDescriptor ) );
-		dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( virtualSelectionDescriptor ) );
-		dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( virtualSelectionDescriptor ) );
-		dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( virtualSelectionDescriptor ) );
+		dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( highlightDescriptor ) );
+		dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( highlightDescriptor ) );
+		dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( highlightDescriptor ) );
+		dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( highlightDescriptor ) );
 
 		// Default selection converters.
 		dispatcher.on( 'selection', clearAttributes(), { priority: 'low' } );
@@ -80,7 +80,7 @@ describe( 'model-selection-to-view-converters', () => {
 			// Selection converters for selection attributes.
 			dispatcher.on( 'selectionAttribute:bold', convertSelectionAttribute( new ViewAttributeElement( 'strong' ) ) );
 			dispatcher.on( 'selectionAttribute:italic', convertSelectionAttribute( new ViewAttributeElement( 'em' ) ) );
-			dispatcher.on( 'selectionMarker:marker', convertSelectionMarker( virtualSelectionDescriptor ) );
+			dispatcher.on( 'selectionMarker:marker', convertSelectionMarker( highlightDescriptor ) );
 		} );
 
 		describe( 'range selection', () => {
@@ -268,7 +268,7 @@ describe( 'model-selection-to-view-converters', () => {
 					.to.equal( '<div>f<span class="marker">o<strong>o</strong>[]<strong>b</strong>a</span>r</div>' );
 			} );
 
-			it( 'in marker - using virtual selection descriptor creator', () => {
+			it( 'in marker - using highlight descriptor creator', () => {
 				dispatcher.on( 'selectionMarker:marker2', convertSelectionMarker(
 					data => ( { 'class': data.markerName } )
 				) );

+ 30 - 30
packages/ckeditor5-engine/tests/conversion/model-to-view-converters.js

@@ -30,7 +30,7 @@ import {
 	removeUIElement,
 	convertTextsInsideMarker,
 	convertElementsInsideMarker,
-	virtualSelectionDescriptorToAttributeElement
+	highlightDescriptorToAttributeElement
 } from '../../src/conversion/model-to-view-converters';
 
 import { createRangeOnElementOnly } from '../../tests/model/_utils/utils';
@@ -84,8 +84,8 @@ describe( 'model-to-view-converters', () => {
 
 	describe( 'convertTextsInsideMarker()', () => {
 		let modelElement1, modelElement2, markerRange;
-		const virtualSelectionDescriptor = {
-			class: 'marker-class',
+		const highlightDescriptor = {
+			class: 'highlight-class',
 			priority: 7,
 			attributes: { title: 'title' }
 		};
@@ -105,8 +105,8 @@ describe( 'model-to-view-converters', () => {
 		} );
 
 		it( 'should wrap and unwrap text nodes', () => {
-			dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( virtualSelectionDescriptor ) );
-			dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( virtualSelectionDescriptor ) );
+			dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( highlightDescriptor ) );
+			dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( highlightDescriptor ) );
 			dispatcher.convertInsertion( markerRange );
 
 			modelDoc.markers.set( 'marker', markerRange );
@@ -115,10 +115,10 @@ describe( 'model-to-view-converters', () => {
 			expect( viewToString( viewRoot ) ).to.equal(
 				'<div>' +
 					'<p>' +
-						'<span class="marker-class" title="title">foo</span>' +
+						'<span class="highlight-class" title="title">foo</span>' +
 					'</p>' +
 					'<p>' +
-						'<span class="marker-class" title="title">bar</span>' +
+						'<span class="highlight-class" title="title">bar</span>' +
 					'</p>' +
 				'</div>'
 			);
@@ -131,9 +131,9 @@ describe( 'model-to-view-converters', () => {
 		it( 'should not convert marker on elements already consumed', () => {
 			const newDescriptor = { class: 'override-class' };
 
-			dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( virtualSelectionDescriptor ) );
+			dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( highlightDescriptor ) );
 			dispatcher.on( 'addMarker:marker', convertTextsInsideMarker( newDescriptor ), { priority: 'high' } );
-			dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( virtualSelectionDescriptor ) );
+			dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( highlightDescriptor ) );
 			dispatcher.on( 'removeMarker:marker', convertTextsInsideMarker( newDescriptor ), { priority: 'high' } );
 			dispatcher.convertInsertion( markerRange );
 
@@ -173,8 +173,8 @@ describe( 'model-to-view-converters', () => {
 
 	describe( 'convertElementsInsideMarker()', () => {
 		let modelElement1, modelElement2, markerRange;
-		const virtualSelectionDescriptor = {
-			class: 'marker-class',
+		const highlightDescriptor = {
+			class: 'highlight-class',
 			priority: 7,
 			attributes: { title: 'title' }
 		};
@@ -193,9 +193,9 @@ describe( 'model-to-view-converters', () => {
 			markerRange = ModelRange.createIn( modelRoot );
 		} );
 
-		it( 'should use setVirtualSelection and removeVirtualSelection on elements and not convert children nodes', () => {
-			dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( virtualSelectionDescriptor ) );
-			dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( virtualSelectionDescriptor ) );
+		it( 'should use setHighlight and removeHighlight on elements and not convert children nodes', () => {
+			dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( highlightDescriptor ) );
+			dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( highlightDescriptor ) );
 			dispatcher.on( 'insert:paragraph', insertElement( data => {
 				// Use special converter only for first paragraph.
 				if ( data.item == modelElement2 ) {
@@ -204,16 +204,16 @@ describe( 'model-to-view-converters', () => {
 
 				const viewContainer = new ViewContainerElement( 'p' );
 
-				viewContainer.setCustomProperty( 'setVirtualSelection', ( element, descriptor ) => {
-					element.addClass( 'virtual-selection-own-class' );
+				viewContainer.setCustomProperty( 'setHighlight', ( element, descriptor ) => {
+					element.addClass( 'highlight-own-class' );
 
-					expect( descriptor ).to.equal( virtualSelectionDescriptor );
+					expect( descriptor ).to.equal( highlightDescriptor );
 				} );
 
-				viewContainer.setCustomProperty( 'removeVirtualSelection', ( element, descriptor ) => {
-					element.removeClass( 'virtual-selection-own-class' );
+				viewContainer.setCustomProperty( 'removeHighlight', ( element, descriptor ) => {
+					element.removeClass( 'highlight-own-class' );
 
-					expect( descriptor ).to.equal( virtualSelectionDescriptor );
+					expect( descriptor ).to.equal( highlightDescriptor );
 				} );
 
 				return viewContainer;
@@ -225,7 +225,7 @@ describe( 'model-to-view-converters', () => {
 
 			expect( viewToString( viewRoot ) ).to.equal(
 				'<div>' +
-					'<p class="virtual-selection-own-class">' +
+					'<p class="highlight-own-class">' +
 						'foo' +
 					'</p>' +
 					'<p>' +
@@ -242,16 +242,16 @@ describe( 'model-to-view-converters', () => {
 		it( 'should not convert marker on elements already consumed', () => {
 			const newDescriptor = { class: 'override-class' };
 
-			dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( virtualSelectionDescriptor ) );
-			dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( virtualSelectionDescriptor ) );
+			dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( highlightDescriptor ) );
+			dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( highlightDescriptor ) );
 
 			dispatcher.on( 'addMarker:marker', convertElementsInsideMarker( newDescriptor ), { priority: 'high' } );
 			dispatcher.on( 'removeMarker:marker', convertElementsInsideMarker( newDescriptor ), { priority: 'high' } );
 
 			dispatcher.on( 'insert:paragraph', insertElement( () => {
 				const element = new ViewContainerElement( 'p' );
-				element.setCustomProperty( 'setVirtualSelection', ( element, data ) => element.addClass( data.class ) );
-				element.setCustomProperty( 'removeVirtualSelection', ( element, data ) => element.removeClass( data.class ) );
+				element.setCustomProperty( 'setHighlight', ( element, data ) => element.addClass( data.class ) );
+				element.setCustomProperty( 'removeHighlight', ( element, data ) => element.removeClass( data.class ) );
 
 				return element;
 			} ), { priority: 'high' } );
@@ -1192,14 +1192,14 @@ describe( 'model-to-view-converters', () => {
 		} );
 	} );
 
-	describe( 'virtualSelectionDescriptorToAttributeElement()', () => {
+	describe( 'highlightDescriptorToAttributeElement()', () => {
 		it( 'should return attribute element from descriptor object', () => {
 			const descriptor = {
 				class: 'foo-class',
 				attributes: { one: 1, two: 2 },
 				priority: 7,
 			};
-			const element = virtualSelectionDescriptorToAttributeElement( descriptor );
+			const element = highlightDescriptorToAttributeElement( descriptor );
 
 			expect( element.is( 'attributeElement' ) ).to.be.true;
 			expect( element.name ).to.equal( 'span' );
@@ -1216,7 +1216,7 @@ describe( 'model-to-view-converters', () => {
 				attributes: { one: 1, two: 2 },
 				priority: 7,
 			};
-			const element = virtualSelectionDescriptorToAttributeElement( descriptor );
+			const element = highlightDescriptorToAttributeElement( descriptor );
 
 			expect( element.is( 'attributeElement' ) ).to.be.true;
 			expect( element.name ).to.equal( 'span' );
@@ -1232,7 +1232,7 @@ describe( 'model-to-view-converters', () => {
 				class: 'foo-class',
 				attributes: { one: 1, two: 2 },
 			};
-			const element = virtualSelectionDescriptorToAttributeElement( descriptor );
+			const element = highlightDescriptorToAttributeElement( descriptor );
 
 			expect( element.is( 'attributeElement' ) ).to.be.true;
 			expect( element.name ).to.equal( 'span' );
@@ -1249,7 +1249,7 @@ describe( 'model-to-view-converters', () => {
 				class: 'foo-class',
 				priority: 7
 			};
-			const element = virtualSelectionDescriptorToAttributeElement( descriptor );
+			const element = highlightDescriptorToAttributeElement( descriptor );
 
 			expect( element.is( 'attributeElement' ) ).to.be.true;
 			expect( element.name ).to.equal( 'span' );

+ 10 - 10
packages/ckeditor5-engine/tests/manual/virtualselection.html

@@ -1,13 +1,13 @@
 <style>
-	span.virtual-selection-yellow {
+	span.highlight-yellow {
 		background-color: yellow;
 	}
 
-	span.virtual-selection-blue {
+	span.highlight-blue {
 		background-color: blue;
 	}
 
-	span.virtual-selection-red {
+	span.highlight-red {
 		background-color: red;
 	}
 
@@ -19,17 +19,17 @@
 		line-height: 40px;
 	}
 
-	.ck-widget.fancy-widget.virtual-selection-yellow {
+	.ck-widget.fancy-widget.highlight-yellow {
 		background-color: yellow;
 		color: black;
 	}
 
-	.ck-widget.fancy-widget.virtual-selection-blue {
+	.ck-widget.fancy-widget.highlight-blue {
 		background-color: blue;
 		color: black;
 	}
 
-	.ck-widget.fancy-widget.virtual-selection-red {
+	.ck-widget.fancy-widget.highlight-red {
 		background-color: red;
 		color: black;
 	}
@@ -45,10 +45,10 @@
 	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas at diam quis justo imperdiet posuere non eu tortor. Mauris vel magna eu sem hendrerit varius. Ut imperdiet velit ut ante interdum convallis. Vestibulum vitae lacinia mi. </p>
 </div>
 <h2>Markers</h2>
-<button id="add-marker-yellow">Set yellow marker</button><button id="remove-marker-yellow">Remove yellow marker</button>
+<button id="add-marker-yellow">Set yellow highlight</button><button id="remove-marker-yellow">Remove yellow highlight</button>
 <br />
-<button id="add-marker-red">Set red marker</button><button id="remove-marker-red">Remove red marker</button>
+<button id="add-marker-red">Set red highlight</button><button id="remove-marker-red">Remove red highlight</button>
 <br />
-<button id="add-marker-blue">Set blue marker</button><button id="remove-marker-blue">Remove blue marker</button>
+<button id="add-marker-blue">Set blue highlight</button><button id="remove-marker-blue">Remove blue highlight</button>
 <br />
-<button id="remove-markers">Remove all markers</button>
+<button id="remove-markers">Remove all highlights</button>

+ 1 - 1
packages/ckeditor5-engine/tests/manual/virtualselection.js

@@ -68,7 +68,7 @@ ClassicEditor.create( global.document.querySelector( '#editor' ), {
 		buildModelConverter()
 			.for( editor.editing.modelToView )
 			.fromMarker( 'marker' )
-			.toVirtualSelection( data => ( { class: 'virtual-selection-' + data.markerName.split( ':' )[ 1 ] } ) );
+			.toHighlight( data => ( { class: 'highlight-' + data.markerName.split( ':' )[ 1 ] } ) );
 
 		document.getElementById( 'add-marker-yellow' ).addEventListener( 'mousedown', evt => {
 			addMarker( editor, 'yellow' );

+ 14 - 0
packages/ckeditor5-engine/tests/manual/highlight.md

@@ -0,0 +1,14 @@
+### Highlight manual test
+
+1. Create selection that starts before the last word of the first paragraph and ends after first
+word of the second paragraph and press `Set yellow highlight`.
+1. Yellow highlight should be visible on text and widget.
+1. Select whole contents of the editor and press `Set red highlight`.
+1. Yellow highlight should be visible as before, red highlight should be visible on ranges where yellow highlight is not
+applied.
+1. Click `Remove yellow highlight`.
+1. Red highlight should be visible on the whole content, including the widget.
+1. Play with highlights, add and remove them, check if they are applied correctly.
+
+NOTE: Yellow highlight should be visible over red and blue one. Red highlight should be visible over blue one. 
+

+ 1 - 1
packages/ckeditor5-engine/tests/manual/markers.js

@@ -34,7 +34,7 @@ ClassicEditor
 
 		buildModelConverter().for( editor.editing.modelToView )
 			.fromMarker( 'highlight' )
-			.toVirtualSelection( data => {
+			.toHighlight( data => {
 				const color = data.markerName.split( ':' )[ 1 ];
 
 				return {

+ 0 - 14
packages/ckeditor5-engine/tests/manual/virtualselection.md

@@ -1,14 +0,0 @@
-### Virtual selection manual test
-
-1. Create selection that starts before the last word of the first paragraph and ends after first
-word of the second paragraph and press `Set yellow marker`.
-1. Yellow marker should be visible on text and widget.
-1. Select whole contents of the editor and press `Set red marker`.
-1. Yellow marker should be visible as before, red marker should be visible on ranges where yellow marker is not
-applied.
-1. Click `Remove yellow marker`.
-1. Red marker should be visible on the whole content, including the widget.
-1. Play with markers, add and remove them, check if they are applied correctly.
-
-NOTE: Yellow marker should be visible over red and blue one. Red marker should be visible over blue one. 
-