mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
fix: 🐛 Don't trigger theme changes when in contenteditable fields
This commit is contained in:
parent
4d086dce80
commit
e0e8db8d55
|
|
@ -45,7 +45,8 @@ const activeElement = useActiveElement();
|
||||||
const notUsingInput = computed(
|
const notUsingInput = computed(
|
||||||
() =>
|
() =>
|
||||||
activeElement.value?.tagName !== "INPUT" &&
|
activeElement.value?.tagName !== "INPUT" &&
|
||||||
activeElement.value?.tagName !== "TEXTAREA",
|
activeElement.value?.tagName !== "TEXTAREA" &&
|
||||||
|
activeElement.value?.contentEditable !== "true",
|
||||||
);
|
);
|
||||||
|
|
||||||
const backgroundImage = useSetting(SettingIds.BackgroundURL);
|
const backgroundImage = useSetting(SettingIds.BackgroundURL);
|
||||||
|
|
@ -53,14 +54,14 @@ const canParseUrl = URL.canParse;
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
watchEffect(async () => {
|
watch([n, notUsingInput, d], async () => {
|
||||||
if (n?.value && notUsingInput.value) {
|
if (n?.value && notUsingInput.value) {
|
||||||
// Wait 50ms
|
// Wait 50ms
|
||||||
await new Promise((resolve) => setTimeout(resolve, 50));
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||||
useEvent("composer:open");
|
useEvent("composer:open");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d?.value && !colorMode.forced) {
|
if (d?.value && notUsingInput.value && !colorMode.forced) {
|
||||||
// Swap theme from dark to light or vice versa
|
// Swap theme from dark to light or vice versa
|
||||||
if (colorMode.value === "dark") {
|
if (colorMode.value === "dark") {
|
||||||
colorMode.preference = "light";
|
colorMode.preference = "light";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue