zydx-plus 1.33.352 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.33.352",
3
+ "version": "1.33.353",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -338,7 +338,8 @@ let buttonNames = {
338
338
  allClass: this.getPrefix(item) + '情况',
339
339
  },
340
340
  lowLevel: {
341
- default: "setTask",
341
+ default: "viewResources",
342
+ viewResources: '查看资源',
342
343
  setTask: '布置任务',
343
344
  teacherAnswer: '教师答疑',
344
345
  // duplicate: '违纪查重',
@@ -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: KaiT;">${menusData(data, 'authorMenu').text}:</span></p>`
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: '抬&nbsp;&nbsp;&nbsp;头',
@@ -67,7 +67,7 @@ export function butJson(editor, data) {
67
67
  name: '标&nbsp;&nbsp;&nbsp;题',
68
68
  key: 'paragraphTitle',
69
69
  menuKeys: [],
70
- html: `<p data-signId="paragraph" class="indent"><span style="color: rgb(0, 0, 0);font-size: 16px;font-weight: 700;">标题名称</span></p>`
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: '正&nbsp;&nbsp;&nbsp;文',
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: '落&nbsp;&nbsp;&nbsp;款',
83
83
  key: 'paragraphMenu',
@@ -67,17 +67,18 @@
67
67
  <!-- </div>-->
68
68
  <!-- </div>-->
69
69
  </div>
70
- <div class="editor-content" :class="{'editor-content-show': !editableShow}">
70
+ <div :class="{'editor-content-show': !editableShow}" class="editor-content">
71
71
  <div class="editing">
72
- <div class="editing-header" v-if="signMenuShow">
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 @paste.native.capture.prevent="preventPaste" class="editing-cont" :editor="editor"></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" v-if="readOnly">查看</button>
79
- <button class="but" @click="enlDownload" v-if="readOnly">下载</button>
80
- <button class="but" @click="enlDel" v-if="!readOnly">删除</button>
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="isShowFile=false" v-html="`关闭`"></div>
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
- let historica = _this.interpositionData.splice(k, 1)
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
- let historica = this.interpositionData.splice(k, 1)
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
@@ -1716,23 +1742,23 @@ export default {
1716
1742
  let linkTypeArr = ['linkWorks', 'linkArticle', 'linkImage']
1717
1743
  // this.bubbleData = this.interpositionData.filter(item => item.id === text)[0]
1718
1744
  this.interpositionData.forEach(item => {
1719
- if(item.id === text){
1720
- if (linkTypeArr.indexOf(item.type) !== -1){
1745
+ if (item.id === text) {
1746
+ if (linkTypeArr.indexOf(item.type) !== -1) {
1721
1747
  window.open(item.url, '_blank');
1722
1748
  return
1723
1749
  }
1724
- item.isShow=true
1750
+ item.isShow = true
1725
1751
  }
1726
1752
  })
1727
1753
  if (href) {
1728
1754
  // this.bubbleData = this.interpositionData.filter(item => item.id === href)[0]
1729
1755
  this.interpositionData.forEach(item => {
1730
- if(item.id === href){
1731
- if (linkTypeArr.indexOf(item.type) !== -1){
1756
+ if (item.id === href) {
1757
+ if (linkTypeArr.indexOf(item.type) !== -1) {
1732
1758
  window.open(item.url, '_blank');
1733
1759
  return
1734
1760
  }
1735
- item.isShow=true
1761
+ item.isShow = true
1736
1762
  }
1737
1763
  })
1738
1764
  }
@@ -1964,21 +1990,31 @@ export default {
1964
1990
  }
1965
1991
  if (v === 'group-upload') {
1966
1992
  up.customInsert(res, file, async (name, url) => {
1967
- const b = await this.signIdData('paragraph')
1993
+ // const b = await this.signIdData('paragraph')
1968
1994
  const t = await this.signIdData('enclosure')
1995
+ const r = await this.signIdData('reference')
1969
1996
  const html = butJson(this.editor, this.menusText)[v].html
1970
- if (b === -1) {
1997
+ if(r===-1){
1971
1998
  const last = this.editor.state.selection.$anchor.path[0].content.size
1972
1999
  if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
1973
2000
  const num = this.upSort(this.editor, 'enclosure')
1974
2001
  const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
1975
2002
  this.editor.chain().focus().insertContentAt(num.len, html2).run()
1976
- } else {
1977
- if (t === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('paragraph', b - 1), html).run()
1978
- const num = this.upSort(this.editor, 'enclosure')
1979
- const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
1980
- this.editor.chain().focus().insertContentAt(num.len, html2).run()
2003
+ return
1981
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
+ // }
1982
2018
  })
1983
2019
  }
1984
2020
  if (v === 'uploadImage') {
@@ -2257,36 +2293,85 @@ export default {
2257
2293
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2258
2294
  // const html = butJson(this.editor, this.menusText)[data.key].html
2259
2295
  const b = await this.signIdData('red') // 判断是否有红头文件
2260
- const r = await this.signIdData('subject')
2296
+ const r = await this.signIdData('subject')// 判断是否有题目
2261
2297
  if (b === -1) {
2262
2298
  if (r === -1) this.editor.chain().focus().insertContentAt(0, html).run()
2263
2299
  } else {
2264
2300
  if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
2265
2301
  }
2266
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
+ }
2267
2319
  // 摘要
2268
2320
  if (key.key === 'abstractMenu') {
2269
2321
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2270
- const r = await this.signIdData('abstract')
2271
- if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
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()
2272
2339
  }
2273
2340
  // 关键词
2274
2341
  if (key.key === 'keywordMenu') {
2275
2342
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2276
- const r = await this.signIdData('keyword')
2277
- if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
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()
2278
2365
  }
2279
2366
  // 标题
2280
2367
  if (key.key === 'paragraphTitle') {
2281
2368
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2282
- let form = this.selection()
2283
- this.editor.chain().focus().insertContentAt(form, html).run()
2369
+ this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2284
2370
  }
2285
2371
  // 正文
2286
2372
  if (key.key === 'paragraphBody') {
2287
2373
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2288
- let form = this.selection()
2289
- this.editor.chain().focus().insertContentAt(form, html).run()
2374
+ this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2290
2375
  }
2291
2376
  // 信息源
2292
2377
  if (key.key === 'sourcesInfo') {
@@ -2298,47 +2383,65 @@ export default {
2298
2383
  if (key.key === 'paragraphMenu') {
2299
2384
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2300
2385
  const last = this.editor.state.selection.$anchor.path[0].content.size
2301
- const b = await this.signIdData('ack')
2302
- const r = await this.signIdData('paragraph')
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')//参考文献
2303
2390
  if (b === -1) {
2304
- if (r === -1) this.editor.chain().focus().insertContentAt(last, html).run()
2305
- } else {
2306
- const num = this.upSort(this.editor, 'ack')
2307
- if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
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
2308
2403
  }
2404
+ const num = this.upSort(this.editor, 'ack')
2405
+ if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
2309
2406
  }
2310
2407
  // 致谢
2311
2408
  if (key.key === 'ackMenu') {
2312
2409
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2313
2410
  const last = this.editor.state.selection.$anchor.path[0].content.size
2314
2411
  const r = await this.signIdData('ack')
2315
- if (r === -1) {
2316
- this.editor.chain().focus().insertContentAt(last, html[0]).run()
2317
- this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
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
2318
2428
  }
2319
- }
2320
- // 作者
2321
- if (key.key === 'authorMenu') {
2322
- const html = menusHtml.filter(item => item.key == key.key)[0].html
2323
- const b = await this.signIdData('subject') // 判断是否有题目
2324
- const r = await this.signIdData('author')
2325
- if (b === -1) {
2326
- if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2327
- } else {
2328
- 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()
2329
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
+ // }
2330
2444
  }
2331
- // 作者
2332
- // if (key.key === 'authorMenu') {
2333
- // const html = menusHtml.filter(item => item.key == key.key)[0].html
2334
- // const b = await this.signIdData('subject') // 判断是否有题目
2335
- // const r = await this.signIdData('author')
2336
- // if (b === -1) {
2337
- // if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2338
- // } else {
2339
- // if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
2340
- // }
2341
- // }
2342
2445
  }
2343
2446
 
2344
2447
  if (data.key === 'textMenu' && key === 0 || data.key === 'titleMenu' && key === 0) return
@@ -2582,6 +2685,7 @@ export default {
2582
2685
  }
2583
2686
  const html = `<sup>[${res[0]}]</sup> `
2584
2687
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2688
+ this.addReferenceMenu(dataInfo)
2585
2689
  this.documentClick()
2586
2690
  }).catch((err) => {
2587
2691
  console.log('取消', err)
@@ -2647,6 +2751,7 @@ export default {
2647
2751
  }
2648
2752
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2649
2753
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2754
+ this.addReferenceMenu(dataInfo)
2650
2755
  this.documentClick()
2651
2756
  }).catch((err) => {
2652
2757
  console.log('取消', err)
@@ -2712,6 +2817,7 @@ export default {
2712
2817
  }
2713
2818
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2714
2819
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2820
+ this.addReferenceMenu(dataInfo)
2715
2821
  this.documentClick()
2716
2822
  }).catch((err) => {
2717
2823
  console.log('取消', err)
@@ -2773,6 +2879,7 @@ export default {
2773
2879
  }
2774
2880
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2775
2881
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2882
+ this.addReferenceMenu(dataInfo)
2776
2883
  this.documentClick()
2777
2884
  }).catch((err) => {
2778
2885
  console.log('取消', err)
@@ -2811,6 +2918,7 @@ export default {
2811
2918
  }
2812
2919
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2813
2920
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2921
+ this.addReferenceMenu(dataInfo)
2814
2922
  this.documentClick()
2815
2923
  }).catch((err) => {
2816
2924
  console.log('取消', err)
@@ -3103,7 +3211,47 @@ export default {
3103
3211
  } else {
3104
3212
  return false;
3105
3213
  }
3106
- }
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
+ },
3107
3255
  }
3108
3256
  }
3109
3257
  </script>
@@ -3557,8 +3705,7 @@ li {
3557
3705
 
3558
3706
 
3559
3707
  .menu-one {
3560
- //max-width: 557px; min-width: 300px; width: max-content; padding: 10px; border-radius: 7px;
3561
- //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;
3562
3709
  }
3563
3710
 
3564
3711
  .menu-one-text {
package/src/index.js CHANGED
@@ -83,7 +83,7 @@ function install(app) {
83
83
  }
84
84
 
85
85
  export default {
86
- version: '1.33.352',
86
+ version: '1.33.353',
87
87
  install,
88
88
  Calendar,
89
89
  Message,