refactor
This commit is contained in:
parent
f4baa973bf
commit
caf6a3ab81
|
@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
:forceBlurhash="forceBlurhash"
|
||||
/>
|
||||
<img
|
||||
v-else-if="isThumbnailAvailable"
|
||||
v-else-if="isThumbnailAvailable && file.thumbnailUrl != null"
|
||||
:src="file.thumbnailUrl"
|
||||
:alt="file.name"
|
||||
:title="file.name"
|
||||
|
|
|
@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<Mfm class="summaryMfm" :text="flash.summary" :plain="true" :nowrap="true"/>
|
||||
</p>
|
||||
<footer>
|
||||
<img class="icon" :src="flash.user.avatarUrl"/>
|
||||
<img v-if="flash.user.avatarUrl != null" class="icon" :src="flash.user.avatarUrl"/>
|
||||
<p>{{ userName(flash.user) }}</p>
|
||||
</footer>
|
||||
</article>
|
||||
|
|
|
@ -17,11 +17,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts" setup>
|
||||
import { defineAsyncComponent, ref } from 'vue';
|
||||
import { url as local } from '@@/js/config.js';
|
||||
import { maybeMakeRelative } from '@@/js/url.js';
|
||||
import type { MkABehavior } from '@/components/global/MkA.vue';
|
||||
import { useTooltip } from '@/composables/use-tooltip.js';
|
||||
import * as os from '@/os.js';
|
||||
import { isEnabledUrlPreview } from '@/utility/url-preview.js';
|
||||
import type { MkABehavior } from '@/components/global/MkA.vue';
|
||||
import { maybeMakeRelative } from '@@/js/url.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
|
@ -42,7 +42,7 @@ if (isEnabledUrlPreview.value) {
|
|||
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||
showing,
|
||||
url: props.url,
|
||||
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||
anchorEl: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||
}, {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ import { prefer } from '@/preferences.js';
|
|||
const props = defineProps<{
|
||||
showing: boolean;
|
||||
url: string;
|
||||
source: HTMLElement;
|
||||
anchorEl: HTMLElement;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
@ -32,9 +32,9 @@ const top = ref(0);
|
|||
const left = ref(0);
|
||||
|
||||
onMounted(() => {
|
||||
const rect = props.source.getBoundingClientRect();
|
||||
const x = Math.max((rect.left + (props.source.offsetWidth / 2)) - (300 / 2), 6) + window.scrollX;
|
||||
const y = rect.top + props.source.offsetHeight + window.scrollY;
|
||||
const rect = props.anchorEl.getBoundingClientRect();
|
||||
const x = Math.max((rect.left + (props.anchorEl.offsetWidth / 2)) - (300 / 2), 6) + window.scrollX;
|
||||
const y = rect.top + props.anchorEl.offsetHeight + window.scrollY;
|
||||
|
||||
top.value = y;
|
||||
left.value = x;
|
||||
|
|
|
@ -62,7 +62,7 @@ if (props.showUrlPreview && isEnabledUrlPreview.value) {
|
|||
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||
showing,
|
||||
url: props.url,
|
||||
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||
anchorEl: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||
}, {
|
||||
closed: () => dispose(),
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue