Browse Source

Update prepateIntegrations util.

panr 5 years ago
parent
commit
ebed510151
1 changed files with 7 additions and 2 deletions
  1. 7 2
      packages/ckeditor5-image/src/imageupload/utils.js

+ 7 - 2
packages/ckeditor5-image/src/imageupload/utils.js

@@ -87,14 +87,17 @@ function getImageMimeType( blob, src ) {
  * Creates integrations object that will be passed to the
  * {@link module:image/imageupload/ui/imageuploadpanelview~ImageUploadPanelView}.
  *
+ * @param {module:core/editor/editor~Editor} editor Editor instance.
+ *
  * @returns {Object}
  */
+
 export function prepareIntegrations( editor ) {
 	const panelItems = editor.config.get( 'image.upload.panel.items' );
 	const imageUploadUIPlugin = editor.plugins.get( 'ImageUploadUI' );
 
 	if ( !panelItems ) {
-		return;
+		return null;
 	}
 
 	const PREDEFINED_INTEGRATIONS = {
@@ -119,10 +122,12 @@ export function prepareIntegrations( editor ) {
 	const integrations = panelItems.reduce( ( object, key ) => {
 		if ( PREDEFINED_INTEGRATIONS[ key ] ) {
 			object[ key ] = PREDEFINED_INTEGRATIONS[ key ];
+		} else if ( editor.ui.componentFactory.has( key ) ) {
+			object[ key ] = editor.ui.componentFactory.create( key );
 		}
 
 		return object;
 	}, {} );
 
-	return Object.keys( integrations ).length ? integrations : null;
+	return integrations;
 }