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
No related tags found
No related merge requests found
...@@ -113,20 +113,30 @@ class Loader { ...@@ -113,20 +113,30 @@ class Loader {
/** /**
* Returns a file that contains the tinyMCE configuration * 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 * @return string
*/ */
protected function getConfiguration() { protected function getConfiguration() {
$configuration = $this->tinymceConfiguration['preJS']; $configuration = $this->tinymceConfiguration['preJS'];
$configuration .= ' $configuration .= '
document.addEventListener( var SG = SG || {};
"DOMContentLoaded", function() { SG.initTinyMceLoadFunction = function() {
if (window.tinymce && window.tinymce.init) { if (SG.initializedTinyMceLoaderInstance) {
(new SG.TinyMceLoader(window.tinymce, { return;
' . $this->replaceTypo3Paths($this->tinymceConfiguration['configurationData']) . ' }
}));
} if (SG.TinyMceLoader && window.tinymce && window.tinymce.init) {
}, false 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']; $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