zydx-plus 1.33.352 → 1.33.354

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.354",
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',
@@ -4,8 +4,7 @@
4
4
  <div v-for="(item,index) in butData" class="editor-but">
5
5
  <div v-if="uploadTypeArr.indexOf(item.key) !== -1" class="editor-but-name">
6
6
  <label>
7
- <input :accept="acceptType[item.key]" style="display: none;" type="file"
8
- @change="upload($event,item.key)">
7
+ <input :accept="acceptType[item.key]" style="display: none;" type="file" @change="upload($event,item.key)">
9
8
  <span v-html="item.name"></span>
10
9
  </label>
11
10
  </div>
@@ -18,8 +17,7 @@
18
17
  <ul v-for="(item2,index2) in item.menuKeys" style="position: relative">
19
18
  <li v-if="uploadTypeArr.indexOf(item2.key) !== -1">
20
19
  <label>
21
- <input :accept="acceptType[item2.key]" style="display: none;" type="file"
22
- @change="upload($event,item2.key)">
20
+ <input :accept="acceptType[item2.key]" style="display: none;" type="file" @change="upload($event,item2.key)">
23
21
  <span v-html="item2.name"></span>
24
22
  </label>
25
23
  </li>
@@ -32,8 +30,7 @@
32
30
  <li v-for="(childItem,childIndex) in item2.childMenuKeys" @click="butTap(item,item2,childItem)">
33
31
  <!-- childItem.key === 'uploadImage'-->
34
32
  <label v-if=" uploadTypeArr.indexOf(childItem.key) !== -1 ">
35
- <input :accept="acceptType[childItem.key]" style="display: none;" type="file"
36
- @change="upload($event,childItem.key)">
33
+ <input :accept="acceptType[childItem.key]" style="display: none;" type="file" @change="upload($event,childItem.key)">
37
34
  <span v-html="item2.name"></span>
38
35
  </label>
39
36
  <span v-else v-html="childItem.name"></span>
@@ -67,17 +64,18 @@
67
64
  <!-- </div>-->
68
65
  <!-- </div>-->
69
66
  </div>
70
- <div class="editor-content" :class="{'editor-content-show': !editableShow}">
67
+ <div :class="{'editor-content-show': !editableShow}" class="editor-content">
71
68
  <div class="editing">
72
- <div class="editing-header" v-if="signMenuShow">
69
+ <div v-if="signMenuShow" class="editing-header">
73
70
  <img :src="menusData('signMenu')?.ico" alt=""/>
74
71
  <span>{{ menusData('signMenu')?.text }}</span>
75
72
  </div>
76
- <editor-content @paste.native.capture.prevent="preventPaste" class="editing-cont" :editor="editor"></editor-content>
73
+ <editor-content :editor="editor" class="editing-cont"
74
+ @paste.native.capture.prevent="preventPaste"></editor-content>
77
75
  <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>
76
+ <button v-if="readOnly" class="but" @click="enlSee">查看</button>
77
+ <button v-if="readOnly" class="but" @click="enlDownload">下载</button>
78
+ <button v-if="!readOnly" class="but" @click="enlDel">删除</button>
81
79
  </div>
82
80
  </div>
83
81
  </div>
@@ -303,7 +301,7 @@
303
301
 
304
302
  <!-- 展示弹窗 -->
305
303
  <div v-for="(item,index) in interpositionData" :key="index">
306
- <zydx-drag-popup v-if="item.isShow"
304
+ <zydx-drag-popup v-if="item.isShow" :minWidth="640" :minHeight="183"
307
305
  :enlargeShow="false" :minimize="false" :minimizeCir="false"
308
306
  :title="titleDragPopup[item.type]?titleDragPopup[item.type]:'参考文献'" height="auto"
309
307
  width="auto" @close="closeDataShowPopup(item)">
@@ -369,7 +367,7 @@
369
367
  v-html="'删除'"></div>
370
368
  </div>
371
369
  </div>
372
- <div :style="{width: item.type === 'linkCourseware'?'1280px':'885px'}" class="tip-box">
370
+ <div style="min-width:600px;width: 600px" class="tip-box">
373
371
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
374
372
  <div class="tip-boxContent">
