Wait for tinyMCE editor to initialize when loading the notes view (#3293)

This commit is contained in:
Thomas Bruederli 2014-08-12 15:17:11 +02:00
parent f75cc4757d
commit 79af219093
2 changed files with 14 additions and 2 deletions

View file

@ -764,7 +764,7 @@ function rcube_kolab_notes_ui(settings)
/** /**
* *
*/ */
function render_note(data) function render_note(data, retry)
{ {
rcmail.set_busy(false, 'loading', ui_loading); rcmail.set_busy(false, 'loading', ui_loading);
@ -853,6 +853,18 @@ function rcube_kolab_notes_ui(settings)
} }
var node, editor = tinyMCE.get('notecontent'), is_html = false; var node, editor = tinyMCE.get('notecontent'), is_html = false;
retry = retry || 0;
// sometimes the editor instance is not ready yet (FF only)...
if (!readonly && !editor && $('#notecontent').length && retry < 5) {
// ... give it some more time
setTimeout(function() {
$(rcmail.gui_objects.noteseditform).show();
render_note(data, retry+1);
}, 200);
return;
}
if (!readonly && editor) { if (!readonly && editor) {
$(rcmail.gui_objects.notesdetailview).hide(); $(rcmail.gui_objects.notesdetailview).hide();
$(rcmail.gui_objects.noteseditform).show(); $(rcmail.gui_objects.noteseditform).show();

View file

@ -51,7 +51,7 @@ $(document).ready(function(e){
// fixes issue when toolbar is not ready yet and content // fixes issue when toolbar is not ready yet and content
// area height is set to 0, wait and try again later... // area height is set to 0, wait and try again later...
if (h < 0) if (h < 0)
setTimeout(function() { layout_view(); }, 1000); setTimeout(function() { layout_view(); }, 100);
} }
$(window).resize(function(e){ $(window).resize(function(e){