0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00
ghost/core/client/components/gh-uploader.js
Felix Rieseberg 028a64eaee Tag Cover Images
Closes 

Works just like the Post Cover Images (and uses the same component)
Tiny changes to the component ensures that we can reuse it across Ghost
2014-12-10 17:48:18 -08:00

34 lines
935 B
JavaScript

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, {
editor: true,
fileStorage: this.get('config.fileStorage')
}));
$this.on('uploadsuccess', function (event, result) {
if (result && result !== '' && result !== 'http://') {
self.sendAction('uploaded', result);
}
});
$this.on('imagecleared', function () {
self.sendAction('canceled');
});
}.on('didInsertElement'),
removeListeners: function () {
var $this = this.$();
$this.off();
$this.find('.js-cancel').off();
}.on('willDestroyElement')
});
export default PostImageUploader;