File size: 2,280 Bytes
89ce340 |
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
<template>
<div
class="base-element-text"
:style="{
top: elementInfo.top + 'px',
left: elementInfo.left + 'px',
width: elementInfo.width + 'px',
height: elementInfo.height + 'px',
}"
>
<div
class="rotate-wrapper"
:style="{ transform: `rotate(${elementInfo.rotate}deg)` }"
>
<div
class="element-content"
:style="{
width: elementInfo.vertical ? 'auto' : elementInfo.width + 'px',
height: elementInfo.vertical ? elementInfo.height + 'px' : 'auto',
backgroundColor: elementInfo.fill,
opacity: elementInfo.opacity,
textShadow: shadowStyle,
lineHeight: elementInfo.lineHeight,
letterSpacing: (elementInfo.wordSpace || 0) + 'px',
color: elementInfo.defaultColor,
fontFamily: elementInfo.defaultFontName,
writingMode: elementInfo.vertical ? 'vertical-rl' : 'horizontal-tb',
}"
>
<ElementOutline
:width="elementInfo.width"
:height="elementInfo.height"
:outline="elementInfo.outline"
/>
<div
class="text ProseMirror-static"
:class="{ 'thumbnail': target === 'thumbnail' }"
:style="{
'--paragraphSpace': `${elementInfo.paragraphSpace === undefined ? 5 : elementInfo.paragraphSpace}px`,
}"
v-html="elementInfo.content"
></div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import type { PPTTextElement } from '@/types/slides'
import ElementOutline from '@/views/components/element/ElementOutline.vue'
import useElementShadow from '@/views/components/element/hooks/useElementShadow'
const props = defineProps<{
elementInfo: PPTTextElement
target?: string
}>()
const shadow = computed(() => props.elementInfo.shadow)
const { shadowStyle } = useElementShadow(shadow)
</script>
<style lang="scss" scoped>
.base-element-text {
position: absolute;
}
.rotate-wrapper {
width: 100%;
height: 100%;
}
.element-content {
position: relative;
padding: 10px;
line-height: 1.5;
word-break: break-word;
.text {
position: relative;
&.thumbnail {
pointer-events: none;
}
}
}
</style>
|