Răsfoiți Sursa

Made editor throw when config.creator is not defined.

Piotrek Koszuliński 10 ani în urmă
părinte
comite
358207e4c0
1 a modificat fișierele cu 18 adăugiri și 0 ștergeri
  1. 18 0
      packages/ckeditor5-ui/src/utils.js

+ 18 - 0
packages/ckeditor5-ui/src/utils.js

@@ -91,6 +91,24 @@ CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lod
 				// Compared array is longer so it is a suffix of the other array.
 				return utils.compareArrays.EXTENSION;
 			}
+		},
+
+		/**
+		 * Returns `nth` (starts from `0` of course) item of an `iterable`.
+		 *
+		 * @param {Number} index
+		 * @param {Iterable.<*>} iterable
+		 * @returns {*}
+		 */
+		nth( index, iterable ) {
+			for ( let item of iterable ) {
+				if ( index === 0 ) {
+					return item;
+				}
+				index -= 1;
+			}
+
+			return null;
 		}
 	};