Oskar Wróbel пре 9 година
родитељ
комит
c042b588e4

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

@@ -12,7 +12,7 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import Node from './node';
 
 /**
- * UIElement class. It is used to represent features of UI not content of the document.
+ * UIElement class. It is used to represent UI not a content of the document.
  * This element can't be split and selection can't be placed inside this element.
  */
 export default class UIElement extends Element {
@@ -29,7 +29,7 @@ export default class UIElement extends Element {
 		super( name, attributes, children );
 
 		/**
-		 * Returns `null` because filler is not needed for EmptyElements.
+		 * Returns `null` because filler is not needed for UIElements.
 		 *
 		 * @method #getFillerOffset
 		 * @returns {null} Always returns null.
@@ -39,13 +39,13 @@ export default class UIElement extends Element {
 
 	/**
 	 * Overrides {@link module:engine/view/element~Element#insertChildren} method.
-	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` to prevent adding any child nodes
-	 * to EmptyElement.
+	 * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-uielement-cannot-add` to prevent adding any child nodes
+	 * to UIElement.
 	 */
 	insertChildren( index, nodes ) {
 		if ( nodes && ( nodes instanceof Node || Array.from( nodes ).length > 0 ) ) {
 			/**
-			 * Cannot add children to {@link module:engine/view/emptyelement~EmptyElement}.
+			 * Cannot add children to {@link module:engine/view/uielement~UIElement}.
 			 *
 			 * @error view-uielement-cannot-add
 			 */
@@ -54,7 +54,7 @@ export default class UIElement extends Element {
 	}
 }
 
-// Returns `null` because block filler is not needed for EmptyElements.
+// Returns `null` because block filler is not needed for UIElements.
 //
 // @returns {null}
 function getFillerOffset() {

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

@@ -412,7 +412,7 @@ export function remove( range ) {
 }
 
 /**
- * Removes matches elements from given range.
+ * Removes matching elements from given range.
  *
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-writer-invalid-range-container` when
  * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
@@ -426,14 +426,14 @@ export function clear( range, element ) {
 	validateRangeContainer( range );
 
 	// Create walker on given range.
-	// We are walking backward because when we remove element during walk it modify range end position.
-	const rangeWalker = range.getWalker( {
+	// We walk backward because when we remove element during walk it modify range end position.
+	const walker = range.getWalker( {
 		direction: 'backward',
 		ignoreElementEnd: true
 	} );
 
 	// Let's walk.
-	for ( const current of rangeWalker ) {
+	for ( const current of walker ) {
 		const item = current.item;
 		let rangeToRemove;
 
@@ -448,7 +448,7 @@ export function clear( range, element ) {
 				return ancestor instanceof Element && element.isSimilar( ancestor );
 			} );
 
-			// If it is then create a range inside this element.
+			// If it is then create range inside this element.
 			if ( parentElement && parentElement ) {
 				rangeToRemove = Range.createIn( parentElement );
 			}
@@ -456,7 +456,7 @@ export function clear( range, element ) {
 
 		// If we have found element to remove.
 		if ( rangeToRemove ) {
-			// We need to check if element range stick out of given range and truncate if it is.
+			// We need to check if element range stick out of the given range and truncate if it is.
 			if ( !range.containsRange( rangeToRemove ) && range.isIntersecting( rangeToRemove ) ) {
 				if ( rangeToRemove.end.isAfter( range.end ) ) {
 					rangeToRemove.end = range.end;
@@ -467,6 +467,7 @@ export function clear( range, element ) {
 				}
 			}
 
+			// At the end we remove range with founded element.
 			remove( rangeToRemove );
 		}
 	}