Skip to content
This repository
Browse code

BUGFIX Calling tinyMCE.init() in sync with entwine rules to avoid unc…

…ached loading interfereing with call order (fixes #6877)
  • Loading branch information...
commit a64715beeb48914b1d9cece001267d96c2e0149c 1 parent 8292075
Ingo Schommer authored April 10, 2012
1  admin/javascript/LeftAndMain.Preview.js
@@ -129,6 +129,7 @@
129 129
 			
130 130
 			_fixIframeLinks: function() {
131 131
 				var doc = this.find('iframe')[0].contentDocument;
  132
+				if(!doc) return;
132 133
 
133 134
 				// Block outside links from going anywhere
134 135
 				var links = doc.getElementsByTagName('A');
1  forms/HtmlEditorConfig.php
@@ -308,7 +308,6 @@ function generateJS() {
308 308
 if((typeof tinyMCE != 'undefined')) {
309 309
 	$externalPluginsJS
310 310
 	var ssTinyMceConfig = " . Convert::raw2json($config) . ";
311  
-	tinyMCE.init(ssTinyMceConfig);
312 311
 }
313 312
 ";
314 313
 	}
15  javascript/HtmlEditorField.js
@@ -209,8 +209,17 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
209 209
 					}
210 210
 				});
211 211
 
212  
-				// Only works after TinyMCE.init() has been invoked, see $(window).bind() call below for details.
213  
-				this.redraw();
  212
+				// Using a global config (generated through HTMLEditorConfig PHP logic).
  213
+				// Depending on browser cache load behaviour, entwine's DOMMaybeChanged
  214
+				// can be called before the bottom-most inline script tag is executed,
  215
+				// which defines the global. If that's the case, wait for the window load.
  216
+				if(typeof ssTinyMceConfig != 'undefined') {
  217
+					this.redraw();
  218
+				} else {
  219
+					$(window).bind('load', function() {
  220
+						self.redraw();
  221
+					});
  222
+				}
214 223
 
215 224
 				this._super();
216 225
 			},
@@ -219,6 +228,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
219 228
 				// Using a global config (generated through HTMLEditorConfig PHP logic)
220 229
 				var config = ssTinyMceConfig, self = this, ed = this.getEditor();
221 230
 
  231
+				tinyMCE.init(config);
  232
+
222 233
 				// Avoid flicker (also set in CSS to apply as early as possible)
223 234
 				self.css('visibility', '');
224 235
 

0 notes on commit a64715b

Please sign in to comment.
Something went wrong with that request. Please try again.