From 525a7bdf5d26ea698d994e84cfed357095ce0e38 Mon Sep 17 00:00:00 2001 From: Blair McMillan Date: Thu, 4 Jul 2024 10:47:28 +1000 Subject: [PATCH] v12 compatibility --- changelog.md | 4 ++++ module.json | 6 +++--- scripts/core.js | 10 ++++++++++ scripts/setting.js | 14 +++++++------- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index 01dbabf..971e364 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## v2.2.1 + +- v12 compatibility. + ## v2.2.0 - Re-added "core.compendiumConfiguration" setting to exports to export Compendium Folder structure mappings. diff --git a/module.json b/module.json index 97d0b3b..46e780a 100644 --- a/module.json +++ b/module.json @@ -23,11 +23,11 @@ "allowBugReporter": true }, "minimumCoreVersion": "0.6.0", - "compatibleCoreVersion": "11", - "version": "2.2.0", + "compatibleCoreVersion": "12", + "version": "2.2.1", "compatibility": { "minimum": "0.6.0", - "verified": "11.306" + "verified": "12" }, "scripts": [], "esmodules": [ diff --git a/scripts/core.js b/scripts/core.js index 03516ff..a7fdb40 100755 --- a/scripts/core.js +++ b/scripts/core.js @@ -593,6 +593,11 @@ export default class Core extends FormApplication { type: 'Setting', action: 'update', updates: updates, + operation: { + pack: null, + parent: null, + updates: updates, + } }); } if (creates.length) { @@ -601,6 +606,11 @@ export default class Core extends FormApplication { type: 'Setting', action: 'create', data: creates, + operation: { + pack: null, + parent: null, + data: creates, + } }); } return true; diff --git a/scripts/setting.js b/scripts/setting.js index 5b3a58e..283d293 100755 --- a/scripts/setting.js +++ b/scripts/setting.js @@ -95,8 +95,8 @@ export class WorldSetting { newValue = JSON.parse(newValue); } if (typeof existingSetting === 'object' && typeof newValue === 'object') { - let diff = diffObject(existingSetting, newValue); - if (typeof isEmpty === 'function' ? isEmpty(diff) : isObjectEmpty(diff)) { + let diff = foundry.utils.diffObject(existingSetting, newValue); + if (typeof foundry.utils.isEmpty === 'function' ? foundry.utils.isEmpty(diff) : foundry.utils.isObjectEmpty(diff)) { // No difference in the underlying object. return new Difference(this.key, null, null); } @@ -167,7 +167,7 @@ export class PlayerSetting { ); } - let flagDiff = diffObject(userData.flags, setting.flags); + let flagDiff = foundry.utils.diffObject(userData.flags, setting.flags); for (const prop in flagDiff) { if (!flagDiff.hasOwnProperty(prop)) { continue; @@ -198,13 +198,13 @@ export class PlayerSetting { * @returns boolean */ hasDataChanges() { - if (typeof isEmpty === 'function') { - return !isEmpty(this.playerDifferences) || !isEmpty(this.playerFlagDifferences); + if (typeof foundry.utils.isEmpty === 'function') { + return !foundry.utils.isEmpty(this.playerDifferences) || !foundry.utils.isEmpty(this.playerFlagDifferences); } return ( - !isObjectEmpty(this.playerDifferences) || - !isObjectEmpty(this.playerFlagDifferences) + !foundry.utils.isObjectEmpty(this.playerDifferences) || + !foundry.utils.isObjectEmpty(this.playerFlagDifferences) ); } }