0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed clicking on existing snippets in dropdown having no effect

no issue

- mousedown handler in the snippet input component was automatically closing when it was detecting a mousedown event outside of the element
- the new dropdown select is rendered in a wormhole outside of the component's element so the whole component was being destroyed before the mouseup listener on an option was fired
This commit is contained in:
Kevin Ansfield 2021-08-24 16:04:49 +01:00
parent e9f2bfa92b
commit 8309904fcc

View file

@ -185,7 +185,10 @@ export default class KoenigSnippetInputLabsComponent extends Component {
}
_handleMousedown(event) {
if (this.element && !event.target.closest(this.element.id)) {
const isOutsideElement = this.element && !event.target.closest(this.element.id);
const isOutsideDropdown = !event.target.closest('.ember-basic-dropdown-content');
if (isOutsideElement && isOutsideDropdown) {
this.args.cancel();
}
}