Skip to content

Commit e426409

Browse files
committed
insertion hotfix
1 parent 4f3f083 commit e426409

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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": {

src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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' && /daggerheart\s+(environment|adversary)/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,

src/ui.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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

versions.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
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
}

0 commit comments

Comments
 (0)