File tree Expand file tree Collapse file tree 3 files changed +15
-10
lines changed
Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine {
284284 }
285285
286286 const file : TFile = await this . createFileWithInput ( filePath , fileContent ) ;
287- await replaceTemplaterTemplatesInCreatedFile ( this . app , file ) ;
287+ await replaceTemplaterTemplatesInCreatedFile ( this . app , file , true ) ;
288288
289289 const updatedFileContent : string = await this . app . vault . cachedRead ( file ) ;
290290 const newFileContent : string = await this . formatter . formatContentWithFile (
Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ export abstract class TemplateEngine extends QuickAddEngine {
106106 formattedTemplateContent
107107 ) ;
108108
109- await replaceTemplaterTemplatesInCreatedFile ( this . app , createdFile ) ;
109+ // Always force processing of Templater commands for template choices
110+ await replaceTemplaterTemplatesInCreatedFile ( this . app , createdFile , true ) ;
110111
111112 return createdFile ;
112113 } catch ( e ) {
@@ -132,6 +133,7 @@ export abstract class TemplateEngine extends QuickAddEngine {
132133 await this . formatter . formatFileContent ( templateContent ) ;
133134 await this . app . vault . modify ( file , formattedTemplateContent ) ;
134135
136+ // Already forcing Templater processing, keep this as-is
135137 await replaceTemplaterTemplatesInCreatedFile ( this . app , file , true ) ;
136138
137139 return file ;
@@ -160,6 +162,7 @@ export abstract class TemplateEngine extends QuickAddEngine {
160162 : `${ fileContent } \n${ formattedTemplateContent } ` ;
161163 await this . app . vault . modify ( file , newFileContent ) ;
162164
165+ // Already forcing Templater processing, keep this as-is
163166 await replaceTemplaterTemplatesInCreatedFile ( this . app , file , true ) ;
164167
165168 return file ;
Original file line number Diff line number Diff line change @@ -25,14 +25,16 @@ export async function replaceTemplaterTemplatesInCreatedFile(
2525 force = false ,
2626) {
2727 const templater = getTemplater ( app ) ;
28-
29- if (
30- templater &&
31- ( force ||
32- ! ( templater . settings as Record < string , unknown > ) [
33- "trigger_on_file_creation"
34- ] )
35- ) {
28+
29+ if ( ! templater ) return ;
30+
31+ // Process Templater commands in these cases:
32+ // 1. force=true (explicitly requested processing, e.g., for Template choices)
33+ // 2. Templater's trigger_on_file_creation=false (manual processing required)
34+ const shouldProcess = force ||
35+ ! ( templater . settings as Record < string , unknown > ) [ "trigger_on_file_creation" ] ;
36+
37+ if ( shouldProcess ) {
3638 const impl = templater ?. templater as {
3739 overwrite_file_commands ?: ( file : TFile ) => Promise < void > ;
3840 } ;
You can’t perform that action at this time.
0 commit comments