enhance(frontend): ページ遷移時にPlayerを閉じるように (#13013)

* なんかできた

* update changelog.md

* onDeactivatedを使うように
This commit is contained in:
ikasoba 2024-01-17 13:26:36 +09:00 committed by GitHub
parent c971edd2dd
commit bc5aebe956
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View file

@ -83,7 +83,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { defineAsyncComponent, onUnmounted, ref } from 'vue';
import { defineAsyncComponent, onDeactivated, onUnmounted, ref } from 'vue';
import type { summaly } from '@misskey-dev/summaly';
import { url as local } from '@/config.js';
import { i18n } from '@/i18n.js';
@ -131,6 +131,10 @@ const embedId = `embed${Math.random().toString().replace(/\D/, '')}`;
const tweetHeight = ref(150);
const unknownUrl = ref(false);
onDeactivated(() => {
playerEnabled.value = false;
});
const requestUrl = new URL(props.url);
if (!['http:', 'https:'].includes(requestUrl.protocol)) throw new Error('invalid url');