Merge pull request #29 from Nambers/clickEdit

Enable Click edit
This commit is contained in:
Yaotian Liu 2025-11-11 15:51:09 -07:00 committed by GitHub
commit a9aed6f856
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,6 +30,15 @@ export default class PseudocodePlugin extends Plugin {
const blockDiv = el.createDiv({ cls: "pseudocode-block" }); const blockDiv = el.createDiv({ cls: "pseudocode-block" });
const blockWidth = this.settings.blockSize; const blockWidth = this.settings.blockSize;
blockDiv.style.width = `${blockWidth}em`; blockDiv.style.width = `${blockWidth}em`;
blockDiv.addEventListener("click", (event) => {
const target = (event.target as HTMLElement | null);
if(target && target.tagName !== 'BUTTON')
(target
.closest('.pseudocode-block')
?.parentElement?.parentElement
?.querySelector('.edit-block-button') as HTMLElement | null)
?.click();
});
// Extract inline macros // Extract inline macros
const [inlineMacros, nonMacroLines] = extractInlineMacros(source); const [inlineMacros, nonMacroLines] = extractInlineMacros(source);