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