1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/gh-file-input.js

27 lines
629 B
JavaScript
Raw Normal View History

import XFileInput from 'emberx-file-input/components/x-file-input';
// TODO: remove this override and use {{x-file-input}} directly once we've
// upgraded to emberx-file-input@1.2.0
export default XFileInput.extend({
change(e) {
let action = this.action;
let files = this.files(e);
if (files.length && action) {
action(files, this.resetInput.bind(this));
}
},
/**
* Gets files from event object.
*
* @method
* @private
* @param {$.Event || Event}
*/
files(e) {
return (e.originalEvent || e).testingFiles || e.target.files;
}
});