diff --git a/src/apps/active-effect-config.js b/src/apps/active-effect-config.js index fc02074d..e0acae02 100644 --- a/src/apps/active-effect-config.js +++ b/src/apps/active-effect-config.js @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -export class DS4ActiveEffectConfig extends foundry.applications.sheets.ActiveEffectConfig { +export class DS4ActiveEffectConfig extends ActiveEffectConfig { /** @override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { diff --git a/src/apps/actor/base-sheet.js b/src/apps/actor/base-sheet.js index 39d22cc9..75a74b11 100644 --- a/src/apps/actor/base-sheet.js +++ b/src/apps/actor/base-sheet.js @@ -16,7 +16,7 @@ import { disableOverriddenFields } from "../sheet-helpers"; /** * The base sheet class for all {@link DS4Actor}s. */ -export class DS4ActorSheet extends foundry.appv1.sheets.ActorSheet { +export class DS4ActorSheet extends ActorSheet { /** @override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { diff --git a/src/apps/actor/character-sheet.js b/src/apps/actor/character-sheet.js index 2d33b262..368fe176 100644 --- a/src/apps/actor/character-sheet.js +++ b/src/apps/actor/character-sheet.js @@ -17,12 +17,9 @@ export class DS4CharacterActorSheet extends DS4ActorSheet { /** @override */ async getData(options = {}) { const context = await super.getData(options); - context.data.system.profile.biography = await foundry.applications.ux.TextEditor.implementation.enrichHTML( - context.data.system.profile.biography, - { - async: true, - }, - ); + context.data.system.profile.biography = await TextEditor.enrichHTML(context.data.system.profile.biography, { + async: true, + }); return context; } } diff --git a/src/apps/actor/creature-sheet.js b/src/apps/actor/creature-sheet.js index 21acb003..fe89dec0 100644 --- a/src/apps/actor/creature-sheet.js +++ b/src/apps/actor/creature-sheet.js @@ -17,12 +17,9 @@ export class DS4CreatureActorSheet extends DS4ActorSheet { /** @override */ async getData(options = {}) { const context = await super.getData(options); - context.data.system.baseInfo.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML( - context.data.system.baseInfo.description, - { - async: true, - }, - ); + context.data.system.baseInfo.description = await TextEditor.enrichHTML(context.data.system.baseInfo.description, { + async: true, + }); return context; } } diff --git a/src/apps/item-sheet.js b/src/apps/item-sheet.js index e9b84533..1fc6f0aa 100644 --- a/src/apps/item-sheet.js +++ b/src/apps/item-sheet.js @@ -12,7 +12,7 @@ import { disableOverriddenFields } from "./sheet-helpers"; /** * The Sheet class for DS4 Items */ -export class DS4ItemSheet extends foundry.appv1.sheets.ItemSheet { +export class DS4ItemSheet extends ItemSheet { /** @override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { @@ -33,12 +33,9 @@ export class DS4ItemSheet extends foundry.appv1.sheets.ItemSheet { /** @override */ async getData(options = {}) { const superContext = await super.getData(options); - superContext.data.system.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML( - superContext.data.system.description, - { - async: true, - }, - ); + superContext.data.system.description = await TextEditor.enrichHTML(superContext.data.system.description, { + async: true, + }); const context = { ...superContext, config: DS4, diff --git a/src/dice/check-factory.js b/src/dice/check-factory.js index 7070e7e2..6063ca98 100644 --- a/src/dice/check-factory.js +++ b/src/dice/check-factory.js @@ -166,7 +166,7 @@ async function askForInteractiveRollData(checkTargetNumber, options = {}, { temp }), id, }; - const renderedHtml = await foundry.applications.handlebars.renderTemplate(usedTemplate, templateData); + const renderedHtml = await renderTemplate(usedTemplate, templateData); const dialogPromise = new Promise((resolve) => { new DialogWithListeners( diff --git a/src/dice/roll.js b/src/dice/roll.js index 833f6b19..bc632a07 100644 --- a/src/dice/roll.js +++ b/src/dice/roll.js @@ -29,6 +29,6 @@ export class DS4Roll extends Roll { isCoup: isPrivate ? null : isCoup, isFumble: isPrivate ? null : isFumble, }; - return foundry.applications.handlebars.renderTemplate(template, chatData); + return renderTemplate(template, chatData); } } diff --git a/src/handlebars/handlebars-partials.js b/src/handlebars/handlebars-partials.js index 70cd1e35..747c13c4 100644 --- a/src/handlebars/handlebars-partials.js +++ b/src/handlebars/handlebars-partials.js @@ -56,5 +56,5 @@ export async function registerHandlebarsPartials() { "systems/ds4/templates/sheets/shared/components/control-button-group.hbs", "systems/ds4/templates/sheets/shared/components/rollable-image.hbs", ]; - await foundry.applications.handlebars.loadTemplates(templatePaths); + await loadTemplates(templatePaths); } diff --git a/src/hooks/init.js b/src/hooks/init.js index a57f4a6e..199b32bd 100644 --- a/src/hooks/init.js +++ b/src/hooks/init.js @@ -65,25 +65,16 @@ async function init() { registerSystemSettings(); - foundry.applications.apps.DocumentSheetConfig.unregisterSheet(Actor, "core", foundry.appv1.sheets.ActorSheet); - foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CharacterActorSheet, { + DocumentSheetConfig.unregisterSheet(Actor, "core", ActorSheet); + DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CharacterActorSheet, { types: ["character"], makeDefault: true, }); - foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CreatureActorSheet, { - types: ["creature"], - makeDefault: true, - }); - foundry.applications.apps.DocumentSheetConfig.unregisterSheet(Item, "core", foundry.appv1.sheets.ItemSheet); - foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "ds4", DS4ItemSheet, { makeDefault: true }); - foundry.applications.apps.DocumentSheetConfig.unregisterSheet( - ActiveEffect, - "core", - foundry.applications.sheets.ActiveEffectConfig, - ); - foundry.applications.apps.DocumentSheetConfig.registerSheet(ActiveEffect, "ds4", DS4ActiveEffectConfig, { - makeDefault: true, - }); + DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CreatureActorSheet, { types: ["creature"], makeDefault: true }); + DocumentSheetConfig.unregisterSheet(Item, "core", ItemSheet); + DocumentSheetConfig.registerSheet(Item, "ds4", DS4ItemSheet, { makeDefault: true }); + DocumentSheetConfig.unregisterSheet(ActiveEffect, "core", ActiveEffectConfig); + DocumentSheetConfig.registerSheet(ActiveEffect, "ds4", DS4ActiveEffectConfig, { makeDefault: true }); preloadFonts(); await registerHandlebarsPartials(); diff --git a/src/utils/utils.js b/src/utils/utils.js index ae2f52eb..f7fec6cb 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -40,7 +40,7 @@ export function getCanvas() { * @returns {Game} */ export function getGame() { - enforce(game instanceof foundry.Game, "Game is not initialized yet."); + enforce(game instanceof Game, "Game is not initialized yet."); return game; } diff --git a/templates/dice/roll.hbs b/templates/dice/roll.hbs index 9b9fc28f..8afcbd10 100644 --- a/templates/dice/roll.hbs +++ b/templates/dice/roll.hbs @@ -4,7 +4,7 @@ SPDX-FileCopyrightText: 2021 Johannes Loher SPDX-License-Identifier: MIT --}} -