zydx-plus 1.32.191 → 1.32.193
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/butJson.js +9 -9
- package/src/components/editor/src/editor.vue +251 -32
- package/src/components/editor2/src/editor.vue +47 -26
- package/src/components/question/src/question.vue +6 -1
- package/src/components/textarea/src/textarea.vue +1 -1
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -18,10 +18,10 @@ export function butJson (editor,data) {
|
|
|
18
18
|
{name: '(左)黑体5号', key: 'blackLeft5'},
|
|
19
19
|
],
|
|
20
20
|
html: {
|
|
21
|
-
blackCenter4: `<p data-signId="title-1" class="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
22
|
-
blackLeft4: `<p data-signId="title-2" class="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
23
|
-
blackCenter5: `<p data-signId="title-3" class="${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
24
|
-
blackLeft5: `<p data-signId="title-4" class="${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
21
|
+
blackCenter4: `<p data-signId="title-1" class="title ${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
22
|
+
blackLeft4: `<p data-signId="title-2" class="title ${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 16px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
23
|
+
blackCenter5: `<p data-signId="title-3" class="title ${randomId()}" style="text-align: center;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
24
|
+
blackLeft5: `<p data-signId="title-4" class="title ${randomId()}" style="text-align: left;"><span style="font-weight: 700;color: rgb(0, 0, 0);font-size: 14px;font-family: SimHei">${menusData(data,'titleMenu').text}</span></p>`,
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
textMenu: {
|
|
@@ -32,8 +32,8 @@ export function butJson (editor,data) {
|
|
|
32
32
|
{name: '楷体5号', key: 'regular5'},
|
|
33
33
|
],
|
|
34
34
|
html: {
|
|
35
|
-
Song5: `<p style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: SimSun">请输入正文</span></p>`,
|
|
36
|
-
regular5: `<p style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">请输入正文</span></p>`,
|
|
35
|
+
Song5: `<p class="text" style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: SimSun">请输入正文</span></p>`,
|
|
36
|
+
regular5: `<p class="text" style="text-align: left;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">请输入正文</span></p>`,
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
redMenu: {
|
|
@@ -46,7 +46,7 @@ export function butJson (editor,data) {
|
|
|
46
46
|
name: '添加作者',
|
|
47
47
|
key: 'authorMenu',
|
|
48
48
|
menuKeys: [],
|
|
49
|
-
html: `<p
|
|
49
|
+
html: `<p contenteditable="false" class="author" data-signId="author" style="text-align: center;"><span style="color: rgb(0, 0, 0);font-size: 14px;">${menusData(data,'authorMenu').text}</span></p>`
|
|
50
50
|
},
|
|
51
51
|
subjectMenu: {
|
|
52
52
|
name: '添加题目',
|
|
@@ -70,13 +70,13 @@ export function butJson (editor,data) {
|
|
|
70
70
|
name: '关键词',
|
|
71
71
|
key: 'keywordMenu',
|
|
72
72
|
menuKeys: [],
|
|
73
|
-
html: `<p><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;"> 关键词:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">关键词内容...</span></p>`
|
|
73
|
+
html: `<p class="keyword"><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;"> 关键词:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">关键词内容...</span></p>`
|
|
74
74
|
},
|
|
75
75
|
abstractMenu: {
|
|
76
76
|
name: '添加摘要',
|
|
77
77
|
key: 'abstractMenu',
|
|
78
78
|
menuKeys: [],
|
|
79
|
-
html: `<p><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;"> 摘要:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">摘要内容...</span></p>`
|
|
79
|
+
html: `<p class="abstract"><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;"> 摘要:</span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: KaiTi">摘要内容...</span></p>`
|
|
80
80
|
},
|
|
81
81
|
literatureMenu: {
|
|
82
82
|
name: '添加文献',
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
|
-
<div class="editor-content"
|
|
32
|
+
<div class="editor-content" :class="{'editor-content-show': !editableShow}">
|
|
33
33
|
<div class="editing">
|
|
34
34
|
<div class="editing-header" v-if="signMenuShow">
|
|
35
35
|
<img :src="menusData('signMenu')?.ico" alt=""/>
|
|
36
36
|
<span>{{ menusData('signMenu')?.text }}</span>
|
|
37
37
|
</div>
|
|
38
|
-
<editor-content
|
|
38
|
+
<editor-content class="editing-cont" :editor="editor"></editor-content>
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
41
41
|
<div class="complete" v-if="!readOnly && toolbar.length > 0">
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<img :src="menusData('signMenu')?.ico" alt=""/>
|
|
47
47
|
<span>{{ menusData('signMenu')?.text }}</span>
|
|
48
48
|
</div>
|
|
49
|
-
<div class="read-only-page" v-for="(item,index) in htmlArr">
|
|
49
|
+
<div class="read-only-page" :style="{height: wit * 1.4 + 'px',width: wit + 'px'}" v-for="(item,index) in htmlArr">
|
|
50
50
|
<div class="read-only-p" v-html="item"></div>
|
|
51
51
|
<div class="read-only-a">{{ index + 1 }}/{{ htmlArr.length }}</div>
|
|
52
52
|
</div>
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
<button class="but" @click="imgCancel">取消</button>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
|
+
<div v-if="loading" class="loading-back">
|
|
63
|
+
<div class="loading-cont">
|
|
64
|
+
<div class="loadings">Loading</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="down-html" id="test" v-html="htmlArr2"></div>
|
|
62
68
|
</div>
|
|
63
69
|
</template>
|
|
64
70
|
|
|
@@ -97,7 +103,10 @@ export default {
|
|
|
97
103
|
imgUrl: '', // 图片地址
|
|
98
104
|
imgType: '', // 图片类型
|
|
99
105
|
htmlArr: [],
|
|
100
|
-
editableShow: true
|
|
106
|
+
editableShow: true,
|
|
107
|
+
wit: 0,
|
|
108
|
+
htmlArr2: [],
|
|
109
|
+
loading: false
|
|
101
110
|
}
|
|
102
111
|
},
|
|
103
112
|
props: {
|
|
@@ -169,7 +178,7 @@ export default {
|
|
|
169
178
|
})
|
|
170
179
|
if (this.page) {
|
|
171
180
|
this.editableShow = !e
|
|
172
|
-
this.readOnlyPage()
|
|
181
|
+
this.readOnlyPage() // 只读分页
|
|
173
182
|
}
|
|
174
183
|
},
|
|
175
184
|
deep: true
|
|
@@ -247,25 +256,118 @@ export default {
|
|
|
247
256
|
},
|
|
248
257
|
emits: ['confirm', 'enclosure'],
|
|
249
258
|
methods: {
|
|
259
|
+
signMenu(next) { // 签名菜单
|
|
260
|
+
this.signMenuShow = !this.signMenuShow
|
|
261
|
+
next(this.signMenuShow)
|
|
262
|
+
},
|
|
263
|
+
titleMenu(next) { // 标题菜单
|
|
264
|
+
next(this.classShow('title'))
|
|
265
|
+
},
|
|
266
|
+
authorMenu(next) { // 作者菜单
|
|
267
|
+
next(this.classShow('author'))
|
|
268
|
+
},
|
|
269
|
+
abstractMenu(next) { // 摘要菜单
|
|
270
|
+
next(this.classShow('abstract'))
|
|
271
|
+
},
|
|
272
|
+
keywordMenu(next) { // 关键词菜单
|
|
273
|
+
next(this.classShow('keyword'))
|
|
274
|
+
},
|
|
275
|
+
textMenu(next) { // 文本菜单
|
|
276
|
+
next(this.classShow('text'))
|
|
277
|
+
},
|
|
278
|
+
classShow(v) {
|
|
279
|
+
if(!this.readOnly) return
|
|
280
|
+
let state = false
|
|
281
|
+
const ed = document.getElementsByClassName('z-editor')[0]
|
|
282
|
+
const cls = ed.getElementsByClassName(v)
|
|
283
|
+
for (let i = 0; i < cls.length; i++) {
|
|
284
|
+
if (cls[i].style.display === 'none') {
|
|
285
|
+
cls[i].style.display = 'block'
|
|
286
|
+
state = false
|
|
287
|
+
} else {
|
|
288
|
+
cls[i].style.display = 'none'
|
|
289
|
+
state = true
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
this.readOnlyPage()
|
|
293
|
+
return state
|
|
294
|
+
},
|
|
295
|
+
// 下载word
|
|
250
296
|
exportToWord() {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
297
|
+
let that = this
|
|
298
|
+
that.loading = true
|
|
299
|
+
that.htmlArr2 = ''
|
|
300
|
+
let arr = []
|
|
301
|
+
let imgArr = []
|
|
302
|
+
let imgIndex = 0
|
|
303
|
+
const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
|
|
304
|
+
for (let i = 0; i < data.length; i++) {
|
|
305
|
+
if(data[i].firstChild.localName === 'img') {
|
|
306
|
+
that.imgBase64(data[i]).then(res => {
|
|
307
|
+
imgArr.push(res)
|
|
308
|
+
})
|
|
309
|
+
arr.push(imgIndex)
|
|
310
|
+
imgIndex++
|
|
311
|
+
}else {
|
|
312
|
+
arr.push(data[i].outerHTML)
|
|
313
|
+
}
|
|
259
314
|
}
|
|
260
|
-
|
|
315
|
+
setTimeout(() => {
|
|
316
|
+
for (let i = 0; i < arr.length; i++) {
|
|
317
|
+
if(typeof arr[i] === 'number') {
|
|
318
|
+
that.htmlArr2 += imgArr[arr[i]]
|
|
319
|
+
}else {
|
|
320
|
+
that.htmlArr2 += arr[i]
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
setTimeout(() => {
|
|
324
|
+
const wrap = document.getElementById('test')
|
|
325
|
+
const config = {
|
|
326
|
+
addStyle: true, // 是否导出样式,默认为true,此操作会将所有样式转换成行内样式导出
|
|
327
|
+
fileName: this.fileName, // 导出文件名
|
|
328
|
+
// toImg:['.editor-img'], // 页面哪些部分需要转化成图片,例如echart图表之类
|
|
329
|
+
success() {
|
|
330
|
+
that.loading = false
|
|
331
|
+
} // 完成之后回调,一般页面篇幅比较大,时间比较长
|
|
332
|
+
}
|
|
333
|
+
exportWord(wrap, config)
|
|
334
|
+
},100)
|
|
335
|
+
},1000)
|
|
336
|
+
|
|
261
337
|
},
|
|
262
|
-
|
|
338
|
+
imgBase64 (data) {
|
|
339
|
+
return new Promise((res, rej) => {
|
|
340
|
+
const img = new Image()
|
|
341
|
+
img.src = data.firstChild.src
|
|
342
|
+
img.crossOrigin= 'anonymous' // 解决跨域
|
|
343
|
+
img.onload = function () {
|
|
344
|
+
const canvas = document.createElement('canvas')
|
|
345
|
+
canvas.width = img.width
|
|
346
|
+
canvas.height = img.height
|
|
347
|
+
const ctx = canvas.getContext('2d')
|
|
348
|
+
ctx.drawImage(img, 0, 0, img.width, img.height)
|
|
349
|
+
const dataURL = canvas.toDataURL('image/png')
|
|
350
|
+
res(`<p class="img-cont"><img class="editor-img" src="${dataURL}" alt="" /></p>`)
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
},
|
|
354
|
+
readOnlyPage() { // 只读分页
|
|
263
355
|
this.htmlArr = []
|
|
264
356
|
const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
|
|
265
|
-
|
|
357
|
+
this.wit = document.getElementsByClassName('editor-content')[0].offsetWidth
|
|
358
|
+
let max = this.wit * 1.4 - 200
|
|
266
359
|
let pHeight = 0
|
|
267
360
|
let html = ''
|
|
268
361
|
for (let i = 0; i < data.length; i++) {
|
|
362
|
+
if(data[i].firstChild.localName === 'img') {
|
|
363
|
+
const img = data[i].firstChild
|
|
364
|
+
const imgHeight = img.offsetHeight
|
|
365
|
+
if((pHeight + imgHeight) > max) {
|
|
366
|
+
this.htmlArr.push(html)
|
|
367
|
+
pHeight = 0
|
|
368
|
+
html = ''
|
|
369
|
+
}
|
|
370
|
+
}
|
|
269
371
|
let text = data[i].offsetHeight
|
|
270
372
|
if (data[i].dataset?.signid === 'ack') {
|
|
271
373
|
this.htmlArr.push(html)
|
|
@@ -274,14 +376,16 @@ export default {
|
|
|
274
376
|
}
|
|
275
377
|
if ((pHeight + text) > max) {
|
|
276
378
|
const {start, end} = this.rows(data[i], max - pHeight)
|
|
277
|
-
html += `<p>${start}</p>`
|
|
379
|
+
html += `<p>${start.data}</p>`
|
|
278
380
|
this.htmlArr.push(html)
|
|
279
381
|
pHeight = 0
|
|
280
382
|
html = ''
|
|
281
|
-
html += `<p>${end}</p>`
|
|
383
|
+
html += `<p>${end.data}</p>`
|
|
384
|
+
pHeight = end.size
|
|
385
|
+
}else {
|
|
386
|
+
pHeight += text
|
|
387
|
+
html += data[i].outerHTML
|
|
282
388
|
}
|
|
283
|
-
pHeight += text + 5
|
|
284
|
-
html += data[i].outerHTML
|
|
285
389
|
if (i === data.length - 1) {
|
|
286
390
|
this.htmlArr.push(html)
|
|
287
391
|
pHeight = 0
|
|
@@ -294,13 +398,17 @@ export default {
|
|
|
294
398
|
let size = parseInt(window.getComputedStyle(data, null).fontSize)
|
|
295
399
|
let line = parseInt(window.getComputedStyle(data, null).lineHeight)
|
|
296
400
|
let width = data.offsetWidth
|
|
401
|
+
let height = data.offsetHeight
|
|
297
402
|
let rows = Math.round(num / line) // 行数
|
|
298
403
|
let text = data.innerText
|
|
299
|
-
let len = this.measureText(text,size)
|
|
300
|
-
let textLen = Math.round((width / (len/text.length)) * rows)
|
|
404
|
+
let len = this.measureText(text,size) // 文本宽度
|
|
405
|
+
let textLen = Math.round((width / (len/text.length)) * rows) // 文本长度
|
|
301
406
|
let start = text.slice(0, textLen)
|
|
302
407
|
let end = text.slice(textLen)
|
|
303
|
-
return {
|
|
408
|
+
return {
|
|
409
|
+
start: {data: start, size: num},
|
|
410
|
+
end: {data: end, size: height - num}
|
|
411
|
+
}
|
|
304
412
|
},
|
|
305
413
|
measureText (text, fontSize=10) {
|
|
306
414
|
text = String(text);
|
|
@@ -405,8 +513,13 @@ export default {
|
|
|
405
513
|
})
|
|
406
514
|
} else {
|
|
407
515
|
up.customInsert(res, (data) => {
|
|
408
|
-
const
|
|
516
|
+
const cla = this.randomId()
|
|
517
|
+
const html = `<p class="imgCont ${cla}"><img src="${data}" alt="" /></p>`
|
|
409
518
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
519
|
+
if(this.selection() <= 6) this.selectionClass2(cla)
|
|
520
|
+
if(this.selectionClass(cla)) {
|
|
521
|
+
this.editor.chain().focus().insertContentAt(this.selection(), '<p></p>').run()
|
|
522
|
+
}
|
|
410
523
|
})
|
|
411
524
|
}
|
|
412
525
|
up.onSuccess(file, res) // 上传成功回调
|
|
@@ -446,8 +559,40 @@ export default {
|
|
|
446
559
|
imgConfirm() {
|
|
447
560
|
this.imgPop = false
|
|
448
561
|
if (this.imgUrl === '') return
|
|
449
|
-
const
|
|
562
|
+
const cla = this.randomId()
|
|
563
|
+
const html = `<p class="imgCont ${cla}"><img src="${this.imgUrl}" alt="" /></p>`
|
|
450
564
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
565
|
+
if(this.selection() <= 6) this.selectionClass2(cla)
|
|
566
|
+
if(this.selectionClass(cla)) {
|
|
567
|
+
this.editor.chain().focus().insertContentAt(this.selection(), '<p></p>').run()
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
randomId() {
|
|
571
|
+
const id = Math.random().toString(36).substr(2)
|
|
572
|
+
return id.replace(/[0-9]/g, '')
|
|
573
|
+
},
|
|
574
|
+
// 查询class
|
|
575
|
+
selectionClass(v) {
|
|
576
|
+
const json = this.editor.getJSON()
|
|
577
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
578
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
579
|
+
if (val === v) {
|
|
580
|
+
if(json.content[i+1] === undefined) return true
|
|
581
|
+
break
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return false
|
|
585
|
+
},
|
|
586
|
+
selectionClass2(v) {
|
|
587
|
+
const json = this.editor.getJSON()
|
|
588
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
589
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
590
|
+
if (val === v) {
|
|
591
|
+
json.content.splice(i - 1, 1)
|
|
592
|
+
this.editor?.commands.setContent(json)
|
|
593
|
+
break
|
|
594
|
+
}
|
|
595
|
+
}
|
|
451
596
|
},
|
|
452
597
|
// 取消图片地址
|
|
453
598
|
imgCancel() {
|
|
@@ -647,21 +792,37 @@ export default {
|
|
|
647
792
|
</script>
|
|
648
793
|
|
|
649
794
|
<style scoped>
|
|
795
|
+
:deep(.ProseMirror-separator) {
|
|
796
|
+
display: none !important;
|
|
797
|
+
}
|
|
798
|
+
.down-html{
|
|
799
|
+
position: fixed;
|
|
800
|
+
top: -9999px;
|
|
801
|
+
left: 0;
|
|
802
|
+
z-index: -1;
|
|
803
|
+
width: 798px;
|
|
804
|
+
padding: 100px;
|
|
805
|
+
background-color: #fff;
|
|
806
|
+
box-sizing: border-box;
|
|
807
|
+
border: 1px solid #ccc;
|
|
808
|
+
margin: 10px 10px 20px 10px;
|
|
809
|
+
}
|
|
810
|
+
.down-html :deep(img){
|
|
811
|
+
padding: 5px 0;
|
|
812
|
+
}
|
|
650
813
|
.read-only {
|
|
651
814
|
position: relative;
|
|
652
|
-
width: 794px;
|
|
653
815
|
margin: 0 auto;
|
|
654
816
|
}
|
|
655
817
|
|
|
656
818
|
.read-only-page {
|
|
657
819
|
width: 100%;
|
|
658
|
-
height: 1123px;
|
|
659
820
|
padding: 100px;
|
|
660
821
|
background-color: #fff;
|
|
661
822
|
box-sizing: border-box;
|
|
662
823
|
position: relative;
|
|
663
|
-
|
|
664
|
-
margin: 20px
|
|
824
|
+
border: 1px solid #ccc;
|
|
825
|
+
margin: 10px 10px 20px 10px;
|
|
665
826
|
}
|
|
666
827
|
|
|
667
828
|
.read-only-p {
|
|
@@ -675,7 +836,7 @@ export default {
|
|
|
675
836
|
|
|
676
837
|
.read-only-a {
|
|
677
838
|
position: absolute;
|
|
678
|
-
bottom:
|
|
839
|
+
bottom: 70px;
|
|
679
840
|
left: 50%;
|
|
680
841
|
z-index: 1;
|
|
681
842
|
font-size: 14px;
|
|
@@ -700,6 +861,9 @@ label {
|
|
|
700
861
|
:deep(.editor-img) {
|
|
701
862
|
max-width: 100%;
|
|
702
863
|
}
|
|
864
|
+
:deep(.imgCont) {
|
|
865
|
+
line-height: 0 !important;
|
|
866
|
+
}
|
|
703
867
|
|
|
704
868
|
.img-pop {
|
|
705
869
|
position: absolute;
|
|
@@ -746,7 +910,7 @@ label {
|
|
|
746
910
|
.editing-header {
|
|
747
911
|
position: absolute;
|
|
748
912
|
top: 10px;
|
|
749
|
-
left:
|
|
913
|
+
left: 20px;
|
|
750
914
|
display: flex;
|
|
751
915
|
z-index: 1;
|
|
752
916
|
}
|
|
@@ -775,7 +939,10 @@ label {
|
|
|
775
939
|
}
|
|
776
940
|
|
|
777
941
|
.editing-cont :deep(p) {
|
|
778
|
-
line-height:
|
|
942
|
+
line-height: 30px;
|
|
943
|
+
}
|
|
944
|
+
.editing-cont :deep(img) {
|
|
945
|
+
padding: 5px 0;
|
|
779
946
|
}
|
|
780
947
|
|
|
781
948
|
li {
|
|
@@ -853,6 +1020,12 @@ li {
|
|
|
853
1020
|
margin: 10px;
|
|
854
1021
|
border: 1px solid rgba(204, 204, 204, 1);
|
|
855
1022
|
}
|
|
1023
|
+
.editor-content-show{
|
|
1024
|
+
position: fixed;
|
|
1025
|
+
top: -9999px;
|
|
1026
|
+
left: 0;
|
|
1027
|
+
z-index: -1;
|
|
1028
|
+
}
|
|
856
1029
|
|
|
857
1030
|
.editing {
|
|
858
1031
|
width: 794px;
|
|
@@ -867,4 +1040,50 @@ li {
|
|
|
867
1040
|
width: 794px;
|
|
868
1041
|
min-height: 1123px;
|
|
869
1042
|
}
|
|
1043
|
+
.loading-back{
|
|
1044
|
+
position: absolute;
|
|
1045
|
+
top: 0;
|
|
1046
|
+
left: 0;
|
|
1047
|
+
right: 0;
|
|
1048
|
+
bottom: 0;
|
|
1049
|
+
z-index: 100;
|
|
1050
|
+
display: flex;
|
|
1051
|
+
align-items: center;
|
|
1052
|
+
}
|
|
1053
|
+
.loading-cont{
|
|
1054
|
+
display: inline-block;
|
|
1055
|
+
margin: 0 auto;
|
|
1056
|
+
}
|
|
1057
|
+
.loadings {
|
|
1058
|
+
display: inline-block;
|
|
1059
|
+
font-size: 28px;
|
|
1060
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
1061
|
+
font-weight: bold;
|
|
1062
|
+
color: #fff;
|
|
1063
|
+
text-shadow: 0 0 2px #ff3d00, 0 0 1px #ff3d00, 0 0 1px #ff3d00;
|
|
1064
|
+
letter-spacing: 2px;
|
|
1065
|
+
position: relative;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.loadings::after {
|
|
1069
|
+
content: "Loading";
|
|
1070
|
+
position: absolute;
|
|
1071
|
+
left: 0;
|
|
1072
|
+
top: 0;
|
|
1073
|
+
color: #ff3d00;
|
|
1074
|
+
width: 0%;
|
|
1075
|
+
height: 100%;
|
|
1076
|
+
overflow: hidden;
|
|
1077
|
+
animation: loading-animation 6s linear infinite;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
@keyframes loading-animation {
|
|
1081
|
+
0% {
|
|
1082
|
+
width: 0;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
100% {
|
|
1086
|
+
width: 100%;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
870
1089
|
</style>
|
|
@@ -264,6 +264,10 @@ export default {
|
|
|
264
264
|
return x
|
|
265
265
|
})
|
|
266
266
|
},
|
|
267
|
+
randomId() { // 生成随机id
|
|
268
|
+
const id = Math.random().toString(36).substr(2)
|
|
269
|
+
return id.replace(/[0-9]/g, '')
|
|
270
|
+
},
|
|
267
271
|
del(index) {
|
|
268
272
|
if(this.uploadAttData[index].name === undefined) {
|
|
269
273
|
this.uploadAttData[index].active = false
|
|
@@ -339,26 +343,36 @@ export default {
|
|
|
339
343
|
},
|
|
340
344
|
imgHtml(data) {
|
|
341
345
|
const url = this.uploadImage.url + data
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
tag: 'img',
|
|
352
|
-
node: "element",
|
|
353
|
-
}],
|
|
354
|
-
}
|
|
355
|
-
]
|
|
356
|
-
this.insertContent(html)
|
|
346
|
+
const cla = this.randomId()
|
|
347
|
+
const html = `<p class="imgCont ${cla}"><img src="${url}" alt="" /></p>`
|
|
348
|
+
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
349
|
+
console.log(this.selection())
|
|
350
|
+
if(this.selection() <= 6) this.selectionClass2(cla)
|
|
351
|
+
if(this.selectionClass(cla)) {
|
|
352
|
+
this.editor.chain().focus().insertContentAt(this.selection(), '<p></p>').run()
|
|
353
|
+
}
|
|
357
354
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
355
|
+
// 查询class
|
|
356
|
+
selectionClass(v) {
|
|
357
|
+
const json = this.editor.getJSON()
|
|
358
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
359
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
360
|
+
if (val === v) {
|
|
361
|
+
if(json.content[i+1] === undefined) return true
|
|
362
|
+
break
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return false
|
|
366
|
+
},
|
|
367
|
+
selectionClass2(v) {
|
|
368
|
+
const json = this.editor.getJSON()
|
|
369
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
370
|
+
const val = json.content[i].attrs?.titleId?.split(' ')[1]
|
|
371
|
+
if (val === v) {
|
|
372
|
+
json.content.splice(i - 1, 1)
|
|
373
|
+
this.editor?.commands.setContent(json)
|
|
374
|
+
break
|
|
375
|
+
}
|
|
362
376
|
}
|
|
363
377
|
},
|
|
364
378
|
enclosureContent(v) {
|
|
@@ -423,21 +437,27 @@ export default {
|
|
|
423
437
|
</script>
|
|
424
438
|
|
|
425
439
|
<style scoped>
|
|
440
|
+
:deep(.imgCont) {
|
|
441
|
+
line-height: 0 !important;
|
|
442
|
+
}
|
|
443
|
+
:deep(.ProseMirror-separator) {
|
|
444
|
+
display: none !important;
|
|
445
|
+
}
|
|
426
446
|
.editor :deep(h1) {
|
|
427
|
-
line-height:
|
|
447
|
+
line-height: 30px;
|
|
428
448
|
font-size: 18px;
|
|
429
449
|
}
|
|
430
450
|
.editor :deep(h2) {
|
|
431
|
-
line-height:
|
|
451
|
+
line-height: 30px;
|
|
432
452
|
font-size: 16px;
|
|
433
453
|
}
|
|
434
454
|
.editor :deep(h3) {
|
|
435
|
-
line-height:
|
|
455
|
+
line-height: 30px;
|
|
436
456
|
font-size: 14px;
|
|
437
457
|
}
|
|
438
458
|
.editor :deep(p) {
|
|
439
459
|
font-size: 14px;
|
|
440
|
-
line-height:
|
|
460
|
+
line-height: 30px;
|
|
441
461
|
}
|
|
442
462
|
:deep(.ProseMirror) p.is-editor-empty:first-child::before {
|
|
443
463
|
content: attr(data-placeholder);
|
|
@@ -457,7 +477,8 @@ export default {
|
|
|
457
477
|
pointer-events: none;
|
|
458
478
|
}
|
|
459
479
|
:deep(.editor-img){
|
|
460
|
-
max-width: 100
|
|
480
|
+
max-width: calc(100% - 4em);
|
|
481
|
+
padding: 2px 0;
|
|
461
482
|
}
|
|
462
483
|
.editor-but{
|
|
463
484
|
text-align: right;
|
|
@@ -512,12 +533,12 @@ export default {
|
|
|
512
533
|
padding: 5px 0;
|
|
513
534
|
}
|
|
514
535
|
.ed-cont{
|
|
515
|
-
padding:
|
|
536
|
+
padding: 5px 0 0;
|
|
516
537
|
}
|
|
517
538
|
.editor{
|
|
518
539
|
border-radius: 3px;
|
|
519
|
-
padding: 10px;
|
|
520
540
|
outline: none;
|
|
541
|
+
text-indent: 2em;
|
|
521
542
|
}
|
|
522
543
|
.editor img{
|
|
523
544
|
max-width: 100%;
|
|
@@ -176,8 +176,12 @@ export default {
|
|
|
176
176
|
},
|
|
177
177
|
getContent() {
|
|
178
178
|
let arr = []
|
|
179
|
+
let state = false
|
|
179
180
|
for(let i=0; i< this.question.length; i++) {
|
|
180
|
-
if(this.question[i].allScore === '-' || this.question[i].count === '-')
|
|
181
|
+
if(this.question[i].allScore === '-' || this.question[i].count === '-') {
|
|
182
|
+
state = true
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
181
185
|
arr.push({
|
|
182
186
|
...this.question[i],
|
|
183
187
|
easyScore: this.question[i].easy? this.question[i].easyScore: '',
|
|
@@ -191,6 +195,7 @@ export default {
|
|
|
191
195
|
return {
|
|
192
196
|
data: arr,
|
|
193
197
|
total: this.totalNum,
|
|
198
|
+
state: state
|
|
194
199
|
}
|
|
195
200
|
},
|
|
196
201
|
// 添加数据
|