Merge pull request #12480 from dataease/pr@dev-v2@fix_rich-text

Pr@dev v2@fix rich text
This commit is contained in:
王嘉豪 2024-09-26 10:35:05 +08:00 committed by GitHub
commit bdf4742dca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 47 additions and 15 deletions

View File

@ -6,6 +6,7 @@
@keyup.stop
@dblclick="setEdit"
@click="onClick"
:style="richTextStyle"
>
<chart-error v-if="isError" :err-msg="errMsg" />
<Editor
@ -163,7 +164,28 @@ const init = ref({
inline: true, //
branding: false,
icons: 'vertical-content',
vertical_align: element.value.propValue.verticalAlign
vertical_align: element.value.propValue.verticalAlign,
setup: function (editor) {
//
editor.on('ObjectResizeStart', function (e) {
const { target, width, height } = e
if (target.nodeName === 'TABLE') {
//
// e.width = width / props.scale
// e.height = height / props.scale
}
})
//
editor.on('ObjectResized', function (e) {
const { target, width, height } = e
if (target.nodeName === 'TABLE') {
//
// target.style.width = `${width * props.scale}px`
// target.style.height = `${height scaleFactor}px`
}
})
}
})
const editStatus = computed(() => {
@ -561,6 +583,8 @@ const conditionAdaptor = (chart: Chart) => {
return res
}
const richTextStyle = computed(() => [{ '--de-canvas-scale': props.scale }])
onMounted(() => {
viewInit()
})
@ -583,6 +607,12 @@ defineExpose({
width: 0px !important;
height: 0px !important;
}
::v-deep(p) {
zoom: var(--de-canvas-scale);
}
::v-deep(span) {
zoom: var(--de-canvas-scale);
}
}
:deep(.ol) {

View File

@ -58,18 +58,19 @@ const props = defineProps({
const { element, view, active, searchCount, scale } = toRefs(props)
const autoStyle = computed(() => {
if (element.value.innerType === 'rich-text') {
return {
position: 'absolute',
height: 100 / scale.value + '%!important',
width: 100 / scale.value + '%!important',
left: 50 * (1 - 1 / scale.value) + '%', // 2
top: 50 * (1 - 1 / scale.value) + '%', // 2
transform: 'scale(' + scale.value + ')'
} as CSSProperties
} else {
return {}
}
return {}
// if (element.value.innerType === 'rich-text') {
// return {
// position: 'absolute',
// height: 100 / scale.value + '%!important',
// width: 100 / scale.value + '%!important',
// left: 50 * (1 - 1 / scale.value) + '%', // 2
// top: 50 * (1 - 1 / scale.value) + '%', // 2
// transform: 'scale(' + scale.value + ') translateZ(0)'
// } as CSSProperties
// } else {
// return {}
// }
})
const emits = defineEmits(['onPointClick'])

View File

@ -557,7 +557,7 @@ const autoStyle = computed(() => {
width: 100 / scale.value + '%!important',
left: 50 * (1 - 1 / scale.value) + '%', // 2
top: 50 * (1 - 1 / scale.value) + '%', // 2
transform: 'scale(' + scale.value + ')',
transform: 'scale(' + scale.value + ') translateZ(0)',
opacity: element.value?.style?.opacity || 1
} as CSSProperties
})

View File

@ -596,7 +596,7 @@ const autoStyle = computed(() => {
height: 20 * scale.value + 8 + 'px',
width: 100 / scale.value + '%!important',
left: 50 * (1 - 1 / scale.value) + '%', // 2
transform: 'scale(' + scale.value + ')'
transform: 'scale(' + scale.value + ') translateZ(0)'
}
})

View File

@ -944,6 +944,7 @@ const loadPluginCategory = data => {
</de-picture-group>
<de-rich-text-view
v-else-if="showChartView(ChartLibraryType.RICH_TEXT)"
:scale="scale"
:themes="canvasStyleData.dashboard.themeColor"
ref="chartComponent"
:element="element"