Create fake placeholder

This commit is contained in:
Carlos Fernandez 2025-12-18 16:05:02 -05:00
parent ac727eb492
commit 0009357496
3 changed files with 8 additions and 1 deletions

View file

@ -248,6 +248,9 @@ export default function DHApplicationMixin(Base) {
input.addEventListener("keydown", event => { input.addEventListener("keydown", event => {
if (event.key === "Enter") input.blur(); if (event.key === "Enter") input.blur();
}); });
// Chrome sometimes add <br>, which aren't a problem for the value but are for the placeholder
input.addEventListener("input", () => input.querySelectorAll("br").forEach((i) => i.remove()));
} }
} }

View file

@ -46,6 +46,10 @@
.input[contenteditable] { .input[contenteditable] {
cursor: var(--cursor-text); cursor: var(--cursor-text);
&:empty:before {
color: light-dark(@dark-40, @beige-50);
content: attr(placeholder);
}
} }
input[type='checkbox'], input[type='checkbox'],

View file

@ -1,7 +1,7 @@
<header class='adversary-header-sheet'> <header class='adversary-header-sheet'>
<line-div></line-div> <line-div></line-div>
<div class="name-row"> <div class="name-row">
<h1 class='input actor-name' contenteditable="plaintext-only" data-property="name">{{source.name}}</h1> <h1 class='input actor-name' contenteditable="plaintext-only" data-property="name" placeholder="{{localize "DAGGERHEART.GENERAL.actorName"}}">{{source.name}}</h1>
</div> </div>
<div class="tags"> <div class="tags">
<div class="tag"> <div class="tag">