Created
September 28, 2019 09:56
-
-
Save ronald-hove/eed0b4b52795fe26e372d3c198e729e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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