Skip to content

Instantly share code, notes, and snippets.

@ronald-hove
Created September 28, 2019 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronald-hove/eed0b4b52795fe26e372d3c198e729e9 to your computer and use it in GitHub Desktop.
Save ronald-hove/eed0b4b52795fe26e372d3c198e729e9 to your computer and use it in GitHub Desktop.
loadCkEditor() {
const script = this._renderer2.createElement('script');
script.type = 'application/javascript';
script.src =
'https://cdn.ckeditor.com/ckeditor5/12.4.0/classic/ckeditor.js';
script.text = `
${(script.onload = async () => {
const CKEditor = (window as any).ClassicEditor;
const editor = await CKEditor.create(
document.querySelector('#editor'),
{
toolbar: [
'heading',
'|',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'insertTable',
'undo',
'redo'
]
}
);
editor.model.document.on('change', () => {
this.ckEditorData = JSON.stringify(editor.getData());
});
})}
`;
this._renderer2.appendChild(this._document.body, script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment