Skip to content

Commit b8beb2d

Browse files
committed
fix(frontend): isEnabledUrlPreview をリアクティブに判定する
1 parent 15ca917 commit b8beb2d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

packages/frontend/src/components/MkLink.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
2424
import { computed, defineAsyncComponent, shallowRef } from 'vue';
2525
import { url as local } from '@/config.js';
2626
import { useTooltip } from '@/scripts/use-tooltip.js';
27-
import * as os from '@/os.js';
27+
import { popup } from '@/os.js';
2828
import { isEnabledUrlPreview } from '@/instance.js';
2929
import MkA, { type MkABehavior } from '@/components/global/MkA.vue';
3030

@@ -46,15 +46,15 @@ const anchorElement = computed(() => {
4646
return rootEl.value.getAnchorElement();
4747
});
4848

49-
if (isEnabledUrlPreview.value) {
50-
useTooltip(anchorElement, (showing) => {
51-
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
49+
useTooltip(anchorElement, (showing) => {
50+
if (isEnabledUrlPreview.value && anchorElement.value != null) {
51+
popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
5252
showing,
5353
url: props.url,
5454
source: anchorElement.value,
5555
}, {}, 'closed');
56-
});
57-
}
56+
}
57+
});
5858
</script>
5959

6060
<style lang="scss" module>

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
3434
import { computed, defineAsyncComponent, shallowRef } from 'vue';
3535
import { toUnicode as decodePunycode } from 'punycode/';
3636
import { url as local } from '@/config.js';
37-
import * as os from '@/os.js';
37+
import { popup } from '@/os.js';
3838
import { useTooltip } from '@/scripts/use-tooltip.js';
3939
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
4040
import { isEnabledUrlPreview } from '@/instance.js';
@@ -60,15 +60,15 @@ const anchorElement = computed(() => {
6060
return rootEl.value.getAnchorElement();
6161
});
6262

63-
if (props.showUrlPreview && isEnabledUrlPreview.value) {
64-
useTooltip(anchorElement, (showing) => {
65-
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
63+
useTooltip(anchorElement, (showing) => {
64+
if (props.showUrlPreview && isEnabledUrlPreview.value && anchorElement.value != null) {
65+
popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
6666
showing,
6767
url: props.url,
6868
source: anchorElement.value,
6969
}, {}, 'closed');
70-
});
71-
}
70+
}
71+
});
7272

7373
const schema = url.protocol;
7474
const hostname = decodePunycode(url.hostname);

0 commit comments

Comments
 (0)