mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
a3456b7e1c
* Adds `bind`, `isFinite`, and `isNumber` utility functions from lodash. * Use new util funtions instead of lodash throughout the codebase. * Remove lodash from vendor builds.
41 lines
1.4 KiB
JavaScript
41 lines
1.4 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 () {
|
|
Ember.run.scheduleOnce('afterRender', this, function () {
|
|
var dropzones = $('.js-drop-zone'),
|
|
self = this;
|
|
|
|
uploader.call(dropzones, {
|
|
editor: true,
|
|
fileStorage: this.get('config.fileStorage')
|
|
});
|
|
|
|
function boundSendAction(actionName) {
|
|
return function() {
|
|
self.sendAction.call(self, actionName);
|
|
}
|
|
}
|
|
|
|
dropzones.on('uploadstart', boundSendAction('uploadStarted'));
|
|
dropzones.on('uploadfailure', boundSendAction('uploadFinished'));
|
|
dropzones.on('uploadsuccess', boundSendAction('uploadFinished'));
|
|
dropzones.on('uploadsuccess', boundSendAction('uploadSuccess'));
|
|
});
|
|
}.observes('markdown')
|
|
});
|
|
|
|
export default Markdown;
|