mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
Support multiline adversary names
This commit is contained in:
parent
e74ce7726a
commit
ac727eb492
4 changed files with 29 additions and 10 deletions
|
|
@ -179,6 +179,7 @@ export default function DHApplicationMixin(Base) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
this._dragDrop.forEach(d => d.bind(htmlElement));
|
this._dragDrop.forEach(d => d.bind(htmlElement));
|
||||||
|
|
||||||
|
// Handle delta inputs
|
||||||
for (const deltaInput of htmlElement.querySelectorAll('input[data-allow-delta]')) {
|
for (const deltaInput of htmlElement.querySelectorAll('input[data-allow-delta]')) {
|
||||||
deltaInput.dataset.numValue = deltaInput.value;
|
deltaInput.dataset.numValue = deltaInput.value;
|
||||||
deltaInput.inputMode = 'numeric';
|
deltaInput.inputMode = 'numeric';
|
||||||
|
|
@ -232,6 +233,22 @@ export default function DHApplicationMixin(Base) {
|
||||||
handleUpdate();
|
handleUpdate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle contenteditable
|
||||||
|
for (const input of htmlElement.querySelectorAll('[contenteditable][data-property]')) {
|
||||||
|
const property = input.dataset.property;
|
||||||
|
input.addEventListener("blur", () => {
|
||||||
|
const selection = document.getSelection();
|
||||||
|
if (input.contains(selection.anchorNode)) {
|
||||||
|
selection.empty();
|
||||||
|
}
|
||||||
|
this.document.update({ [property]: input.textContent });
|
||||||
|
});
|
||||||
|
|
||||||
|
input.addEventListener("keydown", event => {
|
||||||
|
if (event.key === "Enter") input.blur();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
input[type='text'],
|
input[type='text'],
|
||||||
input[type='number'],
|
input[type='number'],
|
||||||
textarea {
|
textarea,
|
||||||
|
.input[contenteditable] {
|
||||||
background: light-dark(transparent, transparent);
|
background: light-dark(transparent, transparent);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: 0 4px 30px @soft-shadow;
|
box-shadow: 0 4px 30px @soft-shadow;
|
||||||
|
|
@ -43,6 +44,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input[contenteditable] {
|
||||||
|
cursor: var(--cursor-text);
|
||||||
|
}
|
||||||
|
|
||||||
input[type='checkbox'],
|
input[type='checkbox'],
|
||||||
input[type='radio'] {
|
input[type='radio'] {
|
||||||
&:checked::after {
|
&:checked::after {
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0;
|
padding: 8px 0;
|
||||||
padding-top: 5px;
|
|
||||||
padding-bottom: 8px;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
input[type='text'] {
|
h1 {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
padding: 6px 0 0 0;
|
||||||
font-size: var(--font-size-32);
|
font-size: var(--font-size-32);
|
||||||
height: 42px;
|
|
||||||
text-align: start;
|
text-align: start;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
outline: 2px solid transparent;
|
outline: 2px solid transparent;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +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='actor-name'>
|
<h1 class='input actor-name' contenteditable="plaintext-only" data-property="name">{{source.name}}</h1>
|
||||||
<input type='text' name='name' value='{{source.name}}' placeholder="{{localize "DAGGERHEART.GENERAL.actorName"}}"
|
|
||||||
/>
|
|
||||||
</h1>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
<div class="tag">
|
<div class="tag">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue