mirror of
https://github.com/ytliu74/obsidian-pseudocode.git
synced 2026-07-22 07:40:25 +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;
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue