zydx-plus 1.30.158 → 1.30.160
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 +34 -16
- 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="{width: !page? '100%': '794px',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) {
|
|
@@ -95,28 +100,34 @@ export default defineComponent({
|
|
|
95
100
|
if(e) this.readOnlyPage()
|
|
96
101
|
},
|
|
97
102
|
deep: true
|
|
98
|
-
}
|
|
103
|
+
}
|
|
99
104
|
},
|
|
100
105
|
mounted() {
|
|
101
|
-
// this.$nextTick(() => {
|
|
102
|
-
// if(this.readOnly) this.readOnlyPage()
|
|
103
|
-
// })
|
|
104
106
|
window.closeMaker = this.closeMaker
|
|
105
107
|
},
|
|
106
108
|
methods: {
|
|
107
109
|
readOnlyPage() {
|
|
108
110
|
this.htmlArr = []
|
|
109
111
|
const data = document.querySelectorAll('.w-e-scroll')[0].childNodes[0].childNodes
|
|
112
|
+
let max = 1123
|
|
110
113
|
let pHeight = 0
|
|
111
114
|
let html = ''
|
|
115
|
+
if(!this.page) {
|
|
116
|
+
for (let i = 0; i < data.length; i++) {
|
|
117
|
+
html += data[i].outerHTML
|
|
118
|
+
}
|
|
119
|
+
this.htmlArr.push(html)
|
|
120
|
+
return
|
|
121
|
+
}
|
|
112
122
|
for (let i = 0; i < data.length; i++) {
|
|
113
123
|
let text = data[i].offsetHeight
|
|
114
|
-
if((pHeight + text) >
|
|
124
|
+
if((pHeight + text) > max) {
|
|
125
|
+
// console.log(this.rows(data[i],(pHeight + text) - max))
|
|
115
126
|
this.htmlArr.push(html)
|
|
116
127
|
pHeight = 0
|
|
117
128
|
html = ''
|
|
118
129
|
}
|
|
119
|
-
pHeight += text
|
|
130
|
+
pHeight += text + 5
|
|
120
131
|
html += data[i].outerHTML
|
|
121
132
|
if(i === data.length - 1) {
|
|
122
133
|
this.htmlArr.push(html)
|
|
@@ -126,6 +137,21 @@ export default defineComponent({
|
|
|
126
137
|
}
|
|
127
138
|
}
|
|
128
139
|
},
|
|
140
|
+
rows(data,num) {
|
|
141
|
+
let line = parseInt(window.getComputedStyle(data, null).lineHeight)
|
|
142
|
+
let height = data.offsetHeight
|
|
143
|
+
let rows = Math.round(height/line)
|
|
144
|
+
let text = data.innerText
|
|
145
|
+
let textLen = Math.round(text.length/rows)
|
|
146
|
+
let start = text.slice(0,textLen)
|
|
147
|
+
let end = text.slice(textLen)
|
|
148
|
+
console.log(Math.round((height - num)/line))
|
|
149
|
+
console.log(rows)
|
|
150
|
+
// if(rows - num > 0) {
|
|
151
|
+
// console.log(rows - num)
|
|
152
|
+
// }
|
|
153
|
+
return {start,end}
|
|
154
|
+
},
|
|
129
155
|
closeMaker(data) {
|
|
130
156
|
this.$emit('enclosure',data)
|
|
131
157
|
},
|
|
@@ -192,12 +218,8 @@ export default defineComponent({
|
|
|
192
218
|
text-align: right;
|
|
193
219
|
}
|
|
194
220
|
.read-only-page{
|
|
195
|
-
width: 794px;
|
|
196
|
-
height: 1123px;
|
|
197
221
|
margin: 0 auto 20px auto;
|
|
198
222
|
background-color: #fff;
|
|
199
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
200
|
-
padding: 60px;
|
|
201
223
|
box-sizing: border-box;
|
|
202
224
|
position: relative;
|
|
203
225
|
}
|
|
@@ -268,10 +290,6 @@ export default defineComponent({
|
|
|
268
290
|
:deep(.w-e-text-container h5) {
|
|
269
291
|
margin: 5px 0;
|
|
270
292
|
}
|
|
271
|
-
:deep(.w-e-text-container h6) {
|
|
272
|
-
margin: 5px 0;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
293
|
|
|
276
294
|
:deep(.w-e-text-placeholder) {
|
|
277
295
|
top: 6px;
|