ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Uncaught CKEditorError: ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated

Open tanmaymishu opened this issue 7 years ago • 13 comments

📝 Reproduction Steps

I have a typical web app.

I am having a hard time integrating ckeditor-5 in my application. Here are the steps I followed:

  • I installed the ckeditor5-build-classic, following their official installation guide, with the following npm command: npm install --save @ckeditor/ckeditor5-build-classic

  • I imported it in my app.js and bound it to the window object:

    import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
    window.ClassicEditor = ClassicEditor;
    
  • In my view file, I initialized the editor:

    ClassicEditor
            .create( document.querySelector( '#editor' ) )
            .catch( error => {
                console.error( error );
            } );
    
  • No error so far. However, when I want to add image, I get a warning in the console which takes me to this page. Where I am asked to configure an upload adapter.

  • I chose Simple Upload Adapter. I installed it with: npm install --save @ckeditor/ckeditor5-upload

  • Imported It, and attached it to the window object:

    import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
    import SimpleUploadAdapter from '@ckeditor/ckeditor5-upload/src/adapters/simpleuploadadapter';
    
    
    window.ClassicEditor = ClassicEditor;
    window.SimpleUploadAdapter = SimpleUploadAdapter;
    
  • Reconfigured the editor in view file:

    ClassicEditor
    .create( document.querySelector( '#editor' ), {
        plugins: [ SimpleUploadAdapter ],
        simpleUpload: {
            uploadUrl: '/ck-images',
        }
    } )
    .then()
    .catch();
    
  • And now I am getting this error:

Uncaught CKEditorError: ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-ckeditor-duplicated-modules

What am I doing wrong? They've also stated that

The @ckeditor/ckeditor5-upload package is available by default in all official editor builds. You do not have to install it, if you are extending one.

Apparently ckeditor5-build-classic is one of the official builds. But if Simple Upload Adapter is available by default and I don't have to install it, why is it asking me to add one? ¯\(ツ)/¯

How can I configure simple upload adapter for the ckeditor?

✔️ Expected result

Simple Upload Adapter to be integrated.

❌ Actual result

Uncaught CKEditorError: ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated

📃 Other details

  • Browser: Google Chrome 78.0.3904.108 (Official Build) (64-bit)
  • OS: macOS Catalina 10.15.1
  • CKEditor version: "@ckeditor/ckeditor5-build-classic": "^15.0.0",
  • Installed CKEditor plugins: "@ckeditor/ckeditor5-upload": "^15.0.0",

tanmaymishu avatar Nov 22 '19 03:11 tanmaymishu

Hi, thanks for the report. You're trying to add the plugin to the existing build which is not a proper way. To make it work, you should create a custom build which will have your plugin included. Please, see our Adding a plugin to a build guide to learn more.

We're aware that this way of adding plugins isn't convenient and might be misleading, however, it's not easy to change it with the current architecture. We'd definitely like to improve it and we have already a discussion ticket which you can read here.

What am I doing wrong? They've also stated that

The @ckeditor/ckeditor5-upload package is available by default in all official editor builds. You do not have to install it, if you are extending one.

Indeed, this part of the documentation is misleading. We've already fixed it - https://github.com/ckeditor/ckeditor5-upload/pull/101.

Mgsy avatar Nov 22 '19 08:11 Mgsy

Thanks. I went ahead and implemented my own custom upload adapter.

tanmaymishu avatar Nov 22 '19 10:11 tanmaymishu

Thanks. I went ahead and implemented my own custom upload adapter.

did you implemented your own custom upload adapter? :) I have the same hard time.

selbest avatar Aug 21 '20 08:08 selbest

Why not add a build with all the editors in it? Needlessly complicated and poorly documented

bremg avatar Sep 18 '20 10:09 bremg

Just spent 2 hours+ on all this - ended up looking at https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/upload-adapter.html#the-complete-implementation but that doesn't work either:

There was a problem initializing the editor. TypeError: t.map is not a function
    at Wf (ckeditor.js:5)
    at em.init (ckeditor.js:5)

