summaryrefslogtreecommitdiff
path: root/src/client/components/url-preview-popup.vue
blob: 938566e9e20f3a047d5ce2429a473cb1ea8a2b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div class="fgmtyycl _panel" :style="{ top: top + 'px', left: left + 'px' }">
	<mk-url-preview :url="url"/>
</div>
</template>

<script lang="ts">
import Vue from 'vue';
import i18n from '../i18n';
import MkUrlPreview from './url-preview.vue';

export default Vue.extend({
	i18n,

	components: {
		MkUrlPreview
	},

	props: {
		url: {
			type: String,
			required: true
		},
		source: {
			required: true
		}
	},

	data() {
		return {
			u: null,
			top: 0,
			left: 0,
		};
	},

	mounted() {
		const rect = this.source.getBoundingClientRect();
		const x = ((rect.left + (this.source.offsetWidth / 2)) - (300 / 2)) + window.pageXOffset;
		const y = rect.top + this.source.offsetHeight + window.pageYOffset;

		this.top = y;
		this.left = x;
	},
});
</script>

<style lang="scss" scoped>
.fgmtyycl {
	position: absolute;
	z-index: 11000;
	width: 500px;
	overflow: hidden;
	pointer-events: none;
}
</style>