chore: use soft null check

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

12
main.ts
View file

@ -31,13 +31,13 @@ export default class PseudocodePlugin extends Plugin {
const blockWidth = this.settings.blockSize;
blockDiv.style.width = `${blockWidth}em`;
blockDiv.addEventListener("click", (event) => {
const target = (event.target as HTMLElement)!;
if(target.tagName !== 'BUTTON')
const target = (event.target as HTMLElement | null);
if(target && target.tagName !== 'BUTTON')
(target
.closest('.pseudocode-block')!
.parentElement!.parentElement!
.querySelector('.edit-block-button') as HTMLElement)!
.click();
.closest('.pseudocode-block')
?.parentElement?.parentElement
?.querySelector('.edit-block-button') as HTMLElement | null)
?.click();
});
// Extract inline macros