zydx-plus 1.30.157 → 1.30.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/editor/src/editor.vue +45 -21
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<we-toolbar v-show="!readOnly && toolbar.length > 0" class="toolbar" :handle="handle"/>
|
|
3
|
-
<we-editable v-show="!editableShow" class="editable" :style="{'min-height': height + 'px'}" :handle="handle" v-model:json="formData.html" />
|
|
3
|
+
<we-editable v-show="!editableShow" class="editable" :style="{'min-height': height + 'px',opacity: readOnly? '0':'1'}" :handle="handle" v-model:json="formData.html" />
|
|
4
4
|
<div class="but" v-if="!readOnly && toolbar.length > 0">
|
|
5
5
|
<button class="def-but" v-if="butShow" @click="confirm">完成</button>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="read-only" v-if="readOnly">
|
|
8
|
-
<div class="read-only-page" v-for="(item,index) in htmlArr" >
|
|
8
|
+
<div class="read-only-page" :style="{height: !page? 'auto': '1123px','box-shadow': !page? 'none': '0 0 10px rgba(0, 0, 0, 0.1)', 'padding': !page? '10px':'60px'}" v-for="(item,index) in htmlArr" >
|
|
9
9
|
<div class="read-only-p" v-html="item"></div>
|
|
10
|
-
<div class="read-only-a">{{ index + 1 }}/{{ htmlArr.length }}</div>
|
|
10
|
+
<div v-if="page" class="read-only-a">{{ index + 1 }}/{{ htmlArr.length }}</div>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
@@ -71,19 +71,24 @@ export default defineComponent({
|
|
|
71
71
|
uploadAttachment: {
|
|
72
72
|
type: Object,
|
|
73
73
|
default: {}
|
|
74
|
+
},
|
|
75
|
+
page: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true
|
|
74
78
|
}
|
|
75
79
|
},
|
|
76
80
|
emits: ['confirm','enclosure'],
|
|
77
81
|
watch: {
|
|
78
82
|
html: {
|
|
79
83
|
handler: function (e, oldVal) {
|
|
84
|
+
// 获取焦点
|
|
85
|
+
this.editableShow = false
|
|
80
86
|
this.formData.html = e
|
|
81
87
|
if(this.readOnly) {
|
|
82
|
-
this.editableShow = false
|
|
83
88
|
setTimeout(() => {
|
|
84
89
|
this.editableShow = true
|
|
85
|
-
|
|
86
|
-
},
|
|
90
|
+
this.readOnlyPage()
|
|
91
|
+
},10)
|
|
87
92
|
}
|
|
88
93
|
},
|
|
89
94
|
deep: true,
|
|
@@ -91,33 +96,45 @@ export default defineComponent({
|
|
|
91
96
|
},
|
|
92
97
|
readOnly: {
|
|
93
98
|
handler: function (e, oldVal) {
|
|
94
|
-
this.opts.editable.config.readOnly = e
|
|
95
99
|
this.editableShow = e
|
|
96
100
|
if(e) this.readOnlyPage()
|
|
97
101
|
},
|
|
98
102
|
deep: true
|
|
99
103
|
},
|
|
104
|
+
page: {
|
|
105
|
+
handler: function (e, oldVal) {
|
|
106
|
+
if(!e) {
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
const data = document.querySelectorAll('.w-e-scroll')[0].childNodes[0].childNodes
|
|
109
|
+
for (let i = 0; i < data.length; i++) {
|
|
110
|
+
this.htmlArr.push(data[i].outerHTML)
|
|
111
|
+
}
|
|
112
|
+
},10)
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
deep: true,
|
|
116
|
+
immediate: true
|
|
117
|
+
}
|
|
100
118
|
},
|
|
101
119
|
mounted() {
|
|
102
|
-
// this.$nextTick(() => {
|
|
103
|
-
// if(this.readOnly) this.readOnlyPage()
|
|
104
|
-
// })
|
|
105
120
|
window.closeMaker = this.closeMaker
|
|
106
121
|
},
|
|
107
122
|
methods: {
|
|
108
123
|
readOnlyPage() {
|
|
109
124
|
this.htmlArr = []
|
|
110
125
|
const data = document.querySelectorAll('.w-e-scroll')[0].childNodes[0].childNodes
|
|
126
|
+
let max = 1123
|
|
111
127
|
let pHeight = 0
|
|
112
128
|
let html = ''
|
|
113
129
|
for (let i = 0; i < data.length; i++) {
|
|
114
130
|
let text = data[i].offsetHeight
|
|
115
|
-
if((pHeight + text) >
|
|
131
|
+
if((pHeight + text) > max) {
|
|
132
|
+
// console.log(this.rows(data[i],(pHeight + text) - max))
|
|
116
133
|
this.htmlArr.push(html)
|
|
117
134
|
pHeight = 0
|
|
118
135
|
html = ''
|
|
119
136
|
}
|
|
120
|
-
pHeight += text
|
|
137
|
+
pHeight += text + 5
|
|
121
138
|
html += data[i].outerHTML
|
|
122
139
|
if(i === data.length - 1) {
|
|
123
140
|
this.htmlArr.push(html)
|
|
@@ -126,7 +143,21 @@ export default defineComponent({
|
|
|
126
143
|
break
|
|
127
144
|
}
|
|
128
145
|
}
|
|
129
|
-
|
|
146
|
+
},
|
|
147
|
+
rows(data,num) {
|
|
148
|
+
let line = parseInt(window.getComputedStyle(data, null).lineHeight)
|
|
149
|
+
let height = data.offsetHeight
|
|
150
|
+
let rows = Math.round(height/line)
|
|
151
|
+
let text = data.innerText
|
|
152
|
+
let textLen = Math.round(text.length/rows)
|
|
153
|
+
let start = text.slice(0,textLen)
|
|
154
|
+
let end = text.slice(textLen)
|
|
155
|
+
console.log(Math.round((height - num)/line))
|
|
156
|
+
console.log(rows)
|
|
157
|
+
// if(rows - num > 0) {
|
|
158
|
+
// console.log(rows - num)
|
|
159
|
+
// }
|
|
160
|
+
return {start,end}
|
|
130
161
|
},
|
|
131
162
|
closeMaker(data) {
|
|
132
163
|
this.$emit('enclosure',data)
|
|
@@ -155,7 +186,7 @@ export default defineComponent({
|
|
|
155
186
|
editable: {
|
|
156
187
|
config: {
|
|
157
188
|
placeholder: props.placeholder,
|
|
158
|
-
readOnly:
|
|
189
|
+
readOnly: false,
|
|
159
190
|
// autoFocus: (props.html !== ''),
|
|
160
191
|
autoFocus: true, // 自动聚焦
|
|
161
192
|
MENU_CONF: {
|
|
@@ -195,11 +226,8 @@ export default defineComponent({
|
|
|
195
226
|
}
|
|
196
227
|
.read-only-page{
|
|
197
228
|
width: 794px;
|
|
198
|
-
height: 1123px;
|
|
199
229
|
margin: 0 auto 20px auto;
|
|
200
230
|
background-color: #fff;
|
|
201
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
202
|
-
padding: 60px;
|
|
203
231
|
box-sizing: border-box;
|
|
204
232
|
position: relative;
|
|
205
233
|
}
|
|
@@ -270,10 +298,6 @@ export default defineComponent({
|
|
|
270
298
|
:deep(.w-e-text-container h5) {
|
|
271
299
|
margin: 5px 0;
|
|
272
300
|
}
|
|
273
|
-
:deep(.w-e-text-container h6) {
|
|
274
|
-
margin: 5px 0;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
301
|
|
|
278
302
|
:deep(.w-e-text-placeholder) {
|
|
279
303
|
top: 6px;
|