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; const blockWidth = this.settings.blockSize;
blockDiv.style.width = `${blockWidth}em`; blockDiv.style.width = `${blockWidth}em`;
blockDiv.addEventListener("click", (event) => { blockDiv.addEventListener("click", (event) => {
const target = (event.target as HTMLElement)!; const target = (event.target as HTMLElement | null);
if(target.tagName !== 'BUTTON') if(target && target.tagName !== 'BUTTON')
(target (target
.closest('.pseudocode-block')! .closest('.pseudocode-block')
.parentElement!.parentElement! ?.parentElement?.parentElement
.querySelector('.edit-block-button') as HTMLElement)! ?.querySelector('.edit-block-button') as HTMLElement | null)
.click(); ?.click();
}); });
// Extract inline macros // Extract inline macros