embedのstoreでの変更が外部タブに影響しないように・されないように

This commit is contained in:
kakkokari-gtyih 2024-06-07 19:43:09 +09:00
parent e5415812e6
commit 6a7ed7e0d1
3 changed files with 74 additions and 47 deletions

View file

@ -11,6 +11,7 @@ import '@/style.embed.scss';
import type { CommonBootOptions } from '@/boot/common.js';
import { subBoot } from '@/boot/sub-boot.js';
import { setIframeId, postMessageToParentWindow } from '@/scripts/post-message.js';
import { defaultStore } from '@/store.js';
const bootOptions: Partial<CommonBootOptions> = {};
@ -21,6 +22,11 @@ if (color && ['light', 'dark'].includes(color)) {
bootOptions.forceColorMode = color as 'light' | 'dark';
}
// 外部タブでのstoreの変更の影響を受けないように
defaultStore.setConfig({
disableMessageChannel: true,
});
// iframeIdの設定
window.addEventListener('message', event => {
if (event.data?.type === 'misskey:embedParent:registerIframeId' && event.data.payload?.iframeId != null) {