Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Update config.removePlugins docs as it results in an exception #525

Closed
wwalc opened this issue Aug 21, 2017 · 4 comments
Closed

[Docs] Update config.removePlugins docs as it results in an exception #525

wwalc opened this issue Aug 21, 2017 · 4 comments
Assignees
Labels
type:docs This issue reports a task related to documentation (e.g. an idea for a guide).
Milestone

Comments

@wwalc
Copy link
Member

wwalc commented Aug 21, 2017

If you follow the documentation as is (define just config.removePlugins), then the editor does not load due to:

CKEditorError: componentfactory-item-missing: There is no such UI component in the factory. {"name":"bold"}

Apparently the default build toolbar must be defined manually if a plugin is missing. This is quite confusing, at least for users with CKEditor 4 experience.

Some misleading locations that I relied on:

@wwalc wwalc added the type:docs This issue reports a task related to documentation (e.g. an idea for a guide). label Aug 21, 2017
@Reinmar Reinmar added this to the iteration 11 milestone Aug 23, 2017
@marc-wilson
Copy link

marc-wilson commented Aug 30, 2017

+1

I'm receiving the same error message but it's only when I specify toolbar options in config:

InlineEditor.create(document.querySelector('#ckeditor-test'), {
      toolbar: ['bold', 'italic']
    }).then( editor => {
      const e = editor;
    }, error => {
      const edr = this._dialog.open(ErrorDialogComponent);
      edr.componentInstance.message = error.message;
    });

componentfactory-item-missing: There is no such UI component in the factory. {"name":"bold"}

@Reinmar Reinmar modified the milestones: iteration 12, iteration 11 Aug 31, 2017
@Reinmar
Copy link
Member

Reinmar commented Aug 31, 2017

I'm receiving the same error message but it's only when I specify toolbar options in config:

You're using the InlineEditor class for which we don't have a build yet, so this means that you're using the creator directly (there are "editor creator classes" and "editor builds"). Creators don't have the features built in so that's why you see the error about a missing component. You need to specify config.plugins option to have something like this:

import EssentialsPlugin from '@ckeditor/ckeditor5-presets/src/essentials';
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat';
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
import BlockquotePlugin from '@ckeditor/ckeditor5-block-quote/src/blockquote';
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
import ImagePlugin from '@ckeditor/ckeditor5-image/src/image';
import ImagecaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption';
import ImagestylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle';
import ImagetoolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar';
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';

InlineEditor.create( element, {
	plugins: [
		EssentialsPlugin,
		AutoformatPlugin,
		BoldPlugin,
		ItalicPlugin,
		BlockquotePlugin,
		HeadingPlugin,
		ImagePlugin,
		ImagecaptionPlugin,
		ImagestylePlugin,
		ImagetoolbarPlugin,
		LinkPlugin,
		ListPlugin,
		ParagraphPlugin
	],
	toolbar: [ ... ]
} )
.then( ... )
.catch( ... );

Of course, you can remove the plugins that you don't need.

What I see is that we definitely have a problem in explaining what is a build and what's an editor creator source and what are the differences between them. The classes have the same names and only the package names differentiate them (@ckeditor-editor-classic and @ckedtor-build-classic). Also, the word "build" is used as a verb and noun all the time which doesn't make things easier. We need to be extremely careful here and clear in the communication.

E.g. here, we could extend the componentfactory-item-missing error description, but for that we need to work on a plugin for JSDoc which will read our @error docs from the code (we've had this planned). Then, we could explain what are the reasons to see such an error.

@Reinmar
Copy link
Member

Reinmar commented Sep 5, 2017

This ticket is blocked by #526. Let's wait for #526 because it will tell us how the warning really looks.

@Reinmar Reinmar modified the milestones: iteration 12, iteration 13 Oct 9, 2017
@Reinmar Reinmar modified the milestones: iteration 13, iteration 14 Nov 14, 2017
@Reinmar Reinmar self-assigned this Mar 5, 2018
@Reinmar
Copy link
Member

Reinmar commented Mar 5, 2018

It seems that this became less of an issue after the actions we took. First of all, we added the following note in the docs:

Be careful when removing plugins using config.removePlugins from CKEditor builds. If removed plugins were providing toolbar buttons, the default toolbar configuration included in a build will become invalid. In such case you need to provide the updated toolbar configuration as in the example above.

Second, the error was converted into a warning and does not crash the editor. Third, the error links to a much nicer description:

image

@Reinmar Reinmar closed this as completed Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:docs This issue reports a task related to documentation (e.g. an idea for a guide).
Projects
None yet
Development

No branches or pull requests

3 participants