375
373
  <zydx-read :url="item.url" style="height: 100%"></zydx-read>
@@ -388,7 +386,7 @@
388
386
  v-html="'删除'"></div>
389
387
  </div>
390
388
  </div>
391
- <div :style="{width: item.type === 'linkCourseware'?'1280px':'885px'}" class="tip-box">
389
+ <div style="min-width:600px;width: 600px" class="tip-box">
392
390
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
393
391
  <div class="tip-boxContent">
394
392
  <zydx-read :url="item.url" style="height: 100%"></zydx-read>
@@ -407,7 +405,7 @@
407
405
  v-html="'删除'"></div>
408
406
  </div>
409
407
  </div>
410
- <div :style="{width: item.type === 'linkCourseware'?'1280px':'885px'}" class="tip-box">
408
+ <div style="min-width:600px;width: 600px" class="tip-box">
411
409
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
412
410
  <div class="tip-boxContent">
413
411
  <zydx-read :url="item.url" style="height: 100%"></zydx-read>
@@ -426,7 +424,7 @@
426
424
  v-html="'删除'"></div>
427
425
  </div>
428
426
  </div>
429
- <div :style="{width: item.type === 'linkCourseware'?'1280px':'885px'}" class="tip-box">
427
+ <div style="min-width:600px;width: 600px" class="tip-box">
430
428
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
431
429
  <div class="tip-boxContent">
432
430
  <iframe v-if="item.type === 'linkCourseware'" :src="item.url" frameborder="no" height="590"
@@ -434,7 +432,7 @@
434
432
  </div>
435
433
  </div>
436
434
  <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>
435
+ <div class="tip-btn" @click="item.isShow=false" v-html="`关闭`"></div>
438
436
  </div>
439
437
  </div>
440
438
 
@@ -448,7 +446,7 @@
448
446
  v-html="'删除'"></div>
449
447
  </div>
450
448
  </div>
451
- <div class="tip-box" style="width: auto">
449
+ <div class="tip-box" style="min-width:600px;width: 600px">
452
450
  <div class="tip-boxContent">
453
451
  {{ item.text }}
454
452
  </div>
@@ -461,6 +459,29 @@
461
459
  </zydx-drag-popup>
462
460
  </div>
463
461
 
462
+
463
+ <!-- 链接注释-->
464
+ <zydx-drag-popup v-if="isShowUpload" :dragStatus="false" :width="400"
465
+ :enlargeShow="false" :minimize="false" :height="200"
466
+ :minimizeCir="false" :title="'上传附件'" @close="isShowUpload=false">
467
+ <template #content>
468
+ <div class="upload-box">
469
+ <div class="check-upload">
470
+ <label>
471
+ <input type="checkbox" v-model="checkboxObj.value" :checked="checkboxObj.checked" @change="checkboxTao(checkboxObj)"/>
472
+ <span>{{ checkboxObj.label }}</span>
473
+ </label>
474
+ </div>
475
+ <div >
476
+ <label style="border:1px solid #000;border-radius: 3px;padding:2px 5px;">
477
+ <input :accept="acceptType['group-upload']" style="display: none;" type="file" @change="upload($event,'group-upload')">
478
+ <span v-html="'上传附件'"></span>
479
+ </label>
480
+ </div>
481
+ </div>
482
+ </template>
483
+ </zydx-drag-popup>
484
+
464
485
  </div>
465
486
  </template>
466
487
 
@@ -499,6 +520,7 @@ import viewSvg from "./view-svg.vue";
499
520
  import Recorder from 'js-audio-recorder'
500
521
  import zydxColoring from '../../coloring'
501
522
  import Message from '../../../components/tipBox/index';
523
+ import Upload from '../../../components/upload' //上传文件
502
524
  import zydxTextarea from '../../textarea'
503
525
  import zydxRead from '../../read'
504
526
  import zydxDragPopup from '../../dragPopup'
@@ -527,6 +549,8 @@ export default {
527
549
  },
