2020-02-09 18:59:00 +01:00
|
|
|
<template>
|
2021-12-16 02:57:07 +01:00
|
|
|
<div class="fgmtyycl" :style="{ zIndex, top: top + 'px', left: left + 'px' }">
|
2023-04-01 06:42:40 +02:00
|
|
|
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" @after-leave="emit('closed')">
|
2021-11-19 11:36:12 +01:00
|
|
|
<MkUrlPreview v-if="showing" class="_popup _shadow" :url="url"/>
|
2022-12-30 05:37:14 +01:00
|
|
|
</Transition>
|
2020-02-09 18:59:00 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-09-05 11:37:41 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted } from 'vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkUrlPreview from '@/components/MkUrlPreview.vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import * as os from '@/os';
|
2023-04-01 06:42:40 +02:00
|
|
|
import { defaultStore } from '@/store';
|
2020-02-09 18:59:00 +01:00
|
|
|
|
2022-09-05 11:37:41 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
showing: boolean;
|
|
|
|
url: string;
|
|
|
|
source: HTMLElement;
|
|
|
|
}>();
|
2020-02-09 18:59:00 +01:00
|
|
|
|
2022-09-05 11:37:41 +02:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'closed'): void;
|
|
|
|
}>();
|
2020-02-09 18:59:00 +01:00
|
|
|
|
2022-09-05 11:37:41 +02:00
|
|
|
const zIndex = os.claimZIndex('middle');
|
|
|
|
let top = $ref(0);
|
|
|
|
let left = $ref(0);
|
2020-02-09 18:59:00 +01:00
|
|
|
|
2022-09-05 11:37:41 +02:00
|
|
|
onMounted(() => {
|
|
|
|
const rect = props.source.getBoundingClientRect();
|
|
|
|
const x = Math.max((rect.left + (props.source.offsetWidth / 2)) - (300 / 2), 6) + window.pageXOffset;
|
|
|
|
const y = rect.top + props.source.offsetHeight + window.pageYOffset;
|
2020-02-09 18:59:00 +01:00
|
|
|
|
2022-09-05 11:37:41 +02:00
|
|
|
top = y;
|
|
|
|
left = x;
|
2020-02-09 18:59:00 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 10:29:39 +01:00
|
|
|
<style lang="scss" scoped>
|
2020-02-09 18:59:00 +01:00
|
|
|
.fgmtyycl {
|
|
|
|
position: absolute;
|
2020-02-09 19:13:24 +01:00
|
|
|
width: 500px;
|
2020-04-13 17:00:52 +02:00
|
|
|
max-width: calc(90vw - 12px);
|
2020-02-09 19:13:24 +01:00
|
|
|
pointer-events: none;
|
2020-02-09 18:59:00 +01:00
|
|
|
}
|
|
|
|
</style>
|