Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-01-25 19:40:06 +0300
committerJulius Härtl <jus@bitgrid.net>2019-01-25 19:42:10 +0300
commit12b3780c7dc229e8f21c23dd750653f228b254ff (patch)
tree6069d38a4f19c7e794bd7722e278f94512574a86 /js/documents.js
parent91011dee5a0382e4dc7dcc0cf726ab731c4b1011 (diff)
Properly load file model with correct name on creation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'js/documents.js')
-rw-r--r--js/documents.js28
1 files changed, 19 insertions, 9 deletions
diff --git a/js/documents.js b/js/documents.js
index cfc73f3a..a545766e 100644
--- a/js/documents.js
+++ b/js/documents.js
@@ -149,6 +149,7 @@ var documentsMain = {
loadError : false,
loadErrorMessage : '',
loadErrorHint : '',
+ fileModel: null,
renderComplete: false, // false till page is rendered with all required data about the document(s)
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>',
$deferredVersionRestoreAck: null,
@@ -611,6 +612,10 @@ var documentsMain = {
}
} else if (msg.Values.Status === "Document_Loaded" ) {
window.removeEventListener('message', editorInitListener, false);
+ if (parent.OCA.Files.App) {
+ parent.OCA.Files.App.fileList.reload();
+ documentsMain.getFileModel();
+ }
}
}
};
@@ -839,15 +844,6 @@ var documentsMain = {
documentsMain.canEdit = Boolean(richdocuments_permissions & OC.PERMISSION_UPDATE);
documentsMain.loadDocument(documentsMain.fileName, documentsMain.fileId);
- if (parent.OCA.Files.App) {
- parent.OCA.Files.App.fileList._updateDetailsView(documentsMain.fileName, false);
- var fileModel = parent.OCA.Files.App.fileList.getModelForFile(documentsMain.fileName);
- fileModel.on('change', function () {
- documentsMain.UI._addHeaderFileActions();
- });
- documentsMain.UI._addHeaderFileActions();
-
- }
});
},
@@ -861,6 +857,20 @@ var documentsMain = {
});
},
+ getFileModel: function() {
+ parent.OCA.Files.App.fileList._updateDetailsView(documentsMain.fileName, false);
+ var fileModel = parent.OCA.Files.App.fileList.getModelForFile(documentsMain.fileName);
+ if (fileModel) {
+ documentsMain.fileModel = fileModel;
+ fileModel.on('change', function () {
+ documentsMain.UI._addHeaderFileActions();
+ });
+ documentsMain.UI._addHeaderFileActions();
+ } else {
+ setTimeout(documentsMain.getFileModel, 500);
+ }
+ },
+
loadDocument: function(title, fileId) {
documentsMain.UI.showEditor(title, fileId, 'write');
},