mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
eb949aafae
closes #2426, closes #2781, closes #2913 - Concatenate vendor files on change of js in core/shared/ - Add all the markerManager stuff to its own mixin - make markers a shared object for all that mix it in. makes it easier to use helper functions in different modules - add getMarkdown method, returns object with two keys holding the markdown: one with markers, the other without - Clear markers when codemirror is destroyed - make Editor subcomponents communicate through the Editor Controller - Set Codemirror and html preview shared scrolling - Set CodeMirror, html preview css scroll class with util - Create 'scratch' property in Editor controller; prevents a model save wiping image markers due to markdown bindings - Add editor and html preview actions to handle img upload start/finish - disable codemirror when an image is being uploaded, enables on success or failure - Fix editor wordcount when there are 0 words - Add modal dialog when transitioning out of the editor with an unsaved post - Add window.onbeforeunload handling with `.unloadDirtyMessage()` on editor controller - and various other things
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
import uploader from 'ghost/assets/lib/uploader';
|
|
|
|
var Markdown = Ember.Component.extend({
|
|
classNames: ['rendered-markdown'],
|
|
|
|
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: false
|
|
});
|
|
|
|
dropzones.on('uploadstart', this.sendAction.bind(this, 'uploadStarted'));
|
|
dropzones.on('uploadfailure', this.sendAction.bind(this, 'uploadFinished'));
|
|
dropzones.on('uploadsuccess', this.sendAction.bind(this, 'uploadFinished'));
|
|
dropzones.on('uploadsuccess', this.sendAction.bind(this, 'uploadSuccess'));
|
|
});
|
|
}.observes('markdown')
|
|
});
|
|
|
|
export default Markdown;
|