Commit 265b20b0 authored by Stefan Galinski's avatar Stefan Galinski 🎮

[BUGFIX] The RTE isn't loading sometimes

parent cc3e9dd9
......@@ -123,6 +123,32 @@ class Loader {
$configuration = $this->tinymceConfiguration['preJS'];
$configuration .= '
var SG = SG || {};
SG.domIsReady = (function(domIsReady) {
var isBrowserIeOrNot = function() {
return (!document.attachEvent || typeof document.attachEvent === "undefined" ? "not-ie" : "ie");
}
domIsReady = function(callback) {
if(callback && typeof callback === "function"){
if(isBrowserIeOrNot() !== "ie") {
document.addEventListener("DOMContentLoaded", function() {
return callback();
});
} else {
document.attachEvent("onreadystatechange", function() {
if(document.readyState === "complete") {
return callback();
}
});
}
} else {
console.error("The callback is not a function!");
}
}
return domIsReady;
})(SG.domIsReady || {});
SG.initTinyMceLoadFunction = function() {
if (SG.initializedTinyMceLoaderInstance) {
return;
......@@ -132,11 +158,12 @@ class Loader {
SG.initializedTinyMceLoaderInstance = new SG.TinyMceLoader(window.tinymce, {
' . $this->replaceTypo3Paths($this->tinymceConfiguration['configurationData']) . '
});
clearInterval(SG.initTinyMceLoadInterval);
}
};
SG.initTinyMceLoadFunction();
SG.initTinyMceLoadInterval = window.setInterval(SG.initTinyMceLoadFunction, 333);
SG.domIsReady(function() {
SG.initTinyMceLoadFunction();
});
';
$configuration .= $this->tinymceConfiguration['postJS'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment