File tree Expand file tree Collapse file tree 5 files changed +12
-9
lines changed
Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "id" : " beastvault" ,
33 "name" : " BeastVault" ,
4- "version" : " 1.1.0 " ,
4+ "version" : " 1.2.1 " ,
55 "minAppVersion" : " 1.9.14" ,
66 "description" : " Adversary and environment stat blocks for Daggerheart TTRPG." ,
77 "author" : " Lyova Potyomkin" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " beastvault" ,
3- "version" : " 1.1.0 " ,
3+ "version" : " 1.2.1 " ,
44 "description" : " Obsidian plugin for encounter management in Daggerheart TTRPG" ,
55 "main" : " main.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export default class BeastVault extends Plugin {
101101 . filter ( sec => lines [ sec . position . start . line ] . trim ( ) === '```statblock' )
102102 . map ( sec => {
103103 const targetLines = lines . slice ( sec . position . start . line + 1 , sec . position . end . line ) . join ( "\n" ) ;
104- const statblock = parseYaml ( targetLines ) ;
104+ const statblock = parseYaml ( targetLines ) ?? { } ;
105105 const isDaggerheart = statblock . layout && typeof statblock . layout == 'string' && / d a g g e r h e a r t \s + ( e n v i r o n m e n t | a d v e r s a r y ) / i. test ( statblock . layout ) ;
106106 if ( ! isDaggerheart ) return null ;
107107 return {
@@ -125,9 +125,9 @@ export default class BeastVault extends Plugin {
125125 impulses : statblock . impulses ,
126126 adversaries : statblock . potential_adversaries ,
127127
128- features : statblock . feats ?. map ( ( f : { name ?: string , text ?: string } ) => ( {
129- name : f . name ,
130- desc : f . text
128+ features : statblock . feats ?. map ( ( f ? : { name ?: string , text ?: string } ) => ( {
129+ name : f ? .name ,
130+ desc : f ? .text
131131 } ) ) ,
132132
133133 source : statblock . source ,
Original file line number Diff line number Diff line change @@ -82,11 +82,12 @@ export class AdversaryModal extends SuggestModal<RawAdversary> {
8282 }
8383
8484 onChooseSuggestion ( adv : RawAdversary , evt : MouseEvent | KeyboardEvent ) {
85- const copy = { ... adv } ;
85+ const copy = { ...adv } ;
8686 copy . id = Math . random ( ) . toString ( 36 ) . slice ( 2 ) ;
8787 delete copy . source ;
8888 delete copy . raw ;
89- this . editor . replaceSelection ( `\`\`\`daggerheart\n${ adv . raw ? adv . raw : stringifyYaml ( copy ) } \`\`\`\n` ) ;
89+ const inserted = adv . raw ? adv . raw : stringifyYaml ( copy ) ;
90+ this . editor . replaceSelection ( `\`\`\`daggerheart\n${ inserted . trim ( ) } \n\`\`\`\n` ) ;
9091 }
9192}
9293
Original file line number Diff line number Diff line change 11{
22 "1.0.0" : " 1.9.14" ,
3- "1.1.0" : " 1.9.14"
3+ "1.1.0" : " 1.9.14" ,
4+ "1.2.0" : " 1.9.14" ,
5+ "1.2.1" : " 1.9.14"
46}
You can’t perform that action at this time.
0 commit comments