Skip to content
Snippets Groups Projects
Commit c8feee41 authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Load the tinymce loader also if the code is added after the load event (IRRE)

parent 7bd8c9fc
No related branches found
Tags 4.2.0
No related merge requests found
......@@ -113,20 +113,30 @@ class Loader {
/**
* Returns a file that contains the tinyMCE configuration
*
* Note: The load dom event cannot be used, because e.g. IRRE adds the javascript
* later on. This leads to code that is never executed. The interval timer hack fixes this
* issue.
*
* @return string
*/
protected function getConfiguration() {
$configuration = $this->tinymceConfiguration['preJS'];
$configuration .= '
document.addEventListener(
"DOMContentLoaded", function() {
if (window.tinymce && window.tinymce.init) {
(new SG.TinyMceLoader(window.tinymce, {
' . $this->replaceTypo3Paths($this->tinymceConfiguration['configurationData']) . '
}));
}
}, false
);
var SG = SG || {};
SG.initTinyMceLoadFunction = function() {
if (SG.initializedTinyMceLoaderInstance) {
return;
}
if (SG.TinyMceLoader && window.tinymce && window.tinymce.init) {
SG.initializedTinyMceLoaderInstance = new SG.TinyMceLoader(window.tinymce, {
' . $this->replaceTypo3Paths($this->tinymceConfiguration['configurationData']) . '
});
clearInterval(SG.initTinyMceLoadInterval);
}
};
SG.initTinyMceLoadFunction();
SG.initTinyMceLoadInterval = window.setInterval(SG.initTinyMceLoadFunction, 1000);
';
$configuration .= $this->tinymceConfiguration['postJS'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment