zydx-plus 1.35.552 → 1.35.554

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.552",
3
+ "version": "1.35.554",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -3,6 +3,7 @@
3
3
  <drag-popup
4
4
  v-if='modelValue'
5
5
  ref="dragPopup"
6
+ class='popup_chat'
6
7
  :title="title"
7
8
  :width="960"
8
9
  :height="400"
@@ -363,6 +364,10 @@ export default {
363
364
  </script>
364
365
 
365
366
  <style scoped>
367
+ /* 避免AI助手弹出层级小于全局弹窗 */
368
+ .popup_chat{
369
+ z-index: 10001;
370
+ }
366
371
  .disabled{
367
372
  opacity: 0.5;
368
373
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div ref="only" :class="`z-editor z-editor-${refSrc}`"
3
- :style="!readOnly&&showBorder?'border: 1px solid rgba(204, 204, 204, 1);':''">
3
+ :style="[!readOnly&&showBorder?'border:1px solid rgba(204, 204, 204, 1);':'',readOnly?'overflow-y:auto;':'']">
4
4
  <div v-show="!readOnly" class="editor-header">
5
5
  <div v-for="(item,index) in butData" :key="index" class="editor-but">
6
6
  <div v-if="uploadTypeArr.indexOf(item.key) !== -1" class="editor-but-name">
@@ -3014,6 +3014,8 @@ export default {
3014
3014
  },
3015
3015
 
3016
3016
  async butTap(data, key, childKey) {
3017
+ // 标志
3018
+ if (data.key === 'signMenu') this.signMenuShow = !this.signMenuShow
3017
3019
  if (!key.key) return
3018
3020
  // 切换版式
3019
3021
  if (data.key === 'switchingFormat') {
@@ -3242,8 +3244,6 @@ export default {
3242
3244
  // }
3243
3245
  }*/
3244
3246
  }
3245
- // 标志
3246
- if (data.key === 'signMenu') this.signMenuShow = !this.signMenuShow
3247
3247
  // 红头文件
3248
3248
  if (data.key === 'redMenu') {
3249
3249
  const html = butJson(this.editor, this.menusText)[data.key].html
@@ -4413,7 +4413,7 @@ export default {
4413
4413
 
4414
4414
  .read-only {
4415
4415
  position: relative;
4416
- margin: 0 auto;
4416
+ margin: 8px auto;
4417
4417
  display: flex;
4418
4418
  flex-direction: column;
4419
4419
  align-items: center;
@@ -4602,9 +4602,9 @@ li {
4602
4602
  .z-editor {
4603
4603
  position: relative;
4604
4604
  width: 100%;
4605
- max-height: 900px;
4606
- overflow-y: auto;
4605
+ max-height: 952px;
4607
4606
  scrollbar-width: none;
4607
+ overflow: hidden;
4608
4608
  }
4609
4609
 
4610
4610
  .editor-header {
@@ -217,6 +217,7 @@ export default {
217
217
  paintShow: false,
218
218
  isShowAi: false,
219
219
  lastSelectedText: '',
220
+ updateInit: false,
220
221
  }
221
222
  },
222
223
  beforeUnmount() {
@@ -341,6 +342,10 @@ export default {
341
342
  enclosureButton: {
342
343
  type: Object,
343
344
  default: {}
345
+ },
346
+ updateStatus: {
347
+ type: Boolean,
348
+ default: false
344
349
  }
345
350
  },
346
351
  emits: ['see', 'del', 'complete', 'update:data', 'enclosureSuccess', 'download', 'updateData'],
@@ -348,6 +353,8 @@ export default {
348
353
  // 强制监听data变化
349
354
  data: {
350
355
  handler: function (e, oldVal) {
356
+ if(this.updateInit) return
357
+ if(this.updateStatus) this.updateInit = true
351
358
  this.editor?.commands.setContent(json2html({node: "root", child: (e.html === undefined || e.html === null || e.html === 'null') ? [] : e.html}))
352
359
  this.uploadAttData = (e.enclosure === undefined || e.enclosure === null || e.html === 'null') ? [] : this.enclosureAction(e.enclosure)
353
360
  },
@@ -200,7 +200,8 @@ export default {
200
200
  "children": []
201
201
  },
202
202
  fullShow: true,
203
- layoutList: ''
203
+ layoutList: '',
204
+ updateInit: false,
204
205
  }
205
206
  },
206
207
  props: {
@@ -220,7 +221,11 @@ export default {
220
221
  protectShow: {
221
222
  type: Boolean,
222
223
  default: true
223
- }
224
+ },
225
+ updateStatus: {
226
+ type: Boolean,
227
+ default: false
228
+ }
224
229
  },
225
230
  watch: {
226
231
  readOnly: {
@@ -232,6 +237,8 @@ export default {
232
237
  },
233
238
  data: {
234
239
  handler: function (val) {
240
+ if(this.updateInit) return
241
+ if(this.updateStatus) this.updateInit = true
235
242
  if(Object.keys(val).length === 0) {
236
243
  this.mindMap?.setData(this.defaultData)
237
244
  }else {
@@ -49,7 +49,7 @@
49
49
  <td rowspan="2">{{ item.allScore }}</td>
50
50
  <td rowspan="2" v-if="!readOnlys&&butShows">
51
51
  <span class="buts" v-if="empty">-</span>
52
- <button v-else class="but" @click="cancel(index)">撤销选择</button>
52
+ <button v-else class="but-que" @click="cancel(index)">撤销选择</button>
53
53
  </td>
54
54
  </tr>
55
55
  <tr>
@@ -354,7 +354,7 @@ export default {
354
354
  width: 80px;
355
355
  }
356
356
 
357
- .but {
357
+ .but-que {
358
358
  margin-left: 1px;
359
359
  font-size: 12px;
360
360
  background-color: transparent;
@@ -364,6 +364,7 @@ export default {
364
364
  cursor: pointer;
365
365
  min-width: 60px;
366
366
  height: 21px;
367
+ line-height: 17px;
367
368
  }
368
369
 
369
370
  .buts {
@@ -9,7 +9,6 @@ import {createRoot} from 'react-dom/client'
9
9
  import {AssetRecordType,createShapeId, Tldraw} from 'tldraw'
10
10
  import 'tldraw/tldraw.css'
11
11
  import * as buffer from "buffer";
12
- import {debounce} from "../../utils"; //引入buffer
13
12
 
14
13
  if (typeof window.Buffer === "undefined") { // 判断当前环境是否有Buffer对象
15
14
  window.Buffer = buffer.Buffer; // Buffer对象不存在则创建导入的buffer
@@ -80,6 +79,8 @@ export default {
80
79
  name: "zydx-sketchpad",
81
80
  data() {
82
81
  return {
82
+ shapeArr:[],
83
+ interval:null
83
84
  // editor: null
84
85
  }
85
86
  },
@@ -154,13 +155,23 @@ export default {
154
155
  },
155
156
  handleMountedEditor(editor) {
156
157
  editorAPP = editor
157
- editorAPP.sideEffects.registerAfterChangeHandler('shape', debounce((prev, next)=> {
158
+ editorAPP.sideEffects.registerAfterChangeHandler('shape', (prev, next)=> {
158
159
  // there can only be one red shape at a time:
159
- this.$emit('shapeChangeHandler', prev);
160
- },200) )
161
- editorAPP.sideEffects.registerAfterDeleteHandler('shape', (shape) => {
162
- // if the last shape in a frame is deleted, delete the frame too:
163
- this.$emit('shapeDeleteHandler', shape);
160
+ let typeArr = ["note","text"]
161
+ this.$emit('shapeChangeHandler',typeArr.indexOf(prev.type) !==-1? next : prev);
162
+ })
163
+ editorAPP.sideEffects.registerAfterDeleteHandler('shape', (shape, source) => {
164
+ // if the last shape in a frame is deleted, delete the frame too:\
165
+ this.shapeArr.push(shape)
166
+ if(this.shapeArr.length > 0){
167
+ this.interval = setInterval(() => {
168
+ this.$emit('shapeDeleteHandler', this.shapeArr.shift());
169
+ },300)
170
+ }else {
171
+ if(this.interval){
172
+ clearInterval(this.interval)
173
+ }
174
+ }
164
175
  })
165
176
  editorAPP.setCameraOptions({ isLocked: this.cameraIsLocked })
166
177
  editorAPP.updateInstanceState({ isToolLocked: this.isToolLocked })
@@ -193,7 +204,20 @@ export default {
193
204
  },
194
205
  //
195
206
  editorCreateShape(myShape){
196
- editorAPP?.createShape(myShape)
207
+ let shape = editorAPP?.getShape(myShape.id)
208
+ myShape = JSON.parse(JSON.stringify(myShape))
209
+ if(shape){
210
+ shape = JSON.parse(JSON.stringify(shape))
211
+ if(shape.type==="draw"){
212
+ shape.props.segments[0].points.push(myShape.props.segments[0].points.at(-1))
213
+ }else {
214
+ shape = myShape
215
+ }
216
+ editorAPP?.updateShape(shape)
217
+ }else {
218
+ editorAPP?.createShape(myShape)
219
+
220
+ }
197
221
  },
198
222
  editorDeleteShape(shapeId){
199
223
  editorAPP?.deleteShape(shapeId)
@@ -420,35 +444,69 @@ export default {
420
444
  editorAPP.setCurrentTool('highlight')
421
445
  editorAPP.updateInstanceState({ isToolLocked: this.isToolLocked })
422
446
  },
423
- insertPicture(img) {
424
- const assetId = AssetRecordType.createId()
425
- editorAPP.createAssets([{
426
- id: assetId,
427
- type: 'image',
428
- typeName: 'asset',
429
- meta: {},
430
- props: {
431
- w: img.width,
432
- h: img.height,
433
- name: 'image',
434
- src: img.src,
435
- mimeType: 'image/*',
436
- isAnimated: false,
447
+ insertPicture(img, type) {
448
+ if(type){
449
+ editorAPP.createAssets([{...img.asset}])
450
+ editorAPP.createShape({...img.img})
451
+ }else {
452
+ const assetId = AssetRecordType.createId()
453
+ editorAPP.createAssets([{
454
+ id: assetId,
455
+ type: 'image',
456
+ typeName: 'asset',
457
+ meta: {},
458
+ props: {
459
+ w: img.width,
460
+ h: img.height,
461
+ name: 'image',
462
+ src: img.src,
463
+ mimeType: 'image/*',
464
+ isAnimated: false,
465
+ }
466
+ }])
467
+ const imageId = createShapeId()
468
+ editorAPP.createShape({
469
+ id: imageId,
470
+ type: 'image',
471
+ x: 200,
472
+ y: 200,
473
+ isLocked: false,
474
+ props: {
475
+ w: img.width,
476
+ h: img.height,
477
+ assetId
478
+ },
479
+ })
480
+ let imgObj = {
481
+ asset:{
482
+ id: assetId,
483
+ type: 'image',
484
+ typeName: 'asset',
485
+ meta: {},
486
+ props: {
487
+ w: img.width,
488
+ h: img.height,
489
+ name: 'image',
490
+ src: img.src,
491
+ mimeType: 'image/*',
492
+ isAnimated: false,
493
+ }
494
+ },
495
+ img:{
496
+ id: imageId,
497
+ type: 'image',
498
+ x: 200,
499
+ y: 200,
500
+ isLocked: false,
501
+ props: {
502
+ w: img.width,
503
+ h: img.height,
504
+ assetId
505
+ },
506
+ }
437
507
  }
438
- }])
439
- const imageId = createShapeId()
440
- editorAPP.createShape({
441
- id: imageId,
442
- type: 'image',
443
- x: 200,
444
- y: 200,
445
- isLocked: false,
446
- props: {
447
- w: img.width,
448
- h: img.height,
449
- assetId
450
- },
451
- })
508
+ this.$emit('insertPicture',imgObj);
509
+ }
452
510
 
453
511
  },
454
512
  laser() {
package/src/index.js CHANGED
@@ -89,7 +89,7 @@ function install(app) {
89
89
  }
90
90
 
91
91
  export default {
92
- version: '1.35.552',
92
+ version: '1.35.554',
93
93
  install,
94
94
  Calendar,
95
95
  Message,