Skip to content

Commit

Permalink
fix(settings page): font family buttons not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec committed Feb 15, 2024
1 parent f9b537b commit 0a9a6e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions frontend/src/ts/pages/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
$(
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/popups/simple-popups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", []);
}
Expand Down

0 comments on commit 0a9a6e6

Please sign in to comment.