()
| 65 | } |
| 66 | |
| 67 | private beginExecutionContext(): void { |
| 68 | if (this.executionDepth === 0) { |
| 69 | this.focusedProperty = |
| 70 | this.focusedPropertyOverride !== undefined |
| 71 | ? this.focusedPropertyOverride |
| 72 | : getFocusedPropertyTarget(this.app); |
| 73 | // Snapshot the trigger-time editor context at the outermost boundary, so a |
| 74 | // nested execute() (a {{MACRO}} that opens a file then runs a FIELD |
| 75 | // template, or the API path) keeps the ORIGINAL trigger note as the source |
| 76 | // for {{...|default-from:active}}, mirroring focusedProperty's depth-0 |
| 77 | // semantics. The Multi path opens a nested suggester and lets the outer |
| 78 | // execute() return (clearing this at depth 0), so — like focusedProperty — |
| 79 | // the captured context is threaded through the suggester and re-injected as |
| 80 | // triggerContextOverride for the chosen leaf's own depth-0 run, instead of a |
| 81 | // live re-read at leaf time. A direct execute() (command palette/ribbon) has |
| 82 | // no override and reads live, which is the trigger note (the active markdown |
| 83 | // leaf is unchanged by the launching modal). |
| 84 | this.triggerContext = |
| 85 | this.triggerContextOverride !== undefined |
| 86 | ? this.triggerContextOverride |
| 87 | : { activeFile: this.app.workspace.getActiveFile() }; |
| 88 | } |
| 89 | this.executionDepth++; |
| 90 | } |
| 91 | |
| 92 | private endExecutionContext(): void { |
| 93 | this.executionDepth = Math.max(0, this.executionDepth - 1); |
no test coverage detected