Architecture. Must. Change.

Might roll back to CK4 or migrate to tinyMCE, do let us know when fixed.

ThePeterMick avatar Jan 13 '21 00:01 ThePeterMick

Adding a plugin is way too hard. I've spent all day in this and can't get it working. I'm using a themeforest theme where the editor is already built in. Like how is align not part of the default inline editor!

GCodebase avatar Feb 06 '21 02:02 GCodebase

I'm using the decoupled editor with source, not a build, and also having this problem. Why so complicated?

nimarahbari avatar Mar 24 '21 09:03 nimarahbari

Just use https://summernote.org/ - I've moved a while back and loving it! <3

ThePeterMick avatar Mar 24 '21 10:03 ThePeterMick

Just use https://summernote.org/ - I've moved a while back and loving it! <3

Hi, Does this support Angular? By any chance do you know does this component has export to pdf feature?

shyambabu-kolipaka avatar Aug 25 '21 12:08 shyambabu-kolipaka

It's really difficult to add a plug-in, and the document can't be understood. I don't know what to do to normally introduce a plug-in. The document is said to be copied. If you follow the document process, there will still be this prompt. I don't know whether this can be repaired, or give a document that can be understood and executed normally

luckykiss avatar Nov 08 '21 03:11 luckykiss

If you want to have an editor build to which you can add/remove plugins, you should build your editor from source code - https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/advanced-setup.html#scenario-2-building-from-source. This is the best method in my opinion as it gives you full control over the build. 

You can add plugin to a build by following this guide https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/installing-plugins.html#adding-a-plugin-to-a-build. Please note this guide requires you to actually clone source code repository of a build, modifying it and then build it which makes is a build from source code except that you have certain set og plugins already defined and you don't have to do everything from scratch. 

Some users try to download editor build CKSource download page and add plugins to it or they try to make a source build from build package import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; instead of source package import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';. Both methods are incorrect and should be avoided as they won't work.

jswiderski avatar Mar 10 '22 09:03 jswiderski

I am not able to use ckeditor5-build-balloon-block

GET http://localhost:4200/node_modules/@ckeditor/ckeditor5-build-balloon-block/build/ckeditor.js net::ERR_ABORTED 404 (Not Found) ckeditor.js:6 Uncaught CKEditorError: ckeditor-duplicated-modules Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-ckeditor-duplicated-modules at ckeditor.js:6:314134 at ckeditor.js:6:976166 at ckeditor.js:6:976182 at ckeditor.js:6:64 at Object.3784 (ckeditor.js:6:206) at webpack_require (bootstrap:19:1) at Module.51018 (app.module.ts:46:19) at webpack_require (bootstrap:19:1) at Module.55041 (app-routing.module.ts:20:25) at webpack_require (bootstrap:19:1)

CkEditorComponent.ts import BalloonEditor from '@ckeditor/ckeditor5-build-balloon-block';

export class CkEditorComponent implements OnInit { public Editor = BalloonEditor; }

CkEditorComponent.html

<ckeditor [editor]="Editor">

typings.d.ts

declare module '@ckeditor/ckeditor5-build-balloon-block' { // or other CKEditor 5 build.

const BalloonEditor: any;
export default BalloonEditor;

}

siva-geddada avatar Mar 18 '22 10:03 siva-geddada

Hi, thanks for the report. You're trying to add the plugin to the existing build which is not a proper way. To make it work, you should create a custom build which will have your plugin included. Please, see our Adding a plugin to a build guide to learn more.

We're aware that this way of adding plugins isn't convenient and might be misleading, however, it's not easy to change it with the current architecture. We'd definitely like to improve it and we have already a discussion ticket which you can read here.

What am I doing wrong? They've also stated that

The @ckeditor/ckeditor5-upload package is available by default in all official editor builds. You do not have to install it, if you are extending one.

Indeed, this part of the documentation is misleading. We've already fixed it - ckeditor/ckeditor5-upload#101.

так нихуя же нет этой страницы

easydgz avatar May 07 '24 14:05 easydgz