Use appEvents for ace resize
This commit is contained in:
parent
09398dc8c2
commit
a953f83574
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
<div class="query-editor">
|
<div class="query-editor">
|
||||||
<div class="editor-panel">
|
<div class="editor-panel">
|
||||||
{{ace-editor content=selectedItem.sql mode="sql" stashSelf=editor}}
|
{{ace-editor content=selectedItem.sql mode="sql"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<div class="schema grippie-target">
|
<div class="schema grippie-target">
|
||||||
|
|
|
@ -5,10 +5,6 @@ export default Ember.View.extend({
|
||||||
if (!$editPane.length) {
|
if (!$editPane.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const aceComponent = this.get('controller.editor');
|
|
||||||
if (!aceComponent) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const oldGrippie = this.get('grippie');
|
const oldGrippie = this.get('grippie');
|
||||||
if (oldGrippie) {
|
if (oldGrippie) {
|
||||||
oldGrippie.off('mousedown mousemove mouseup');
|
oldGrippie.off('mousedown mousemove mouseup');
|
||||||
|
@ -25,7 +21,7 @@ export default Ember.View.extend({
|
||||||
const mousemove = Discourse.debounce(function(e) {
|
const mousemove = Discourse.debounce(function(e) {
|
||||||
const diff = self.get('startY') - e.screenY;
|
const diff = self.get('startY') - e.screenY;
|
||||||
$targets.height(self.get('startSize') - diff);
|
$targets.height(self.get('startSize') - diff);
|
||||||
aceComponent.trigger('resize');
|
self.appEvents.trigger('ace:resize');
|
||||||
}, 5);
|
}, 5);
|
||||||
|
|
||||||
const mouseup = function(e) {
|
const mouseup = function(e) {
|
||||||
|
@ -34,7 +30,7 @@ export default Ember.View.extend({
|
||||||
$body.off('mouseup', mouseup);
|
$body.off('mouseup', mouseup);
|
||||||
self.set('startY', null);
|
self.set('startY', null);
|
||||||
self.set('startSize', null);
|
self.set('startSize', null);
|
||||||
}
|
};
|
||||||
|
|
||||||
$grippie.on('mousedown', function(e) {
|
$grippie.on('mousedown', function(e) {
|
||||||
self.set('startY', e.screenY);
|
self.set('startY', e.screenY);
|
||||||
|
@ -45,5 +41,9 @@ export default Ember.View.extend({
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
}.observes('controller.editor')
|
}.on('didInsertElement'),
|
||||||
|
|
||||||
|
_cleanup: function() {
|
||||||
|
this.set('grippie', null);
|
||||||
|
}.on('willDestroyElement')
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue