mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
9aa13330ba
Refs #3491
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
import uploader from 'ghost/assets/lib/uploader';
|
|
|
|
var Markdown = Ember.Component.extend({
|
|
didInsertElement: function () {
|
|
this.set('scrollWrapper', this.$().closest('.entry-preview-content'));
|
|
},
|
|
|
|
adjustScrollPosition: function () {
|
|
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 () {
|
|
function handleDropzoneEvents() {
|
|
var dropzones = $('.js-drop-zone');
|
|
|
|
uploader.call(dropzones, {
|
|
editor: true,
|
|
fileStorage: this.get('config.fileStorage')
|
|
});
|
|
|
|
dropzones.on('uploadstart', Ember.run.bind(this, 'sendAction', 'uploadStarted'));
|
|
dropzones.on('uploadfailure', Ember.run.bind(this, 'sendAction', 'uploadFinished'));
|
|
dropzones.on('uploadsuccess', Ember.run.bind(this, 'sendAction', 'uploadFinished'));
|
|
dropzones.on('uploadsuccess', Ember.run.bind(this, 'sendAction', 'uploadSuccess'));
|
|
}
|
|
|
|
Ember.run.scheduleOnce('afterRender', this, handleDropzoneEvents);
|
|
}.observes('markdown')
|
|
});
|
|
|
|
export default Markdown;
|