From 80ee69c6fe41cec2769367e9be9641381cf11596 Mon Sep 17 00:00:00 2001 From: Daniel Sun Date: Wed, 7 Mar 2018 01:07:31 +1100 Subject: [PATCH] do an automatic reload when ckeditor has not been loaded. --- src/ckeditor.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ckeditor.js b/src/ckeditor.js index 359d0dc..ec2a20c 100644 --- a/src/ckeditor.js +++ b/src/ckeditor.js @@ -36,6 +36,13 @@ class CKEditor extends React.Component { this.unmounting = true; } + reloadEditor() { + clearTimeout(this.timeout); + if (!this.editorInstance.ui.editor.loaded) { + loadScript(this.props.scriptUrl, this.onLoad); + } + } + onLoad() { if (this.unmounting) return; @@ -60,6 +67,8 @@ class CKEditor extends React.Component { this.editorInstance.on(event, eventHandler); } + + this.timeout = setTimeout(this.reloadEditor.bind(this), 3000); } render() {