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