BUGFIX Only call TinyMCE.init() once per window load (actual editor creation happens through new tinymce.Editor()

This commit is contained in:
Ingo Schommer 2012-04-18 17:38:24 +02:00
parent 57ee9bf5e8
commit 14895a2056

View File

@ -13,8 +13,15 @@
* Caution: Incomplete and unstable API.
*/
ss.editorWrappers = {};
ss.editorWrappers.initial
ss.editorWrappers.tinyMCE = (function() {
return {
init: function(config) {
if(!ss.editorWrappers.tinyMCE.initialized) {
tinyMCE.init(config);
ss.editorWrappers.tinyMCE.initialized = true;
}
},
/**
* @return Mixed Implementation specific object
*/
@ -196,7 +203,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
* Constructor: onmatch
*/
onmatch : function() {
var self = this, ed = ss.editorWrappers['default']();
var self = this, edClass = this.data('editor') || ss.editorWrappers['default'], ed = edClass();
this.setEditor(ed);
this.closest('form').bind('beforesave', function() {
// TinyMCE modifies input, so change tracking might get false
@ -228,7 +235,7 @@ 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);
ed.init(config);
// Avoid flicker (also set in CSS to apply as early as possible)
self.css('visibility', '');