Skip to content

Commit 6d9c234

Browse files
authored
fix: URL preview popup for local URL appears in the upper left corner (misskey-dev#13555)
1 parent b280faa commit 6d9c234

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
1111
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
1212
- Fix: 周年の実績が閏年を考慮しない問題を修正
13+
- Fix: ローカルURLのプレビューポップアップが左上に表示される
1314

1415
### Server
1516
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに

packages/frontend/src/components/MkLink.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ const self = props.url.startsWith(local);
2929
const attr = self ? 'to' : 'href';
3030
const target = self ? null : '_blank';
3131

32-
const el = ref<HTMLElement>();
32+
const el = ref<HTMLElement | { $el: HTMLElement }>();
3333

3434
useTooltip(el, (showing) => {
3535
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
3636
showing,
3737
url: props.url,
38-
source: el.value,
38+
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
3939
}, {}, 'closed');
4040
});
4141
</script>

packages/frontend/src/components/global/MkA.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ SPDX-License-Identifier: AGPL-3.0-only
44
-->
55

66
<template>
7-
<a :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu">
7+
<a ref="el" :href="to" :class="active ? activeClass : null" @click.prevent="nav" @contextmenu.prevent.stop="onContextmenu">
88
<slot></slot>
99
</a>
1010
</template>
1111

1212
<script lang="ts" setup>
13-
import { computed } from 'vue';
13+
import { computed, shallowRef } from 'vue';
1414
import * as os from '@/os.js';
1515
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
1616
import { url } from '@/config.js';
@@ -26,6 +26,10 @@ const props = withDefaults(defineProps<{
2626
behavior: null,
2727
});
2828

29+
const el = shallowRef<HTMLElement>();
30+
31+
defineExpose({ $el: el });
32+
2933
const router = useRouter();
3034

3135
const active = computed(() => {

packages/frontend/src/components/global/MkUrl.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (props.showUrlPreview) {
4949
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
5050
showing,
5151
url: props.url,
52-
source: el.value,
52+
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
5353
}, {}, 'closed');
5454
});
5555
}

0 commit comments

Comments
 (0)