From 21973543b7a200307f1ea3b82b39b49da1c63986 Mon Sep 17 00:00:00 2001 From: AngryBeaver Date: Sun, 1 Sep 2024 00:15:52 +0200 Subject: [PATCH] remove potential bug with migrate scripts. --- changelog.md | 3 +++ module.json | 2 +- package.json | 2 +- src/Recipe.ts | 4 +--- src/apps/RecipeSheet.ts | 20 +++++++++++++++----- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index a099673..b39d04a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Changelog +## 4.0.3 +- remove potential bug with migrate scripts. +- fix recipeSheet for systems without Formapplication e.g. a5e ## 4.0.1 + 4.0.2 - fix compatibility warnings for v14 ## 4.0.0 diff --git a/module.json b/module.json index bb3ccc2..9308be2 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "title": "Beaver's Crafting Module", "description": "A Module for crafting, brewing, harvesting, mining, fabricating, gathering, character advancement, tech tree, skill tree, ability tree, downtime activities, factions / organisation reputation, quest logs, skill training", "id": "beavers-crafting", - "version": "4.0.2", + "version": "4.0.3", "authors": [ { "name": "angryBeaver", diff --git a/package.json b/package.json index 3944441..f067e72 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "beavers-crafting", "title": "Beaver's Crafting", - "version": "4.0.2", + "version": "4.0.3", "description": "Crafting", "devDir": "c:\\vtts\\v12.331\\Data\\modules", "#devDir": "c:\\vtts\\v11.315\\Data\\modules", diff --git a/src/Recipe.ts b/src/Recipe.ts index 1212134..369b7dc 100644 --- a/src/Recipe.ts +++ b/src/Recipe.ts @@ -133,9 +133,7 @@ export class Recipe implements RecipeData { ors: {}, } }; - if(recipeTestsToBeaversTests(this)){ - this.update(); - } + recipeTestsToBeaversTests(this) } serialize(): RecipeData { diff --git a/src/apps/RecipeSheet.ts b/src/apps/RecipeSheet.ts index e4cf792..3e16c7b 100644 --- a/src/apps/RecipeSheet.ts +++ b/src/apps/RecipeSheet.ts @@ -54,6 +54,9 @@ export class RecipeSheet { return; } this.recipeElement = $('
'); + if(!this.app.form){ + this.recipeElement = $('
') + } beaversSystemInterface.itemSheetReplaceContent(this.app,html,this.recipeElement); this.recipe = Recipe.fromItem(this.item); this.render().then(i=>this.addDragDrop()); @@ -127,13 +130,20 @@ export class RecipeSheet { } async update() { - const flags={}; - flags[Settings.NAMESPACE] = { + let update={flags:{}}; + update.flags[Settings.NAMESPACE] = { recipe: this.recipe.serialize() }; - await this.item.update({ - "flags": flags - }); + if(!this.app.form){ + const formData = new FormData(this.recipeElement[0]); + // @ts-ignore + for (const [key, value] of formData.entries()) { + setProperty(update,key,value); + } + } + await this.item.update(update); + this.recipe = Recipe.fromItem(this.item); + if(this.recipeElement) { this.app.scrollToPosition = this.recipeElement.scrollTop(); }