0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/components/gh-uploader.js

35 lines
935 B
JavaScript
Raw Normal View History

2014-09-15 17:46:40 -05:00
import uploader from 'ghost/assets/lib/uploader';
var PostImageUploader = Ember.Component.extend({
classNames: ['image-uploader', 'js-post-image-upload'],
setup: function () {
var $this = this.$(),
self = this;
this.set('uploaderReference', uploader.call($this, {
2014-09-15 17:46:40 -05:00
editor: true,
fileStorage: this.get('config.fileStorage')
}));
2014-09-15 17:46:40 -05:00
$this.on('uploadsuccess', function (event, result) {
if (result && result !== '' && result !== 'http://') {
self.sendAction('uploaded', result);
}
});
$this.on('imagecleared', function () {
2014-09-15 17:46:40 -05:00
self.sendAction('canceled');
});
}.on('didInsertElement'),
removeListeners: function () {
var $this = this.$();
2014-09-15 17:46:40 -05:00
$this.off();
$this.find('.js-cancel').off();
}.on('willDestroyElement')
});
export default PostImageUploader;