zydx-plus 1.33.351 → 1.33.353
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
CHANGED
|
@@ -45,7 +45,7 @@ export function butJson(editor, data) {
|
|
|
45
45
|
name: '作 者',
|
|
46
46
|
key: 'authorMenu',
|
|
47
47
|
menuKeys: [],
|
|
48
|
-
html: `<p class="author" data-signId="author" style="text-align: center;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family:
|
|
48
|
+
html: `<p class="author" data-signId="author" style="text-align: center;"><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: FangSong;">${menusData(data, 'authorMenu').text}:</span></p>`
|
|
49
49
|
},
|
|
50
50
|
// {
|
|
51
51
|
// name: '抬 头',
|
|
@@ -67,7 +67,7 @@ export function butJson(editor, data) {
|
|
|
67
67
|
name: '标 题',
|
|
68
68
|
key: 'paragraphTitle',
|
|
69
69
|
menuKeys: [],
|
|
70
|
-
html: `<p data-signId="
|
|
70
|
+
html: `<p data-signId="title" class="indent"><span style="color: rgb(0, 0, 0);font-size: 16px;font-weight: 700;">标题名称</span></p>`
|
|
71
71
|
}, {
|
|
72
72
|
name: '正 文',
|
|
73
73
|
key: 'paragraphBody',
|
|
@@ -77,7 +77,7 @@ export function butJson(editor, data) {
|
|
|
77
77
|
name: '信息源',
|
|
78
78
|
key: 'sourcesInfo',
|
|
79
79
|
menuKeys: [],
|
|
80
|
-
html: `<p style="text-align: right;"><span style="color: rgb(0, 0, 0);font-size: 14px;">———— </span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: SimSun;">信息源文本</span></p>`
|
|
80
|
+
html: `<p style="text-align: right;" data-signId="sourcesInfo"><span style="color: rgb(0, 0, 0);font-size: 14px;">———— </span><span style="color: rgb(0, 0, 0);font-size: 14px;font-family: SimSun;">信息源文本</span></p>`
|
|
81
81
|
}, {
|
|
82
82
|
name: '落 款',
|
|
83
83
|
key: 'paragraphMenu',
|
|
@@ -67,17 +67,18 @@
|
|
|
67
67
|
<!-- </div>-->
|
|
68
68
|
<!-- </div>-->
|
|
69
69
|
</div>
|
|
70
|
-
<div
|
|
70
|
+
<div :class="{'editor-content-show': !editableShow}" class="editor-content">
|
|
71
71
|
<div class="editing">
|
|
72
|
-
<div class="editing-header"
|
|
72
|
+
<div v-if="signMenuShow" class="editing-header">
|
|
73
73
|
<img :src="menusData('signMenu')?.ico" alt=""/>
|
|
74
74
|
<span>{{ menusData('signMenu')?.text }}</span>
|
|
75
75
|
</div>
|
|
76
|
-
<editor-content
|
|
76
|
+
<editor-content :editor="editor" class="editing-cont"
|
|
77
|
+
@paste.native.capture.prevent="preventPaste"></editor-content>
|
|
77
78
|
<div class="menu">
|
|
78
|
-
<button class="but" @click="enlSee"
|
|
79
|
-
<button class="but" @click="enlDownload"
|
|
80
|
-
<button class="but" @click="enlDel"
|
|
79
|
+
<button v-if="readOnly" class="but" @click="enlSee">查看</button>
|
|
80
|
+
<button v-if="readOnly" class="but" @click="enlDownload">下载</button>
|
|
81
|
+
<button v-if="!readOnly" class="but" @click="enlDel">删除</button>
|
|
81
82
|
</div>
|
|
82
83
|
</div>
|
|
83
84
|
</div>
|
|
@@ -434,7 +435,7 @@
|
|
|
434
435
|
</div>
|
|
435
436
|
</div>
|
|
436
437
|
<div style="display: flex;flex-direction: row;justify-content: flex-end;margin-top: 10px;">
|
|
437
|
-
<div class="tip-btn" @click="
|
|
438
|
+
<div class="tip-btn" @click="item.isShow=false" v-html="`关闭`"></div>
|
|
438
439
|
</div>
|
|
439
440
|
</div>
|
|
440
441
|
|
|
@@ -986,15 +987,18 @@ export default {
|
|
|
986
987
|
let typeArr = ['superscript', 'underline', 'link']
|
|
987
988
|
if (typeArr.indexOf(marks && marks.length && marks[marks.length - 1].type) !== -1) {
|
|
988
989
|
if (!item.content[j + 1] || item.content[j + 1].text.indexOf(' ') !== 0) {
|
|
990
|
+
let historica = []
|
|
989
991
|
for (let k = 0; k < _this.interpositionData.length; k++) {
|
|
990
992
|
if (_this.interpositionData[k].id.toString() === item.content[j].text) {
|
|
991
|
-
|
|
993
|
+
historica = _this.interpositionData.splice(k, 1)
|
|
992
994
|
_this.historicalData.push(historica[0])
|
|
993
995
|
}
|
|
994
|
-
console.log('onUpdate', _this.historicalData)
|
|
995
996
|
}
|
|
996
997
|
item.content.splice(j, 1)
|
|
997
998
|
editor.chain().setContent(json).run()
|
|
999
|
+
if (_this.literature.indexOf(historica[0].type) !== -1) {
|
|
1000
|
+
_this.delReferenceMenu(historica[0])
|
|
1001
|
+
}
|
|
998
1002
|
break
|
|
999
1003
|
}
|
|
1000
1004
|
}
|
|
@@ -1092,10 +1096,11 @@ export default {
|
|
|
1092
1096
|
for (let j = 0; j < item.content.length; j++) {
|
|
1093
1097
|
if (item.content[j].marks && item.content[j].marks.length) {
|
|
1094
1098
|
let typeArr = ['taggingMenu', 'nounExplain', 'importArticles', 'importWorks', 'videoLink', 'linkCourseware', 'periodical', 'dissertation', 'writings', 'newspaper', 'customize']
|
|
1099
|
+
let historica = []
|
|
1095
1100
|
if (typeArr.indexOf(type) !== -1) {
|
|
1096
1101
|
for (let k = 0; k < this.interpositionData.length; k++) {
|
|
1097
1102
|
if (this.interpositionData[k].id === id) {
|
|
1098
|
-
|
|
1103
|
+
historica = this.interpositionData.splice(k, 1)
|
|
1099
1104
|
this.historicalData.push(historica[0])
|
|
1100
1105
|
}
|
|
1101
1106
|
}
|
|
@@ -1107,6 +1112,9 @@ export default {
|
|
|
1107
1112
|
}
|
|
1108
1113
|
item.content.splice(j, 1)
|
|
1109
1114
|
this.editor.chain().setContent(json).run()
|
|
1115
|
+
if (this.literature.indexOf(historica[0].type) !== -1) {
|
|
1116
|
+
this.delReferenceMenu(historica[0])
|
|
1117
|
+
}
|
|
1110
1118
|
break
|
|
1111
1119
|
}
|
|
1112
1120
|
}
|
|
@@ -1123,6 +1131,9 @@ export default {
|
|
|
1123
1131
|
}
|
|
1124
1132
|
item.content.splice(j, 1)
|
|
1125
1133
|
this.editor.chain().setContent(json).run()
|
|
1134
|
+
if (this.literature.indexOf(historica[0].type) !== -1) {
|
|
1135
|
+
this.delReferenceMenu(historica[0])
|
|
1136
|
+
}
|
|
1126
1137
|
}
|
|
1127
1138
|
}
|
|
1128
1139
|
}
|
|
@@ -1131,7 +1142,6 @@ export default {
|
|
|
1131
1142
|
},
|
|
1132
1143
|
//修改注释 文献
|
|
1133
1144
|
editAnnotatedLiterature(bubbleData) {
|
|
1134
|
-
console.log('bubbleData', bubbleData)
|
|
1135
1145
|
// 添加标注
|
|
1136
1146
|
if (bubbleData.type === 'nounExplain') {
|
|
1137
1147
|
// this.isShowExegesis = true
|
|
@@ -1526,6 +1536,8 @@ export default {
|
|
|
1526
1536
|
// 删除附件
|
|
1527
1537
|
enlDel() {
|
|
1528
1538
|
const json = this.editor.getJSON()
|
|
1539
|
+
let delTitle = true
|
|
1540
|
+
let index = 0
|
|
1529
1541
|
for (let i = 0; i < json.content.length; i++) {
|
|
1530
1542
|
const val = json.content[i].attrs?.signId
|
|
1531
1543
|
if (val === this.encIndex.signId) {
|
|
@@ -1534,6 +1546,20 @@ export default {
|
|
|
1534
1546
|
break
|
|
1535
1547
|
}
|
|
1536
1548
|
}
|
|
1549
|
+
for (let j = 0; j < json.content.length; j++) {
|
|
1550
|
+
const signId = json.content[j].attrs?.signId
|
|
1551
|
+
if (signId === 'enclosure') {
|
|
1552
|
+
index = j
|
|
1553
|
+
}
|
|
1554
|
+
if (signId && signId.includes('u-')) {
|
|
1555
|
+
delTitle = false
|
|
1556
|
+
break
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
if (delTitle) {
|
|
1560
|
+
json.content.splice(index, 1)
|
|
1561
|
+
this.editor?.commands.setContent(json)
|
|
1562
|
+
}
|
|
1537
1563
|
},
|
|
1538
1564
|
signMenu(next) { // 签名菜单
|
|
1539
1565
|
this.signMenuShow = !this.signMenuShow
|
|
@@ -1713,17 +1739,26 @@ export default {
|
|
|
1713
1739
|
// const marginRight = Math.ceil(styles.getPropertyValue("margin-right").split('px')[0])
|
|
1714
1740
|
// let width = editing[0].clientWidth
|
|
1715
1741
|
if (this.readOnly) {
|
|
1742
|
+
let linkTypeArr = ['linkWorks', 'linkArticle', 'linkImage']
|
|
1716
1743
|
// this.bubbleData = this.interpositionData.filter(item => item.id === text)[0]
|
|
1717
1744
|
this.interpositionData.forEach(item => {
|
|
1718
|
-
if(item.id === text){
|
|
1719
|
-
item.
|
|
1745
|
+
if (item.id === text) {
|
|
1746
|
+
if (linkTypeArr.indexOf(item.type) !== -1) {
|
|
1747
|
+
window.open(item.url, '_blank');
|
|
1748
|
+
return
|
|
1749
|
+
}
|
|
1750
|
+
item.isShow = true
|
|
1720
1751
|
}
|
|
1721
1752
|
})
|
|
1722
1753
|
if (href) {
|
|
1723
1754
|
// this.bubbleData = this.interpositionData.filter(item => item.id === href)[0]
|
|
1724
1755
|
this.interpositionData.forEach(item => {
|
|
1725
|
-
if(item.id === href){
|
|
1726
|
-
item.
|
|
1756
|
+
if (item.id === href) {
|
|
1757
|
+
if (linkTypeArr.indexOf(item.type) !== -1) {
|
|
1758
|
+
window.open(item.url, '_blank');
|
|
1759
|
+
return
|
|
1760
|
+
}
|
|
1761
|
+
item.isShow = true
|
|
1727
1762
|
}
|
|
1728
1763
|
})
|
|
1729
1764
|
}
|
|
@@ -1955,21 +1990,31 @@ export default {
|
|
|
1955
1990
|
}
|
|
1956
1991
|
if (v === 'group-upload') {
|
|
1957
1992
|
up.customInsert(res, file, async (name, url) => {
|
|
1958
|
-
const b = await this.signIdData('paragraph')
|
|
1993
|
+
// const b = await this.signIdData('paragraph')
|
|
1959
1994
|
const t = await this.signIdData('enclosure')
|
|
1995
|
+
const r = await this.signIdData('reference')
|
|
1960
1996
|
const html = butJson(this.editor, this.menusText)[v].html
|
|
1961
|
-
if
|
|
1997
|
+
if(r===-1){
|
|
1962
1998
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
1963
1999
|
if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
|
|
1964
2000
|
const num = this.upSort(this.editor, 'enclosure')
|
|
1965
2001
|
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
|
|
1966
2002
|
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
1967
|
-
|
|
1968
|
-
if (t === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('paragraph', b - 1), html).run()
|
|
1969
|
-
const num = this.upSort(this.editor, 'enclosure')
|
|
1970
|
-
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
|
|
1971
|
-
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
2003
|
+
return
|
|
1972
2004
|
}
|
|
2005
|
+
const num1 = this.upSort(this.editor, 'reference')
|
|
2006
|
+
if (t === -1) this.editor.chain().focus().insertContentAt(num1.len-7, html).run()
|
|
2007
|
+
const num = this.upSort(this.editor, 'enclosure')
|
|
2008
|
+
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
|
|
2009
|
+
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
2010
|
+
|
|
2011
|
+
// if (b === -1) {
|
|
2012
|
+
// } else {
|
|
2013
|
+
// if (t === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('paragraph', b - 1), html).run()
|
|
2014
|
+
// const num = this.upSort(this.editor, 'enclosure')
|
|
2015
|
+
// const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
|
|
2016
|
+
// this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
2017
|
+
// }
|
|
1973
2018
|
})
|
|
1974
2019
|
}
|
|
1975
2020
|
if (v === 'uploadImage') {
|
|
@@ -2248,36 +2293,85 @@ export default {
|
|
|
2248
2293
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2249
2294
|
// const html = butJson(this.editor, this.menusText)[data.key].html
|
|
2250
2295
|
const b = await this.signIdData('red') // 判断是否有红头文件
|
|
2251
|
-
const r = await this.signIdData('subject')
|
|
2296
|
+
const r = await this.signIdData('subject')// 判断是否有题目
|
|
2252
2297
|
if (b === -1) {
|
|
2253
2298
|
if (r === -1) this.editor.chain().focus().insertContentAt(0, html).run()
|
|
2254
2299
|
} else {
|
|
2255
2300
|
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
|
|
2256
2301
|
}
|
|
2257
2302
|
}
|
|
2303
|
+
// 作者
|
|
2304
|
+
if (key.key === 'authorMenu') {
|
|
2305
|
+
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2306
|
+
const b = await this.signIdData('subject') // 判断是否有题目
|
|
2307
|
+
const r = await this.signIdData('author')// 判断是否有作者
|
|
2308
|
+
const a = await this.signIdData('red') // 判断是否有红头文件
|
|
2309
|
+
if (b === -1) {
|
|
2310
|
+
if (a === -1) {
|
|
2311
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(0, html).run()
|
|
2312
|
+
return
|
|
2313
|
+
}
|
|
2314
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
|
|
2315
|
+
return
|
|
2316
|
+
}
|
|
2317
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
2318
|
+
}
|
|
2258
2319
|
// 摘要
|
|
2259
2320
|
if (key.key === 'abstractMenu') {
|
|
2260
2321
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2322
|
+
const a = await this.signIdData('red') // 判断是否有红头文件
|
|
2323
|
+
const b = await this.signIdData('subject') // 判断是否有题目
|
|
2324
|
+
const r = await this.signIdData('author')// 判断是否有作者
|
|
2325
|
+
const n = await this.signIdData('abstract')// 判断是否有摘要
|
|
2326
|
+
if (r === -1) {
|
|
2327
|
+
if (b === -1) {
|
|
2328
|
+
if (a === -1) {
|
|
2329
|
+
if (n === -1) this.editor.chain().focus().insertContentAt(0, html).run()
|
|
2330
|
+
return
|
|
2331
|
+
}
|
|
2332
|
+
if (n === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
|
|
2333
|
+
return
|
|
2334
|
+
}
|
|
2335
|
+
if (n === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
2336
|
+
return
|
|
2337
|
+
}
|
|
2338
|
+
if (n === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('author'), html).run()
|
|
2263
2339
|
}
|
|
2264
2340
|
// 关键词
|
|
2265
2341
|
if (key.key === 'keywordMenu') {
|
|
2266
2342
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2343
|
+
const a = await this.signIdData('red') // 判断是否有红头文件
|
|
2344
|
+
const b = await this.signIdData('subject') // 判断是否有题目
|
|
2345
|
+
const r = await this.signIdData('author')// 判断是否有作者
|
|
2346
|
+
const n = await this.signIdData('abstract')// 判断是否有摘要
|
|
2347
|
+
const k = await this.signIdData('keyword')// 判断是否有关键词
|
|
2348
|
+
if (n === -1) {
|
|
2349
|
+
if (r === -1) {
|
|
2350
|
+
if (b === -1) {
|
|
2351
|
+
if (a === -1) {
|
|
2352
|
+
if (k === -1) this.editor.chain().focus().insertContentAt(0, html).run()
|
|
2353
|
+
return
|
|
2354
|
+
}
|
|
2355
|
+
if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
|
|
2356
|
+
return
|
|
2357
|
+
}
|
|
2358
|
+
if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
2359
|
+
return
|
|
2360
|
+
}
|
|
2361
|
+
if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('author'), html).run()
|
|
2362
|
+
return
|
|
2363
|
+
}
|
|
2364
|
+
if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('abstract'), html).run()
|
|
2269
2365
|
}
|
|
2270
2366
|
// 标题
|
|
2271
2367
|
if (key.key === 'paragraphTitle') {
|
|
2272
2368
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2273
|
-
|
|
2274
|
-
this.editor.chain().focus().insertContentAt(form, html).run()
|
|
2369
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2275
2370
|
}
|
|
2276
2371
|
// 正文
|
|
2277
2372
|
if (key.key === 'paragraphBody') {
|
|
2278
2373
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2279
|
-
|
|
2280
|
-
this.editor.chain().focus().insertContentAt(form, html).run()
|
|
2374
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2281
2375
|
}
|
|
2282
2376
|
// 信息源
|
|
2283
2377
|
if (key.key === 'sourcesInfo') {
|
|
@@ -2289,47 +2383,65 @@ export default {
|
|
|
2289
2383
|
if (key.key === 'paragraphMenu') {
|
|
2290
2384
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2291
2385
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
2292
|
-
const
|
|
2293
|
-
const
|
|
2386
|
+
const r = await this.signIdData('paragraph')//落款
|
|
2387
|
+
const b = await this.signIdData('ack')//致谢
|
|
2388
|
+
const n = await this.signIdData('enclosure')//附件
|
|
2389
|
+
const a = await this.signIdData('reference')//参考文献
|
|
2294
2390
|
if (b === -1) {
|
|
2295
|
-
if
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2391
|
+
if(n===-1){
|
|
2392
|
+
if(a===-1){
|
|
2393
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(last, html).run()
|
|
2394
|
+
return
|
|
2395
|
+
}
|
|
2396
|
+
const num = this.selectionPath('reference')
|
|
2397
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(num - 7, html).run()
|
|
2398
|
+
return
|
|
2399
|
+
}
|
|
2400
|
+
const num = this.selectionPath('enclosure')
|
|
2401
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(num - 7, html).run()
|
|
2402
|
+
return
|
|
2299
2403
|
}
|
|
2404
|
+
const num = this.upSort(this.editor, 'ack')
|
|
2405
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
|
|
2300
2406
|
}
|
|
2301
2407
|
// 致谢
|
|
2302
2408
|
if (key.key === 'ackMenu') {
|
|
2303
2409
|
const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2304
2410
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
2305
2411
|
const r = await this.signIdData('ack')
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2412
|
+
const b = await this.signIdData('enclosure')//附件
|
|
2413
|
+
const a = await this.signIdData('reference')//参考文献
|
|
2414
|
+
if(b===-1){
|
|
2415
|
+
if(a===-1){
|
|
2416
|
+
if (r === -1) {
|
|
2417
|
+
this.editor.chain().focus().insertContentAt(last, html[0]).run()
|
|
2418
|
+
this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
|
|
2419
|
+
}
|
|
2420
|
+
return
|
|
2421
|
+
}
|
|
2422
|
+
const num = this.upSort(this.editor, 'reference')
|
|
2423
|
+
if (r === -1) {
|
|
2424
|
+
this.editor.chain().focus().insertContentAt(num.len - 7, html[0]).run()
|
|
2425
|
+
this.editor.chain().focus().insertContentAt(num.len-3, html[1]).run()
|
|
2426
|
+
}
|
|
2427
|
+
return
|
|
2309
2428
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
const r = await this.signIdData('author')
|
|
2316
|
-
if (b === -1) {
|
|
2317
|
-
if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2318
|
-
} else {
|
|
2319
|
-
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
2429
|
+
const num = this.selectionPath('enclosure')
|
|
2430
|
+
if (r === -1) {
|
|
2431
|
+
this.editor.chain().focus().insertContentAt(num-7, html[0]).run()
|
|
2432
|
+
const ackNum = this.selectionPath('ack')
|
|
2433
|
+
this.editor.chain().focus().insertContentAt(ackNum, html[1]).run()
|
|
2320
2434
|
}
|
|
2435
|
+
|
|
2436
|
+
// if(a===-1){
|
|
2437
|
+
// if (r === -1) {
|
|
2438
|
+
// this.editor.chain().focus().insertContentAt(last, html[0]).run()
|
|
2439
|
+
// this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
|
|
2440
|
+
// }
|
|
2441
|
+
// }else {
|
|
2442
|
+
// // if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
|
|
2443
|
+
// }
|
|
2321
2444
|
}
|
|
2322
|
-
// 作者
|
|
2323
|
-
// if (key.key === 'authorMenu') {
|
|
2324
|
-
// const html = menusHtml.filter(item => item.key == key.key)[0].html
|
|
2325
|
-
// const b = await this.signIdData('subject') // 判断是否有题目
|
|
2326
|
-
// const r = await this.signIdData('author')
|
|
2327
|
-
// if (b === -1) {
|
|
2328
|
-
// if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2329
|
-
// } else {
|
|
2330
|
-
// if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
2331
|
-
// }
|
|
2332
|
-
// }
|
|
2333
2445
|
}
|
|
2334
2446
|
|
|
2335
2447
|
if (data.key === 'textMenu' && key === 0 || data.key === 'titleMenu' && key === 0) return
|
|
@@ -2573,6 +2685,7 @@ export default {
|
|
|
2573
2685
|
}
|
|
2574
2686
|
const html = `<sup>[${res[0]}]</sup> `
|
|
2575
2687
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2688
|
+
this.addReferenceMenu(dataInfo)
|
|
2576
2689
|
this.documentClick()
|
|
2577
2690
|
}).catch((err) => {
|
|
2578
2691
|
console.log('取消', err)
|
|
@@ -2638,6 +2751,7 @@ export default {
|
|
|
2638
2751
|
}
|
|
2639
2752
|
const html = `<sup>[${res[0]}]</sup><span> </span>`
|
|
2640
2753
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2754
|
+
this.addReferenceMenu(dataInfo)
|
|
2641
2755
|
this.documentClick()
|
|
2642
2756
|
}).catch((err) => {
|
|
2643
2757
|
console.log('取消', err)
|
|
@@ -2703,6 +2817,7 @@ export default {
|
|
|
2703
2817
|
}
|
|
2704
2818
|
const html = `<sup>[${res[0]}]</sup><span> </span>`
|
|
2705
2819
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2820
|
+
this.addReferenceMenu(dataInfo)
|
|
2706
2821
|
this.documentClick()
|
|
2707
2822
|
}).catch((err) => {
|
|
2708
2823
|
console.log('取消', err)
|
|
@@ -2764,6 +2879,7 @@ export default {
|
|
|
2764
2879
|
}
|
|
2765
2880
|
const html = `<sup>[${res[0]}]</sup><span> </span>`
|
|
2766
2881
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2882
|
+
this.addReferenceMenu(dataInfo)
|
|
2767
2883
|
this.documentClick()
|
|
2768
2884
|
}).catch((err) => {
|
|
2769
2885
|
console.log('取消', err)
|
|
@@ -2802,6 +2918,7 @@ export default {
|
|
|
2802
2918
|
}
|
|
2803
2919
|
const html = `<sup>[${res[0]}]</sup><span> </span>`
|
|
2804
2920
|
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
2921
|
+
this.addReferenceMenu(dataInfo)
|
|
2805
2922
|
this.documentClick()
|
|
2806
2923
|
}).catch((err) => {
|
|
2807
2924
|
console.log('取消', err)
|
|
@@ -3094,7 +3211,47 @@ export default {
|
|
|
3094
3211
|
} else {
|
|
3095
3212
|
return false;
|
|
3096
3213
|
}
|
|
3097
|
-
}
|
|
3214
|
+
},
|
|
3215
|
+
|
|
3216
|
+
async addReferenceMenu(data) {
|
|
3217
|
+
const t = await this.signIdData('reference')
|
|
3218
|
+
const html = `<p contenteditable="false" data-signId="reference" style="text-align: center;margin-bottom: 30px;"><span style="font-weight: 700;font-size: 16px;">参考文献:</span></p>`
|
|
3219
|
+
const html2 = `<p contenteditable="false" data-signId="r-${data.number}"><span style="font-family: FangSong;font-size: 12px;line-height25px">${data.text}</span></p>`
|
|
3220
|
+
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
3221
|
+
if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
|
|
3222
|
+
let last1 = this.editor.state.selection.$anchor.path[0].content.size
|
|
3223
|
+
// const num = this.selectionPath('reference')
|
|
3224
|
+
// console.log(num)
|
|
3225
|
+
this.editor.chain().focus().insertContentAt(last1, html2).run()
|
|
3226
|
+
},
|
|
3227
|
+
|
|
3228
|
+
delReferenceMenu(data) {
|
|
3229
|
+
const json = this.editor.getJSON()
|
|
3230
|
+
let delTitle = true
|
|
3231
|
+
let index = 0
|
|
3232
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
3233
|
+
const val = json.content[i].attrs?.signId
|
|
3234
|
+
if (val === `r-${data.number}`) {
|
|
3235
|
+
json.content.splice(i, 1)
|
|
3236
|
+
this.editor?.commands.setContent(json)
|
|
3237
|
+
break
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
for (let j = 0; j < json.content.length; j++) {
|
|
3241
|
+
const signId = json.content[j].attrs?.signId
|
|
3242
|
+
if (signId === 'reference') {
|
|
3243
|
+
index = j
|
|
3244
|
+
}
|
|
3245
|
+
if (signId && signId.includes('r-')) {
|
|
3246
|
+
delTitle = false
|
|
3247
|
+
break
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
if (delTitle) {
|
|
3251
|
+
json.content.splice(index, 1)
|
|
3252
|
+
this.editor?.commands.setContent(json)
|
|
3253
|
+
}
|
|
3254
|
+
},
|
|
3098
3255
|
}
|
|
3099
3256
|
}
|
|
3100
3257
|
</script>
|
|
@@ -3548,8 +3705,7 @@ li {
|
|
|
3548
3705
|
|
|
3549
3706
|
|
|
3550
3707
|
.menu-one {
|
|
3551
|
-
//max-width: 557px; min-width: 300px; width: max-content; padding: 10px; border-radius: 7px;
|
|
3552
|
-
//margin:0 100px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.58); background: #FFFFFF; display: flex; flex-direction: column; justify-content: space-between; z-index: 10 !important;
|
|
3708
|
+
//max-width: 557px; min-width: 300px; width: max-content; padding: 10px; border-radius: 7px; //margin:0 100px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.58); background: #FFFFFF; display: flex; flex-direction: column; justify-content: space-between; z-index: 10 !important;
|
|
3553
3709
|
}
|
|
3554
3710
|
|
|
3555
3711
|
.menu-one-text {
|