Skip to content

Commit

Permalink
fix(frontend): isEnabledUrlPreview をリアクティブに判定する
Browse files Browse the repository at this point in the history
  • Loading branch information
taiyme committed Apr 29, 2024
1 parent 15ca917 commit b8beb2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions packages/frontend/src/components/MkLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, defineAsyncComponent, shallowRef } from 'vue';
import { url as local } from '@/config.js';
import { useTooltip } from '@/scripts/use-tooltip.js';
import * as os from '@/os.js';
import { popup } from '@/os.js';
import { isEnabledUrlPreview } from '@/instance.js';
import MkA, { type MkABehavior } from '@/components/global/MkA.vue';
Expand All @@ -46,15 +46,15 @@ const anchorElement = computed(() => {
return rootEl.value.getAnchorElement();
});
if (isEnabledUrlPreview.value) {
useTooltip(anchorElement, (showing) => {
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
useTooltip(anchorElement, (showing) => {
if (isEnabledUrlPreview.value && anchorElement.value != null) {
popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
showing,
url: props.url,
source: anchorElement.value,
}, {}, 'closed');
});
}
}
});
</script>
<style lang="scss" module>
Expand Down
12 changes: 6 additions & 6 deletions packages/frontend/src/components/global/MkUrl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, defineAsyncComponent, shallowRef } from 'vue';
import { toUnicode as decodePunycode } from 'punycode/';
import { url as local } from '@/config.js';
import * as os from '@/os.js';
import { popup } from '@/os.js';
import { useTooltip } from '@/scripts/use-tooltip.js';
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
import { isEnabledUrlPreview } from '@/instance.js';
Expand All @@ -60,15 +60,15 @@ const anchorElement = computed(() => {
return rootEl.value.getAnchorElement();
});
if (props.showUrlPreview && isEnabledUrlPreview.value) {
useTooltip(anchorElement, (showing) => {
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
useTooltip(anchorElement, (showing) => {
if (props.showUrlPreview && isEnabledUrlPreview.value && anchorElement.value != null) {
popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
showing,
url: props.url,
source: anchorElement.value,
}, {}, 'closed');
});
}
}
});
const schema = url.protocol;
const hostname = decodePunycode(url.hostname);
Expand Down

0 comments on commit b8beb2d

Please sign in to comment.