Fix files-actions script name

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-09-05 13:40:29 +02:00
parent b0e1808b1b
commit fb9fe6da2b
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
2 changed files with 9 additions and 4 deletions

View File

@ -21,12 +21,15 @@
*/
import { generateUrl } from '@nextcloud/router'
const mime = 'text/vcard'
const name = 'contacts-import'
window.addEventListener('DOMContentLoaded', () => {
if (OCA.Files && OCA.Files.fileActions) {
OCA.Files.fileActions.registerAction({
name: 'contacts_import',
name,
displayName: t('contacts', 'Import'),
mime: 'text/vcard',
mime,
permissions: OC.PERMISSION_READ,
iconClass: 'icon-contacts',
actionHandler(fileName, context) {
@ -34,6 +37,8 @@ window.addEventListener('DOMContentLoaded', () => {
window.location = generateUrl(`/apps/contacts/import?file=${absPath}`)
},
})
OCA.Files.fileActions.setDefault('text/vcard', 'contacts_import')
OCA.Files.fileActions.setDefault(mime, name)
return
}
console.error('Unable to register vcf import action')
})

View File

@ -2,7 +2,7 @@ const path = require('path')
const webpack = require('webpack')
const webpackConfig = require('@nextcloud/webpack-vue-config')
webpackConfig.entry['files-action'] = path.join(__dirname, 'src', 'files_action.js')
webpackConfig.entry['files-action'] = path.join(__dirname, 'src', 'files-action.js')
webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
module.exports = webpackConfig