FIX: Disable links in the preview to avoid losing your drafts

This commit is contained in:
Robin Ward 2015-03-27 14:24:41 -04:00
parent ada633f084
commit ed58a87616
2 changed files with 14 additions and 10 deletions

View File

@ -6,11 +6,10 @@ export default Ember.TextArea.extend({
}.property('placeholderKey'),
_signalParentInsert: function() {
return this.get('parentView').childDidInsertElement(this);
this.get('parentView').childDidInsertElement(this);
}.on('didInsertElement'),
_signalParentDestroy: function() {
return this.get('parentView').childWillDestroyElement(this);
this.get('parentView').childWillDestroyElement(this);
}.on('willDestroyElement')
});

View File

@ -125,7 +125,6 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
this.set('controller.view', this);
positioningWorkaround(this.$());
}.on('didInsertElement'),
_unlinkView: function() {
@ -520,19 +519,25 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
},
childDidInsertElement() {
return this.initEditor();
this.initEditor();
// Disable links in the preview
$('#wmd-preview').on('click.preview', (e) => {
e.preventDefault();
return false;
});
},
childWillDestroyElement() {
const self = this;
this._unbindUploadTarget();
Em.run.next(function() {
$('#wmd-preview').off('click.preview');
Em.run.next(() => {
$('#main-outlet').css('padding-bottom', 0);
// need to wait a bit for the "slide down" transition of the composer
Em.run.later(function() {
self.appEvents.trigger("composer:closed");
Em.run.later(() => {
this.appEvents.trigger("composer:closed");
}, 400);
});
},