mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Improved the autocomplete typing experience
This commit is contained in:
parent
735ed4c214
commit
044d184832
5 changed files with 26 additions and 7 deletions
|
|
@ -54,7 +54,11 @@ export default class AttributionDialog extends HandlebarsApplicationMixin(Applic
|
||||||
const after = label.slice(matchIndex + search.length, label.length);
|
const after = label.slice(matchIndex + search.length, label.length);
|
||||||
|
|
||||||
const element = document.createElement('li');
|
const element = document.createElement('li');
|
||||||
element.innerHTML = `${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`;
|
element.innerHTML =
|
||||||
|
`${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`.replaceAll(
|
||||||
|
' ',
|
||||||
|
' '
|
||||||
|
);
|
||||||
if (item.hint) {
|
if (item.hint) {
|
||||||
element.dataset.tooltip = game.i18n.localize(item.hint);
|
element.dataset.tooltip = game.i18n.localize(item.hint);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,11 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
element.appendChild(img);
|
element.appendChild(img);
|
||||||
|
|
||||||
const label = document.createElement('span');
|
const label = document.createElement('span');
|
||||||
label.innerHTML = `${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`;
|
label.innerHTML =
|
||||||
|
`${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`.replaceAll(
|
||||||
|
' ',
|
||||||
|
' '
|
||||||
|
);
|
||||||
element.appendChild(label);
|
element.appendChild(label);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
|
|
@ -119,7 +123,11 @@ export default class GroupRollDialog extends HandlebarsApplicationMixin(Applicat
|
||||||
element.appendChild(img);
|
element.appendChild(img);
|
||||||
|
|
||||||
const label = document.createElement('span');
|
const label = document.createElement('span');
|
||||||
label.innerHTML = `${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`;
|
label.innerHTML =
|
||||||
|
`${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`.replaceAll(
|
||||||
|
' ',
|
||||||
|
' '
|
||||||
|
);
|
||||||
element.appendChild(label);
|
element.appendChild(label);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,18 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
||||||
},
|
},
|
||||||
render: function (item, search) {
|
render: function (item, search) {
|
||||||
const label = game.i18n.localize(item.label);
|
const label = game.i18n.localize(item.label);
|
||||||
const matchIndex = label.toLowerCase().indexOf(search);
|
const matchIndex = label.toLowerCase().indexOf(search.toLowerCase());
|
||||||
|
|
||||||
const beforeText = label.slice(0, matchIndex);
|
const beforeText = label.slice(0, matchIndex);
|
||||||
const matchText = label.slice(matchIndex, matchIndex + search.length);
|
const matchText = label.slice(matchIndex, matchIndex + search.length);
|
||||||
const after = label.slice(matchIndex + search.length, label.length);
|
const after = label.slice(matchIndex + search.length, label.length);
|
||||||
|
|
||||||
const element = document.createElement('li');
|
const element = document.createElement('li');
|
||||||
element.innerHTML = `${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`;
|
element.innerHTML =
|
||||||
|
`${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`.replaceAll(
|
||||||
|
' ',
|
||||||
|
' '
|
||||||
|
);
|
||||||
if (item.hint) {
|
if (item.hint) {
|
||||||
element.dataset.tooltip = game.i18n.localize(item.hint);
|
element.dataset.tooltip = game.i18n.localize(item.hint);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,11 @@ export default class SettingActiveEffectConfig extends HandlebarsApplicationMixi
|
||||||
const after = label.slice(matchIndex + search.length, label.length);
|
const after = label.slice(matchIndex + search.length, label.length);
|
||||||
|
|
||||||
const element = document.createElement('li');
|
const element = document.createElement('li');
|
||||||
element.innerHTML = `${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`;
|
element.innerHTML =
|
||||||
|
`${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`.replaceAll(
|
||||||
|
' ',
|
||||||
|
' '
|
||||||
|
);
|
||||||
if (item.hint) {
|
if (item.hint) {
|
||||||
element.dataset.tooltip = game.i18n.localize(item.hint);
|
element.dataset.tooltip = game.i18n.localize(item.hint);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
li[role='option'] {
|
li[role='option'] {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
|
||||||
font-size: var(--font-size-14);
|
font-size: var(--font-size-14);
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue