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:
parent
7a4e2f4145
commit
466d1f0ab2
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue