mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
c1cae072f2
Closes #1990, Ref #3810 - Add `js-` prefix to jQuery calls throughout code and templates - move MarkdownComponent classNames to template - Fix back button on posts content preview - Remove dead code for preview tabbing jQuery
35 lines
1.3 KiB
JavaScript
35 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 () {
|
|
Ember.run.scheduleOnce('afterRender', this, function () {
|
|
var dropzones = $('.js-drop-zone');
|
|
|
|
uploader.call(dropzones, {
|
|
editor: true,
|
|
fileStorage: this.get('config.fileStorage')
|
|
});
|
|
|
|
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'));
|
|
});
|
|
}.observes('markdown')
|
|
});
|
|
|
|
export default Markdown;
|