Преглед на файлове

Other: Extract `getBindingTargets()` to own file and move it to ui/bindings.

Maciej Gołaszewski преди 7 години
родител
ревизия
a9b71a1deb

+ 21 - 0
packages/ckeditor5-ui/src/bindings/getbindingtargets.js

@@ -0,0 +1,21 @@
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/**
+ * @module ui/bindings/getbindingtargets
+ */
+
+/**
+ * Returns an array of binding components for
+ * {@link module:utils/observablemixin~Observable#bind} from a set of iterable
+ * buttons.
+ *
+ * @param {Iterable.<module:ui/button/buttonview~ButtonView>} buttons
+ * @param {String} attribute
+ * @returns {Array.<String>}
+ */
+export default function getBindingTargets( buttons, attribute ) {
+	return Array.prototype.concat( ...buttons.map( button => [ button, attribute ] ) );
+}

+ 1 - 1
packages/ckeditor5-ui/src/dropdown/helpers/enablemodelifoneisenabled.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-import { getBindingTargets } from '../utils';
+import getBindingTargets from '../../bindings/getbindingtargets';
 
 /**
  * @module ui/dropdown/helpers/enablemodelifoneisenabled

+ 0 - 20
packages/ckeditor5-ui/src/dropdown/utils.js

@@ -1,20 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/**
- * @module ui/dropdown/helpers
- */
-
-// Returns an array of binding components for
-// {@link module:utils/observablemixin~Observable#bind} from a set of iterable
-// buttons.
-//
-// @private
-// @param {Iterable.<module:ui/button/buttonview~ButtonView>} buttons
-// @param {String} attribute
-// @returns {Array.<String>}
-export function getBindingTargets( buttons, attribute ) {
-	return Array.prototype.concat( ...buttons.map( button => [ button, attribute ] ) );
-}