zydx-plus 1.30.158 → 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 +40 -14
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
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,12 +71,17 @@ 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
|
+
// 获取焦点
|
|
80
85
|
this.editableShow = false
|
|
81
86
|
this.formData.html = e
|
|
82
87
|
if(this.readOnly) {
|
|
@@ -96,27 +101,40 @@ export default defineComponent({
|
|
|
96
101
|
},
|
|
97
102
|
deep: true
|
|
98
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
|
+
}
|
|
99
118
|
},
|
|
100
119
|
mounted() {
|
|
101
|
-
// this.$nextTick(() => {
|
|
102
|
-
// if(this.readOnly) this.readOnlyPage()
|
|
103
|
-
// })
|
|
104
120
|
window.closeMaker = this.closeMaker
|
|
105
121
|
},
|
|
106
122
|
methods: {
|
|
107
123
|
readOnlyPage() {
|
|
108
124
|
this.htmlArr = []
|
|
109
125
|
const data = document.querySelectorAll('.w-e-scroll')[0].childNodes[0].childNodes
|
|
126
|
+
let max = 1123
|
|
110
127
|
let pHeight = 0
|
|
111
128
|
let html = ''
|
|
112
129
|
for (let i = 0; i < data.length; i++) {
|
|
113
130
|
let text = data[i].offsetHeight
|
|
114
|
-
if((pHeight + text) >
|
|
131
|
+
if((pHeight + text) > max) {
|
|
132
|
+
// console.log(this.rows(data[i],(pHeight + text) - max))
|
|
115
133
|
this.htmlArr.push(html)
|
|
116
134
|
pHeight = 0
|
|
117
135
|
html = ''
|
|
118
136
|
}
|
|
119
|
-
pHeight += text
|
|
137
|
+
pHeight += text + 5
|
|
120
138
|
html += data[i].outerHTML
|
|
121
139
|
if(i === data.length - 1) {
|
|
122
140
|
this.htmlArr.push(html)
|
|
@@ -126,6 +144,21 @@ export default defineComponent({
|
|
|
126
144
|
}
|
|
127
145
|
}
|
|
128
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}
|
|
161
|
+
},
|
|
129
162
|
closeMaker(data) {
|
|
130
163
|
this.$emit('enclosure',data)
|
|
131
164
|
},
|
|
@@ -193,11 +226,8 @@ export default defineComponent({
|
|
|
193
226
|
}
|
|
194
227
|
.read-only-page{
|
|
195
228
|
width: 794px;
|
|
196
|
-
height: 1123px;
|
|
197
229
|
margin: 0 auto 20px auto;
|
|
198
230
|
background-color: #fff;
|
|
199
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
200
|
-
padding: 60px;
|
|
201
231
|
box-sizing: border-box;
|
|
202
232
|
position: relative;
|
|
203
233
|
}
|
|
@@ -268,10 +298,6 @@ export default defineComponent({
|
|
|
268
298
|
:deep(.w-e-text-container h5) {
|
|
269
299
|
margin: 5px 0;
|
|
270
300
|
}
|
|
271
|
-
:deep(.w-e-text-container h6) {
|
|
272
|
-
margin: 5px 0;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
301
|
|
|
276
302
|
:deep(.w-e-text-placeholder) {
|
|
277
303
|
top: 6px;
|