refactor(富文本): 富文本组件和富文本视图

This commit is contained in:
wangjiahao 2022-10-27 16:31:40 +08:00
parent b72c2681dc
commit 9cfb88fa40
3 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,9 @@
<template> <template>
<div class="rich-main-class" :style="autoStyle" @dblclick="setEdit"> <div
class="rich-main-class"
:style="autoStyle"
@dblclick="setEdit"
>
<Editor <Editor
v-if="editShow" v-if="editShow"
:id="tinymceId" :id="tinymceId"
@ -97,7 +101,7 @@ export default {
} }
}, },
computed: { computed: {
scale(){ scale() {
return Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient return Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
}, },
editStatus() { editStatus() {
@ -107,7 +111,7 @@ export default {
return { return {
height: (100 / this.scale) + '%!important', height: (100 / this.scale) + '%!important',
width: (100 / this.scale) + '%!important', width: (100 / this.scale) + '%!important',
left: 50 * (1 - 1 / this.scale) + '%', // 2 left: 50 * (1 - 1 / this.scale) + '%', // 2
top: 50 * (1 - 1 / this.scale) + '%', top: 50 * (1 - 1 / this.scale) + '%',
transform: 'scale(' + this.scale + ')' transform: 'scale(' + this.scale + ')'
} }

View File

@ -1,5 +1,9 @@
<template> <template>
<div class="rich-main-class" :style="autoStyle" @dblclick="setEdit"> <div
class="rich-main-class"
:style="autoStyle"
@dblclick="setEdit"
>
<Editor <Editor
v-if="editShow" v-if="editShow"
:id="tinymceId" :id="tinymceId"
@ -111,7 +115,7 @@ export default {
return { return {
height: (100 / this.scale) + '%!important', height: (100 / this.scale) + '%!important',
width: (100 / this.scale) + '%!important', width: (100 / this.scale) + '%!important',
left: 50 * (1 - 1 / this.scale) + '%', // 2 left: 50 * (1 - 1 / this.scale) + '%', // 2
top: 50 * (1 - 1 / this.scale) + '%', top: 50 * (1 - 1 / this.scale) + '%',
transform: 'scale(' + this.scale + ')' transform: 'scale(' + this.scale + ')'
} }
@ -181,7 +185,6 @@ export default {
ed.insertContent(attachValue) ed.insertContent(attachValue)
}, },
onClick(e) { onClick(e) {
const edInner = tinymce.get(this.tinymceId)
const node = tinymce.activeEditor.selection.getNode() const node = tinymce.activeEditor.selection.getNode()
this.resetSelect(node) this.resetSelect(node)
}, },

View File

@ -127,8 +127,8 @@
</div> </div>
<div class="de-foot"> <div class="de-foot">
<deBtn <deBtn
@click="reset"
secondary secondary
@click="reset"
>{{ >{{
$t("commons.reset") $t("commons.reset")
}}</deBtn> }}</deBtn>