Open file editor through URL

Co-authored-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-01-25 09:00:39 +01:00
parent 5fe97321f3
commit d6e431a221
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 23 additions and 2 deletions

View File

@ -350,7 +350,8 @@
if (options.scrollTo) {
this.$fileList.one('updated', function() {
self.scrollTo(options.scrollTo);
var open = true;
self.scrollTo(options.scrollTo, open);
});
}
@ -2723,13 +2724,33 @@
this.$el.find('.mask').remove();
this.$table.removeClass('hidden');
},
scrollTo:function(file) {
scrollTo:function(file, open) {
if (!_.isArray(file)) {
file = [file];
}
if (file.length === 1) {
_.defer(function() {
this.showDetailsView(file[0]);
if (open) {
var $tr = this.findFileEl(file[0]);
var filename = $tr.attr('data-file');
this.fileActions.currentFile = $tr.find('td');
var mime = this.fileActions.getCurrentMimeType();
var type = this.fileActions.getCurrentType();
var permissions = this.fileActions.getCurrentPermissions();
var action = this.fileActions.get(mime, type, permissions)['Edit'];
if (action) {
// also set on global object for legacy apps
window.FileActions.currentFile = this.fileActions.currentFile;
action(filename, {
$file: $tr,
fileList: this,
fileActions: this.fileActions,
dir: $tr.attr('data-path') || this.getCurrentDirectory()
});
}
}
}.bind(this));
}
this.highlightFiles(file, function($tr) {