diff --git a/src/main.css b/src/main.css index aa0c888..f25fdd0 100644 --- a/src/main.css +++ b/src/main.css @@ -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; diff --git a/src/main.mjs b/src/main.mjs index 0041284..cab438f 100644 --- a/src/main.mjs +++ b/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); } });