zydx-plus 1.35.542 → 1.35.543

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.35.542",
3
+ "version": "1.35.543",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1,8 +1,14 @@
1
1
  <template>
2
2
  <div :style="heightStyle" class="edit">
3
3
  <div :class="{'ed-head': !titleVertical, 'ed-head-vertical': titleVertical}">
4
- <div v-if="titleShow && titleVertical" :style="titleStyle" v-html="title"></div>
5
- <div class="ed-title" v-if="titleShow && !titleVertical" :style="titleStyle" v-html="title"></div>
4
+ <div v-if="titleShow && titleVertical">
5
+ <div :style="titleStyle" v-html="title"></div>
6
+ <slot name='titleSuffix'></slot>
7
+ </div>
8
+ <div class="ed-title" v-if="titleShow && !titleVertical">
9
+ <span :style="titleStyle" v-html="title"></span>
10
+ <slot name='titleSuffix'></slot>
11
+ </div>
6
12
  <div class="ed-but" v-if="readOnly">
7
13
  <div class="ed-head-but" v-for="(item,index) in toolbar">
8
14
  <button v-if="item.key === 'but'" class="buts" @click="item.onClick(item,info)"
@@ -20,6 +26,7 @@
20
26
  :style="{color: (voiceStatus)? '#4B0C77' :'#000'}">{{ voiceStatus ? '关闭语音' : '语音输入' }}
21
27
  </button>
22
28
  <button v-if='isShowAiTool' class="buts" @click="showAi">AI助手</button>
29
+ <slot name='toolBtn'></slot>
23
30
  </div>
24
31
  </div>
25
32
  <zydx-chat v-model='isShowAi'></zydx-chat>
@@ -520,6 +527,10 @@ export default {
520
527
  const text2 = text.replace(/[\r\n]/g, '').replace(/\s*/g, '')
521
528
  this.editor.chain().focus().insertContentAt(this.selection(), text2).run()
522
529
  },
530
+ addContent(text) {
531
+ const text2 = text.replace(/[\r\n]/g, '').replace(/\s*/g, '')
532
+ this.editor.chain().focus().insertContentAt(this.selection(), text2).run()
533
+ },
523
534
  to16kHz(audioData, sampleRate = 44100) {
524
535
  const data = new Float32Array(audioData);
525
536
  const fitCount = Math.round(data.length * (16000 / sampleRate));
@@ -194,7 +194,8 @@ export default {
194
194
  doc: null,
195
195
  viewWidth: 0,
196
196
  viewHeight: 0,
197
- annotations: []
197
+ annotations: [],
198
+ inits: true
198
199
  }
199
200
  },
200
201
  props: {
@@ -249,6 +250,18 @@ export default {
249
250
  }
250
251
  },
251
252
  watch: {
253
+ annotationsData: {
254
+ handler: function (val) {
255
+ console.log(val)
256
+ if(typeof val === Object) {
257
+ this.annotations.push(val)
258
+ }else {
259
+ this.annotations = val.concat(this.annotations)
260
+ }
261
+ },
262
+ deep: true,
263
+ immediate: true
264
+ },
252
265
  pointsData: {
253
266
  handler: function (val) {
254
267
  if (!val) return
@@ -323,6 +336,7 @@ export default {
323
336
  },
324
337
  emits: ['flip','annotationTap'],
325
338
  mounted() {
339
+ this.inits = true
326
340
  if (!this.doublePage) {
327
341
  this.id = 'canvas-wrap' + this.generateUniqueKey()
328
342
  }
@@ -348,7 +362,7 @@ export default {
348
362
  let timestamp = 'flip' + Math.random().toString(36).substr(2)
349
363
  this.replaceSelectedStrByEle(timestamp)
350
364
  const elements = document.querySelectorAll(`.${timestamp}`)[0];
351
- if(!elements) return
365
+ if(!elements) return next(false)
352
366
  const wid = this.$refs.wrap.offsetWidth - 10
353
367
  const hei = this.$refs.wrap.offsetHeight - 10
354
368
  const hei2 = elements.offsetHeight - 8
@@ -414,10 +428,10 @@ export default {
414
428
  return range
415
429
  },
416
430
  styleAnnotation(v) {
417
- const x1 = (v.rect[0] * this.scales / this.viewport.width) * 100
418
- const y1 = ((this.viewport.height - (v.rect[1] * this.scales)) / this.viewport.height) * 100
419
- const x2 = (((v.rect[2] - v.rect[0]) * this.scales) / this.viewport.width) * 100
420
- const y2 = (((v.rect[3] - v.rect[1]) * this.scales) / this.viewport.height) * 100
431
+ const x1 = (v.rect[0] * this.scales / this.viewport?.width) * 100
432
+ const y1 = ((this.viewport?.height - (v.rect[1] * this.scales)) / this.viewport?.height) * 100
433
+ const x2 = (((v.rect[2] - v.rect[0]) * this.scales) / this.viewport?.width) * 100
434
+ const y2 = (((v.rect[3] - v.rect[1]) * this.scales) / this.viewport?.height) * 100
421
435
  return {
422
436
  'left': x1 - 0.2 + '%',
423
437
  'top': (y1 - y2) - 0.2 + '%',
@@ -1362,7 +1376,7 @@ export default {
1362
1376
  let viewport = page.getViewport({scale: that.scales})
1363
1377
  that.viewport = viewport
1364
1378
  const sc = (viewport.width / viewport.height).toFixed(2)
1365
- const wid = that.$refs.wrap.offsetWidth - 10
1379
+ const wid = that.$refs.wrap?.offsetWidth - 10
1366
1380
  const hei = wid / sc
1367
1381
  canvas.width = wid * that.sratio
1368
1382
  canvas.height = hei * that.sratio
@@ -1390,7 +1404,15 @@ export default {
1390
1404
  that.styles = res.styles
1391
1405
  })
1392
1406
  page.getAnnotations().then((res) => {
1393
- that.annotations = res.concat(that.annotationsData)
1407
+ console.log(that.inits)
1408
+ if(that.inits) {
1409
+ that.annotations = res.concat(that.annotationsData)
1410
+ setTimeout(() => {
1411
+ that.inits = false
1412
+ },1000)
1413
+ }else {
1414
+ that.annotations = res
1415
+ }
1394
1416
  })
1395
1417
  that.loading = false
1396
1418
  if (that.oneIndex === 'right') {
@@ -1466,7 +1488,14 @@ export default {
1466
1488
  item.styles = res.styles
1467
1489
  })
1468
1490
  page.getAnnotations().then((res) => {
1469
- item.annotations = res
1491
+ if(that.inits) {
1492
+ item.annotations = res.concat(that.annotationsData)
1493
+ setTimeout(() => {
1494
+ that.inits = false
1495
+ },1000)
1496
+ }else {
1497
+ item.annotations = res
1498
+ }
1470
1499
  })
1471
1500
  that.loading = false
1472
1501
  if (that.oneIndex === 'right') {
package/src/index.js CHANGED
@@ -89,7 +89,7 @@ function install(app) {
89
89
  }
90
90
 
91
91
  export default {
92
- version: '1.35.542',
92
+ version: '1.35.543',
93
93
  install,
94
94
  Calendar,
95
95
  Message,