|
42 | 42 | dark:text-gray-300 |
43 | 43 | justify-between |
44 | 44 | items-center |
45 | | - w-96 |
| 45 | + w-full |
| 46 | + md:w-1/2 |
46 | 47 | px-2 |
47 | 48 | py-1 |
48 | 49 | " |
|
51 | 52 | <InputSelect v-model="lang" :arr="['Português do Brasil', 'English']" /> |
52 | 53 | </div> |
53 | 54 | <SwitchGroup> |
54 | | - <div class="flex px-2 items-center w-96 justify-between"> |
| 55 | + <div class="flex px-2 items-center w-full md:w-1/2 justify-between"> |
55 | 56 | <SwitchLabel |
56 | 57 | class=" |
57 | 58 | mr-4 |
|
92 | 93 | </Switch> |
93 | 94 | </div> |
94 | 95 | </SwitchGroup> |
| 96 | + <div |
| 97 | + class=" |
| 98 | + flex |
| 99 | + font-bold |
| 100 | + text-base text-black |
| 101 | + dark:text-gray-300 |
| 102 | + justify-between |
| 103 | + items-center |
| 104 | + w-full |
| 105 | + md:w-1/2 |
| 106 | + px-2 |
| 107 | + py-1 |
| 108 | + " |
| 109 | + > |
| 110 | + <p>{{ t('editor.aside.configuration.autosave') }}</p> |
| 111 | + <InputSelect v-model="auto" :arr="[1, 2, 5, 15, 30, 'never']" /> |
| 112 | + </div> |
95 | 113 | </div> |
96 | 114 | </div> |
97 | 115 | </template> |
98 | 116 |
|
99 | 117 | <script setup lang="ts"> |
100 | 118 | import { useEditorStore } from '@/store/editor' |
101 | | - import { ref, watch } from 'vue' |
| 119 | + import { ref, watch, nextTick } from 'vue' |
102 | 120 | import { useI18n } from 'vue-i18n' |
103 | 121 | import { useAbsoluteStore } from '@/store/absolute' |
| 122 | + import { useLocalStorage } from '@/use/storage/local' |
104 | 123 |
|
105 | 124 | const ABSOLUTE = useAbsoluteStore() |
106 | | -
|
107 | 125 | const EDITOR = useEditorStore() |
108 | 126 |
|
| 127 | + const local = useLocalStorage() |
| 128 | +
|
109 | 129 | const { t, locale } = useI18n() |
110 | 130 |
|
| 131 | + const auto = ref(EDITOR.configuration.auto) |
111 | 132 | const dark = ref(EDITOR.configuration.dark) |
112 | 133 | watch(dark, (_dark: boolean) => { |
113 | 134 | EDITOR.configuration.dark = _dark |
|
118 | 139 | _dark ? (localStorage.theme = 'dark') : localStorage.removeItem('theme') |
119 | 140 | }) |
120 | 141 |
|
| 142 | + watch(auto, async (_auto) => { |
| 143 | + EDITOR.setAutoSave(_auto) |
| 144 | +
|
| 145 | + await nextTick |
| 146 | +
|
| 147 | + local.onSaveProject().then(() => { |
| 148 | + window.location.reload() |
| 149 | + }) |
| 150 | + }) |
| 151 | +
|
121 | 152 | const convert = (iso: string) => { |
122 | 153 | return ( |
123 | 154 | { |
|
0 commit comments