mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-26 15:54:35 +08:00
fix(settings page): font family buttons not working
This commit is contained in:
parent
f9b537be1e
commit
0a9a6e6ef1
2 changed files with 9 additions and 10 deletions
|
@ -382,7 +382,7 @@ async function initGroups(): Promise<void> {
|
|||
undefined,
|
||||
() => {
|
||||
const customButton = $(
|
||||
".pageSettings .section[data-config-name='fontFamily'] .buttons .custom"
|
||||
".pageSettings .section[data-config-name='fontFamily'] .buttons button[data-config-value='custom']"
|
||||
);
|
||||
if (
|
||||
$(
|
||||
|
@ -643,22 +643,21 @@ async function fillSettingsPage(): Promise<void> {
|
|||
if (fontsList) {
|
||||
for (const font of fontsList) {
|
||||
if (Config.fontFamily === font.name) isCustomFont = false;
|
||||
fontsElHTML += `<div class="button${
|
||||
fontsElHTML += `<button class="${
|
||||
Config.fontFamily === font.name ? " active" : ""
|
||||
}" style="font-family:${
|
||||
font.display !== undefined ? font.display : font.name
|
||||
}" data-config-value="${font.name.replace(/ /g, "_")}" tabindex="0"
|
||||
onclick="this.blur();">${
|
||||
font.display !== undefined ? font.display : font.name
|
||||
}</div>`;
|
||||
}" data-config-value="${font.name.replace(/ /g, "_")}">${
|
||||
font.display !== undefined ? font.display : font.name
|
||||
}</button>`;
|
||||
}
|
||||
|
||||
fontsElHTML += isCustomFont
|
||||
? `<div class="button no-auto-handle custom active" onclick="this.blur();">Custom (${Config.fontFamily.replace(
|
||||
? `<button class="no-auto-handle active" data-config-value="custom">Custom (${Config.fontFamily.replace(
|
||||
/_/g,
|
||||
" "
|
||||
)})</div>`
|
||||
: '<div class="button no-auto-handle custom" onclick="this.blur();">Custom</div>';
|
||||
)})</button>`
|
||||
: '<button class="no-auto-handle" data-config-value="custom"">Custom</button>';
|
||||
|
||||
fontsEl.innerHTML = fontsElHTML;
|
||||
}
|
||||
|
|
|
@ -1872,7 +1872,7 @@ $("#popups").on("click", "#apeKeysPopup table tbody tr .button.edit", (e) => {
|
|||
|
||||
$(".pageSettings").on(
|
||||
"click",
|
||||
".section[data-config-name='fontFamily'] .button.custom",
|
||||
".section[data-config-name='fontFamily'] button[data-config-value='custom']",
|
||||
() => {
|
||||
showPopup("applyCustomFont", []);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue