diff --git a/src/journal/adventure-sites/adventure-site-sheet.js b/src/journal/adventure-sites/adventure-site-sheet.js index 48ad2290..349acaf1 100644 --- a/src/journal/adventure-sites/adventure-site-sheet.js +++ b/src/journal/adventure-sites/adventure-site-sheet.js @@ -3,19 +3,21 @@ export class AdventureSitesSheet extends JournalSheet { return "systems/forbidden-lands/templates/journal/adventure-sites/adventure-site-sheet.hbs"; } - getData() { - const data = super.getData(); + getData(options) { + const data = super.getData(options); data.type = this.object.type; return data; } activateListeners(html) { super.activateListeners(html); + html.find('[data-action="add-room"]').on("click", async () => { const type = this.object.type; const path = CONFIG.fbl.adventureSites.types[type]; const room = await CONFIG.fbl.adventureSites?.generate(path, type + "_rooms"); - const pageName = ($(room).find("h4") || $(room).find("strong")) + const pageName = $(room) + .find("h4, strong") ?.first() .text() .replace(/[^\p{L}]+/u, " ") diff --git a/src/journal/adventure-sites/templates/adventure-site-sheet.hbs b/src/journal/adventure-sites/templates/adventure-site-sheet.hbs index 78b6afe9..882aa410 100644 --- a/src/journal/adventure-sites/templates/adventure-site-sheet.hbs +++ b/src/journal/adventure-sites/templates/adventure-site-sheet.hbs @@ -11,6 +11,11 @@ data-action="toggleView" data-tooltip="{{localize viewMode.label}}" > +