8
0
فهرست منبع

Renamed `CHARACTER` to lower case.

Oskar Wrobel 9 سال پیش
والد
کامیت
e4a56f9316

+ 3 - 3
packages/ckeditor5-engine/src/model/composer/modifyselection.js

@@ -13,7 +13,7 @@ import Range from '../range.js';
  * Modifies the selection. Currently the supported modifications are:
  *
  * * Extending. The selection focus is moved in the specified `options.direction` with a step specified in `options.unit`
- * (defaults to `'CHARACTER'`, other values are not not yet supported).
+ * (defaults to `'character'`, other values are not not yet supported).
  * Note: if you extend a forward selection in a backward direction you will in fact shrink it.
  *
  * @method engine.model.composer.modifySelection
@@ -41,7 +41,7 @@ export default function modifySelection( selection, options = {} ) {
 	let value = next.value;
 
 	// 2. Consume next character.
-	if ( value.type == 'CHARACTER' ) {
+	if ( value.type == 'character' ) {
 		selection.setFocus( value.nextPosition );
 
 		return;
@@ -67,7 +67,7 @@ export default function modifySelection( selection, options = {} ) {
 
 	// 4.2. Character found after element end. Not really a valid case in our data model, but let's
 	// do something sensible and put the selection focus before that character.
-	if ( value.type == 'CHARACTER' ) {
+	if ( value.type == 'character' ) {
 		selection.setFocus( value.previousPosition );
 	}
 	// 4.3. OK, we're entering a new element. So let's place there the focus.

+ 4 - 4
packages/ckeditor5-engine/src/model/treewalker.js

@@ -207,7 +207,7 @@ export default class TreeWalker {
 				position.offset++;
 				this.position = position;
 
-				return formatReturnValue( 'CHARACTER', node, previousPosition, position, 1 );
+				return formatReturnValue( 'character', node, previousPosition, position, 1 );
 			} else {
 				let charactersCount = node._nodeListText.text.length - node._index;
 				let offset = position.offset + charactersCount;
@@ -288,7 +288,7 @@ export default class TreeWalker {
 				position.offset--;
 				this.position = position;
 
-				return formatReturnValue( 'CHARACTER', node, previousPosition, position, 1 );
+				return formatReturnValue( 'character', node, previousPosition, position, 1 );
 			} else {
 				let charactersCount = node._index + 1;
 				let offset = position.offset - charactersCount;
@@ -332,7 +332,7 @@ function formatReturnValue( type, item, previousPosition, nextPosition, length )
 /**
  * Type of the step made by {@link engine.model.TreeWalker}.
  * Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end of node,
- * `'CHARACTER'` if walker traversed over a character, or `'text'` if walker traversed over multiple characters (available in
+ * `'character'` if walker traversed over a character, or `'text'` if walker traversed over multiple characters (available in
  * character merging mode, see {@link engine.model.TreeWalker#constructor}).
  *
  * @typedef {String} engine.model.TreeWalkerValueType
@@ -357,7 +357,7 @@ function formatReturnValue( type, item, previousPosition, nextPosition, length )
  * the position after the item.
  * * Backward iteration: For `'elementEnd'` it is last position inside element. For all other types it is the position
  * before the item.
- * @property {Number} [length] Length of the item. For `'elementStart'` and `'CHARACTER'` it is 1. For `'text'` it is
+ * @property {Number} [length] Length of the item. For `'elementStart'` and `'character'` it is 1. For `'text'` it is
  * the length of the text. For `'elementEnd'` it is undefined.
  */
 

+ 12 - 12
packages/ckeditor5-engine/tests/model/treewalker.js

@@ -333,12 +333,12 @@ describe( 'TreeWalker', () => {
 					{ type: 'elementStart', item: img1 },
 					{ type: 'elementEnd', item: img1 },
 					{ type: 'elementStart', item: paragraph },
-					{ type: 'CHARACTER', text: 'b', attrs: [ [ 'bold', true ] ] },
-					{ type: 'CHARACTER', text: 'a', attrs: [ [ 'bold', true ] ] },
-					{ type: 'CHARACTER', text: 'r', attrs: [] },
+					{ type: 'character', text: 'b', attrs: [ [ 'bold', true ] ] },
+					{ type: 'character', text: 'a', attrs: [ [ 'bold', true ] ] },
+					{ type: 'character', text: 'r', attrs: [] },
 					{ type: 'elementStart', item: img2 },
 					{ type: 'elementEnd', item: img2 },
-					{ type: 'CHARACTER', text: 'x', attrs: [] },
+					{ type: 'character', text: 'x', attrs: [] },
 					{ type: 'elementEnd', item: paragraph }
 				];
 			} );
@@ -376,9 +376,9 @@ describe( 'TreeWalker', () => {
 
 			before( () => {
 				expected = [
-					{ type: 'CHARACTER', text: 'b', attrs: [ [ 'bold', true ] ] },
-					{ type: 'CHARACTER', text: 'a', attrs: [ [ 'bold', true ] ] },
-					{ type: 'CHARACTER', text: 'r', attrs: [] },
+					{ type: 'character', text: 'b', attrs: [ [ 'bold', true ] ] },
+					{ type: 'character', text: 'a', attrs: [ [ 'bold', true ] ] },
+					{ type: 'character', text: 'r', attrs: [] },
 					{ type: 'elementStart', item: img2 }
 				];
 
@@ -501,11 +501,11 @@ describe( 'TreeWalker', () => {
 				expected = [
 					{ type: 'elementStart', item: img1 },
 					{ type: 'elementStart', item: paragraph },
-					{ type: 'CHARACTER', text: 'b', attrs: [ [ 'bold', true ] ] },
-					{ type: 'CHARACTER', text: 'a', attrs: [ [ 'bold', true ] ] },
-					{ type: 'CHARACTER', text: 'r', attrs: [] },
+					{ type: 'character', text: 'b', attrs: [ [ 'bold', true ] ] },
+					{ type: 'character', text: 'a', attrs: [ [ 'bold', true ] ] },
+					{ type: 'character', text: 'r', attrs: [] },
 					{ type: 'elementStart', item: img2 },
-					{ type: 'CHARACTER', text: 'x', attrs: [] }
+					{ type: 'character', text: 'x', attrs: [] }
 				];
 			} );
 
@@ -549,7 +549,7 @@ function expectValue( value, expected, options ) {
 
 	if ( value.type == 'text' ) {
 		expectText( value, expected, options );
-	} else if ( value.type == 'CHARACTER' ) {
+	} else if ( value.type == 'character' ) {
 		expectCharacter( value, expected, options );
 	} else if ( value.type == 'elementStart' ) {
 		expectStart( value, expected, options );