0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Move Tippy hooks to separate arrow function declarations

This commit is contained in:
Sage Abdullah 2024-01-25 10:11:07 +00:00 committed by sag​e
parent ea288448cd
commit 6991c1f2d9

View File

@ -144,12 +144,21 @@ export class DropdownController extends Controller<HTMLElement> {
}); });
} }
const onShow = () => {
if (hoverTooltipInstance) {
hoverTooltipInstance.disable();
}
};
const onShown = () => { const onShown = () => {
this.dispatch('shown'); this.dispatch('shown');
}; };
const onHide = () => { const onHide = () => {
this.dispatch('hide'); this.dispatch('hide');
if (hoverTooltipInstance) {
hoverTooltipInstance.enable();
}
}; };
return { return {
@ -162,20 +171,9 @@ export class DropdownController extends Controller<HTMLElement> {
...(this.hasOffsetValue && { offset: this.offsetValue }), ...(this.hasOffsetValue && { offset: this.offsetValue }),
getReferenceClientRect: () => this.reference.getBoundingClientRect(), getReferenceClientRect: () => this.reference.getBoundingClientRect(),
theme: this.themeValue, theme: this.themeValue,
onShow() { onShow,
if (hoverTooltipInstance) { onShown,
hoverTooltipInstance.disable(); onHide,
}
},
onShown() {
onShown();
},
onHide() {
if (hoverTooltipInstance) {
hoverTooltipInstance.enable();
}
onHide();
},
}; };
} }