fix(frontend-embed): URLエンコードされた文字列が正常に読み込めない問題を修正 (#14630)
* fix(frontend-embed): URLエンコードされた文字列が正常に読み込めない問題を修正 * fix(frontend-embed): bring back missing bits
This commit is contained in:
parent
5c62cbcca8
commit
8c3be57ab3
|
@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<a :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer" :class="$style.avatarLink">
|
<a :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer" :class="$style.avatarLink">
|
||||||
<EmAvatar :class="$style.avatar" :user="user"/>
|
<EmAvatar :class="$style.avatar" :user="user"/>
|
||||||
</a>
|
</a>
|
||||||
<div :class="$style.headerTitle">
|
<div :class="$style.headerTitle" @click="top">
|
||||||
<I18n :src="i18n.ts.noteOf" tag="div" class="_nowrap">
|
<I18n :src="i18n.ts.noteOf" tag="div" class="_nowrap">
|
||||||
<template #user>
|
<template #user>
|
||||||
<a v-if="user != null" :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer">
|
<a v-if="user != null" :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer">
|
||||||
|
@ -56,6 +56,8 @@ import EmUserName from '@/components/EmUserName.vue';
|
||||||
import I18n from '@/components/I18n.vue';
|
import I18n from '@/components/I18n.vue';
|
||||||
import XNotFound from '@/pages/not-found.vue';
|
import XNotFound from '@/pages/not-found.vue';
|
||||||
import EmTimelineContainer from '@/components/EmTimelineContainer.vue';
|
import EmTimelineContainer from '@/components/EmTimelineContainer.vue';
|
||||||
|
import { scrollToTop } from '@@/js/scroll.js';
|
||||||
|
import { isLink } from '@@/js/is-link.js';
|
||||||
import { misskeyApi } from '@/misskey-api.js';
|
import { misskeyApi } from '@/misskey-api.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { assertServerContext } from '@/server-context.js';
|
import { assertServerContext } from '@/server-context.js';
|
||||||
|
@ -98,6 +100,15 @@ const pagination = computed(() => ({
|
||||||
} as Paging));
|
} as Paging));
|
||||||
|
|
||||||
const notesEl = useTemplateRef('notesEl');
|
const notesEl = useTemplateRef('notesEl');
|
||||||
|
|
||||||
|
function top(ev: MouseEvent) {
|
||||||
|
const target = ev.target as HTMLElement | null;
|
||||||
|
if (target && isLink(target)) return;
|
||||||
|
|
||||||
|
if (notesEl.value) {
|
||||||
|
scrollToTop(notesEl.value.$el as HTMLElement, { behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
|
|
@ -44,8 +44,16 @@ import EmTagPage from '@/pages/tag.vue';
|
||||||
import XNotFound from '@/pages/not-found.vue';
|
import XNotFound from '@/pages/not-found.vue';
|
||||||
import EmLoading from '@/components/EmLoading.vue';
|
import EmLoading from '@/components/EmLoading.vue';
|
||||||
|
|
||||||
|
function safeURIDecode(str: string): string {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const page = location.pathname.split('/')[2];
|
const page = location.pathname.split('/')[2];
|
||||||
const contentId = location.pathname.split('/')[3];
|
const contentId = safeURIDecode(location.pathname.split('/')[3]);
|
||||||
if (_DEV_) console.log(page, contentId);
|
if (_DEV_) console.log(page, contentId);
|
||||||
|
|
||||||
const embedParams = inject(DI.embedParams, defaultEmbedParams);
|
const embedParams = inject(DI.embedParams, defaultEmbedParams);
|
||||||
|
|
Loading…
Reference in New Issue