feat: complete ApplicationV1 to V2 migration cleanup

- Remove jQuery dependency from render hooks - Update
selectTargetInputOnFocus to use modern DOM methods - Remove legacy appv1
sheet unregistration calls - Eliminate all remaining V1 compatibility
code
This commit is contained in:
Alexander Minges 2025-07-12 21:46:47 +02:00
parent 76a0df49e8
commit 6c72605156
Signed by: Athemis
GPG key ID: 31FBDEF92DDB162B
2 changed files with 7 additions and 6 deletions

View file

@ -65,7 +65,6 @@ async function init() {
registerSystemSettings();
foundry.applications.apps.DocumentSheetConfig.unregisterSheet(Actor, "core", foundry.appv1.sheets.ActorSheet);
foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CharacterActorSheet, {
types: ["character"],
makeDefault: true,
@ -74,7 +73,6 @@ async function init() {
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,

View file

@ -17,10 +17,13 @@ export function registerForRenderHooks() {
* Select the text of input elements in given application when focused via an on focus listener.
*
* @param {Application} app The application in which to activate the listener.
* @param {JQuery} html The {@link JQuery} representing the HTML of the application.
* @param {HTMLElement} element The HTML element representing the HTML of the application.
*/
function selectTargetInputOnFocus(app, html) {
html.find("input").on("focus", (ev) => {
ev.currentTarget.select();
function selectTargetInputOnFocus(app, element) {
const inputs = element.querySelectorAll("input");
inputs.forEach(input => {
input.addEventListener("focus", (ev) => {
ev.currentTarget.select();
});
});
}