π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Update toggle: support v-model
Smaug67399abc243b1030
diff --git a/frontend/app/components/AppToggle.vue b/frontend/app/components/AppToggle.vueindex 2eeaee3a..6c04717f 100644--- a/frontend/app/components/AppToggle.vue+++ b/frontend/app/components/AppToggle.vue@@ -1,19 +1,24 @@<template>- <button class="toggle" :class="{ active }" :aria-pressed="active" role="switch" @click="toggle">+ <button class="toggle" :class="{ active: modelValue || active }" :aria-pressed="modelValue" role="switch" @click="toggle"><span class="circle" /></button></template><script setup lang="ts">-defineProps<{- active: boolean;+const props = defineProps<{+ modelValue?: boolean;+ active?: boolean;}>();+const active = ref(props.active || props.modelValue || false);const emit = defineEmits<{+ (e: 'update:modelValue', value: boolean): void;(e: 'toggle'): void;}>();const toggle = () => {+ active.value = !active.value;+ emit('update:modelValue', active.value);emit('toggle');};</script>diff --git a/frontend/app/pages/dashboard/settings/_views/preferences.vue b/frontend/app/pages/dashboard/settings/_views/preferences.vueindex 038d570c..04dc88c5 100644--- a/frontend/app/pages/dashboard/settings/_views/preferences.vue+++ b/frontend/app/pages/dashboard/settings/_views/preferences.vue@@ -10,7 +10,13 @@<AppToggle v-if="option.type === 'toggle'" :active="option.value" @toggle="toggleOption(option)" /><!-- Native select -->- <AppSelect v-else-if="option.type === 'select'" v-model="option.value" :items="option.choices" size="40%" @update:model-value="o => selectOption({ ...option, value: o })" />+ <AppSelect+ v-else-if="option.type === 'select'"+ v-model="option.value"+ :items="option.choices"+ size="40%"+ @update:model-value="o => selectOption({ ...option, value: o })"+ /><AppColorPicker v-else-if="option.type === 'color'" :selected-color="option.value" @update:selected-color="option.onChange" /></div></div>