fix onBeforeRouteLeave

fixes https://github.com/misskey-dev/misskey/issues/8861
This commit is contained in:
syuilo 2022-06-24 00:47:55 +09:00 committed by Johann150
parent c781dd445f
commit 252ab3d852
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
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>
<MkSpacer :content-max="800" :margin-min="16" :margin-max="32">
<div class="cwepdizn _formRoot">
@ -62,7 +63,8 @@
</div>
</FormFolder>
</div>
</MkSpacer></MkStickyContainer>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
@ -85,6 +87,7 @@ import { ColdDeviceStorage, defaultStore } from '@/store';
import { addTheme } from '@/theme-store';
import { i18n } from '@/i18n';
import { useLeaveGuard } from '@/scripts/use-leave-guard';
import { definePageMetadata } from '@/scripts/page-metadata';
const bgColors = [
{ color: '#f5f5f5', kind: 'light', forPreview: '#f5f5f5' },
@ -204,15 +207,7 @@ async function saveAs() {
watch($$(theme), apply, { deep: true });
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts.themeEditor,
icon: 'fas fa-palette',
bg: 'var(--bg)',
actions: [{
const headerActions = $computed(() => [{
asFullButton: true,
icon: 'fas fa-eye',
text: i18n.ts.preview,
@ -222,7 +217,14 @@ definePageMetadata({
icon: 'fas fa-check',
text: i18n.ts.saveAs,
handler: saveAs,
}],
}]);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts.themeEditor,
icon: 'fas fa-palette',
bg: 'var(--bg)',
});
</script>

View file

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