File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,14 @@ export default class MediaDbPlugin extends Plugin {
329329 ( { fileMetadata, fileContent } = await this . attachFile ( fileMetadata , fileContent , options . attachFile ) ) ;
330330 ( { fileMetadata, fileContent } = await this . attachTemplate ( fileMetadata , fileContent , template ) ) ;
331331
332- fileContent = `---\n${ this . settings . useCustomYamlStringifier ? YAMLConverter . toYaml ( fileMetadata ) : stringifyYaml ( fileMetadata ) } ---\n` + fileContent ;
332+ if ( this . settings . enableTemplaterIntegration && hasTemplaterPlugin ( this . app ) ) {
333+ // Only support stringifyYaml for templater plugin
334+ // Include the media variable in all templater commands by using a top level JavaScript execution command.
335+ fileContent = `---\n<%* const media = ${ JSON . stringify ( mediaTypeModel ) } %>\n${ stringifyYaml ( fileMetadata ) } ---\n${ fileContent } ` ;
336+ } else {
337+ fileContent = `---\n${ this . settings . useCustomYamlStringifier ? YAMLConverter . toYaml ( fileMetadata ) : stringifyYaml ( fileMetadata ) } ---\n` + fileContent ;
338+ }
339+
333340 return fileContent ;
334341 }
335342
You can’t perform that action at this time.
0 commit comments