This commit is contained in:
kakkokari-gtyih 2024-07-06 10:54:05 +09:00
parent ea3db748c7
commit acdeb5cc44
2 changed files with 5 additions and 3 deletions

View File

@ -62,8 +62,10 @@ export function parseEmbedParams(searchParams: URLSearchParams | string): Parsed
let _searchParams: URLSearchParams; let _searchParams: URLSearchParams;
if (typeof searchParams === 'string') { if (typeof searchParams === 'string') {
_searchParams = new URLSearchParams(searchParams); _searchParams = new URLSearchParams(searchParams);
} else { } else if (searchParams instanceof URLSearchParams) {
_searchParams = searchParams; _searchParams = searchParams;
} else {
throw new Error('searchParams must be URLSearchParams or string');
} }
const params: EmbedParams = {}; const params: EmbedParams = {};

View File

@ -2,6 +2,7 @@
* SPDX-FileCopyrightText: syuilo and misskey-project * SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { defineAsyncComponent } from 'vue';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { url } from '@/config.js'; import { url } from '@/config.js';
import { MOBILE_THRESHOLD } from '@/const.js'; import { MOBILE_THRESHOLD } from '@/const.js';
@ -9,7 +10,6 @@ import * as os from '@/os.js';
import copy from '@/scripts/copy-to-clipboard.js'; import copy from '@/scripts/copy-to-clipboard.js';
import type { EmbedParams, EmbeddableEntity } from '@/scripts/embed-page.js'; import type { EmbedParams, EmbeddableEntity } from '@/scripts/embed-page.js';
import { defaultEmbedParams, embedRouteWithScrollbar } from '@/scripts/embed-page.js'; import { defaultEmbedParams, embedRouteWithScrollbar } from '@/scripts/embed-page.js';
import MkEmbedCodeGenDialog from '@/components/MkEmbedCodeGenDialog.vue';
/** /**
* *
@ -76,7 +76,7 @@ export function copyEmbedCode(entity: EmbeddableEntity, idOrUsername: string, pa
copy(getEmbedCode(`/embed/${entity}/${_idOrUsername}`, _params)); copy(getEmbedCode(`/embed/${entity}/${_idOrUsername}`, _params));
os.success(); os.success();
} else { } else {
const { dispose } = os.popup(MkEmbedCodeGenDialog, { const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkEmbedCodeGenDialog.vue')), {
entity, entity,
idOrUsername, idOrUsername,
params: _params, params: _params,