navhookをbootに移動

This commit is contained in:
kakkokari-gtyih 2024-07-06 13:03:21 +09:00
parent 15443e4418
commit 6f802477c3
2 changed files with 10 additions and 8 deletions

View File

@ -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<CommonBootOptions> = {};
@ -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');
});

View File

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