zydx-plus 1.33.354 → 1.33.356

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.354",
3
+ "version": "1.33.356",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="drag-pop" :class="{trans: transAll}" :style="position" :id="id" @click.stop="dragTap">
3
- <div class="drag-head" :style="{'background-color':titleColor}">
2
+ <div class="drag-pop" :class="{trans: transAll, 'drag-pop-shadow': !fixedStart}" :style="position" :id="id" @click.stop="dragTap">
3
+ <div v-show="!fixedStart" class="drag-head" :style="{'background-color':titleColor}">
4
4
  <span @mousedown.stop="mousedown"
5
5
  @mousemove.stop="mousemove"
6
6
  @mouseup.stop="mouseup"
@@ -14,16 +14,18 @@
14
14
  <i v-if="closeShow" @click.stop="close"></i>
15
15
  </div>
16
16
  </div>
17
- <div :class="{'drag-cont': dragStatus || dragTextShow,'drag-conts': !dragStatus || !dragTextShow}"
17
+ <div :class="{'drag-cont2': fixedStart,'drag-cont': dragStatus || dragTextShow,'drag-conts': !dragStatus || !dragTextShow}"
18
18
  @mousemove.stop="footMove" @mouseleave.stop="footMove">
19
19
  <div class="drag-cont-slot">
20
20
  <slot name="content"></slot>
21
21
  </div>
22
- <i class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>
23
- <i class="drag-in" v-if="dragStatus" @mousedown.stop="footDown($event,'in')" @mouseup.stop="footUp"></i>
24
- <i class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>
22
+ <div v-show="!fixedStart">
23
+ <i class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>
24
+ <i class="drag-in" v-if="dragStatus" @mousedown.stop="footDown($event,'in')" @mouseup.stop="footUp"></i>
25
+ <i class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>
26
+ </div>
25
27
  </div>
26
- <div class="down-text" v-if="dragStatus&&dragTextShow">
28
+ <div class="down-text" v-if="dragStatus&&dragTextShow&&!fixedStart">
27
29
  <div class="down-text-cont">
28
30
  <slot name="down"></slot>
29
31
  <!-- <img-->
@@ -52,7 +54,9 @@ export default {
52
54
  state: false,//是否显示
53
55
  clientWidth: 0,
54
56
  clientHeight: 0,
55
- transAll: false
57
+ transAll: false,
58
+ fixedStart: false,
59
+ initWidth: 1280
56
60
  }
57
61
  },
