diff --git a/js/documents.js b/js/documents.js index 66dc6722..ee578bc8 100644 --- a/js/documents.js +++ b/js/documents.js @@ -17,6 +17,7 @@ $.widget('oc.documentGrid', { jQuery.when(this._load(fileId)) .then(function(){ that._render(); + documentsMain.renderComplete = true; }); }, @@ -189,6 +190,7 @@ var documentsMain = { loadError : false, loadErrorMessage : '', loadErrorHint : '', + renderComplete: false, // false till page is rendered with all required data about the document(s) toolbar : '
', returnToDir : null, // directory where we started from in the 'Files' app @@ -375,6 +377,12 @@ var documentsMain = { return; } + if (!documentsMain.renderComplete) { + setTimeout(function() { documentsMain.UI.showEditor(title); }, 500); + console.log('Waiting for page to render ...'); + return; + } + $(document.body).addClass("claro"); $(document.body).prepend(documentsMain.UI.container);