Selaa lähdekoodia

Changed: Move `addListViewToDropdown()` helper to ui/dropdown/utils.

Maciej Gołaszewski 8 vuotta sitten
vanhempi
sitoutus
4bcc89230a

+ 4 - 5
packages/ckeditor5-font/src/fontfamily/fontfamilyui.js

@@ -11,12 +11,12 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Model from '@ckeditor/ckeditor5-ui/src/model';
 import Collection from '@ckeditor/ckeditor5-utils/src/collection';
 
-import addListViewToDropdown from '@ckeditor/ckeditor5-ui/src/dropdown/helpers/addlistviewtodropdown';
-import { createDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
+import { createDropdown, addListViewToDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
 
-import fontFamilyIcon from '../../theme/icons/font-family.svg';
 import { normalizeOptions } from './utils';
 
+import fontFamilyIcon from '../../theme/icons/font-family.svg';
+
 /**
  * @extends module:core/plugin~Plugin
  */
@@ -56,7 +56,6 @@ export default class FontFamilyUI extends Plugin {
 		const dropdownModel = new Model( {
 			icon: fontFamilyIcon,
 			withText: false,
-			items: dropdownItems,
 			tooltip: t( 'Font Family' )
 		} );
 
@@ -66,7 +65,7 @@ export default class FontFamilyUI extends Plugin {
 		editor.ui.componentFactory.add( 'fontFamily', locale => {
 			const dropdownView = createDropdown( dropdownModel, locale );
 
-			addListViewToDropdown( dropdownView, dropdownModel, locale );
+			addListViewToDropdown( dropdownView, dropdownItems, dropdownModel, locale );
 
 			dropdownView.extendTemplate( {
 				attributes: {

+ 2 - 4
packages/ckeditor5-font/src/fontsize/fontsizeui.js

@@ -11,8 +11,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Model from '@ckeditor/ckeditor5-ui/src/model';
 import Collection from '@ckeditor/ckeditor5-utils/src/collection';
 
-import addListViewToDropdown from '@ckeditor/ckeditor5-ui/src/dropdown/helpers/addlistviewtodropdown';
-import { createDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
+import { createDropdown, addListViewToDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
 
 import { normalizeOptions } from '../fontsize/utils';
 
@@ -62,7 +61,6 @@ export default class FontSizeUI extends Plugin {
 		const dropdownModel = new Model( {
 			icon: fontSizeIcon,
 			withText: false,
-			items: dropdownItems,
 			tooltip: t( 'Font Size' )
 		} );
 
@@ -72,7 +70,7 @@ export default class FontSizeUI extends Plugin {
 		editor.ui.componentFactory.add( 'fontSize', locale => {
 			const dropdownView = createDropdown( dropdownModel, locale );
 
-			addListViewToDropdown( dropdownView, dropdownModel, locale );
+			addListViewToDropdown( dropdownView, dropdownItems, dropdownModel, locale );
 
 			dropdownView.extendTemplate( {
 				attributes: {