ckeditor / ckeditor5-angular

Official CKEditor 5 Angular 5+ component.
https://ckeditor.com/ckeditor-5
Other
203 stars 111 forks source link

Add note to the readme that the Watchdog feature should not be added to the custom build #211

Open ikliapchuk opened 4 years ago

ikliapchuk commented 4 years ago

Based on the documentation, I made the following steps to add a CKEditor to my app: npm install --save @ckeditor/ckeditor5-angular Then I import it to my module where I plan to use the editor like this :

import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
@NgModule( {
    imports: [
        CKEditorModule,
        // ...
    ],
    // ...
} )

Instead of using already pre-build editors, I generate my own custom build from: https://ckeditor.com/ckeditor-5/online-builder/ I choose an inline type editor with this list of plugins:

plugins-list

As was stated in the documentation I import my custom editor to the component where I plan to use it like this :

import * as CustomEditor from '/assets/ckeditor/build/ckeditor';

@Component( {
    // ...
} )
export class MyComponent {
    public Editor = ClassicEditor;
    // ...
}

I also add this line to my tsconfig.ts "allowJs": true,

The Html code looks pretty simple: <ckeditor [editor]="Editor" data="<p>Hello, world!</p>"></ckeditor>

After rebuilding app I received this error:

Screenshot 2020-06-16 at 13 57 43

What can this error be related to?

BTW: I also tried to make a different custom build with a Classic type of Editor which include only Bold and Italic plugin (just for tests), in this case, the situation looks better, I didn't receive any errors, but it also looks like something is wrong because the toolbar is invisible in this case

Screenshot 2020-06-16 at 13 25 51

Thanks in advance for your help! ;)

FilipTokarski commented 4 years ago

cc @ma2ciek can you take a look at this? I check it and this error occurs only when using builds with Watchdog ( like in this case ☝️ ).

ma2ciek commented 4 years ago

Hi, you should not add the Watchdog feature to the selected plugins in the CKEditor 5 Online Builder as the Watchdog is already added by the ckeditor5-angular package - I see that it isn't mentioned anywhere, so some information should be added to docs.

After adding the Watchdog to other plugins in the Online Builder, both, the editor and the watchdog are exported from the bundle.

import * as CustomEditor from '/assets/ckeditor/build/ckeditor'; - that's no longer true as the bundle in this case will export such object: { Editor, Watchdog } , that's why an issue occurs.

It would be impossible to track the editor state and restart the editor outside of the Angular component, that's why we decided to make the watchdog feature built-in to the CKEditor 5 Angular component.

ikliapchuk commented 4 years ago

Hi, thanks for a quick response.

I tried to make a custom build without Watchdog, error from console disappeared, but the main problem with the invisible toolbar still exists.

Screenshot 2020-06-17 at 14 10 18

what could be the problem?

Mgsy commented 4 years ago

@ikliapchuk, did you add items to your toolbar configuration?

Also, I think this is a separate issue. Could you please open a new issue with a detailed description and all information about your setup?

ikliapchuk commented 4 years ago

I repeated the whole process as I described in the issue description, but did not add Watchdog to the plugin list. Yes, if it's needed I can create a new issue.