mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 09:03:12 +03:00
Fixed dropdown elements staying open/fixed when moving settings panel
refs https://github.com/TryGhost/Team/issues/1219 - added `dropdown.closeDropdowns()` to the `{{movable}}` modifier when dragging starts - updated ember-power-select derived inputs to close their dropdowns when the dropdown service triggers it's `'close'` event
This commit is contained in:
parent
f112bd06c9
commit
c128998d86
@ -2,10 +2,27 @@
|
||||
import Component from '@glimmer/component';
|
||||
import {action} from '@ember/object';
|
||||
import {isBlank} from '@ember/utils';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class GhSearchInputTrigger extends Component {
|
||||
@service dropdown;
|
||||
|
||||
inputElem = null;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.dropdown.on('close', this, this.closeFromDropdown);
|
||||
}
|
||||
|
||||
willDestroy() {
|
||||
super.willDestroy(...arguments);
|
||||
this.dropdown.off('close', this, this.closeFromDropdown);
|
||||
}
|
||||
|
||||
closeFromDropdown() {
|
||||
this.args.select.actions.close();
|
||||
}
|
||||
|
||||
@action
|
||||
registerInput(elem) {
|
||||
this.inputElem = elem;
|
||||
|
@ -1,5 +1,20 @@
|
||||
import PowerSelectTrigger from 'ember-power-select/components/power-select/trigger';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class Trigger extends PowerSelectTrigger {
|
||||
@service dropdown;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.dropdown.on('close', this, this.closeFromDropdown);
|
||||
}
|
||||
|
||||
willDestroy() {
|
||||
super.willDestroy(...arguments);
|
||||
this.dropdown.off('close', this, this.closeFromDropdown);
|
||||
}
|
||||
|
||||
closeFromDropdown() {
|
||||
this.args.select.actions.close();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
import Modifier from 'ember-modifier';
|
||||
import {action} from '@ember/object';
|
||||
import {guidFor} from '@ember/object/internals';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default class MovableModifier extends Modifier {
|
||||
@service dropdown;
|
||||
|
||||
moveThreshold = 3;
|
||||
|
||||
active = false;
|
||||
@ -105,6 +108,7 @@ export default class MovableModifier extends Modifier {
|
||||
Math.abs(Math.abs(this.initialX - eventX) - Math.abs(this.xOffset)) > this.moveThreshold ||
|
||||
Math.abs(Math.abs(this.initialY - eventY) - Math.abs(this.yOffset)) > this.moveThreshold
|
||||
) {
|
||||
this.dropdown.closeDropdowns();
|
||||
this.disableScroll();
|
||||
this.disableSelection();
|
||||
this.disablePointerEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user