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);