embedのURLパラメータの初期化を共通化

This commit is contained in:
kakkokari-gtyih
2024-06-29 17:47:38 +09:00
parent 237605d6b8
commit 1ed6ed6ef0
8 changed files with 113 additions and 78 deletions

View File

@@ -31,7 +31,8 @@ import XCommon from './_common_/common.vue';
import { PageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
import { instanceName } from '@/config.js';
import { mainRouter } from '@/router/main.js';
import { postMessageToParentWindow } from '@/scripts/post-message';
import { postMessageToParentWindow } from '@/scripts/post-message.js';
import { parseEmbedParams } from '@/scripts/embed-page.js';
const isRoot = computed(() => mainRouter.currentRoute.value.name === 'index');
@@ -61,13 +62,16 @@ mainRouter.navHook = (path, flag): boolean => {
//#region Embed Provide
provide('EMBED_PAGE', true);
const params = new URLSearchParams(location.search);
const embedParams = parseEmbedParams(params);
provide('embedParams', embedParams);
//#endregion
//#region Embed Style
const params = new URLSearchParams(location.search);
const embedRounded = ref(params.get('rounded') !== 'false');
const embedNoBorder = ref(params.get('border') === 'false');
const maxHeight = ref(params.get('maxHeight') ? parseInt(params.get('maxHeight')!) : 0);
const embedRounded = ref(embedParams.rounded);
const embedNoBorder = ref(!embedParams.border);
const maxHeight = ref(embedParams.maxHeight ?? 0);
//#endregion
//#region Embed Resizer