0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

capture click events inside the toolbar (#9303)

This commit is contained in:
Fred K. Schott 2023-12-05 04:13:54 -08:00 committed by GitHub
parent 7a4e2f4145
commit 466d1f0ab2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -310,13 +310,14 @@ export class AstroDevOverlay extends HTMLElement {
attachEvents() {
const items = this.shadowRoot.querySelectorAll<HTMLDivElement>('.item');
items.forEach((item) => {
item.addEventListener('click', async (e) => {
const target = e.currentTarget;
item.addEventListener('click', async (event) => {
const target = event.currentTarget;
if (!target || !(target instanceof HTMLElement)) return;
const id = target.dataset.pluginId;
if (!id) return;
const plugin = this.getPluginById(id);
if (!plugin) return;
event.stopPropagation();
await this.togglePluginStatus(plugin);
});
});