fix: 🐛 Don't trigger theme changes when in contenteditable fields

This commit is contained in:
Jesse Wierzbinski 2024-12-25 18:51:52 +01:00
parent 4d086dce80
commit e0e8db8d55
No known key found for this signature in database

View file

@ -45,7 +45,8 @@ const activeElement = useActiveElement();
const notUsingInput = computed(
() =>
activeElement.value?.tagName !== "INPUT" &&
activeElement.value?.tagName !== "TEXTAREA",
activeElement.value?.tagName !== "TEXTAREA" &&
activeElement.value?.contentEditable !== "true",
);
const backgroundImage = useSetting(SettingIds.BackgroundURL);
@ -53,14 +54,14 @@ const canParseUrl = URL.canParse;
const route = useRoute();
watchEffect(async () => {
watch([n, notUsingInput, d], async () => {
if (n?.value && notUsingInput.value) {
// Wait 50ms
await new Promise((resolve) => setTimeout(resolve, 50));
useEvent("composer:open");
}
if (d?.value && !colorMode.forced) {
if (d?.value && notUsingInput.value && !colorMode.forced) {
// Swap theme from dark to light or vice versa
if (colorMode.value === "dark") {
colorMode.preference = "light";