2014-06-06 05:18:03 +04:00
|
|
|
import uploader from 'ghost/assets/lib/uploader';
|
|
|
|
|
2014-03-04 00:18:10 +04:00
|
|
|
var Markdown = Ember.Component.extend({
|
2014-06-06 05:18:03 +04:00
|
|
|
classNames: ['rendered-markdown'],
|
|
|
|
|
|
|
|
didInsertElement: function () {
|
|
|
|
this.set('scrollWrapper', this.$().closest('.entry-preview-content'));
|
|
|
|
},
|
|
|
|
|
2014-03-04 00:18:10 +04:00
|
|
|
adjustScrollPosition: function () {
|
2014-06-06 05:18:03 +04:00
|
|
|
var scrollWrapper = this.get('scrollWrapper'),
|
|
|
|
scrollPosition = this.get('scrollPosition');
|
|
|
|
|
|
|
|
scrollWrapper.scrollTop(scrollPosition);
|
|
|
|
}.observes('scrollPosition'),
|
|
|
|
|
|
|
|
// fire off 'enable' API function from uploadManager
|
|
|
|
// might need to make sure markdown has been processed first
|
|
|
|
reInitDropzones: function () {
|
|
|
|
Ember.run.scheduleOnce('afterRender', this, function () {
|
|
|
|
var dropzones = $('.js-drop-zone');
|
|
|
|
|
|
|
|
uploader.call(dropzones, {
|
|
|
|
editor: true,
|
2014-06-24 01:12:22 +04:00
|
|
|
fileStorage: this.get('config.fileStorage')
|
2014-06-06 05:18:03 +04:00
|
|
|
});
|
2014-03-04 00:18:10 +04:00
|
|
|
|
2014-06-17 01:44:09 +04:00
|
|
|
dropzones.on('uploadstart', _.bind(this.sendAction, this, 'uploadStarted'));
|
|
|
|
dropzones.on('uploadfailure', _.bind(this.sendAction, this, 'uploadFinished'));
|
|
|
|
dropzones.on('uploadsuccess', _.bind(this.sendAction, this, 'uploadFinished'));
|
|
|
|
dropzones.on('uploadsuccess', _.bind(this.sendAction, this, 'uploadSuccess'));
|
2014-06-06 05:18:03 +04:00
|
|
|
});
|
|
|
|
}.observes('markdown')
|
2014-03-04 00:18:10 +04:00
|
|
|
});
|
|
|
|
|
2014-06-06 05:18:03 +04:00
|
|
|
export default Markdown;
|