Sfoglia il codice sorgente

Added: re-added throwing error in model.Selection#_pushRange.

Szymon Cofalik 9 anni fa
parent
commit
e80349a350
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4 0
      packages/ckeditor5-engine/src/model/selection.js

+ 4 - 0
packages/ckeditor5-engine/src/model/selection.js

@@ -276,6 +276,10 @@ export default class Selection {
 
 		// Check whether there is any range in new ranges set that is different than all already added ranges.
 		const anyNewRange = newRanges.some( ( newRange ) => {
+			if ( !( newRange instanceof Range ) ) {
+				throw new CKEditorError( 'model-selection-added-not-range: Trying to add an object that is not an instance of Range.' );
+			}
+
 			return this._ranges.every( ( oldRange ) => {
 				return !oldRange.isEqual( newRange );
 			} );