1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-23 14:46:40 +09:00

fix: URL preview popup for local URL appears in the upper left corner (#13555)

This commit is contained in:
anatawa12 2024-03-12 13:50:24 +09:00 committed by GitHub
parent b280faa8e7
commit 6d9c234cb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 5 deletions

View File

@ -10,6 +10,7 @@
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように - Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
- Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに

View File

@ -29,13 +29,13 @@ const self = props.url.startsWith(local);
const attr = self ? 'to' : 'href'; const attr = self ? 'to' : 'href';
const target = self ? null : '_blank'; const target = self ? null : '_blank';
const el = ref<HTMLElement>(); const el = ref<HTMLElement | { $el: HTMLElement }>();
useTooltip(el, (showing) => { useTooltip(el, (showing) => {
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), { os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
showing, showing,
url: props.url, url: props.url,
source: el.value, source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
}, {}, 'closed'); }, {}, 'closed');
}); });
</script> </script>

View File

@ -4,13 +4,13 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<a :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu"> <a ref="el" :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu">
<slot></slot> <slot></slot>
</a> </a>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import { computed, shallowRef } from 'vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js'; import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { url } from '@/config.js'; import { url } from '@/config.js';
@ -26,6 +26,10 @@ const props = withDefaults(defineProps<{
behavior: null, behavior: null,
}); });
const el = shallowRef<HTMLElement>();
defineExpose({ $el: el });
const router = useRouter(); const router = useRouter();
const active = computed(() => { const active = computed(() => {

View File

@ -49,7 +49,7 @@ if (props.showUrlPreview) {
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), { os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
showing, showing,
url: props.url, url: props.url,
source: el.value, source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
}, {}, 'closed'); }, {}, 'closed');
}); });
} }