BUGFIX Calling tinyMCE.init() in sync with entwine rules to avoid uncached loading interfereing with call order (fixes #6877)

This commit is contained in:
Ingo Schommer 2012-04-10 21:08:31 +02:00
parent 8292075174
commit a64715beeb
3 changed files with 14 additions and 3 deletions

View File

@ -129,6 +129,7 @@
_fixIframeLinks: function() {
var doc = this.find('iframe')[0].contentDocument;
if(!doc) return;
// Block outside links from going anywhere
var links = doc.getElementsByTagName('A');

View File

@ -308,7 +308,6 @@ class HtmlEditorConfig {
if((typeof tinyMCE != 'undefined')) {
$externalPluginsJS
var ssTinyMceConfig = " . Convert::raw2json($config) . ";
tinyMCE.init(ssTinyMceConfig);
}
";
}

View File

@ -209,8 +209,17 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
}
});
// Only works after TinyMCE.init() has been invoked, see $(window).bind() call below for details.
this.redraw();
// Using a global config (generated through HTMLEditorConfig PHP logic).
// Depending on browser cache load behaviour, entwine's DOMMaybeChanged
// can be called before the bottom-most inline script tag is executed,
// which defines the global. If that's the case, wait for the window load.
if(typeof ssTinyMceConfig != 'undefined') {
this.redraw();
} else {
$(window).bind('load', function() {
self.redraw();
});
}
this._super();
},
@ -219,6 +228,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
// Using a global config (generated through HTMLEditorConfig PHP logic)
var config = ssTinyMceConfig, self = this, ed = this.getEditor();
tinyMCE.init(config);
// Avoid flicker (also set in CSS to apply as early as possible)
self.css('visibility', '');