diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/files.js | 12 | ||||
-rw-r--r-- | src/view/NewFileMenu.js | 12 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/files.js b/src/files.js index 54123615..04a2b6d2 100644 --- a/src/files.js +++ b/src/files.js @@ -39,7 +39,7 @@ const odfViewer = { OC.imagePath('core', 'actions/rename'), (fileName, context) => { const fileModel = context.fileList.findFile(fileName) - const shareOwnerId = fileModel.shareOwnerId + const shareOwnerId = fileModel?.shareOwnerId return this.onEdit(fileName, { ...context, shareOwnerId }) }, t('richdocuments', 'Edit with {productName}', { productName: OC.getCapabilities().richdocuments.productName }, undefined, { escape: false }) @@ -72,7 +72,7 @@ const odfViewer = { } odfViewer.open = true if (context) { - if (context.$file.attr('data-mounttype') === 'external-session') { + if (context?.$file?.attr('data-mounttype') === 'external-session') { OCP.Toast.error(t('richdocuments', 'Opening the file is not supported, since the credentials for the external storage are not available without a session'), { timeout: 0 }) @@ -80,7 +80,7 @@ const odfViewer = { return } var fileDir = context.dir - var fileId = context.fileId || context.$file.attr('data-id') + var fileId = context.fileId || context.$file?.attr('data-id') var templateId = context.templateId } FilesAppIntegration.startLoading() @@ -134,7 +134,7 @@ const odfViewer = { } if (context) { - reloadForFederationCSP(fileName, context.shareOwnerId) + reloadForFederationCSP(fileName, context?.shareOwnerId) } $('head').append($('<link rel="stylesheet" type="text/css" href="' + OC.filePath('richdocuments', 'css', 'mobile.css') + '"/>')) @@ -291,7 +291,9 @@ $(document).ready(function() { } odfViewer.registerFileActions() - OC.Plugins.register('OCA.Files.NewFileMenu', NewFileMenu) + if (isPublic) { + OC.Plugins.register('OCA.Files.NewFileMenu', NewFileMenu) + } } // Open the template picker if there was a create parameter detected on load diff --git a/src/view/NewFileMenu.js b/src/view/NewFileMenu.js index b5dc2f22..da033ca2 100644 --- a/src/view/NewFileMenu.js +++ b/src/view/NewFileMenu.js @@ -32,8 +32,8 @@ const NewFileMenu = { newFileMenu.addMenuEntry({ id: 'add-' + document.extension, - displayName: t('richdocuments', 'New Document'), - templateName: t('richdocuments', 'New Document') + '.' + document.extension, + displayName: t('richdocuments', 'New document'), + templateName: t('richdocuments', 'New document') + '.' + document.extension, iconClass: 'icon-filetype-document', fileType: 'x-office-document', actionHandler: function(filename) { @@ -47,8 +47,8 @@ const NewFileMenu = { newFileMenu.addMenuEntry({ id: 'add-' + spreadsheet.extension, - displayName: t('richdocuments', 'New Spreadsheet'), - templateName: t('richdocuments', 'New Spreadsheet') + '.' + spreadsheet.extension, + displayName: t('richdocuments', 'New spreadsheet'), + templateName: t('richdocuments', 'New spreadsheet') + '.' + spreadsheet.extension, iconClass: 'icon-filetype-spreadsheet', fileType: 'x-office-spreadsheet', actionHandler: function(filename) { @@ -62,8 +62,8 @@ const NewFileMenu = { newFileMenu.addMenuEntry({ id: 'add-' + presentation.extension, - displayName: t('richdocuments', 'New Presentation'), - templateName: t('richdocuments', 'New Presentation') + '.' + presentation.extension, + displayName: t('richdocuments', 'New presentation'), + templateName: t('richdocuments', 'New presentation') + '.' + presentation.extension, iconClass: 'icon-filetype-presentation', fileType: 'x-office-presentation', actionHandler: function(filename) { |