This commit is contained in:
Pan 2019-05-26 17:19:26 +08:00
parent 0d4f3c79b8
commit a2d41e9c0b
1 changed files with 4 additions and 6 deletions

View File

@ -1,6 +1,7 @@
let callbacks = [] let callbacks = []
function loadedTinymce() { function loadedTinymce() {
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2144
// check is successfully downloaded script // check is successfully downloaded script
return window.tinymce return window.tinymce
} }
@ -9,17 +10,12 @@ const dynamicLoadScript = (src, callback) => {
const existingScript = document.getElementById(src) const existingScript = document.getElementById(src)
const cb = callback || function() {} const cb = callback || function() {}
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2144
if (!loadedTinymce()) {
callbacks.push(cb)
}
if (!existingScript) { if (!existingScript) {
const script = document.createElement('script') const script = document.createElement('script')
script.src = src // src url for the third-party library being loaded. script.src = src // src url for the third-party library being loaded.
script.id = src script.id = src
document.body.appendChild(script) document.body.appendChild(script)
callbacks.push(cb)
const onEnd = 'onload' in script ? stdOnEnd : ieOnEnd const onEnd = 'onload' in script ? stdOnEnd : ieOnEnd
onEnd(script) onEnd(script)
} }
@ -27,6 +23,8 @@ const dynamicLoadScript = (src, callback) => {
if (existingScript && cb) { if (existingScript && cb) {
if (loadedTinymce()) { if (loadedTinymce()) {
cb(null, existingScript) cb(null, existingScript)
} else {
callbacks.push(cb)
} }
} }