From 680baab9258fbabbc2d933f7ee7afe8f470ea62b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 8 Oct 2012 21:44:03 +0200 Subject: [PATCH] BUG Delay HTMLEditorField showing (TinyMCE workaround) Delayed show because TinyMCE calls hide() via setTimeout on removing an element, which is called in quick succession with adding a new editor after ajax loading new markup See https://github.com/tinymce/tinymce/commit/e0378ceb7792fb7949c3aca3487306a78668595e and https://github.com/silverstripe/sapphire/pull/847 --- javascript/HtmlEditorField.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index d99cdcdde..64c792bc8 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -266,14 +266,15 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; ed.init(config); - // Avoid flicker (also set in CSS to apply as early as possible) - self.css('visibility', ''); - // Create editor instance and render it. // Similar logic to adapter/jquery/jquery.tinymce.js, but doesn't rely on monkey-patching // jQuery methods, and avoids replicate the script lazyloading which is already in place with jQuery.ondemand. ed.create(this.attr('id'), config, function() { - self.css('visibility', 'visible'); + // Delayed show because TinyMCE calls hide() via setTimeout on removing an element, + // which is called in quick succession with adding a new editor after ajax loading new markup + setTimeout(function() { + $(ed.getContainer()).show(); + }, 10); }); this._super();