add the ability to define a subtitle to DSA41_input
This commit is contained in:
parent
f82548fbaf
commit
f2c4b63382
@ -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;
|
||||
|
||||
14
src/main.mjs
14
src/main.mjs
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user