fix: fix click button will also enter edit

This commit is contained in:
Eritque arcus 2025-11-09 23:56:00 -06:00
parent 6614713042
commit 100c1c5bad
No known key found for this signature in database
GPG key ID: B95AA12EA8C8C3AE

12
main.ts
View file

@ -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