From 100c1c5bad9ab52ed3dbac46f6adccff04d023c2 Mon Sep 17 00:00:00 2001 From: Eritque arcus Date: Sun, 9 Nov 2025 23:56:00 -0600 Subject: [PATCH] fix: fix click button will also enter edit --- main.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.ts b/main.ts index 36dc2d3..2d6a652 100644 --- a/main.ts +++ b/main.ts @@ -31,11 +31,13 @@ export default class PseudocodePlugin extends Plugin { const blockWidth = this.settings.blockSize; blockDiv.style.width = `${blockWidth}em`; blockDiv.addEventListener("click", (event) => { - ((event.target as HTMLElement) - .closest('.pseudocode-block')! - .parentElement!.parentElement! - .querySelector('.edit-block-button') as HTMLElement)! - .click(); + const target = (event.target as HTMLElement)!; + if(target.tagName !== 'BUTTON') + (target + .closest('.pseudocode-block')! + .parentElement!.parentElement! + .querySelector('.edit-block-button') as HTMLElement)! + .click(); }); // Extract inline macros