-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
print.vue
54 lines (51 loc) · 1.19 KB
/
print.vue
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
<script setup lang="ts">
import { watchEffect } from 'vue'
import { windowSize } from '../state'
import { isPrintMode } from '../logic/nav'
import { themeVars } from '../env'
import PrintContainer from '../internals/PrintContainer.vue'
import PrintStyle from '../internals/PrintStyle.vue'
watchEffect(() => {
if (isPrintMode)
(document.body.parentNode as HTMLElement).classList.add('print')
else
(document.body.parentNode as HTMLElement).classList.remove('print')
})
</script>
<template>
<PrintStyle v-if="isPrintMode" />
<div id="page-root" class="grid grid-cols-[1fr_max-content]" :style="themeVars">
<PrintContainer
class="w-full h-full"
:style="{ background: 'var(--slidev-slide-container-background, black)' }"
:width="windowSize.width.value"
/>
</div>
</template>
<style lang="postcss">
html.print,
html.print body,
html.print #app {
height: auto;
overflow: auto;
}
html.print #page-root {
height: auto;
overflow: hidden;
}
html.print * {
-webkit-print-color-adjust: exact;
}
html.print {
width: 100%;
height: 100%;
overflow: visible;
}
html.print body {
margin: 0 auto;
border: 0;
padding: 0;
float: none;
overflow: visible;
}
</style>