File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ export interface Monster {
66
66
columnWidth ?: number ;
67
67
columnHeight ?: number ;
68
68
forceColumns ?: boolean ;
69
+
70
+ note ?: string ;
71
+
69
72
[ property : string ] : any ;
70
73
}
71
74
Original file line number Diff line number Diff line change 2
2
addIcon ,
3
3
MarkdownPostProcessorContext ,
4
4
Notice ,
5
- Plugin
5
+ Plugin ,
6
+ TFile
6
7
} from "obsidian" ;
7
8
import domtoimage from "dom-to-image" ;
8
9
@@ -350,10 +351,31 @@ export default class StatBlockPlugin extends Plugin {
350
351
"name"
351
352
) ;
352
353
354
+ let additionalParams = { } ;
355
+ if ( params . note ) {
356
+ const note = Array . isArray ( params . note )
357
+ ? ( < string [ ] > params . note ) . flat ( Infinity ) . pop ( )
358
+ : params . note ;
359
+ const file = await this . app . metadataCache . getFirstLinkpathDest (
360
+ `${ note } ` ,
361
+ ctx . sourcePath
362
+ ) ;
363
+ if ( file && file instanceof TFile ) {
364
+ const cache = await this . app . metadataCache . getFileCache (
365
+ file
366
+ ) ;
367
+ additionalParams = cache . frontmatter ?? { } ;
368
+ }
369
+ }
370
+ console . log (
371
+ "🚀 ~ file: main.ts ~ line 368 ~ additionalParams" ,
372
+ additionalParams
373
+ ) ;
353
374
const monster : Monster = Object . assign (
354
375
{ } ,
355
376
this . bestiary . get ( params . monster ) ??
356
- this . bestiary . get ( params . creature )
377
+ this . bestiary . get ( params . creature ) ,
378
+ additionalParams
357
379
) ;
358
380
let traits , actions , legendary_actions , reactions ;
359
381
if ( monster ) {
You can’t perform that action at this time.
0 commit comments