Merge branch 'master' into push-input-through-postmessage

This commit is contained in:
kenduguay1 2025-05-09 10:29:09 -04:00 committed by GitHub
commit 85a3a18570
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 4499 additions and 538 deletions

View file

@ -160,18 +160,37 @@ class OptionsWaiter {
// Update theme selection
const themeSelect = document.getElementById("theme");
themeSelect.selectedIndex = themeSelect.querySelector(`option[value="${theme}"`).index;
let themeOption = themeSelect.querySelector(`option[value="${theme}"]`);
if (!themeOption) {
const preferredColorScheme = this.getPreferredColorScheme();
document.querySelector(":root").className = preferredColorScheme;
themeOption = themeSelect.querySelector(`option[value="${preferredColorScheme}"]`);
}
themeSelect.selectedIndex = themeOption.index;
}
/**
* Applies the user's preferred color scheme using the `prefers-color-scheme` media query.
*/
applyPreferredColorScheme() {
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
const theme = prefersDarkScheme ? "dark" : "classic";
const themeFromStorage = this.app?.options?.theme;
let theme = themeFromStorage;
if (!theme) {
theme = this.getPreferredColorScheme();
}
this.changeTheme(theme);
}
/**
* Get the user's preferred color scheme using the `prefers-color-scheme` media query.
*/
getPreferredColorScheme() {
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
return prefersDarkScheme ? "dark" : "classic";
}
/**
* Changes the console logging level.
*

View file

@ -8,6 +8,7 @@ import HTMLOperation from "../HTMLOperation.mjs";
import Sortable from "sortablejs";
import Utils from "../../core/Utils.mjs";
import {escapeControlChars} from "../utils/editorUtils.mjs";
import DOMPurify from "dompurify";
/**
@ -435,7 +436,9 @@ class RecipeWaiter {
const item = document.createElement("li");
item.classList.add("operation");
item.innerHTML = name;
const clean = DOMPurify.sanitize(name);
item.innerHTML = clean;
this.buildRecipeOperation(item);
document.getElementById("rec-list").appendChild(item);