mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 11:44:06 -06:00
FIX: Disable links in the preview to avoid losing your drafts
This commit is contained in:
parent
ada633f084
commit
ed58a87616
@ -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')
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user