mirror of
https://github.com/ytliu74/obsidian-pseudocode.git
synced 2026-07-22 04:34:49 +00:00
chore: use soft null check
This commit is contained in:
parent
100c1c5bad
commit
1c3846f0a2
1 changed files with 6 additions and 6 deletions
12
main.ts
12
main.ts
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue