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?
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.
- Set a global variable
CKEDITOR_BASEPATH
in your index.html
<script> CKEDITOR_BASEPATH = '/ckeditor/'; </script>
- Create a
ckeditor
folder uner your public folder(ie. APP_ROOT/public/ckeditor)
- Copy “lang” and “skins” folders(with their content) and also “config.js”, “content.css”, “styles.js” files into
APP_ROOT/public/ckeditor
- Import ckeditor in your module file `import ckeditor from “ckeditor”
- 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.
2 Likes