zydx-plus 1.20.115 → 1.20.116

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.115",
3
+ "version": "1.20.116",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -148,8 +148,9 @@ export default defineComponent({
148
148
 
149
149
  /*工具栏样式*/
150
150
  .toolbar {
151
- border: 1px solid #d9d9d9;
152
- margin-bottom: 20px;
151
+ border-top: 1px solid #d9d9d9;
152
+ border-left: 1px solid #d9d9d9;
153
+ border-right: 1px solid #d9d9d9;
153
154
  }
154
155
 
155
156
  /*工具栏剧中显示*/
@@ -188,4 +189,19 @@ export default defineComponent({
188
189
  :deep(.w-e-text-placeholder) {
189
190
  top: 6px;
190
191
  }
192
+ :deep(.w-e-bar-item) {
193
+ border-right: 1px solid rgba(204, 204, 204, 1);
194
+ flex: 1;
195
+ padding: 0;
196
+ height: auto;
197
+ }
198
+ :deep(.w-e-bar-item):last-child {
199
+ border-right: 0;
200
+ }
201
+ :deep(.w-e-bar):last-child {
202
+ padding: 0;
203
+ }
204
+ :deep(.w-e-bar-item-menus-container) {
205
+ margin-top: 32px;
206
+ }
191
207
  </style>
@@ -1,5 +1,7 @@
1
1
  let signData = null
2
2
  let titleData = null
3
+ let authorData = null
4
+ let numberData = null
3
5
 
4
6
  const num = {1: '①', 2: '②', 3: '③', 4: '④', 5: '⑤', 6: '⑥', 7: '⑦', 8: '⑧', 9: '⑨', 10: '⑩', 11: '⑪', 12: '⑫', 13: '⑬', 14: '⑭', 15: '⑮', 16: '⑯', 17: '⑰', 18: '⑱', 19: '⑲', 20: '⑳',}
5
7
 
@@ -181,10 +183,49 @@ class titleButtonMenu {
181
183
  editor.insertNode(resume2)
182
184
  }
183
185
  }
186
+ //作者
187
+ class authorButtonMenu {
188
+ constructor(v) {
189
+ authorData = v
190
+ this.title = '添加作者' // 自定义菜单标题
191
+ this.tag = 'button'
192
+ }
193
+ // 获取菜单执行时的 value ,用不到则返回空 字符串或 false
194
+ getValue(editor) {
195
+ return false
196
+ }
197
+ // 菜单是否需要激活(如选中加粗文本,“加粗”菜单会激活),用不到则返回 false
198
+ isActive(editor) {
199
+ return false
200
+ }
201
+ // 菜单是否需要禁用(如选中 H1 ,“引用”菜单被禁用),用不到则返回 false
202
+ isDisabled(editor) {
203
+ return false
204
+ }
205
+ // 点击菜单时触发的函数
206
+ exec(editor, value) {
207
+ if (this.isDisabled(editor)) return
208
+ const resume = {
209
+ type: 'paragraph',
210
+ children: [{
211
+ type: 'authorAttachment',
212
+ fileName: authorData.text,
213
+ children: [{text:''}]
214
+ }],
215
+ textAlign: 'center'
216
+ }
217
+ const resume2 = {
218
+ type: 'paragraph',
219
+ children: [{text:''}],
220
+ textAlign: 'left'
221
+ }
222
+ editor.insertNode(resume)
223
+ editor.insertNode(resume2)
224
+ }
225
+ }
184
226
  // 添加参考文献
185
227
  class literatureButtonMenu {
186
228
  constructor(v) {
187
- titleData = v
188
229
  this.title = '参考文献' // 自定义菜单标题
189
230
  this.tag = 'button'
190
231
  }
@@ -245,7 +286,6 @@ class literatureButtonMenu {
245
286
  // 添加标注
246
287
  class taggingButtonMenu {
247
288
  constructor(v) {
248
- titleData = v
249
289
  this.title = '添加标注' // 自定义菜单标题
250
290
  this.tag = 'button'
251
291
  }
@@ -260,32 +300,143 @@ class taggingButtonMenu {
260
300
  }
261
301
  exec(editor, value) {
262
302
  if (this.isDisabled(editor)) return
263
- const anchor = editor.selection.anchor
303
+ const anchor = editor.selection.anchor // 获取光标位置
264
304
  if(anchor.offset === 0) return
265
305
  let node = editor.children
266
306
  let nodes = JSON.parse(JSON.stringify(node)) //拷贝一份
267
307
  const numSub = hasValue(nodes,'sup')
268
- let one = nodes[0]
269
- nodes.splice(0,1)
270
- nodes.unshift({
271
- type: 'attachment',
272
- text: one.children[0].text
273
- })
308
+ // let one = nodes[0]
309
+ // nodes.splice(0,1)
310
+ // nodes.unshift({
311
+ // type: 'attachment',
312
+ // text: one.children[0].text
313
+ // })
314
+ let textNode = nodes[anchor.path[0]].children[anchor.path[1]].text
315
+ const left = textNode.substring(0, anchor.offset)
316
+ const right = textNode.substring(anchor.offset)
317
+ nodes[anchor.path[0]].children[anchor.path[1]].text = left
274
318
  nodes[anchor.path[0]].children.push({
275
319
  text: num[numSub+1],
276
320
  sup: true
277
- },{text: ' '})
278
- nodes.push({
321
+ },{text: right})
322
+ const devider = {
279
323
  type: 'divider',
280
324
  children: [{text:''}]
281
- })
282
- nodes.push({
325
+ }
326
+ const devider2 = {
283
327
  type: 'paragraph',
284
328
  children: [{
329
+ state: numSub+1,
285
330
  text: `${num[numSub+1]}填写标注内容`,
331
+ fontSize: '12px'
286
332
  }],
287
333
  textAlign: 'left'
288
- })
334
+ }
335
+ let nodeType = (nodes[anchor.path[0] + 1])? nodes[anchor.path[0] + 1].type : ''
336
+ let deviderData = [devider,devider2]
337
+ if(nodeType === 'divider') deviderData = [devider2]
338
+ nodes.splice(anchor.path[0] + 1, 0, deviderData)
339
+ addNode(editor,nodes)
340
+ }
341
+ }
342
+ // 摘要
343
+ class abstractButtonMenu {
344
+ constructor(v) {
345
+ this.title = '添加摘要' // 自定义菜单标题
346
+ this.tag = 'button'
347
+ }
348
+ getValue(editor) {
349
+ return false
350
+ }
351
+ isActive(editor) {
352
+ return false
353
+ }
354
+ isDisabled(editor) {
355
+ return false
356
+ }
357
+ exec(editor, value) {
358
+ if (this.isDisabled(editor)) return
359
+ const resume = {
360
+ type: 'paragraph',
361
+ children: [{
362
+ text: ' 摘要:',
363
+ color: '#000000',
364
+ fontSize: '12px',
365
+ bold: true
366
+ },{
367
+ text: '请填写摘要内容',
368
+ color: '#000000',
369
+ fontSize: '12px',
370
+ }],
371
+ textAlign: 'left'
372
+ }
373
+ editor.insertNode(resume)
374
+ }
375
+ }
376
+ //关键词
377
+ class keywordButtonMenu {
378
+ constructor(v) {
379
+ this.title = '关键词' // 自定义菜单标题
380
+ this.tag = 'button'
381
+ }
382
+ getValue(editor) {
383
+ return false
384
+ }
385
+ isActive(editor) {
386
+ return false
387
+ }
388
+ isDisabled(editor) {
389
+ return false
390
+ }
391
+ exec(editor, value) {
392
+ if (this.isDisabled(editor)) return
393
+ const resume = {
394
+ type: 'paragraph',
395
+ children: [{
396
+ text: ' 关键词:',
397
+ color: '#000000',
398
+ fontSize: '12px',
399
+ bold: true
400
+ },{
401
+ text: '请填写关键词内容',
402
+ color: '#000000',
403
+ fontSize: '12px',
404
+ }],
405
+ textAlign: 'left'
406
+ }
407
+ editor.insertNode(resume)
408
+ }
409
+ }
410
+ // 编号
411
+ class numberButtonMenu {
412
+ constructor(v) {
413
+ numberData = v
414
+ this.title = '标注编号' // 自定义菜单标题
415
+ this.tag = 'button'
416
+ }
417
+ getValue(editor) {
418
+ return false
419
+ }
420
+ isActive(editor) {
421
+ return false
422
+ }
423
+ isDisabled(editor) {
424
+ return false
425
+ }
426
+ exec(editor, value) {
427
+ if (this.isDisabled(editor)) return
428
+ const anchor = editor.selection.anchor // 获取光标位置
429
+ if(anchor.offset === 0) return
430
+ let node = editor.children
431
+ let nodes = JSON.parse(JSON.stringify(node)) //拷贝一份
432
+ let textNode = nodes[anchor.path[0]].children[anchor.path[1]].text
433
+ const left = textNode.substring(0, anchor.offset)
434
+ const right = textNode.substring(anchor.offset)
435
+ nodes[anchor.path[0]].children[anchor.path[1]].text = left
436
+ nodes[anchor.path[0]].children.push({
437
+ text: `【${numberData.text}】`,
438
+ sup: true
439
+ },{text: right})
289
440
  addNode(editor,nodes)
290
441
  }
291
442
  }
@@ -322,7 +473,31 @@ const taggingMenuConf = {
322
473
  return new taggingButtonMenu(v)
323
474
  },
324
475
  }
476
+ const authorMenuConf = {
477
+ key: 'authorMenu',
478
+ factory(v) {
479
+ return new authorButtonMenu(v)
480
+ },
481
+ }
482
+ const abstractMenuConf = {
483
+ key: 'abstractMenu',
484
+ factory() {
485
+ return new abstractButtonMenu()
486
+ },
487
+ }
488
+ const keywordMenuConf = {
489
+ key: 'keywordMenu',
490
+ factory() {
491
+ return new keywordButtonMenu()
492
+ },
493
+ }
494
+ const numberMenuConf = {
495
+ key: 'numberMenu',
496
+ factory(v) {
497
+ return new numberButtonMenu(v)
498
+ },
499
+ }
325
500
 
326
501
  export const menuModule = {
327
- menus: [signMenuConf,redMenuConf,titleMenuConf,literatureMenuConf,taggingMenuConf]
502
+ menus: [signMenuConf,redMenuConf,titleMenuConf,literatureMenuConf,taggingMenuConf,authorMenuConf,numberMenuConf,abstractMenuConf,keywordMenuConf]
328
503
  }
@@ -48,7 +48,27 @@ function titleAttachment(elem, children, editor) {
48
48
  )
49
49
  return attachVnode
50
50
  }
51
-
51
+ // 作者
52
+ function authorAttachment(elem, children, editor) {
53
+ const iconText = h(
54
+ 'span',
55
+ {
56
+ props: { contentEditable: false },
57
+ style: {display: 'inline-block',fontSize: '16px'}
58
+ },
59
+ [ elem.fileName ]
60
+ )
61
+ const attachVnode = h(
62
+ 'span',
63
+ {
64
+ props: { contentEditable: false },
65
+ style: { display: 'inline-block'},
66
+ // on: { click() { console.log('clicked', link) } }
67
+ },
68
+ [ iconText]
69
+ )
70
+ return attachVnode
71
+ }
52
72
 
53
73
  const renderElemConf = {
54
74
  type: 'attachment',
@@ -58,7 +78,11 @@ const titleElemConf = {
58
78
  type: 'titleAttachment',
59
79
  renderElem: titleAttachment,
60
80
  }
81
+ const authorElemConf = {
82
+ type: 'authorAttachment',
83
+ renderElem: authorAttachment,
84
+ }
61
85
 
62
86
  export const nodeModule = {
63
- renderElems: [renderElemConf,titleElemConf]
87
+ renderElems: [renderElemConf,titleElemConf,authorElemConf]
64
88
  }
@@ -24,7 +24,9 @@
24
24
  <p :style="enclosureStyle">{{ enclosureText }}</p>
25
25
  <div class="enclosure-list" v-for="(item,index) in uploadAttData">
26
26
  <div class="enclosure-item">
27
- <span>{{ index + 1 }}. {{ (item.name)? item.name : item.annexName }}</span>
27
+ <span v-if="item.name">{{ index + 1 }}. {{ item.name }}</span>
28
+ <span v-if="item.annexName">{{ index + 1 }}. {{ item.annexName }}</span>
29
+ <span v-if="item.fileName">{{ index + 1 }}. {{ item.fileName }}</span>
28
30
  </div>
29
31
  <div class="enclosure-item en-but">
30
32
  <div style="display: inline-block; height: 21px;">
package/src/index.js CHANGED
@@ -63,7 +63,7 @@ function install(app) {
63
63
  }
64
64
 
65
65
  export default {
66
- version: '1.20.115',
66
+ version: '1.20.116',
67
67
  install,
68
68
  Calendar,
69
69
  Message,