From 6f802477c3f27399271e16040167fb98ba411080 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:03:21 +0900 Subject: [PATCH] =?UTF-8?q?navhook=E3=82=92boot=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/_embed_boot_.ts | 10 ++++++++++ packages/frontend/src/ui/embed.vue | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/_embed_boot_.ts b/packages/frontend/src/_embed_boot_.ts index 2e2d8a26b0..f4fc6396e2 100644 --- a/packages/frontend/src/_embed_boot_.ts +++ b/packages/frontend/src/_embed_boot_.ts @@ -14,6 +14,7 @@ import type { CommonBootOptions } from '@/boot/common.js'; import { setIframeId, postMessageToParentWindow } from '@/scripts/post-message.js'; import { parseEmbedParams } from '@/scripts/embed-page.js'; import { defaultStore } from '@/store.js'; +import { useRouter } from '@/router/supplier.js'; const bootOptions: Partial = {}; @@ -61,6 +62,15 @@ common(() => createApp( defaultStore.set('sound_notUseSound', true); //#endregion + //#region Embed Link Behavior + //強制的に新しいタブで開く + const router = useRouter(); + router.navHook = (path, flag): boolean => { + window.open(path, '_blank', 'noopener'); + return true; + }; + //#endregion + // 起動完了を通知(このあとクライアント側から misskey:embedParent:registerIframeId が送信される) postMessageToParentWindow('misskey:embed:ready'); }); diff --git a/packages/frontend/src/ui/embed.vue b/packages/frontend/src/ui/embed.vue index a505cbea14..7771cb2dde 100644 --- a/packages/frontend/src/ui/embed.vue +++ b/packages/frontend/src/ui/embed.vue @@ -55,14 +55,6 @@ provideMetadataReceiver((metadataGetter) => { }); provideReactiveMetadata(pageMetadata); -//#region Embed Link Behavior -//強制的に新しいタブで開く -mainRouter.navHook = (path, flag): boolean => { - window.open(path, '_blank', 'noopener'); - return true; -}; -//#endregion - //#region Embed Style const embedRounded = ref(embedParams.rounded); const embedNoBorder = ref(!embedParams.border);