Selaa lähdekoodia

Internal: Locale instance is required only for BodyCollection - so this is where it is added.

Next commit will remove locale handling from the ViewCollection class.
Marek Lewandowski 5 vuotta sitten
vanhempi
sitoutus
39f3ba2e49
1 muutettua tiedostoa jossa 18 lisäystä ja 0 poistoa
  1. 18 0
      packages/ckeditor5-ui/src/editorui/bodycollection.js

+ 18 - 0
packages/ckeditor5-ui/src/editorui/bodycollection.js

@@ -33,6 +33,24 @@ import createElement from '@ckeditor/ckeditor5-utils/src/dom/createelement';
  * @extends module:ui/viewcollection~ViewCollection
  */
 export default class BodyCollection extends ViewCollection {
+	/**
+	 * Creates a new instance of the {@link module:ui/editorui/bodycollection~BodyCollection}.
+	 *
+	 * @param {module:utils/locale~Locale} locale The {@link module:core/editor/editor~Editor editor's locale} instance.
+	 * @param {Array.<module:ui/view~View>} [initialItems] The initial items of the collection.
+	 */
+	constructor( locale, initialItems = [] ) {
+		super( initialItems );
+
+		/**
+		 * The {@link module:core/editor/editor~Editor#locale editor's locale} instance.
+		 * See the view {@link module:ui/view~View#locale locale} property.
+		 *
+		 * @member {module:utils/locale~Locale}
+		 */
+		this.locale = locale;
+	}
+
 	/**
 	 * Attaches the body collection to the DOM body element. You need to execute this method to render the content of
 	 * the body collection.