Importing CKeditor using npm


#1

I’m trying to load CKeditor to my angular meteor project.
I’ve downloaded it using npm meteor npm install --save ckeditor

But when i’m importing it using import CKEDITOR from 'ckeditor' and then run CKEDITOR.replace(myeditor1) i get an errors.

What is the correct way to load it?


#2

Finally got ckEditor to work and thought to share on how i did it incase anyone will bump into this in the future.

So turns out that when importing ckeditor (import ckeditor from "ckeditor"), ckEditor will set it self right to the window object(window.CKEDITOR).

After i understood that, this is how i made it work.

  1. Set a global variable CKEDITOR_BASEPATH in your index.html
    <script> CKEDITOR_BASEPATH = '/ckeditor/'; </script>
  2. Create a ckeditor folder uner your public folder(ie. APP_ROOT/public/ckeditor)
  3. Copy “lang” and “skins” folders(with their content) and also “config.js”, “content.css”, “styles.js” files into APP_ROOT/public/ckeditor
  4. Import ckeditor in your module file `import ckeditor from “ckeditor”
  5. Load ckeditor
    CKEDITOR.replace( 'textarea', { height: 260 });

If someone thinks of a better way let me know. Any way this is now works as expected.