diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index e433d35fc84..eafe284f788 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -262,16 +262,12 @@ M.form_filemanager.init = function(Y, options) { var button_addfile = this.filemanager.one('.fp-btn-add'); // setup 'add file' button - // if maxfiles == -1, the no limit - button_addfile.on('click', function(e) { - e.preventDefault(); - var options = this.filepicker_options; - options.formcallback = this.filepicker_callback; - // XXX: magic here, to let filepicker use filemanager scope - options.magicscope = this; - options.savepath = this.currentpath; - M.core_filepicker.show(Y, options); - }, this); + button_addfile.on('click', this.show_filepicker, this); + + var dndarrow = this.filemanager.one('.dndupload-arrow'); + if (dndarrow) { + dndarrow.on('click', this.show_filepicker, this); + } // setup 'make a folder' button if (this.options.subdirs) { @@ -370,6 +366,18 @@ M.form_filemanager.init = function(Y, options) { } }, this); }, + + show_filepicker: function (e) { + // if maxfiles == -1, the no limit + e.preventDefault(); + var options = this.filepicker_options; + options.formcallback = this.filepicker_callback; + // XXX: magic here, to let filepicker use filemanager scope + options.magicscope = this; + options.savepath = this.currentpath; + M.core_filepicker.show(Y, options); + }, + print_path: function() { var p = this.options.path; this.pathbar.setContent('').addClass('empty');