diff --git a/packages/frontend/src/pages/theme-editor.vue b/packages/frontend/src/pages/theme-editor.vue index a6dbd3150289..a66871cd133f 100644 --- a/packages/frontend/src/pages/theme-editor.vue +++ b/packages/frontend/src/pages/theme-editor.vue @@ -93,7 +93,6 @@ import * as os from '@/os.js'; import { ColdDeviceStorage, defaultStore } from '@/store.js'; import { addTheme } from '@/theme-store.js'; import { i18n } from '@/i18n.js'; -import { useLeaveGuard } from '@/scripts/use-leave-guard.js'; import { definePageMetadata } from '@/scripts/page-metadata.js'; const $i = signinRequired(); @@ -133,9 +132,6 @@ const theme = ref & Partial>({ }); const description = ref(null); const themeCode = ref(null); -const changed = ref(false); - -useLeaveGuard(changed); function showPreview() { os.pageWindow('/preview'); @@ -170,7 +166,6 @@ function setFgColor(color) { function apply() { themeCode.value = JSON5.stringify(theme.value, null, '\t'); applyTheme(theme.value as Theme, false); - changed.value = true; } function applyThemeCode() { @@ -211,7 +206,7 @@ async function saveAs() { } else { ColdDeviceStorage.set('lightTheme', theme.value as Theme); } - changed.value = false; + os.alert({ type: 'success', text: i18n.tsx._theme.installed({ name: theme.value.name }), diff --git a/packages/frontend/src/scripts/use-leave-guard.ts b/packages/frontend/src/scripts/use-leave-guard.ts deleted file mode 100644 index 395c12a756ae..000000000000 --- a/packages/frontend/src/scripts/use-leave-guard.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and misskey-project - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import type { Ref } from 'vue'; - -export function useLeaveGuard(enabled: Ref) { - /* TODO - const setLeaveGuard = inject('setLeaveGuard'); - - if (setLeaveGuard) { - setLeaveGuard(async () => { - if (!enabled.value) return false; - - const { canceled } = await os.confirm({ - type: 'warning', - text: i18n.ts.leaveConfirm, - }); - - return canceled; - }); - } else { - onBeforeRouteLeave(async (to, from) => { - if (!enabled.value) return true; - - const { canceled } = await os.confirm({ - type: 'warning', - text: i18n.ts.leaveConfirm, - }); - - return !canceled; - }); - } - */ - - /* - function onBeforeLeave(ev: BeforeUnloadEvent) { - if (enabled.value) { - ev.preventDefault(); - ev.returnValue = ''; - } - } - - window.addEventListener('beforeunload', onBeforeLeave); - onUnmounted(() => { - window.removeEventListener('beforeunload', onBeforeLeave); - }); - */ -}