FIX: resize events for ace were not triggered correctly

This commit is contained in:
Sam 2017-05-15 16:10:07 -04:00
parent 7a4e825671
commit c40ac5abe6
2 changed files with 12 additions and 1 deletions

View File

@ -37,6 +37,9 @@ export default Ember.Component.extend({
// xxx: don't run during qunit tests // xxx: don't run during qunit tests
this.appEvents.off('ace:resize', this, this.resize); this.appEvents.off('ace:resize', this, this.resize);
} }
$(window).off('ace:resize');
}.on('willDestroyElement'), }.on('willDestroyElement'),
resize() { resize() {
@ -67,9 +70,14 @@ export default Ember.Component.extend({
this.$().data('editor', editor); this.$().data('editor', editor);
this._editor = editor; this._editor = editor;
$(window).off('ace:resize').on('ace:resize', ()=>{
this.appEvents.trigger('ace:resize');
});
if (this.appEvents) { if (this.appEvents) {
// xxx: don't run during qunit tests // xxx: don't run during qunit tests
this.appEvents.on('ace:resize', self, self.resize); this.appEvents.on('ace:resize', ()=>this.resize());
} }
if (this.get("autofocus")) { if (this.get("autofocus")) {

View File

@ -150,6 +150,9 @@ export default Ember.Controller.extend({
toggleMaximize: function() { toggleMaximize: function() {
this.toggleProperty('maximized'); this.toggleProperty('maximized');
Em.run.next(()=>{
this.appEvents.trigger('ace:resize');
});
} }
} }