This commit is contained in:
syuilo 2022-06-24 00:47:55 +09:00
parent 5ee53c222b
commit c9e9129373
2 changed files with 72 additions and 68 deletions

View file

@ -1,4 +1,5 @@
<template><MkStickyContainer> <template>
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="800" :margin-min="16" :margin-max="32"> <MkSpacer :content-max="800" :margin-min="16" :margin-max="32">
<div class="cwepdizn _formRoot"> <div class="cwepdizn _formRoot">
@ -62,7 +63,8 @@
</div> </div>
</FormFolder> </FormFolder>
</div> </div>
</MkSpacer></MkStickyContainer> </MkSpacer>
</MkStickyContainer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -85,6 +87,7 @@ import { ColdDeviceStorage, defaultStore } from '@/store';
import { addTheme } from '@/theme-store'; import { addTheme } from '@/theme-store';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { useLeaveGuard } from '@/scripts/use-leave-guard'; import { useLeaveGuard } from '@/scripts/use-leave-guard';
import { definePageMetadata } from '@/scripts/page-metadata';
const bgColors = [ const bgColors = [
{ color: '#f5f5f5', kind: 'light', forPreview: '#f5f5f5' }, { color: '#f5f5f5', kind: 'light', forPreview: '#f5f5f5' },
@ -204,7 +207,17 @@ async function saveAs() {
watch($$(theme), apply, { deep: true }); watch($$(theme), apply, { deep: true });
const headerActions = $computed(() => []); const headerActions = $computed(() => [{
asFullButton: true,
icon: 'fas fa-eye',
text: i18n.ts.preview,
handler: showPreview,
}, {
asFullButton: true,
icon: 'fas fa-check',
text: i18n.ts.saveAs,
handler: saveAs,
}]);
const headerTabs = $computed(() => []); const headerTabs = $computed(() => []);
@ -212,17 +225,6 @@ definePageMetadata({
title: i18n.ts.themeEditor, title: i18n.ts.themeEditor,
icon: 'fas fa-palette', icon: 'fas fa-palette',
bg: 'var(--bg)', bg: 'var(--bg)',
actions: [{
asFullButton: true,
icon: 'fas fa-eye',
text: i18n.ts.preview,
handler: showPreview,
}, {
asFullButton: true,
icon: 'fas fa-check',
text: i18n.ts.saveAs,
handler: saveAs,
}],
}); });
</script> </script>

View file

@ -3,6 +3,7 @@ import { i18n } from '@/i18n';
import * as os from '@/os'; import * as os from '@/os';
export function useLeaveGuard(enabled: Ref<boolean>) { export function useLeaveGuard(enabled: Ref<boolean>) {
/* TODO
const setLeaveGuard = inject('setLeaveGuard'); const setLeaveGuard = inject('setLeaveGuard');
if (setLeaveGuard) { if (setLeaveGuard) {
@ -28,6 +29,7 @@ export function useLeaveGuard(enabled: Ref<boolean>) {
return !canceled; return !canceled;
}); });
} }
*/
/* /*
function onBeforeLeave(ev: BeforeUnloadEvent) { function onBeforeLeave(ev: BeforeUnloadEvent) {