58
62
  props: {
@@ -64,6 +68,18 @@ export default {
64
68
  type: Number,
65
69
  default: 400
66
70
  },
71
+ fixed: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ left: {
76
+ type: Number,
77
+ default: 0
78
+ },
79
+ top: {
80
+ type: Number,
81
+ default: 0
82
+ },
67
83
  titleColor: {
68
84
  type: String,
69
85
  default: 'rgba(19, 191, 108, 1)'
@@ -114,17 +130,25 @@ export default {
114
130
  },
115
131
  watch: {
116
132
  width: {
117
- handler: function (val, oldVal) {
133
+ handler: function (val) {
118
134
  this.footRightOffset = val
119
135
  },
120
136
  immediate: true
121
137
  },
122
138
  height: {
123
- handler: function (val, oldVal) {
139
+ handler: function (val) {
124
140
  this.footDownOffset = val
125
141
  },
126
142
  immediate: true
127
143
  },
144
+ fixed: {
145
+ handler: function (val) {
146
+ this.fixedStart = val
147
+ this.init()
148
+ },
149
+ immediate: true,
150
+ deep: true
151
+ }
128
152
  },
129
153
  mounted() {
130
154
  this.id = Math.random().toString(36).substr(2);
@@ -143,6 +167,21 @@ export default {
143
167
  popArr = (pop === null)? [] : JSON.parse(pop)
144
168
  popArr.push(this.id)
145
169
  sessionStorage.setItem('pop', JSON.stringify(popArr))
170
+ // 监听滚动
171
+ window.onscroll = () => {
172
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
173
+ if(this.fixedStart) {
174
+ this.y = this.top - scrollTop
175
+ }
176
+ }
177
+ // 监听窗口变化
178
+ window.addEventListener('resize', () => {
179
+ const wid = document.getElementById('app').offsetWidth
180
+ if(this.fixedStart) {
181
+ if(wid <= this.initWidth) return
182
+ this.x = this.left + (wid-this.initWidth)/2
183
+ }
184
+ });
146
185
  },
147
186
  computed: {
148
187
  position() {
@@ -174,10 +213,16 @@ export default {
174
213
  this.$emit('dragStatus')
175
214
  },
176
215
  init() {
177
- this.clientWidth = document.documentElement.clientWidth;
178
- this.clientHeight = document.documentElement.clientHeight;
179
- this.x = this.clientWidth / 2 - this.footRightOffset / 2;
180
- this.y = this.clientHeight / 2 - this.footDownOffset / 2;
216
+ if(this.fixedStart) {
217
+ const wid = document.getElementById('app').offsetWidth
218
+ this.x = this.left + (wid-this.initWidth)/2
219
+ this.y = this.top - document.documentElement.scrollTop
220
+ }else {
221
+ this.clientWidth = document.documentElement.clientWidth;
222
+ this.clientHeight = document.documentElement.clientHeight;
223
+ this.x = this.clientWidth / 2 - this.footRightOffset / 2;
224
+ this.y = this.clientHeight / 2 - this.footDownOffset / 2;
225
+ }
181
226
  },
182
227
  getWH(v) {
183
228
  this.transAll = true
@@ -414,13 +459,15 @@ export default {
414
459
  position: fixed;
415
460
  top: 0;
416
461
  left: 0;
417
- box-shadow: 0 0 3px 2px #ccc;
418
462
  background-color: #fff;
419
463
  border-radius: 3px;
420
464
  z-index: 9999;
421
465
  animation: linkDown .3s linear forwards;
422
466
  opacity: 0;
423
467
  }
468
+ .drag-pop-shadow{
469
+ box-shadow: 0 0 3px 2px #ccc;
470
+ }
424
471
  .trans{
425
472
  transition: all .3s;
426
473
  }
@@ -444,4 +491,8 @@ export default {
444
491
  height: calc(100% - 30px);
445
492
  position: relative;
446
493
  }
494
+ .drag-cont2{
495
+ height: 100% !important;
496
+ position: relative;
497
+ }
447
498
  </style>
@@ -40,7 +40,7 @@ export function butJson(editor, data) {
40
40
  name: '文章题目',
41
41
  key: 'subjectMenu',
42
42
  menuKeys: [],
43
- html: `<p data-signId="subject" style="text-align: center;padding-bottom: 30px;"><span style="color: rgb(0, 0, 0);font-size: 24px;font-family: SimHei;font-weight: 700;">${menusData(data, 'subjectMenu').text}</span></p>`
43
+ html: `<p data-signId="subject" style="text-align: center;padding-bottom: 10px;"><span style="color: rgb(0, 0, 0);font-size: 24px;font-family: SimHei;font-weight: 700;">${menusData(data, 'subjectMenu').text}</span></p>`
44
44
  }, {
45
45
  name: '作&nbsp;&nbsp;&nbsp;者',
46
46
  key: 'authorMenu',
@@ -57,17 +57,17 @@ export function butJson(editor, data) {
57
57
  name: '摘&nbsp;&nbsp;&nbsp;要',
58
58
  key: 'abstractMenu',
59
59
  menuKeys: [],
60
- html: `<p class="abstract" data-signId="abstract"><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;font-family: SimSun;">摘要:</span> <span style="color: rgb(0, 0, 0);font-size: 12px;font-family: KaiTi"> 摘要内容...</span></p>`
60
+ html: `<p class="abstract" data-signId="abstract"><span style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;font-family: SimSun;">摘要:</span> <span style="color: rgb(0, 0, 0);font-size: 12px;font-family: FangSong"> 摘要内容...</span></p>`
61
61
  }, {
62
62
  name: '关键词',
63
63
  key: 'keywordMenu',
64
64
  menuKeys: [],
65
- html: `<p class="keyword" data-signId="keyword"><span contenteditable="false" style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;font-family: SimSun;">关键词:</span> <span style="color: rgb(0, 0, 0);font-size: 12px;font-family: KaiTi"> 关键词内容...</span></p>`
65
+ html: `<p class="keyword" data-signId="keyword"><span contenteditable="false" style="color: rgb(0, 0, 0);font-size: 14px;font-weight: 700;font-family: SimSun;">关键词:</span> <span style="color: rgb(0, 0, 0);font-size: 12px;font-family: FangSong"> 关键词内容...</span></p>`
66
66
  }, {
67
67
  name: '标&nbsp;&nbsp;&nbsp;题',
68
68
  key: 'paragraphTitle',
69
69
  menuKeys: [],
70
- html: `<p data-signId="title" 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: 22px;font-weight: 700;">标题名称</span></p>`
71
71
  }, {
72
72
  name: '正&nbsp;&nbsp;&nbsp;文',
73
73
  key: 'paragraphBody',
@@ -108,17 +108,8 @@ export function butJson(editor, data) {
108
108
  name: '段落设置',
109
109
  key: 'paragraph',
110
110
  menuKeys: [
111
- // {name: '缩 进', key: 'indent'},
112
- // {name: '行间距', key: 'LineSpace',
113
- /*childMenuKeys: [
114
- {name: '1倍', key: '1'},
115
- {name: '1.25倍', key: '1.25'},
116
- {name: '1.5倍', key: '1.5'},
117
- {name: '2倍', key: '2'},
118
- {name: '2.5倍', key: '2.5'},
119
- {name: '3倍', key: '3'}
120
- ]*/
121
- // },
111
+ {name: '缩进设置', key: 'Retraction'},
112
+ {name: '间距设置', key: 'LineSpace'}
122
113
  ],
123
114
  },
124
115
  alignmentMode: {
@@ -220,7 +211,7 @@ export function butJson(editor, data) {
220
211
  name: '上传附件',
221
212
  key: 'group-upload',
222
213
  menuKeys: [],
223
- html: `<p contenteditable="false" data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
214
+ html: `<p data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
224
215
  },
225
216
  'group-image': {
226
217
  name: '插入图片',
@@ -312,7 +303,7 @@ export function butJson(editor, data) {
312
303
  name: '上传附件',
313
304
  key: 'group-upload',
314
305
  childMenuKeys: [],
315
- html: `<p contenteditable="false" data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
306
+ html: `<p data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
316
307
  },
317
308
  ],
318
309
  }
@@ -17,7 +17,8 @@
17
17
  <ul v-for="(item2,index2) in item.menuKeys" style="position: relative">
18
18
  <li v-if="uploadTypeArr.indexOf(item2.key) !== -1">
19
19
  <label>
20
- <input :accept="acceptType[item2.key]" style="display: none;" type="file" @change="upload($event,item2.key)">
20
+ <input :accept="acceptType[item2.key]" style="display: none;" type="file"
21
+ @change="upload($event,item2.key)">
21
22
  <span v-html="item2.name"></span>
22
23
  </label>
23
24
  </li>
@@ -30,7 +31,8 @@
30
31
  <li v-for="(childItem,childIndex) in item2.childMenuKeys" @click="butTap(item,item2,childItem)">
31
32
  <!-- childItem.key === 'uploadImage'-->
32
33
  <label v-if=" uploadTypeArr.indexOf(childItem.key) !== -1 ">
33
- <input :accept="acceptType[childItem.key]" style="display: none;" type="file" @change="upload($event,childItem.key)">
34
+ <input :accept="acceptType[childItem.key]" style="display: none;" type="file"
35
+ @change="upload($event,childItem.key)">
34
36
  <span v-html="item2.name"></span>
35
37
  </label>
36
38
  <span v-else v-html="childItem.name"></span>
@@ -107,12 +109,14 @@
107
109
  </div>
108
110
  </div>
109
111
 
110
- <div v-if="page&&readOnly" :style="{width: (wit + 20) + 'px'}" class="read-only">
112
+ <div v-if="page&&readOnly" class="read-only">
113
+ <!-- :style="{width: (wit + 20) + 'px'}"-->
111
114
  <div v-if="signMenuShow" class="editing-header">
112
115
  <img :src="menusData('signMenu')?.ico" alt=""/>
113
116
  <span>{{ menusData('signMenu')?.text }}</span>
114
117
  </div>
115
- <div v-for="(item,index) in htmlArr" :key="index" :style="{height: wit * 1.6 + 'px',width: wit + 'px'}"
118
+ <!-- ,width: wit + 'px'-->
119
+ <div v-for="(item,index) in htmlArr" :key="index" :style="{height: wit * 1.6 + 'px'}"
116
120
  class="read-only-page" @click="menusTap">
117
121
  <div class="read-only-p" v-html="item"></div>
118
122
  <div class="read-only-a">{{ index + 1 }}/{{ htmlArr.length }}</div>
@@ -169,40 +173,47 @@
169
173
  </div>
170
174
  </div>
171
175
  <!-- 段落设置-->
172
- <zydx-drag-popup v-if="showDragPopup" :dragStatus="false" :enlargeShow="false" :minimize="false"
173
- :minimizeCir="false" height="450" @close="closeDragPopup">
176
+ <zydx-drag-popup
177
+ v-if="showRetractionPopup" :dragStatus="false" :enlargeShow="false" :minimize="false"
178
+ :minimizeCir="false" height="290" @close="closeDragPopup">
174
179
  <template #content>
175
180
  <div class="p-popup">
176
- <div class="p-popup-title">段落设置</div>
181
+ <div class="p-popup-title">缩进设置</div>
177
182
  <div class="p-popup-retraction">
178
- <h3>缩进:</h3>
179
- <div>
180
- <div class="p-popup-setting">
181
- <div class="name">左侧缩进</div>
182
- :<input v-model="paragraph.left" type="number"/>
183
- <p>px</p></div>
184
- <div class="p-popup-setting">
185
- <div class="name">右侧缩进</div>
186
- :<input v-model="paragraph.right" type="number"/>
187
- <p>px</p></div>
188
- </div>
183
+ <div class="p-popup-setting">
184
+ <div class="name">左侧缩进</div>
185
+ :<input v-model="paragraph.left" type="number" min="0" @input="checkNum"/>
186
+ <p>px</p></div>
187
+ <div class="p-popup-setting">
188
+ <div class="name">右侧缩进</div>
189
+ :<input v-model="paragraph.right" type="number" min="0" @input="checkNum"/>
190
+ <p>px</p></div>
191
+ </div>
192
+ <div class="tip-btnBox">
193
+ <div @click="paragraphSetting" v-html="`确定`"></div>
194
+ <div @click="closeDragPopup" v-html="`关闭`"></div>
189
195
  </div>
196
+ </div>
197
+ </template>
198
+ </zydx-drag-popup>
199
+ <zydx-drag-popup
200
+ v-if="showSpacingPopup" :dragStatus="false" :enlargeShow="false" :minimize="false"
201
+ :minimizeCir="false" height="320" @close="closeDragPopup">
202
+ <template #content>
203
+ <div class="p-popup">
204
+ <div class="p-popup-title">间距设置</div>
190
205
  <div class="p-popup-spacing">
191
- <h3>间距:</h3>
192
- <div>
193
- <div class="p-popup-setting">
194
- <div class="name">段前间距</div>
195
- :<input v-model="paragraph.top" type="number"/>
196
- <p>px</p></div>
197
- <div class="p-popup-setting">
198
- <div class="name">段后间距</div>
199
- :<input v-model="paragraph.bottom" type="number"/>
200
- <p>px</p></div>
201
- <div class="p-popup-setting">
202
- <div class="name">行距</div>
203
-
204
- <zydx-select v-model:value="paragraph.distance" :options="options" style="width: 300px"></zydx-select>
205
- </div>
206
+ <div class="p-popup-setting">
207
+ <div class="name">段前间距</div>:
208
+ <input v-model="paragraph.top" type="number" min="0" @input="checkNum"/>
209
+ <p>px</p></div>
210
+ <div class="p-popup-setting">
211
+ <div class="name">段后间距</div>:
212
+ <input v-model="paragraph.bottom" type="number" min="0" @input="checkNum"/>
213
+ <p>px</p></div>
214
+ <div class="p-popup-setting">
215
+ <div class="name">行距</div>:
216
+ <zydx-select v-model:value="paragraph.distance" :options="options" style="width: 300px"></zydx-select>
206
217
  </div>
207
218
  </div>
208
219
  <div class="tip-btnBox">
@@ -301,8 +312,8 @@
301
312
 
302
313
  <!-- 展示弹窗 -->
303
314
  <div v-for="(item,index) in interpositionData" :key="index">
304
- <zydx-drag-popup v-if="item.isShow" :minWidth="640" :minHeight="183"
305
- :enlargeShow="false" :minimize="false" :minimizeCir="false"
315
+ <zydx-drag-popup v-if="item.isShow" :enlargeShow="false" :minHeight="183"
316
+ :minWidth="640" :minimize="false" :minimizeCir="false"
306
317
  :title="titleDragPopup[item.type]?titleDragPopup[item.type]:'参考文献'" height="auto"
307
318
  width="auto" @close="closeDataShowPopup(item)">
308
319
  <template #content>
@@ -367,7 +378,7 @@
367
378
  v-html="'删除'"></div>
368
379
  </div>
369
380
  </div>
370
- <div style="min-width:600px;width: 600px" class="tip-box">
381
+ <div class="tip-box" style="min-width:600px;width: 600px">
371
382
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
372
383
  <div class="tip-boxContent">
373
384
  <zydx-read :url="item.url" style="height: 100%"></zydx-read>
@@ -386,7 +397,7 @@
386
397
  v-html="'删除'"></div>
387
398
  </div>
388
399
  </div>
389
- <div style="min-width:600px;width: 600px" class="tip-box">
400
+ <div class="tip-box" style="min-width:600px;width: 600px">
390
401
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
391
402
  <div class="tip-boxContent">
392
403
  <zydx-read :url="item.url" style="height: 100%"></zydx-read>
@@ -405,7 +416,7 @@
405
416
  v-html="'删除'"></div>
406
417
  </div>
407
418
  </div>
408
- <div style="min-width:600px;width: 600px" class="tip-box">
419
+ <div class="tip-box" style="min-width:600px;width: 600px">
409
420
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
410
421
  <div class="tip-boxContent">
411
422
  <zydx-read :url="item.url" style="height: 100%"></zydx-read>
@@ -424,7 +435,7 @@
424
435
  v-html="'删除'"></div>
425
436
  </div>
426
437
  </div>
427
- <div style="min-width:600px;width: 600px" class="tip-box">
438
+ <div class="tip-box" style="min-width:600px;width: 600px">
428
439
  <div class="tip-title" v-html="`${item.exegesis}`"></div>
429
440
  <div class="tip-boxContent">
430
441
  <iframe v-if="item.type === 'linkCourseware'" :src="item.url" frameborder="no" height="590"
@@ -461,26 +472,26 @@
461
472
 
462
473
 
463
474
  <!-- 链接注释-->
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>
475
+ <!-- <zydx-drag-popup v-if="isShowUpload" :dragStatus="false" :width="400"
476
+ :enlargeShow="false" :minimize="false" :height="200"
477
+ :minimizeCir="false" :title="'上传附件'" @close="isShowUpload=false">
478
+ <template #content>
479
+ <div class="upload-box">
480
+ <div class="check-upload">
481
+ <label>
482
+ <input type="checkbox" v-model="checkboxObj.value" :checked="checkboxObj.checked" @change="checkboxTao(checkboxObj)"/>
483
+ <span>{{ checkboxObj.label }}</span>
484
+ </label>
485
+ </div>
486
+ <div >
487
+ <label style="border:1px solid #000;border-radius: 3px;padding:2px 5px;">
488
+ <input :accept="acceptType['group-upload']" style="display: none;" type="file" @change="upload($event,'group-upload')">
489
+ <span v-html="'上传附件'"></span>
490
+ </label>
491
+ </div>
492
+ </div>
493
+ </template>
494
+ </zydx-drag-popup>-->
484
495
 
485
496
  </div>
486
497
  </template>
@@ -488,7 +499,6 @@
488
499
  <script>
489
500
  import exportWord from 'js-export-word'
490
501
  import mammoth from './mammoth.browser.min'
491
- import {html2json, json2html} from '../../utils/html2json.js'
492
502
  import {butJson} from './butJson'
493
503
  import {Editor, EditorContent} from '@tiptap/vue-3'
494
504
  import StarterKit from '@tiptap/starter-kit'
@@ -520,12 +530,13 @@ import viewSvg from "./view-svg.vue";
520
530
  import Recorder from 'js-audio-recorder'
521
531
  import zydxColoring from '../../coloring'
522
532
  import Message from '../../../components/tipBox/index';
523
- import Upload from '../../../components/upload' //上传文件
524
533
  import zydxTextarea from '../../textarea'
525
534
  import zydxRead from '../../read'
526
535
  import zydxDragPopup from '../../dragPopup'
527
536
  import zydxSelect from '../../select'
528
537
  import {exegesisId} from "./extend/exegesis-id";
538
+ import {html2json, json2html} from '../../utils/html2json.js'
539
+ import Upload from '../../../components/upload' //上传文件
529
540
 
530
541
  const img = require('./image/annotation.png')
531
542
  export default {
@@ -549,8 +560,8 @@ export default {
549
560
  },
550
561
  data() {
551
562
  return {
552
- checkboxObj:{value: '1', label: '是否开启缩进', checked: false},
553
- checkbox:false,
563
+ checkboxObj: {value: '1', label: '是否开启缩进', checked: false},
564
+ checkbox: false,
554
565
  titleDragPopup: {
555
566
  nounExplain: '链接名词',
556
567
  taggingMenu: '注释',
@@ -586,7 +597,7 @@ export default {
586
597
  uploadImage: 'image/*',
587
598
  },
588
599
  uploadTypeArr: [
589
- // 'group-upload',
600
+ 'group-upload',
590
601
  'importArticles',
591
602
  'importWorks',
592
603
  'videoLink',
@@ -637,7 +648,8 @@ export default {
637
648
  'textMenu', 'color', 'interposition'],
638
649
  bubbleData: {},
639
650
  htmlJson: [],
640
- showDragPopup: false,
651
+ showRetractionPopup: false,
652
+ showSpacingPopup: false,
641
653
  showTaggingMenu: false,
642
654
  titlePopup: '',
643
655
  options: [
@@ -918,7 +930,7 @@ export default {
918
930
  _this.encIndex = state.selection.$from.parent.attrs
919
931
  if (_this.encIndex && _this.encIndex.titleId) {
920
932
  let titleIdArr = state.selection.$from.parent.attrs.titleId.split(' ')
921
- return state.selection.$from.parent.attrs.titleId === 'mu' || titleIdArr.indexOf('mu')!==-1
933
+ return state.selection.$from.parent.attrs.titleId === 'mu' || titleIdArr.indexOf('mu') !== -1
922
934
  } else {
923
935
  return false
924
936
  }
@@ -1107,7 +1119,7 @@ export default {
1107
1119
  },
1108
1120
  emits: ['confirm', 'enclosure', 'enlDownload', 'enlSee'],
1109
1121
  methods: {
1110
- checkboxTao(checkboxObj){
1122
+ checkboxTao(checkboxObj) {
1111
1123
  this.checkbox = checkboxObj.value
1112
1124
  },
1113
1125
  closeDataShowPopup(item) {
@@ -2021,18 +2033,19 @@ export default {
2021
2033
  // const b = await this.signIdData('paragraph')
2022
2034
  const t = await this.signIdData('enclosure')
2023
2035
  const r = await this.signIdData('reference')
2036
+ console.log('menusText', this.menusText)
2024
2037
  const html = butJson(this.editor, this.menusText)[v].html
2025
- if(r===-1){
2038
+ if (r === -1) {
2026
2039
  const last = this.editor.state.selection.$anchor.path[0].content.size
2027
2040
  if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
2028
2041
  const num = this.upSort(this.editor, 'enclosure')
2029
2042
  const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="indent mu"><span>${num.num}. ${name}</span></p>`
2030
2043
  this.editor.chain().focus().insertContentAt(num.len, html2).run()
2031
- const json = this.editor.getJSON()
2044
+ const json = this.editor.getJSON()
2032
2045
  for (let i = 0; i < json.content.length; i++) {
2033
2046
  const item = json.content[i]
2034
- if( item.attrs.signId === 'enclosure'&&item.content[0].text==='附件列表:'){
2035
- item.attrs.titleId = this.checkbox? 'indent' : null
2047
+ if (item.attrs.signId === 'enclosure' && item.content[0].text === '附件列表:') {
2048
+ item.attrs.titleId = this.checkbox ? 'indent' : null
2036
2049
  }
2037
2050
  }
2038
2051
  this.editor.chain().setContent(<p></p>).run()
@@ -2041,15 +2054,15 @@ export default {
2041
2054
  return
2042
2055
  }
2043
2056
  const num1 = this.upSort(this.editor, 'reference')
2044
- if (t === -1) this.editor.chain().focus().insertContentAt(num1.len-7, html).run()
2057
+ if (t === -1) this.editor.chain().focus().insertContentAt(num1.len - 7, html).run()
2045
2058
  const num = this.upSort(this.editor, 'enclosure')
2046
2059
  const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="indent mu"><span>${num.num}. ${name}</span></p>`
2047
2060
  this.editor.chain().focus().insertContentAt(num.len, html2).run()
2048
- const json = this.editor.getJSON()
2061
+ const json = this.editor.getJSON()
2049
2062
  for (let i = 0; i < json.content.length; i++) {
2050
2063
  const item = json.content[i]
2051
- if( item.attrs.signId === 'enclosure'&&item.content[0].text==='附件列表:'){
2052
- item.attrs.titleId = this.checkbox? 'indent' : null
2064
+ if (item.attrs.signId === 'enclosure' && item.content[0].text === '附件列表:') {
2065
+ item.attrs.titleId = this.checkbox ? 'indent' : null
2053
2066
  }
2054
2067
  }
2055
2068
  this.editor.chain().setContent(<p></p>).run()
@@ -2428,8 +2441,8 @@ export default {
2428
2441
  const n = await this.signIdData('enclosure')//附件
2429
2442
  const a = await this.signIdData('reference')//参考文献
2430
2443
  if (b === -1) {
2431
- if(n===-1){
2432
- if(a===-1){
2444
+ if (n === -1) {
2445
+ if (a === -1) {
2433
2446
  if (r === -1) this.editor.chain().focus().insertContentAt(last, html).run()
2434
2447
  return
2435
2448
  }
@@ -2451,8 +2464,8 @@ export default {
2451
2464
  const r = await this.signIdData('ack')
2452
2465
  const b = await this.signIdData('enclosure')//附件
2453
2466
  const a = await this.signIdData('reference')//参考文献
2454
- if(b===-1){
2455
- if(a===-1){
2467
+ if (b === -1) {
2468
+ if (a === -1) {
2456
2469
  if (r === -1) {
2457
2470
  this.editor.chain().focus().insertContentAt(last, html[0]).run()
2458
2471
  this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
@@ -2462,13 +2475,13 @@ export default {
2462
2475
  const num = this.upSort(this.editor, 'reference')
2463
2476
  if (r === -1) {
2464
2477
  this.editor.chain().focus().insertContentAt(num.len - 7, html[0]).run()
2465
- this.editor.chain().focus().insertContentAt(num.len-3, html[1]).run()
2478
+ this.editor.chain().focus().insertContentAt(num.len - 3, html[1]).run()
2466
2479
  }
2467
2480
  return
2468
2481
  }
2469
2482
  const num = this.selectionPath('enclosure')
2470
2483
  if (r === -1) {
2471
- this.editor.chain().focus().insertContentAt(num-7, html[0]).run()
2484
+ this.editor.chain().focus().insertContentAt(num - 7, html[0]).run()
2472
2485
  const ackNum = this.selectionPath('ack')
2473
2486
  this.editor.chain().focus().insertContentAt(ackNum, html[1]).run()
2474
2487
  }
@@ -2509,33 +2522,29 @@ export default {
2509
2522
  // 段落
2510
2523
  if (data.key === 'paragraph') {
2511
2524
  this.menuStast = 'paragraph'
2512
- // if (key.key === 'indent') {
2513
- // let titleId = this.editor.getAttributes('paragraph').titleId
2514
- // if (titleId === 'indent') {
2515
- // this.editor.commands.unsetTitleId()
2516
- // return
2517
- // }
2518
- // this.editor.commands.setTitleId('indent')
2519
- // }
2520
- // if (key.key === 'LineSpace') {
2521
- // }
2522
- this.showDragPopup = true
2523
2525
  const index = this.editor.state.selection.$anchor.path[1]
2524
2526
  const json = this.editor.getJSON()
2525
2527
  const margin = json.content[index].attrs.margin
2526
- console.log('attrs',json.content[index].attrs)
2528
+ console.log('attrs', json.content[index].attrs)
2527
2529
  const lineHeight = json.content[index].attrs.lineHeightId
2528
- if (!margin === false) {
2529
- const marginArr = margin.split(' ').map(item => item.replace('px', ''))
2530
- this.paragraph.top = marginArr[0]
2531
- this.paragraph.right = marginArr[1]
2532
- this.paragraph.bottom = marginArr[2]
2533
- this.paragraph.left = marginArr[3]
2530
+ if (key.key === 'Retraction') {
2531
+ this.showRetractionPopup = true
2532
+ if (!margin === false) {
2533
+ let marginArr = margin.split(' ').map(item => item.replace('px', ''))
2534
+ this.paragraph.right = marginArr[1]
2535
+ this.paragraph.left = marginArr[3]
2536
+ }
2534
2537
  }
2535
- if (!lineHeight === false) {
2536
- let child = ['1', '1.25', '1.5', '2', '2.5', '3']
2537
- const index = lineHeight.split('-')[1]
2538
- this.paragraph.distance = child[index - 1]
2538
+ if (key.key === 'LineSpace') {
2539
+ this.showSpacingPopup = true
2540
+ if (!lineHeight === false) {
2541
+ let marginArr = margin.split(' ').map(item => item.replace('px', ''))
2542
+ this.paragraph.top = marginArr[0]
2543
+ this.paragraph.bottom = marginArr[2]
2544
+ let child = ['1', '1.25', '1.5', '2', '2.5', '3']
2545
+ const index = lineHeight.split('-')[1]
2546
+ this.paragraph.distance = child[index - 1]
2547
+ }
2539
2548
  }
2540
2549
  }
2541
2550
  // 字体
@@ -2606,7 +2615,7 @@ export default {
2606
2615
  }
2607
2616
  // 插入
2608
2617
  if (data.key === 'interposition') {
2609
- if(key.key === 'group-upload'){
2618
+ if (key.key === 'group-upload') {
2610
2619
  this.isShowUpload = true
2611
2620
  }
2612
2621
  // 添加图片
@@ -2983,16 +2992,31 @@ export default {
2983
2992
  paragraphSetting() {
2984
2993
  const selectionIndex = this.editor.state.selection.$anchor.path[1]
2985
2994
  const json = this.editor.getJSON()
2995
+ const textAlign = json.content[selectionIndex].attrs.textAlign
2996
+ const lineHeightId = json.content[selectionIndex].attrs.lineHeightId
2997
+ const signId = json.content[selectionIndex].attrs.signId
2986
2998
  const titleId = json.content[selectionIndex].attrs.titleId
2987
2999
  this.editor.commands.setMargin(`${this.paragraph.top}px ${this.paragraph.right}px ${this.paragraph.bottom}px ${this.paragraph.left}px`)
2988
3000
  let child = ['1', '1.25', '1.5', '2', '2.5', '3']
2989
3001
  let index = this.paragraph?.distance ? child.indexOf(this.paragraph?.distance) + 1 : 2
2990
3002
  this.editor.commands.setLineHeightId(`ling-${index}`)
2991
- if(!titleId===false){
3003
+ if (!textAlign === false) {
3004
+ this.editor.commands.unsetTextAlign()
3005
+ this.editor.commands.setTextAlign(textAlign)
3006
+ }
3007
+ if(!lineHeightId === false){
3008
+ this.editor.commands.unsetLineHeightId()
3009
+ this.editor.commands.setLineHeightId(lineHeightId)
3010
+ }
3011
+ if(!signId === false){
3012
+ this.editor.commands.unsetSignId()
3013
+ this.editor.commands.setSignId(signId)
3014
+ }
3015
+ if(!titleId === false){
2992
3016
  this.editor.commands.unsetTitleId()
2993
3017
  this.editor.commands.setTitleId(titleId)
2994
3018
  }
2995
- this.showDragPopup = false
3019
+ this.closeDragPopup()
2996
3020
  },
2997
3021
  taggingMenuSubmit() {
2998
3022
  this.taggingText = this.$refs.textarea.getContent()
@@ -3000,7 +3024,7 @@ export default {
3000
3024
  Message({type: 'text', promptContent: '注释描述不能为空'})
3001
3025
  return
3002
3026
  }
3003
- const {from, to} = this.editor.state.selection
3027
+ const {to} = this.editor.state.selection
3004
3028
  let dataInfo = {
3005
3029
  id: `${new Date().getTime()}`,
3006
3030
  type: 'taggingMenu',
@@ -3075,7 +3099,8 @@ export default {
3075
3099
  },
3076
3100
 
3077
3101
  closeDragPopup() {
3078
- this.showDragPopup = false
3102
+ this.showSpacingPopup = false
3103
+ this.showRetractionPopup = false
3079
3104
  },
3080
3105
 
3081
3106
  close() {
@@ -3303,6 +3328,26 @@ export default {
3303
3328
  this.editor?.commands.setContent(json)
3304
3329
  }
3305
3330
  },
3331
+ checkNum(element) {
3332
+ var val= element.target.value;
3333
+ //匹配非数字
3334
+ var reg = new RegExp("([^0-9]*)","g");
3335
+ var ma = val.match(reg);
3336
+ //如果有非数字,替换成""
3337
+ if(ma.length>0){
3338
+ for(var k in ma){
3339
+ if(ma[k]!==""){
3340
+ val = val.replace(ma[k],"");
3341
+ }
3342
+ }
3343
+ }
3344
+ //可以为0,但不能以0开头
3345
+ if(val.startsWith("0")&&val.length>1){
3346
+ val = val.substring(1,val.length);
3347
+ }
3348
+ //赋值,这样实现的效果就是用户按下非数字不会有任何反应
3349
+ element.target.value = val;
3350
+ }
3306
3351
  }
3307
3352
  }
3308
3353
  </script>
@@ -3370,7 +3415,7 @@ export default {
3370
3415
  }
3371
3416
 
3372
3417
  :deep(p[data-signid="subject"]) {
3373
- padding-bottom: 15px;
3418
+ //padding-bottom: 15px;
3374
3419
  }
3375
3420
 
3376
3421
  :deep(.author) {
@@ -4016,18 +4061,18 @@ li {
4016
4061
  justify-content: flex-end;
4017
4062
  }
4018
4063
 
4019
- .check-upload label{
4064
+ .check-upload label {
4020
4065
  display: flex;
4021
4066
  flex-direction: row;
4022
4067
  align-items: center;
4023
4068
  line-height: 1;
4024
4069
  }
4025
4070
 
4026
- .check-upload span{
4071
+ .check-upload span {
4027
4072
  padding-left: 10px;
4028
4073
  }
4029
4074
 
4030
- .upload-box{
4075
+ .upload-box {
4031
4076
  padding: 50px 40px;
4032
4077
  height: 100%;
4033
4078
  display: flex;
@@ -3,66 +3,66 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import { createElement } from 'react'
7
- import { createRoot } from 'react-dom/client'
8
- import { Tldraw } from 'tldraw'
6
+ import {createElement} from 'react'
7
+ import {createRoot} from 'react-dom/client'
8
+ import {Tldraw} from 'tldraw'
9
9
  import 'tldraw/tldraw.css'
10
10
 
11
11
  const clearJson = {
12
- store:{
13
- "document:document":{
14
- gridSize:10,
15
- name:"",
16
- meta:{},
17
- id:"document:document",
18
- typeName:"document"
19
- },
20
- "page:page":{
21
- meta:{},
22
- id:"page:page",
23
- name:"Page 1",
24
- index:"a1",
25
- typeName:"page"
12
+ store: {
13
+ "document:document": {
14
+ gridSize: 10,
15
+ name: "",
16
+ meta: {},
17
+ id: "document:document",
18
+ typeName: "document"
19
+ },
20
+ "page:page": {
21
+ meta: {},
22
+ id: "page:page",
23
+ name: "Page 1",
24
+ index: "a1",
25
+ typeName: "page"
26
26
  }
27
27
  },
28
- schema:{
29
- schemaVersion:1,
30
- storeVersion:4,
31
- recordVersions:{
32
- asset:{
33
- version:1,
34
- subTypeKey:"type",
35
- subTypeVersions:{
36
- image:3,
37
- video:3,
38
- bookmark:1
28
+ schema: {
29
+ schemaVersion: 1,
30
+ storeVersion: 4,
31
+ recordVersions: {
32
+ asset: {
33
+ version: 1,
34
+ subTypeKey: "type",
35
+ subTypeVersions: {
36
+ image: 3,
37
+ video: 3,
38
+ bookmark: 1
39
39
  }
40
40
  },
41
- camera:{version:1},
42
- document:{version:2},
43
- instance:{version:24},
44
- instance_page_state:{version:5},
45
- page:{"version":1},
46
- shape:{
47
- version:3,
48
- subTypeKey:"type",
49
- subTypeVersions:{
50
- group:0,
51
- text:1,
52
- bookmark:2,
53
- draw:1,
54
- geo:8,
55
- note:5,
56
- line:4,
57
- frame:0,
58
- arrow:3,
59
- highlight:0,
60
- embed:4,
61
- image:3,
62
- video:2
41
+ camera: {version: 1},
42
+ document: {version: 2},
43
+ instance: {version: 24},
44
+ instance_page_state: {version: 5},
45
+ page: {"version": 1},
46
+ shape: {
47
+ version: 3,
48
+ subTypeKey: "type",
49
+ subTypeVersions: {
50
+ group: 0,
51
+ text: 1,
52
+ bookmark: 2,
53
+ draw: 1,
54
+ geo: 8,
55
+ note: 5,
56
+ line: 4,
57
+ frame: 0,
58
+ arrow: 3,
59
+ highlight: 0,
60
+ embed: 4,
61
+ image: 3,
62
+ video: 2
63
63
  }
64
64
  },
65
- instance_presence:{version:5},pointer:{version:1}
65
+ instance_presence: {version: 5}, pointer: {version: 1}
66
66
  }
67
67
  }
68
68
  }
@@ -71,113 +71,262 @@ export default {
71
71
  name: "zydx-sketchpad",
72
72
  data() {
73
73
  return {
74
- editor:null
74
+ editor: null
75
75
  }
76
76
  },
77
77
  mounted() {
78
+ // 鼠标移入
79
+ this.$refs.reactRef.addEventListener('mouseover', () => {
80
+ document.body.style.overflow = 'hidden'
81
+ });
82
+ // 鼠标移出
83
+ this.$refs.reactRef.addEventListener('mouseleave', () => {
84
+ document.body.style.overflow = 'visible'
85
+ });
86
+
78
87
  const root = createRoot(this.$refs.reactRef)
79
88
  root.render(createElement(Tldraw, {
80
89
  onMount: this.handleMountedEditor,
81
- hideUi: true
90
+ hideUi: true, // 隐藏UI
91
+ // persistenceKey: "example111" // 持久化名字
92
+ autoFocus: false // 聚焦
82
93
  }, null))
83
94
  },
84
95
  methods: {
85
96
  handleMountedEditor(editor) {
97
+ console.log('editor', editor)
86
98
  this.editor = editor
87
- // editor.store.listen((entry) => {
88
- // const up = entry.changes.updated
89
- // })
99
+ setTimeout(() => {
100
+ document.documentElement.scrollTop = 0
101
+ }, 0)
102
+ },
103
+ setOpacityForNextShapes(opacity){
104
+ this.editor.setOpacityForNextShapes(opacity)
90
105
  },
91
106
  // 清空
92
107
  clear() {
93
108
  this.editor.store.loadSnapshot(clearJson)
109
+ this.isFocused()
94
110
  },
95
111
  // 添加快照
96
112
  setSnapshot(v) {
97
113
  this.editor.store.loadSnapshot(v)
114
+ this.isFocused()
98
115
  },
99
116
  // 获取快照
100
117
  getSnapshot() {
101
118
  return this.editor.store.getSnapshot()
102
119
  },
103
120
  draw(v) {
104
- this.styleProps('draw','color').defaultValue = v?.color?? 'black'
105
- this.styleProps('draw','size').defaultValue = v?.size?? 'm'
121
+ this.styleProps('draw', 'color').defaultValue = v?.color ?? 'black'
122
+ this.styleProps('draw', 'size').defaultValue = v?.size ?? 'm'
123
+ this.styleProps('draw', 'dash').defaultValue = v?.dash ?? 'draw'
124
+ this.styleProps('draw', 'fill').defaultValue = v?.fill ?? 'none'
106
125
  this.editor.setCurrentTool('draw')
107
126
  },
108
127
  select() {
109
128
  this.editor.setCurrentTool('select')
110
129
  },
111
130
  hand() {
112
- this.editor.setCurrentTool('hand')
131
+ this.editor.setCurrentTool('hand')
113
132
  },
114
133
  eraser() {
115
134
  this.editor.setCurrentTool('eraser')
116
135
  },
117
136
  arrow(v) {
118
- this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
119
- this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
137
+ // 'none', 'semi', 'solid', 'pattern'
138
+ this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
139
+ this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
140
+ this.styleProps('arrow', 'dash').defaultValue = v?.dash ?? 'draw'
141
+ this.styleProps('arrow', 'fill').defaultValue = v?.fill ?? 'none'
120
142
  this.editor.setCurrentTool('arrow')
121
143
  },
122
144
  text(v) {
123
- this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
124
- this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
145
+ this.styleProps('text', 'color').defaultValue = v?.color ?? 'black'
146
+ this.styleProps('text', 'size').defaultValue = v?.size ?? 'm'
147
+ this.styleProps('text', 'font').defaultValue = v?.font ?? 'draw' //['draw', 'sans', 'serif', 'mono']
148
+ this.styleProps('text', 'align').defaultValue = v?.align ?? 'start'
125
149
  this.editor.setCurrentTool('text')
126
150
  },
151
+ note(v) {
152
+ this.styleProps('note', 'color').defaultValue = v?.color ?? 'black'
153
+ this.styleProps('note', 'size').defaultValue = v?.size ?? 'm'
154
+ this.styleProps('note', 'font').defaultValue = v?.font ?? 'draw' //['draw', 'sans', 'serif', 'mono']
155
+ this.styleProps('note', 'align').defaultValue = v?.align ?? 'start'
156
+ this.editor.setCurrentTool('note')
157
+ },
127
158
  line(v) {
128
- this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
129
- this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
159
+ this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
160
+ this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
161
+ this.styleProps('arrow', 'dash').defaultValue = v?.dash ?? 'draw'
162
+ this.styleProps('arrow', 'fill').defaultValue = v?.fill ?? 'none'
130
163
  this.editor.setCurrentTool('line')
131
164
  },
132
165
  rectangle(v) {
133
- this.styleProps('geo','geo').defaultValue = 'rectangle'
134
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
135
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
166
+ this.styleProps('geo', 'geo').defaultValue = 'rectangle'
167
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
168
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
169
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
170
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
136
171
  this.editor.setCurrentTool('geo')
137
172
  },
138
173
  ellipse(v) {
139
- this.styleProps('geo','geo').defaultValue = 'ellipse'
140
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
141
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
174
+ this.styleProps('geo', 'geo').defaultValue = 'ellipse'
175
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
176
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
177
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
178
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
142
179
  this.editor.setCurrentTool('geo')
143
180
  },
144
181
  triangle(v) {
145
- this.styleProps('geo','geo').defaultValue = 'triangle'
146
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
147
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
182
+ this.styleProps('geo', 'geo').defaultValue = 'triangle'
183
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
184
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
185
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
186
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
187
+ this.editor.setCurrentTool('geo')
188
+ },
189
+
190
+ rhombus(v) {
191
+ this.styleProps('geo', 'geo').defaultValue = 'rhombus'
192
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
193
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
194
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
195
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
196
+ this.editor.setCurrentTool('geo')
197
+ },
198
+ cloud(v) {
199
+ this.styleProps('geo', 'geo').defaultValue = 'cloud'
200
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
201
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
202
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
203
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
204
+ this.editor.setCurrentTool('geo')
205
+ },
206
+ trapezoid(v) {
207
+ this.styleProps('geo', 'geo').defaultValue = 'trapezoid'
208
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
209
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
210
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
211
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
212
+ this.editor.setCurrentTool('geo')
213
+ },
214
+ diamond(v) {
215
+ this.styleProps('geo', 'geo').defaultValue = 'diamond'
216
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
217
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
218
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
219
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
148
220
  this.editor.setCurrentTool('geo')
149
221
  },
150
222
  star(v) {
151
- this.styleProps('geo','geo').defaultValue = 'star'
152
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
153
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
223
+ this.styleProps('geo', 'geo').defaultValue = 'star'
224
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
225
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
226
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
227
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
228
+ this.editor.setCurrentTool('geo')
229
+ },
230
+
231
+ xBox(v) {
232
+ this.styleProps('geo', 'geo').defaultValue = 'x-box'
233
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
234
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
235
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
236
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
237
+ this.editor.setCurrentTool('geo')
238
+ },
239
+ checkBox(v) {
240
+ this.styleProps('geo', 'geo').defaultValue = 'check-box'
241
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
242
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
243
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
244
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
245
+ this.editor.setCurrentTool('geo')
246
+ },
247
+ oval(v) {
248
+ this.styleProps('geo', 'geo').defaultValue = 'oval'
249
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
250
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
251
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
252
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
253
+ this.editor.setCurrentTool('geo')
254
+ },
255
+ arrowLeft(v) {
256
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-left'
257
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
258
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
259
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
260
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
261
+ this.editor.setCurrentTool('geo')
262
+ },
263
+ arrowRight(v) {
264
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-right'
265
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
266
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
267
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
268
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
269
+ this.editor.setCurrentTool('geo')
270
+ },
271
+ arrowUp(v) {
272
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-up'
273
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
274
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
275
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
276
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
277
+ this.editor.setCurrentTool('geo')
278
+ },
279
+ arrowDown(v) {
280
+ this.styleProps('geo', 'geo').defaultValue = 'arrow-down'
281
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
282
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
283
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
284
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
285
+ this.editor.setCurrentTool('geo')
286
+ },
287
+ hexagon(v) {
288
+ this.styleProps('geo', 'geo').defaultValue = 'hexagon'
289
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
290
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
291
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
292
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
154
293
  this.editor.setCurrentTool('geo')
155
294
  },
156
295
  highlight(v) {
157
- this.styleProps('geo','color').defaultValue = v?.color?? 'black'
158
- this.styleProps('geo','size').defaultValue = v?.size?? 'm'
296
+ this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
297
+ this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
298
+ this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
299
+ this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
159
300
  this.editor.setCurrentTool('highlight')
160
301
  },
161
302
  laser() {
162
303
  this.editor.setCurrentTool('laser')
163
304
  },
164
- undo(){
305
+ undo() {
165
306
  this.editor.undo()
166
307
  },
167
- redo(){
308
+ redo() {
168
309
  this.editor.redo()
169
310
  },
170
- styleProps(t,e) {
311
+ styleProps(t, e) {
171
312
  const style = [...this.editor.styleProps[t]]
172
313
  const index = style.findIndex(item => item[1] === e)
173
314
  return style[index][0]
315
+ },
316
+ // 重新获取焦点
317
+ isFocused() {
318
+ const top = document.documentElement.scrollTop
319
+ setTimeout(() => {
320
+ this.editor.updateInstanceState({isFocused: true})
321
+ document.documentElement.scrollTop = top
322
+ }, 10)
174
323
  }
175
324
  }
176
325
  }
177
326
  </script>
178
327
 
179
328
  <style scoped>
180
- .react{
329
+ .react {
181
330
  width: 100%;
182
331
  height: 100%;
183
332
  }
package/src/index.js CHANGED
@@ -83,7 +83,7 @@ function install(app) {
83
83
  }
84
84
 
85
85
  export default {
86
- version: '1.33.354',
86
+ version: '1.33.356',
87
87
  install,
88
88
  Calendar,
89
89
  Message,