zydx-plus 1.20.116 → 1.20.117

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.20.116",
3
+ "version": "1.20.117",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -5,15 +5,35 @@ let numberData = null
5
5
 
6
6
  const num = {1: '①', 2: '②', 3: '③', 4: '④', 5: '⑤', 6: '⑥', 7: '⑦', 8: '⑧', 9: '⑨', 10: '⑩', 11: '⑪', 12: '⑫', 13: '⑬', 14: '⑭', 15: '⑮', 16: '⑯', 17: '⑰', 18: '⑱', 19: '⑲', 20: '⑳',}
7
7
 
8
- function typeCode(node,value) {
8
+
9
+ function resumeSing() {
10
+ return {
11
+ type: 'attachment',
12
+ fileName: signData.text,
13
+ link: signData.ico,
14
+ sign: true,
15
+ children: [{text:''}]
16
+ }
17
+ }
18
+
19
+ function typeCode(node,value,num = false) {
9
20
  let hasAttachment = false
10
- for(let i = 0; i < node.length; i++){
11
- for(let j = 0; j < node[i].children.length; j++){
12
- if(node[i].children[j].type === value) {
21
+ if(num) {
22
+ for(let i = 0; i < node.length; i++){
23
+ if(node[i][value]) {
13
24
  hasAttachment = true
14
25
  break
15
26
  }
16
27
  }
28
+ }else {
29
+ for(let i = 0; i < node.length; i++){
30
+ for(let j = 0; j < node[i].children.length; j++){
31
+ if(node[i].children[j][value]) {
32
+ hasAttachment = true
33
+ break
34
+ }
35
+ }
36
+ }
17
37
  }
18
38
  return hasAttachment
19
39
  }
@@ -30,12 +50,31 @@ function hasValue(arr, value) {
30
50
  let num = 0
31
51
  arr.some(item => {
32
52
  item.children.some(items => {
33
- if(items.sup) num++
53
+ if(items[value]) num++
34
54
  })
35
55
  })
36
56
  return num
37
57
  }
38
58
 
59
+ //分割数组
60
+ function group(array, subNum) {
61
+ let index = 0;
62
+ let newArray = [];
63
+ let num = 0
64
+ while(index < array.length) {
65
+ newArray.push(array.slice(index, index += subNum));
66
+ }
67
+ for(let i=0; i<newArray[1].length; i++) {
68
+ if(newArray[1][i].children[0].state === undefined) {
69
+ num = (i === 0)? 1 : i
70
+ break;
71
+ }else {
72
+ num = (i === 0)? 1 : i
73
+ }
74
+ }
75
+ return num;
76
+ }
77
+
39
78
  //添加标志
40
79
  class signButtonMenu {
41
80
  constructor(v) {
@@ -61,14 +100,8 @@ class signButtonMenu {
61
100
  if (this.isDisabled(editor)) return
62
101
  let node = editor.children
63
102
  let nodes = JSON.parse(JSON.stringify(node)) //拷贝一份
64
- if(typeCode(node,'attachment')) return
65
- const resume = {
66
- type: 'attachment',
67
- fileName: signData.text,
68
- link: signData.ico,
69
- children: [{text:''}]
70
- }
71
- nodes.unshift(resume)
103
+ if(typeCode(nodes,'sign')) return
104
+ nodes.unshift(resumeSing())
72
105
  addNode(editor,nodes)
73
106
  }
74
107
  }
@@ -95,18 +128,10 @@ class redButtonMenu {
95
128
  if (this.isDisabled(editor)) return
96
129
  let node = editor.children
97
130
  let nodes = JSON.parse(JSON.stringify(node)) //拷贝一份
98
- if(nodes[0].children.length === 1) nodes.splice(0,1)
99
- let hasAttachment = false
100
- for(let i = 0; i < node.length; i++){
101
- if(node[i].state === 1) {
102
- hasAttachment = true
103
- break
104
- }
105
- }
106
- if(hasAttachment) return
131
+ if(typeCode(nodes,'tou', true)) return
107
132
  const resume = {
108
133
  type: 'paragraph',
109
- state: 1,
134
+ tou: true,
110
135
  children: [
111
136
  {
112
137
  text:'XXXXXXX(单位)文件',
@@ -131,7 +156,9 @@ class redButtonMenu {
131
156
  type: 'divider',
132
157
  children: [{text:''}]
133
158
  }
134
- if(typeCode(node,'attachment')) {
159
+ if(typeCode(node,'sign')) {
160
+ nodes.splice(0,1)
161
+ nodes.splice(0,0,resumeSing())
135
162
  nodes.splice(1,0,resume)
136
163
  nodes.splice(2,0,resume1)
137
164
  nodes.splice(3,0,resume2)
@@ -304,20 +331,15 @@ class taggingButtonMenu {
304
331
  if(anchor.offset === 0) return
305
332
  let node = editor.children
306
333
  let nodes = JSON.parse(JSON.stringify(node)) //拷贝一份
307
- const numSub = hasValue(nodes,'sup')
308
- // let one = nodes[0]
309
- // nodes.splice(0,1)
310
- // nodes.unshift({
311
- // type: 'attachment',
312
- // text: one.children[0].text
313
- // })
334
+ const numSub = hasValue(nodes,'subs')
314
335
  let textNode = nodes[anchor.path[0]].children[anchor.path[1]].text
315
336
  const left = textNode.substring(0, anchor.offset)
316
337
  const right = textNode.substring(anchor.offset)
317
338
  nodes[anchor.path[0]].children[anchor.path[1]].text = left
318
339
  nodes[anchor.path[0]].children.push({
319
340
  text: num[numSub+1],
320
- sup: true
341
+ sup: true,
342
+ subs: true
321
343
  },{text: right})
322
344
  const devider = {
323
345
  type: 'divider',
@@ -334,8 +356,12 @@ class taggingButtonMenu {
334
356
  }
335
357
  let nodeType = (nodes[anchor.path[0] + 1])? nodes[anchor.path[0] + 1].type : ''
336
358
  let deviderData = [devider,devider2]
337
- if(nodeType === 'divider') deviderData = [devider2]
338
- nodes.splice(anchor.path[0] + 1, 0, deviderData)
359
+ let numNode = -1
360
+ if(nodeType === 'divider') {
361
+ numNode = group(nodes,anchor.path[0] + 2)
362
+ deviderData = [devider2]
363
+ }
364
+ nodes.splice(anchor.path[0] + 2 + numNode, 0, deviderData)
339
365
  addNode(editor,nodes)
340
366
  }
341
367
  }
package/src/index.js CHANGED
@@ -63,7 +63,7 @@ function install(app) {
63
63
  }
64
64
 
65
65
  export default {
66
- version: '1.20.116',
66
+ version: '1.20.117',
67
67
  install,
68
68
  Calendar,
69
69
  Message,