diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-07-16 14:31:53 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-10-13 15:35:55 +0300 |
commit | 3c36406949f7b8bb54edbf8d75691983995f231e (patch) | |
tree | b73d6a71b605018dee5b1899421c162d8590e2d7 /src | |
parent | dd224654e8039df9f2b9b02ee5dccb68cda8d443 (diff) |
More fallbacks for files app specifics
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/files.js | 3 | ||||
-rw-r--r-- | src/view/FilesAppIntegration.js | 19 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/files.js b/src/files.js index c8ab15fe..1247ae4b 100644 --- a/src/files.js +++ b/src/files.js @@ -161,7 +161,8 @@ const odfViewer = { FilesAppIntegration.init({ fileName, fileId, - fileList: context.fileList, + fileList: context ? context.fileList : undefined, + fileModel: context ? context.fileModel : undefined, sendPostMessage: (msgId, values) => { PostMessages.sendWOPIPostMessage(FRAME_DOCUMENT, msgId, values) } diff --git a/src/view/FilesAppIntegration.js b/src/view/FilesAppIntegration.js index 5fd1d6ff..0d4afd6b 100644 --- a/src/view/FilesAppIntegration.js +++ b/src/view/FilesAppIntegration.js @@ -39,15 +39,16 @@ export default { startLoading() { if (this.getFileList()) { - this.getFileList().setViewerMode(true) - this.getFileList().showMask() + this.getFileList().setViewerMode && this.getFileList().setViewerMode(true) + this.getFileList().showMask && this.getFileList().showMask() } }, - init({ fileName, fileId, sendPostMessage, fileList }) { + init({ fileName, fileId, sendPostMessage, fileList, fileModel }) { this.fileName = fileName this.fileId = fileId this.fileList = fileList + this.fileModel = fileModel this.sendPostMessage = sendPostMessage }, @@ -60,7 +61,7 @@ export default { return } - if (typeof this.getFileList() !== 'undefined') { + if (this.getFileList()) { this.getFileModel() this.getFileList().hideMask && this.getFileList().hideMask() this.getFileList().setPageTitle && this.getFileList().setPageTitle(this.fileName) @@ -85,8 +86,8 @@ export default { } if (this.getFileList()) { - this.getFileList().setViewerMode(false) - this.getFileList().reload() + this.getFileList().setViewerMode && this.getFileList().setViewerMode(false) + this.getFileList().reload && this.getFileList().reload() } this.fileModel = null if (!isPublic) { @@ -115,7 +116,7 @@ export default { return } if (this.getFileList()) { - this.getFileList().reload() + this.getFileList().reload && this.getFileList().reload() OC.Apps.hideAppSidebar() } }, @@ -160,10 +161,10 @@ export default { if (!this.getFileList()) { return null } - this.getFileList()._updateDetailsView(this.fileName, false) + this.getFileList()._updateDetailsView && this.getFileList()._updateDetailsView(this.fileName, false) this.fileModel = this.getFileList().getModelForFile(this.fileName) - if (this.fileModel !== null) { + if (this.fileModel && this.fileModel.on) { this.fileModel.on('change', () => { this._addHeaderFileActions() }) |