528
550
  data() {
529
551
  return {
552
+ checkboxObj:{value: '1', label: '是否开启缩进', checked: false},
553
+ checkbox:false,
530
554
  titleDragPopup: {
531
555
  nounExplain: '链接名词',
532
556
  taggingMenu: '注释',
@@ -548,6 +572,7 @@ export default {
548
572
  tipTitle: '',
549
573
  taggingText: '',
550
574
  isShowPopup: false,
575
+ isShowUpload: false,
551
576
  isShowExegesis: false,
552
577
  isShowFile: false,
553
578
  exegesisType: 'add',
@@ -561,7 +586,7 @@ export default {
561
586
  uploadImage: 'image/*',
562
587
  },
563
588
  uploadTypeArr: [
564
- 'group-upload',
589
+ // 'group-upload',
565
590
  'importArticles',
566
591
  'importWorks',
567
592
  'videoLink',
@@ -892,7 +917,8 @@ export default {
892
917
  shouldShow: ({editor, view, state, oldState, from, to}) => {
893
918
  _this.encIndex = state.selection.$from.parent.attrs
894
919
  if (_this.encIndex && _this.encIndex.titleId) {
895
- return state.selection.$from.parent.attrs.titleId === 'mu'
920
+ let titleIdArr = state.selection.$from.parent.attrs.titleId.split(' ')
921
+ return state.selection.$from.parent.attrs.titleId === 'mu' || titleIdArr.indexOf('mu')!==-1
896
922
  } else {
897
923
  return false
898
924
  }
@@ -986,15 +1012,18 @@ export default {
986
1012
  let typeArr = ['superscript', 'underline', 'link']
987
1013
  if (typeArr.indexOf(marks && marks.length && marks[marks.length - 1].type) !== -1) {
988
1014
  if (!item.content[j + 1] || item.content[j + 1].text.indexOf(' ') !== 0) {
1015
+ let historica = []
989
1016
  for (let k = 0; k < _this.interpositionData.length; k++) {
990
1017
  if (_this.interpositionData[k].id.toString() === item.content[j].text) {
991
- let historica = _this.interpositionData.splice(k, 1)
1018
+ historica = _this.interpositionData.splice(k, 1)
992
1019
  _this.historicalData.push(historica[0])
993
1020
  }
994
- console.log('onUpdate', _this.historicalData)
995
1021
  }
996
1022
  item.content.splice(j, 1)
997
1023
  editor.chain().setContent(json).run()
1024
+ if (_this.literature.indexOf(historica[0].type) !== -1) {
1025
+ _this.delReferenceMenu(historica[0])
1026
+ }
998
1027
  break
999
1028
  }
1000
1029
  }
@@ -1078,6 +1107,9 @@ export default {
1078
1107
  },
1079
1108
  emits: ['confirm', 'enclosure', 'enlDownload', 'enlSee'],
1080
1109
  methods: {
1110
+ checkboxTao(checkboxObj){
1111
+ this.checkbox = checkboxObj.value
1112
+ },
1081
1113
  closeDataShowPopup(item) {
1082
1114
  item.isShow = false
1083
1115
  item.edit = false
@@ -1092,10 +1124,11 @@ export default {
1092
1124
  for (let j = 0; j < item.content.length; j++) {
1093
1125
  if (item.content[j].marks && item.content[j].marks.length) {
1094
1126
  let typeArr = ['taggingMenu', 'nounExplain', 'importArticles', 'importWorks', 'videoLink', 'linkCourseware', 'periodical', 'dissertation', 'writings', 'newspaper', 'customize']
1127
+ let historica = []
1095
1128
  if (typeArr.indexOf(type) !== -1) {
1096
1129
  for (let k = 0; k < this.interpositionData.length; k++) {
1097
1130
  if (this.interpositionData[k].id === id) {
1098
- let historica = this.interpositionData.splice(k, 1)
1131
+ historica = this.interpositionData.splice(k, 1)
1099
1132
  this.historicalData.push(historica[0])
1100
1133
  }
1101
1134
  }
@@ -1107,6 +1140,9 @@ export default {
1107
1140
  }
1108
1141
  item.content.splice(j, 1)
1109
1142
  this.editor.chain().setContent(json).run()
1143
+ if (this.literature.indexOf(historica[0].type) !== -1) {
1144
+ this.delReferenceMenu(historica[0])
1145
+ }
1110
1146
  break
1111
1147
  }
1112
1148
  }
@@ -1123,6 +1159,9 @@ export default {
1123
1159
  }
1124
1160
  item.content.splice(j, 1)
1125
1161
  this.editor.chain().setContent(json).run()
1162
+ if (this.literature.indexOf(historica[0].type) !== -1) {
1163
+ this.delReferenceMenu(historica[0])
1164
+ }
1126
1165
  }
1127
1166
  }
1128
1167
  }
@@ -1131,7 +1170,6 @@ export default {
1131
1170
  },
1132
1171
  //修改注释 文献
1133
1172
  editAnnotatedLiterature(bubbleData) {
1134
- console.log('bubbleData', bubbleData)
1135
1173
  // 添加标注
1136
1174
  if (bubbleData.type === 'nounExplain') {
1137
1175
  // this.isShowExegesis = true
@@ -1526,6 +1564,8 @@ export default {
1526
1564
  // 删除附件
1527
1565
  enlDel() {
1528
1566
  const json = this.editor.getJSON()
1567
+ let delTitle = true
1568
+ let index = 0
1529
1569
  for (let i = 0; i < json.content.length; i++) {
1530
1570
  const val = json.content[i].attrs?.signId
1531
1571
  if (val === this.encIndex.signId) {
@@ -1534,6 +1574,20 @@ export default {
1534
1574
  break
1535
1575
  }
1536
1576
  }
1577
+ for (let j = 0; j < json.content.length; j++) {
1578
+ const signId = json.content[j].attrs?.signId
1579
+ if (signId === 'enclosure') {
1580
+ index = j
1581
+ }
1582
+ if (signId && signId.includes('u-')) {
1583
+ delTitle = false
1584
+ break
1585
+ }
1586
+ }
1587
+ if (delTitle) {
1588
+ json.content.splice(index, 1)
1589
+ this.editor?.commands.setContent(json)
1590
+ }
1537
1591
  },
1538
1592
  signMenu(next) { // 签名菜单
1539
1593
  this.signMenuShow = !this.signMenuShow
@@ -1716,23 +1770,23 @@ export default {
1716
1770
  let linkTypeArr = ['linkWorks', 'linkArticle', 'linkImage']
1717
1771
  // this.bubbleData = this.interpositionData.filter(item => item.id === text)[0]
1718
1772
  this.interpositionData.forEach(item => {
1719
- if(item.id === text){
1720
- if (linkTypeArr.indexOf(item.type) !== -1){
1773
+ if (item.id === text) {
1774
+ if (linkTypeArr.indexOf(item.type) !== -1) {
1721
1775
  window.open(item.url, '_blank');
1722
1776
  return
1723
1777
  }
1724
- item.isShow=true
1778
+ item.isShow = true
1725
1779
  }
1726
1780
  })
1727
1781
  if (href) {
1728
1782
  // this.bubbleData = this.interpositionData.filter(item => item.id === href)[0]
1729
1783
  this.interpositionData.forEach(item => {
1730
- if(item.id === href){
1731
- if (linkTypeArr.indexOf(item.type) !== -1){
1784
+ if (item.id === href) {
1785
+ if (linkTypeArr.indexOf(item.type) !== -1) {
1732
1786
  window.open(item.url, '_blank');
1733
1787
  return
1734
1788
  }
1735
- item.isShow=true
1789
+ item.isShow = true
1736
1790
  }
1737
1791
  })
1738
1792
  }
@@ -1964,21 +2018,43 @@ export default {
1964
2018
  }
1965
2019
  if (v === 'group-upload') {
1966
2020
  up.customInsert(res, file, async (name, url) => {
1967
- const b = await this.signIdData('paragraph')
2021
+ // const b = await this.signIdData('paragraph')
1968
2022
  const t = await this.signIdData('enclosure')
2023
+ const r = await this.signIdData('reference')
1969
2024
  const html = butJson(this.editor, this.menusText)[v].html
1970
- if (b === -1) {
2025
+ if(r===-1){
1971
2026
  const last = this.editor.state.selection.$anchor.path[0].content.size
1972
2027
  if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
1973
2028
  const num = this.upSort(this.editor, 'enclosure')
1974
- const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
1975
- 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>`
2029
+ const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="indent mu"><span>${num.num}. ${name}</span></p>`
1980
2030
  this.editor.chain().focus().insertContentAt(num.len, html2).run()
2031
+ const json = this.editor.getJSON()
2032
+ for (let i = 0; i < json.content.length; i++) {
2033
+ const item = json.content[i]
2034
+ if( item.attrs.signId === 'enclosure'&&item.content[0].text==='附件列表:'){
2035
+ item.attrs.titleId = this.checkbox? 'indent' : null
2036
+ }
2037
+ }
2038
+ this.editor.chain().setContent(<p></p>).run()
2039
+ this.editor.chain().setContent(json).run()
2040
+ this.isShowUpload = false
2041
+ return
1981
2042
  }
2043
+ const num1 = this.upSort(this.editor, 'reference')
2044
+ if (t === -1) this.editor.chain().focus().insertContentAt(num1.len-7, html).run()
2045
+ const num = this.upSort(this.editor, 'enclosure')
2046
+ const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="indent mu"><span>${num.num}. ${name}</span></p>`
2047
+ this.editor.chain().focus().insertContentAt(num.len, html2).run()
2048
+ const json = this.editor.getJSON()
2049
+ for (let i = 0; i < json.content.length; i++) {
2050
+ const item = json.content[i]
2051
+ if( item.attrs.signId === 'enclosure'&&item.content[0].text==='附件列表:'){
2052
+ item.attrs.titleId = this.checkbox? 'indent' : null
2053
+ }
2054
+ }
2055
+ this.editor.chain().setContent(<p></p>).run()
2056
+ this.editor.chain().setContent(json).run()
2057
+ this.isShowUpload = false
1982
2058
  })
1983
2059
  }
1984
2060
  if (v === 'uploadImage') {
@@ -2257,36 +2333,85 @@ export default {
2257
2333
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2258
2334
  // const html = butJson(this.editor, this.menusText)[data.key].html
2259
2335
  const b = await this.signIdData('red') // 判断是否有红头文件
2260
- const r = await this.signIdData('subject')
2336
+ const r = await this.signIdData('subject')// 判断是否有题目
2261
2337
  if (b === -1) {
2262
2338
  if (r === -1) this.editor.chain().focus().insertContentAt(0, html).run()
2263
2339
  } else {
2264
2340
  if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
2265
2341
  }
2266
2342
  }
2343
+ // 作者
2344
+ if (key.key === 'authorMenu') {
2345
+ const html = menusHtml.filter(item => item.key == key.key)[0].html
2346
+ const b = await this.signIdData('subject') // 判断是否有题目
2347
+ const r = await this.signIdData('author')// 判断是否有作者
2348
+ const a = await this.signIdData('red') // 判断是否有红头文件
2349
+ if (b === -1) {
2350
+ if (a === -1) {
2351
+ if (r === -1) this.editor.chain().focus().insertContentAt(0, html).run()
2352
+ return
2353
+ }
2354
+ if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
2355
+ return
2356
+ }
2357
+ if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
2358
+ }
2267
2359
  // 摘要
2268
2360
  if (key.key === 'abstractMenu') {
2269
2361
  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()
2362
+ const a = await this.signIdData('red') // 判断是否有红头文件
2363
+ const b = await this.signIdData('subject') // 判断是否有题目
2364
+ const r = await this.signIdData('author')// 判断是否有作者
2365
+ const n = await this.signIdData('abstract')// 判断是否有摘要
2366
+ if (r === -1) {
2367
+ if (b === -1) {
2368
+ if (a === -1) {
2369
+ if (n === -1) this.editor.chain().focus().insertContentAt(0, html).run()
2370
+ return
2371
+ }
2372
+ if (n === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
2373
+ return
2374
+ }
2375
+ if (n === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
2376
+ return
2377
+ }
2378
+ if (n === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('author'), html).run()
2272
2379
  }
2273
2380
  // 关键词
2274
2381
  if (key.key === 'keywordMenu') {
2275
2382
  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()
2383
+ const a = await this.signIdData('red') // 判断是否有红头文件
2384
+ const b = await this.signIdData('subject') // 判断是否有题目
2385
+ const r = await this.signIdData('author')// 判断是否有作者
2386
+ const n = await this.signIdData('abstract')// 判断是否有摘要
2387
+ const k = await this.signIdData('keyword')// 判断是否有关键词
2388
+ if (n === -1) {
2389
+ if (r === -1) {
2390
+ if (b === -1) {
2391
+ if (a === -1) {
2392
+ if (k === -1) this.editor.chain().focus().insertContentAt(0, html).run()
2393
+ return
2394
+ }
2395
+ if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
2396
+ return
2397
+ }
2398
+ if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
2399
+ return
2400
+ }
2401
+ if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('author'), html).run()
2402
+ return
2403
+ }
2404
+ if (k === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('abstract'), html).run()
2278
2405
  }
2279
2406
  // 标题
2280
2407
  if (key.key === 'paragraphTitle') {
2281
2408
  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()
2409
+ this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2284
2410
  }
2285
2411
  // 正文
2286
2412
  if (key.key === 'paragraphBody') {
2287
2413
  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()
2414
+ this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2290
2415
  }
2291
2416
  // 信息源
2292
2417
  if (key.key === 'sourcesInfo') {
@@ -2298,47 +2423,65 @@ export default {
2298
2423
  if (key.key === 'paragraphMenu') {
2299
2424
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2300
2425
  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')
2426
+ const r = await this.signIdData('paragraph')//落款
2427
+ const b = await this.signIdData('ack')//致谢
2428
+ const n = await this.signIdData('enclosure')//附件
2429
+ const a = await this.signIdData('reference')//参考文献
2303
2430
  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()
2431
+ if(n===-1){
2432
+ if(a===-1){
2433
+ if (r === -1) this.editor.chain().focus().insertContentAt(last, html).run()
2434
+ return
2435
+ }
2436
+ const num = this.selectionPath('reference')
2437
+ if (r === -1) this.editor.chain().focus().insertContentAt(num - 7, html).run()
2438
+ return
2439
+ }
2440
+ const num = this.selectionPath('enclosure')
2441
+ if (r === -1) this.editor.chain().focus().insertContentAt(num - 7, html).run()
2442
+ return
2308
2443
  }
2444
+ const num = this.upSort(this.editor, 'ack')
2445
+ if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
2309
2446
  }
2310
2447
  // 致谢
2311
2448
  if (key.key === 'ackMenu') {
2312
2449
  const html = menusHtml.filter(item => item.key == key.key)[0].html
2313
2450
  const last = this.editor.state.selection.$anchor.path[0].content.size
2314
2451
  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()
2452
+ const b = await this.signIdData('enclosure')//附件
2453
+ const a = await this.signIdData('reference')//参考文献
2454
+ if(b===-1){
2455
+ if(a===-1){
2456
+ if (r === -1) {
2457
+ this.editor.chain().focus().insertContentAt(last, html[0]).run()
2458
+ this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
2459
+ }
2460
+ return
2461
+ }
2462
+ const num = this.upSort(this.editor, 'reference')
2463
+ if (r === -1) {
2464
+ this.editor.chain().focus().insertContentAt(num.len - 7, html[0]).run()
2465
+ this.editor.chain().focus().insertContentAt(num.len-3, html[1]).run()
2466
+ }
2467
+ return
2318
2468
  }
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()
2469
+ const num = this.selectionPath('enclosure')
2470
+ if (r === -1) {
2471
+ this.editor.chain().focus().insertContentAt(num-7, html[0]).run()
2472
+ const ackNum = this.selectionPath('ack')
2473
+ this.editor.chain().focus().insertContentAt(ackNum, html[1]).run()
2329
2474
  }
2475
+
2476
+ // if(a===-1){
2477
+ // if (r === -1) {
2478
+ // this.editor.chain().focus().insertContentAt(last, html[0]).run()
2479
+ // this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
2480
+ // }
2481
+ // }else {
2482
+ // // if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
2483
+ // }
2330
2484
  }
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
2485
  }
2343
2486
 
2344
2487
  if (data.key === 'textMenu' && key === 0 || data.key === 'titleMenu' && key === 0) return
@@ -2372,13 +2515,15 @@ export default {
2372
2515
  // this.editor.commands.unsetTitleId()
2373
2516
  // return
2374
2517
  // }
2375
- // this.editor.commands.setTitleId(key.key)
2518
+ // this.editor.commands.setTitleId('indent')
2376
2519
  // }
2377
2520
  // if (key.key === 'LineSpace') {
2521
+ // }
2378
2522
  this.showDragPopup = true
2379
2523
  const index = this.editor.state.selection.$anchor.path[1]
2380
2524
  const json = this.editor.getJSON()
2381
2525
  const margin = json.content[index].attrs.margin
2526
+ console.log('attrs',json.content[index].attrs)
2382
2527
  const lineHeight = json.content[index].attrs.lineHeightId
2383
2528
  if (!margin === false) {
2384
2529
  const marginArr = margin.split(' ').map(item => item.replace('px', ''))
@@ -2392,7 +2537,6 @@ export default {
2392
2537
  const index = lineHeight.split('-')[1]
2393
2538
  this.paragraph.distance = child[index - 1]
2394
2539
  }
2395
- // }
2396
2540
  }
2397
2541
  // 字体
2398
2542
  if (data.key === 'titleMenu') {
@@ -2462,6 +2606,9 @@ export default {
2462
2606
  }
2463
2607
  // 插入
2464
2608
  if (data.key === 'interposition') {
2609
+ if(key.key === 'group-upload'){
2610
+ this.isShowUpload = true
2611
+ }
2465
2612
  // 添加图片
2466
2613
  if (key.key === 'group-image') {
2467
2614
  if (childKey.key === 'insertImage') {
@@ -2582,6 +2729,7 @@ export default {
2582
2729
  }
2583
2730
  const html = `<sup>[${res[0]}]</sup> `
2584
2731
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2732
+ this.addReferenceMenu(dataInfo)
2585
2733
  this.documentClick()
2586
2734
  }).catch((err) => {
2587
2735
  console.log('取消', err)
@@ -2647,6 +2795,7 @@ export default {
2647
2795
  }
2648
2796
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2649
2797
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2798
+ this.addReferenceMenu(dataInfo)
2650
2799
  this.documentClick()
2651
2800
  }).catch((err) => {
2652
2801
  console.log('取消', err)
@@ -2712,6 +2861,7 @@ export default {
2712
2861
  }
2713
2862
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2714
2863
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2864
+ this.addReferenceMenu(dataInfo)
2715
2865
  this.documentClick()
2716
2866
  }).catch((err) => {
2717
2867
  console.log('取消', err)
@@ -2773,6 +2923,7 @@ export default {
2773
2923
  }
2774
2924
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2775
2925
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2926
+ this.addReferenceMenu(dataInfo)
2776
2927
  this.documentClick()
2777
2928
  }).catch((err) => {
2778
2929
  console.log('取消', err)
@@ -2811,6 +2962,7 @@ export default {
2811
2962
  }
2812
2963
  const html = `<sup>[${res[0]}]</sup><span> </span>`
2813
2964
  this.editor.chain().focus().insertContentAt(this.selection(), html).run()
2965
+ this.addReferenceMenu(dataInfo)
2814
2966
  this.documentClick()
2815
2967
  }).catch((err) => {
2816
2968
  console.log('取消', err)
@@ -2829,10 +2981,17 @@ export default {
2829
2981
  },
2830
2982
  // 段落设置
2831
2983
  paragraphSetting() {
2984
+ const selectionIndex = this.editor.state.selection.$anchor.path[1]
2985
+ const json = this.editor.getJSON()
2986
+ const titleId = json.content[selectionIndex].attrs.titleId
2832
2987
  this.editor.commands.setMargin(`${this.paragraph.top}px ${this.paragraph.right}px ${this.paragraph.bottom}px ${this.paragraph.left}px`)
2833
2988
  let child = ['1', '1.25', '1.5', '2', '2.5', '3']
2834
2989
  let index = this.paragraph?.distance ? child.indexOf(this.paragraph?.distance) + 1 : 2
2835
2990
  this.editor.commands.setLineHeightId(`ling-${index}`)
2991
+ if(!titleId===false){
2992
+ this.editor.commands.unsetTitleId()
2993
+ this.editor.commands.setTitleId(titleId)
2994
+ }
2836
2995
  this.showDragPopup = false
2837
2996
  },
2838
2997
  taggingMenuSubmit() {
@@ -3103,7 +3262,47 @@ export default {
3103
3262
  } else {
3104
3263
  return false;
3105
3264
  }
3106
- }
3265
+ },
3266
+
3267
+ async addReferenceMenu(data) {
3268
+ const t = await this.signIdData('reference')
3269
+ 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>`
3270
+ const html2 = `<p contenteditable="false" data-signId="r-${data.number}"><span style="font-family: FangSong;font-size: 12px;line-height25px">${data.text}</span></p>`
3271
+ const last = this.editor.state.selection.$anchor.path[0].content.size
3272
+ if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
3273
+ let last1 = this.editor.state.selection.$anchor.path[0].content.size
3274
+ // const num = this.selectionPath('reference')
3275
+ // console.log(num)
3276
+ this.editor.chain().focus().insertContentAt(last1, html2).run()
3277
+ },
3278
+
3279
+ delReferenceMenu(data) {
3280
+ const json = this.editor.getJSON()
3281
+ let delTitle = true
3282
+ let index = 0
3283
+ for (let i = 0; i < json.content.length; i++) {
3284
+ const val = json.content[i].attrs?.signId
3285
+ if (val === `r-${data.number}`) {
3286
+ json.content.splice(i, 1)
3287
+ this.editor?.commands.setContent(json)
3288
+ break
3289
+ }
3290
+ }
3291
+ for (let j = 0; j < json.content.length; j++) {
3292
+ const signId = json.content[j].attrs?.signId
3293
+ if (signId === 'reference') {
3294
+ index = j
3295
+ }
3296
+ if (signId && signId.includes('r-')) {
3297
+ delTitle = false
3298
+ break
3299
+ }
3300
+ }
3301
+ if (delTitle) {
3302
+ json.content.splice(index, 1)
3303
+ this.editor?.commands.setContent(json)
3304
+ }
3305
+ },
3107
3306
  }
3108
3307
  }
3109
3308
  </script>
@@ -3171,7 +3370,7 @@ export default {
3171
3370
  }
3172
3371
 
3173
3372
  :deep(p[data-signid="subject"]) {
3174
- padding-bottom: 20px;
3373
+ padding-bottom: 15px;
3175
3374
  }
3176
3375
 
3177
3376
  :deep(.author) {
@@ -3557,8 +3756,7 @@ li {
3557
3756
 
3558
3757
 
3559
3758
  .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;
3759
+ //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
3760
  }
3563
3761
 
3564
3762
  .menu-one-text {
@@ -3817,4 +4015,23 @@ li {
3817
4015
  flex-direction: row;
3818
4016
  justify-content: flex-end;
3819
4017
  }
4018
+
4019
+ .check-upload label{
4020
+ display: flex;
4021
+ flex-direction: row;
4022
+ align-items: center;
4023
+ line-height: 1;
4024
+ }
4025
+
4026
+ .check-upload span{
4027
+ padding-left: 10px;
4028
+ }
4029
+
4030
+ .upload-box{
4031
+ padding: 50px 40px;
4032
+ height: 100%;
4033
+ display: flex;
4034
+ flex-direction: column;
4035
+ justify-content: space-between;
4036
+ }
3820
4037
  </style>
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.354',
87
87
  install,
88
88
  Calendar,
89
89
  Message,