add the ability to define a subtitle to DSA41_input

This commit is contained in:
Sven Balzer 2025-05-05 11:58:50 +02:00
parent f82548fbaf
commit f2c4b63382
2 changed files with 22 additions and 0 deletions

View File

@ -135,6 +135,14 @@ html {
text-overflow: ellipsis;
}
& .subtitle {
font-size: 0.8em;
border-top: 1px solid;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
& .character-image {
width: 115px;
height: 115px;

View File

@ -108,8 +108,22 @@ Hooks.once("init", async function() {
return Handlebars.SafeString("");
}
options.hash.placeholder ??= game.i18n.localize(options.hash.subtitle);
const value = foundry.utils.getProperty(options.data.root.document, field_name);
const input = field.toInput({ localize: true, value: value, ...options.hash });
if (options.hash.subtitle) {
let subtitle_div = document.createElement("div");
subtitle_div.className = "subtitle";
subtitle_div.innerText = game.i18n.localize(options.hash.subtitle);
let outer_div = document.createElement("div");
outer_div.replaceChildren(input, subtitle_div);
return new Handlebars.SafeString(outer_div.outerHTML);
}
return new Handlebars.SafeString(input.outerHTML);
}
});