Merge pull request #34171 from nextcloud/enh/edit-locally

Add edit locally file action
This commit is contained in:
Simon L 2022-09-21 14:11:04 +02:00 committed by GitHub
commit 8268416a2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View file

@ -710,6 +710,30 @@
}
});
this.registerAction({
name: 'EditLocally',
displayName: function(context) {
var locked = context.$file.data('locked');
if (!locked) {
return t('files', 'Edit locally');
}
},
mime: 'all',
order: -23,
iconClass: function(filename, context) {
var locked = context.$file.data('locked');
if (!locked) {
return 'icon-rename';
}
},
permissions: OC.PERMISSION_UPDATE,
actionHandler: function (filename, context) {
var dir = context.dir || context.fileList.getCurrentDirectory();
var path = dir === '/' ? dir + filename : dir + '/' + filename;
context.fileList.openLocalClient(path);
},
});
this.registerAction({
name: 'Open',
mime: 'dir',

View file

@ -2807,6 +2807,15 @@
});
},
openLocalClient: function(path) {
var scheme = 'nc://';
var command = 'open';
var uid = OC.getCurrentUser().uid;
var url = scheme + command + '/' + uid + '@' + window.location.host + (window.location.port ? `:${window.location.port}` : '') + OC.encodePath(path);
window.location.href = url;
},
/**
* Updates the given row with the given file info
*