zydx-plus 1.33.353 → 1.33.355
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
|
<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
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
133
|
+
handler: function (val) {
|
|
118
134
|
this.footRightOffset = val
|
|
119
135
|
},
|
|
120
136
|
immediate: true
|
|
121
137
|
},
|
|
122
138
|
height: {
|
|
123
|
-
handler: function (val
|
|
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.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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>
|
|
@@ -312,7 +312,7 @@ export function butJson(editor, data) {
|
|
|
312
312
|
name: '上传附件',
|
|
313
313
|
key: 'group-upload',
|
|
314
314
|
childMenuKeys: [],
|
|
315
|
-
html: `<p
|
|
315
|
+
html: `<p data-signId="enclosure"><span style="font-weight: 700;font-size: 16px;">附件列表:</span></p>`
|
|
316
316
|
},
|
|
317
317
|
],
|
|
318
318
|
}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
<div v-for="(item,index) in butData" class="editor-but">
|
|
5
5
|
<div v-if="uploadTypeArr.indexOf(item.key) !== -1" class="editor-but-name">
|
|
6
6
|
<label>
|
|
7
|
-
<input :accept="acceptType[item.key]" style="display: none;" type="file"
|
|
8
|
-
@change="upload($event,item.key)">
|
|
7
|
+
<input :accept="acceptType[item.key]" style="display: none;" type="file" @change="upload($event,item.key)">
|
|
9
8
|
<span v-html="item.name"></span>
|
|
10
9
|
</label>
|
|
11
10
|
</div>
|
|
@@ -18,8 +17,7 @@
|
|
|
18
17
|
<ul v-for="(item2,index2) in item.menuKeys" style="position: relative">
|
|
19
18
|
<li v-if="uploadTypeArr.indexOf(item2.key) !== -1">
|
|
20
19
|
<label>
|
|
21
|
-
<input :accept="acceptType[item2.key]" style="display: none;" type="file"
|
|
22
|
-
@change="upload($event,item2.key)">
|
|
20
|
+
<input :accept="acceptType[item2.key]" style="display: none;" type="file" @change="upload($event,item2.key)">
|
|
23
21
|
<span v-html="item2.name"></span>
|
|
24
22
|
</label>
|
|
25
23
|
</li>
|
|
@@ -32,8 +30,7 @@
|
|
|
32
30
|
<li v-for="(childItem,childIndex) in item2.childMenuKeys" @click="butTap(item,item2,childItem)">
|
|
33
31
|
<!-- childItem.key === 'uploadImage'-->
|
|
34
32
|
<label v-if=" uploadTypeArr.indexOf(childItem.key) !== -1 ">
|
|
35
|
-
<input :accept="acceptType[childItem.key]" style="display: none;" type="file"
|
|
36
|
-
@change="upload($event,childItem.key)">
|
|
33
|
+
<input :accept="acceptType[childItem.key]" style="display: none;" type="file" @change="upload($event,childItem.key)">
|
|
37
34
|
<span v-html="item2.name"></span>
|
|
38
35
|
</label>
|
|
39
36
|
<span v-else v-html="childItem.name"></span>
|
|
@@ -304,7 +301,7 @@
|
|
|
304
301
|
|
|
305
302
|
<!-- 展示弹窗 -->
|
|
306
303
|
<div v-for="(item,index) in interpositionData" :key="index">
|
|
307
|
-
<zydx-drag-popup v-if="item.isShow"
|
|
304
|
+
<zydx-drag-popup v-if="item.isShow" :minWidth="640" :minHeight="183"
|
|
308
305
|
:enlargeShow="false" :minimize="false" :minimizeCir="false"
|
|
309
306
|
:title="titleDragPopup[item.type]?titleDragPopup[item.type]:'参考文献'" height="auto"
|
|
310
307
|
width="auto" @close="closeDataShowPopup(item)">
|
|
@@ -370,7 +367,7 @@
|
|
|
370
367
|
v-html="'删除'"></div>
|
|
371
368
|
</div>
|
|
372
369
|
</div>
|
|
373
|
-
<div
|
|
370
|
+
<div style="min-width:600px;width: 600px" class="tip-box">
|
|
374
371
|
<div class="tip-title" v-html="`${item.exegesis}`"></div>
|
|
375
372
|
<div class="tip-boxContent">
|
|
376
373
|
<zydx-read :url="item.url" style="height: 100%"></zydx-read>
|
|
@@ -389,7 +386,7 @@
|
|
|
389
386
|
v-html="'删除'"></div>
|
|
390
387
|
</div>
|
|
391
388
|
</div>
|
|
392
|
-
<div
|
|
389
|
+
<div style="min-width:600px;width: 600px" class="tip-box">
|
|
393
390
|
<div class="tip-title" v-html="`${item.exegesis}`"></div>
|
|
394
391
|
<div class="tip-boxContent">
|
|
395
392
|
<zydx-read :url="item.url" style="height: 100%"></zydx-read>
|
|
@@ -408,7 +405,7 @@
|
|
|
408
405
|
v-html="'删除'"></div>
|
|
409
406
|
</div>
|
|
410
407
|
</div>
|
|
411
|
-
<div
|
|
408
|
+
<div style="min-width:600px;width: 600px" class="tip-box">
|
|
412
409
|
<div class="tip-title" v-html="`${item.exegesis}`"></div>
|
|
413
410
|
<div class="tip-boxContent">
|
|
414
411
|
<zydx-read :url="item.url" style="height: 100%"></zydx-read>
|
|
@@ -427,7 +424,7 @@
|
|
|
427
424
|
v-html="'删除'"></div>
|
|
428
425
|
</div>
|
|
429
426
|
</div>
|
|
430
|
-
<div
|
|
427
|
+
<div style="min-width:600px;width: 600px" class="tip-box">
|
|
431
428
|
<div class="tip-title" v-html="`${item.exegesis}`"></div>
|
|
432
429
|
<div class="tip-boxContent">
|
|
433
430
|
<iframe v-if="item.type === 'linkCourseware'" :src="item.url" frameborder="no" height="590"
|
|
@@ -449,7 +446,7 @@
|
|
|
449
446
|
v-html="'删除'"></div>
|
|
450
447
|
</div>
|
|
451
448
|
</div>
|
|
452
|
-
<div class="tip-box" style="width:
|
|
449
|
+
<div class="tip-box" style="min-width:600px;width: 600px">
|
|
453
450
|
<div class="tip-boxContent">
|
|
454
451
|
{{ item.text }}
|
|
455
452
|
</div>
|
|
@@ -462,6 +459,29 @@
|
|
|
462
459
|
</zydx-drag-popup>
|
|
463
460
|
</div>
|
|
464
461
|
|
|
462
|
+
|
|
463
|
+
<!-- 链接注释-->
|
|
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>
|
|
484
|
+
|
|
465
485
|
</div>
|
|
466
486
|
</template>
|
|
467
487
|
|
|
@@ -500,6 +520,7 @@ import viewSvg from "./view-svg.vue";
|
|
|
500
520
|
import Recorder from 'js-audio-recorder'
|
|
501
521
|
import zydxColoring from '../../coloring'
|
|
502
522
|
import Message from '../../../components/tipBox/index';
|
|
523
|
+
import Upload from '../../../components/upload' //上传文件
|
|
503
524
|
import zydxTextarea from '../../textarea'
|
|
504
525
|
import zydxRead from '../../read'
|
|
505
526
|
import zydxDragPopup from '../../dragPopup'
|
|
@@ -528,6 +549,8 @@ export default {
|
|
|
528
549
|
},
|
|
529
550
|
data() {
|
|
530
551
|
return {
|
|
552
|
+
checkboxObj:{value: '1', label: '是否开启缩进', checked: false},
|
|
553
|
+
checkbox:false,
|
|
531
554
|
titleDragPopup: {
|
|
532
555
|
nounExplain: '链接名词',
|
|
533
556
|
taggingMenu: '注释',
|
|
@@ -549,6 +572,7 @@ export default {
|
|
|
549
572
|
tipTitle: '',
|
|
550
573
|
taggingText: '',
|
|
551
574
|
isShowPopup: false,
|
|
575
|
+
isShowUpload: false,
|
|
552
576
|
isShowExegesis: false,
|
|
553
577
|
isShowFile: false,
|
|
554
578
|
exegesisType: 'add',
|
|
@@ -562,7 +586,7 @@ export default {
|
|
|
562
586
|
uploadImage: 'image/*',
|
|
563
587
|
},
|
|
564
588
|
uploadTypeArr: [
|
|
565
|
-
'group-upload',
|
|
589
|
+
// 'group-upload',
|
|
566
590
|
'importArticles',
|
|
567
591
|
'importWorks',
|
|
568
592
|
'videoLink',
|
|
@@ -893,7 +917,8 @@ export default {
|
|
|
893
917
|
shouldShow: ({editor, view, state, oldState, from, to}) => {
|
|
894
918
|
_this.encIndex = state.selection.$from.parent.attrs
|
|
895
919
|
if (_this.encIndex && _this.encIndex.titleId) {
|
|
896
|
-
|
|
920
|
+
let titleIdArr = state.selection.$from.parent.attrs.titleId.split(' ')
|
|
921
|
+
return state.selection.$from.parent.attrs.titleId === 'mu' || titleIdArr.indexOf('mu')!==-1
|
|
897
922
|
} else {
|
|
898
923
|
return false
|
|
899
924
|
}
|
|
@@ -1082,6 +1107,9 @@ export default {
|
|
|
1082
1107
|
},
|
|
1083
1108
|
emits: ['confirm', 'enclosure', 'enlDownload', 'enlSee'],
|
|
1084
1109
|
methods: {
|
|
1110
|
+
checkboxTao(checkboxObj){
|
|
1111
|
+
this.checkbox = checkboxObj.value
|
|
1112
|
+
},
|
|
1085
1113
|
closeDataShowPopup(item) {
|
|
1086
1114
|
item.isShow = false
|
|
1087
1115
|
item.edit = false
|
|
@@ -1998,23 +2026,35 @@ export default {
|
|
|
1998
2026
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
1999
2027
|
if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
|
|
2000
2028
|
const num = this.upSort(this.editor, 'enclosure')
|
|
2001
|
-
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
|
|
2029
|
+
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="indent mu"><span>${num.num}. ${name}</span></p>`
|
|
2002
2030
|
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
2031
|
+
const json = this.editor.getJSON()
|
|
2032
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
2033
|
+
const item = json.content[i]
|
|
2034
|
+
if( item.attrs.signId === 'enclosure'&&item.content[0].text==='附件列表:'){
|
|
2035
|
+
item.attrs.titleId = this.checkbox? 'indent' : null
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
this.editor.chain().setContent(<p></p>).run()
|
|
2039
|
+
this.editor.chain().setContent(json).run()
|
|
2040
|
+
this.isShowUpload = false
|
|
2003
2041
|
return
|
|
2004
2042
|
}
|
|
2005
2043
|
const num1 = this.upSort(this.editor, 'reference')
|
|
2006
2044
|
if (t === -1) this.editor.chain().focus().insertContentAt(num1.len-7, html).run()
|
|
2007
2045
|
const num = this.upSort(this.editor, 'enclosure')
|
|
2008
|
-
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="mu"><span>${num.num}. ${name}</span></p>`
|
|
2046
|
+
const html2 = `<p contenteditable="false" data-signId="u-${num.num}" data-url="${url}" class="indent mu"><span>${num.num}. ${name}</span></p>`
|
|
2009
2047
|
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2048
|
+
const json = this.editor.getJSON()
|
|
2049
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
2050
|
+
const item = json.content[i]
|
|
2051
|
+
if( item.attrs.signId === 'enclosure'&&item.content[0].text==='附件列表:'){
|
|
2052
|
+
item.attrs.titleId = this.checkbox? 'indent' : null
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
this.editor.chain().setContent(<p></p>).run()
|
|
2056
|
+
this.editor.chain().setContent(json).run()
|
|
2057
|
+
this.isShowUpload = false
|
|
2018
2058
|
})
|
|
2019
2059
|
}
|
|
2020
2060
|
if (v === 'uploadImage') {
|
|
@@ -2475,13 +2515,15 @@ export default {
|
|
|
2475
2515
|
// this.editor.commands.unsetTitleId()
|
|
2476
2516
|
// return
|
|
2477
2517
|
// }
|
|
2478
|
-
// this.editor.commands.setTitleId(
|
|
2518
|
+
// this.editor.commands.setTitleId('indent')
|
|
2479
2519
|
// }
|
|
2480
2520
|
// if (key.key === 'LineSpace') {
|
|
2521
|
+
// }
|
|
2481
2522
|
this.showDragPopup = true
|
|
2482
2523
|
const index = this.editor.state.selection.$anchor.path[1]
|
|
2483
2524
|
const json = this.editor.getJSON()
|
|
2484
2525
|
const margin = json.content[index].attrs.margin
|
|
2526
|
+
console.log('attrs',json.content[index].attrs)
|
|
2485
2527
|
const lineHeight = json.content[index].attrs.lineHeightId
|
|
2486
2528
|
if (!margin === false) {
|
|
2487
2529
|
const marginArr = margin.split(' ').map(item => item.replace('px', ''))
|
|
@@ -2495,7 +2537,6 @@ export default {
|
|
|
2495
2537
|
const index = lineHeight.split('-')[1]
|
|
2496
2538
|
this.paragraph.distance = child[index - 1]
|
|
2497
2539
|
}
|
|
2498
|
-
// }
|
|
2499
2540
|
}
|
|
2500
2541
|
// 字体
|
|
2501
2542
|
if (data.key === 'titleMenu') {
|
|
@@ -2565,6 +2606,9 @@ export default {
|
|
|
2565
2606
|
}
|
|
2566
2607
|
// 插入
|
|
2567
2608
|
if (data.key === 'interposition') {
|
|
2609
|
+
if(key.key === 'group-upload'){
|
|
2610
|
+
this.isShowUpload = true
|
|
2611
|
+
}
|
|
2568
2612
|
// 添加图片
|
|
2569
2613
|
if (key.key === 'group-image') {
|
|
2570
2614
|
if (childKey.key === 'insertImage') {
|
|
@@ -2937,10 +2981,17 @@ export default {
|
|
|
2937
2981
|
},
|
|
2938
2982
|
// 段落设置
|
|
2939
2983
|
paragraphSetting() {
|
|
2984
|
+
const selectionIndex = this.editor.state.selection.$anchor.path[1]
|
|
2985
|
+
const json = this.editor.getJSON()
|
|
2986
|
+
const titleId = json.content[selectionIndex].attrs.titleId
|
|
2940
2987
|
this.editor.commands.setMargin(`${this.paragraph.top}px ${this.paragraph.right}px ${this.paragraph.bottom}px ${this.paragraph.left}px`)
|
|
2941
2988
|
let child = ['1', '1.25', '1.5', '2', '2.5', '3']
|
|
2942
2989
|
let index = this.paragraph?.distance ? child.indexOf(this.paragraph?.distance) + 1 : 2
|
|
2943
2990
|
this.editor.commands.setLineHeightId(`ling-${index}`)
|
|
2991
|
+
if(!titleId===false){
|
|
2992
|
+
this.editor.commands.unsetTitleId()
|
|
2993
|
+
this.editor.commands.setTitleId(titleId)
|
|
2994
|
+
}
|
|
2944
2995
|
this.showDragPopup = false
|
|
2945
2996
|
},
|
|
2946
2997
|
taggingMenuSubmit() {
|
|
@@ -3319,7 +3370,7 @@ export default {
|
|
|
3319
3370
|
}
|
|
3320
3371
|
|
|
3321
3372
|
:deep(p[data-signid="subject"]) {
|
|
3322
|
-
padding-bottom:
|
|
3373
|
+
padding-bottom: 15px;
|
|
3323
3374
|
}
|
|
3324
3375
|
|
|
3325
3376
|
:deep(.author) {
|
|
@@ -3964,4 +4015,23 @@ li {
|
|
|
3964
4015
|
flex-direction: row;
|
|
3965
4016
|
justify-content: flex-end;
|
|
3966
4017
|
}
|
|
4018
|
+
|
|
4019
|
+
.check-upload label{
|
|
4020
|
+
display: flex;
|
|
4021
|
+
flex-direction: row;
|
|
4022
|
+
align-items: center;
|
|
4023
|
+
line-height: 1;
|
|
4024
|
+
}
|
|
4025
|
+
|
|
4026
|
+
.check-upload span{
|
|
4027
|
+
padding-left: 10px;
|
|
4028
|
+
}
|
|
4029
|
+
|
|
4030
|
+
.upload-box{
|
|
4031
|
+
padding: 50px 40px;
|
|
4032
|
+
height: 100%;
|
|
4033
|
+
display: flex;
|
|
4034
|
+
flex-direction: column;
|
|
4035
|
+
justify-content: space-between;
|
|
4036
|
+
}
|
|
3967
4037
|
</style>
|
|
@@ -3,66 +3,66 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script>
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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,252 @@ 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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
document.documentElement.scrollTop = 0
|
|
101
|
+
}, 0)
|
|
90
102
|
},
|
|
91
103
|
// 清空
|
|
92
104
|
clear() {
|
|
93
105
|
this.editor.store.loadSnapshot(clearJson)
|
|
106
|
+
this.isFocused()
|
|
94
107
|
},
|
|
95
108
|
// 添加快照
|
|
96
109
|
setSnapshot(v) {
|
|
97
110
|
this.editor.store.loadSnapshot(v)
|
|
111
|
+
this.isFocused()
|
|
98
112
|
},
|
|
99
113
|
// 获取快照
|
|
100
114
|
getSnapshot() {
|
|
101
115
|
return this.editor.store.getSnapshot()
|
|
102
116
|
},
|
|
103
117
|
draw(v) {
|
|
104
|
-
this.styleProps('draw','color').defaultValue = v?.color?? 'black'
|
|
105
|
-
this.styleProps('draw','size').defaultValue = v?.size?? 'm'
|
|
118
|
+
this.styleProps('draw', 'color').defaultValue = v?.color ?? 'black'
|
|
119
|
+
this.styleProps('draw', 'size').defaultValue = v?.size ?? 'm'
|
|
120
|
+
this.styleProps('draw', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
121
|
+
this.styleProps('draw', 'fill').defaultValue = v?.fill ?? 'none'
|
|
106
122
|
this.editor.setCurrentTool('draw')
|
|
107
123
|
},
|
|
108
124
|
select() {
|
|
109
125
|
this.editor.setCurrentTool('select')
|
|
110
126
|
},
|
|
111
127
|
hand() {
|
|
112
|
-
|
|
128
|
+
this.editor.setCurrentTool('hand')
|
|
113
129
|
},
|
|
114
130
|
eraser() {
|
|
115
131
|
this.editor.setCurrentTool('eraser')
|
|
116
132
|
},
|
|
117
133
|
arrow(v) {
|
|
118
|
-
|
|
119
|
-
this.styleProps('arrow','
|
|
134
|
+
// 'none', 'semi', 'solid', 'pattern'
|
|
135
|
+
this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
|
|
136
|
+
this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
|
|
137
|
+
this.styleProps('arrow', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
138
|
+
this.styleProps('arrow', 'fill').defaultValue = v?.fill ?? 'none'
|
|
120
139
|
this.editor.setCurrentTool('arrow')
|
|
121
140
|
},
|
|
122
141
|
text(v) {
|
|
123
|
-
this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
|
|
124
|
-
this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
|
|
142
|
+
this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
|
|
143
|
+
this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
|
|
144
|
+
this.styleProps('arrow', 'font').defaultValue = v?.font ?? 'draw' //['draw', 'sans', 'serif', 'mono']
|
|
145
|
+
this.styleProps('arrow', 'align').defaultValue = v?.align ?? 'start'
|
|
125
146
|
this.editor.setCurrentTool('text')
|
|
126
147
|
},
|
|
127
148
|
line(v) {
|
|
128
|
-
this.styleProps('arrow','color').defaultValue = v?.color?? 'black'
|
|
129
|
-
this.styleProps('arrow','size').defaultValue = v?.size?? 'm'
|
|
149
|
+
this.styleProps('arrow', 'color').defaultValue = v?.color ?? 'black'
|
|
150
|
+
this.styleProps('arrow', 'size').defaultValue = v?.size ?? 'm'
|
|
151
|
+
this.styleProps('arrow', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
152
|
+
this.styleProps('arrow', 'fill').defaultValue = v?.fill ?? 'none'
|
|
130
153
|
this.editor.setCurrentTool('line')
|
|
131
154
|
},
|
|
132
155
|
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'
|
|
156
|
+
this.styleProps('geo', 'geo').defaultValue = 'rectangle'
|
|
157
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
158
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
159
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
160
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
136
161
|
this.editor.setCurrentTool('geo')
|
|
137
162
|
},
|
|
138
163
|
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'
|
|
164
|
+
this.styleProps('geo', 'geo').defaultValue = 'ellipse'
|
|
165
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
166
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
167
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
168
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
142
169
|
this.editor.setCurrentTool('geo')
|
|
143
170
|
},
|
|
144
171
|
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'
|
|
172
|
+
this.styleProps('geo', 'geo').defaultValue = 'triangle'
|
|
173
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
174
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
175
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
176
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
177
|
+
this.editor.setCurrentTool('geo')
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
rhombus(v) {
|
|
181
|
+
this.styleProps('geo', 'geo').defaultValue = 'rhombus'
|
|
182
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
183
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
184
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
185
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
186
|
+
this.editor.setCurrentTool('geo')
|
|
187
|
+
},
|
|
188
|
+
cloud(v) {
|
|
189
|
+
this.styleProps('geo', 'geo').defaultValue = 'cloud'
|
|
190
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
191
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
192
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
193
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
194
|
+
this.editor.setCurrentTool('geo')
|
|
195
|
+
},
|
|
196
|
+
trapezoid(v) {
|
|
197
|
+
this.styleProps('geo', 'geo').defaultValue = 'trapezoid'
|
|
198
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
199
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
200
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
201
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
202
|
+
this.editor.setCurrentTool('geo')
|
|
203
|
+
},
|
|
204
|
+
diamond(v) {
|
|
205
|
+
this.styleProps('geo', 'geo').defaultValue = 'diamond'
|
|
206
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
207
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
208
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
209
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
148
210
|
this.editor.setCurrentTool('geo')
|
|
149
211
|
},
|
|
150
212
|
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'
|
|
213
|
+
this.styleProps('geo', 'geo').defaultValue = 'star'
|
|
214
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
215
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
216
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
217
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
218
|
+
this.editor.setCurrentTool('geo')
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
xBox(v) {
|
|
222
|
+
this.styleProps('geo', 'geo').defaultValue = 'x-box'
|
|
223
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
224
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
225
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
226
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
227
|
+
this.editor.setCurrentTool('geo')
|
|
228
|
+
},
|
|
229
|
+
checkBox(v) {
|
|
230
|
+
this.styleProps('geo', 'geo').defaultValue = 'check-box'
|
|
231
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
232
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
233
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
234
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
235
|
+
this.editor.setCurrentTool('geo')
|
|
236
|
+
},
|
|
237
|
+
oval(v) {
|
|
238
|
+
this.styleProps('geo', 'geo').defaultValue = 'oval'
|
|
239
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
240
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
241
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
242
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
243
|
+
this.editor.setCurrentTool('geo')
|
|
244
|
+
},
|
|
245
|
+
arrowLeft(v) {
|
|
246
|
+
this.styleProps('geo', 'geo').defaultValue = 'arrow-left'
|
|
247
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
248
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
249
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
250
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
251
|
+
this.editor.setCurrentTool('geo')
|
|
252
|
+
},
|
|
253
|
+
arrowRight(v) {
|
|
254
|
+
this.styleProps('geo', 'geo').defaultValue = 'arrow-right'
|
|
255
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
256
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
257
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
258
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
259
|
+
this.editor.setCurrentTool('geo')
|
|
260
|
+
},
|
|
261
|
+
arrowUp(v) {
|
|
262
|
+
this.styleProps('geo', 'geo').defaultValue = 'arrow-up'
|
|
263
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
264
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
265
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
266
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
267
|
+
this.editor.setCurrentTool('geo')
|
|
268
|
+
},
|
|
269
|
+
arrowDown(v) {
|
|
270
|
+
this.styleProps('geo', 'geo').defaultValue = 'arrow-down'
|
|
271
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
272
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
273
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
274
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
275
|
+
this.editor.setCurrentTool('geo')
|
|
276
|
+
},
|
|
277
|
+
hexagon(v) {
|
|
278
|
+
this.styleProps('geo', 'geo').defaultValue = 'hexagon'
|
|
279
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
280
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
281
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
282
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
154
283
|
this.editor.setCurrentTool('geo')
|
|
155
284
|
},
|
|
156
285
|
highlight(v) {
|
|
157
|
-
this.styleProps('geo','color').defaultValue = v?.color?? 'black'
|
|
158
|
-
this.styleProps('geo','size').defaultValue = v?.size?? 'm'
|
|
286
|
+
this.styleProps('geo', 'color').defaultValue = v?.color ?? 'black'
|
|
287
|
+
this.styleProps('geo', 'size').defaultValue = v?.size ?? 'm'
|
|
288
|
+
this.styleProps('geo', 'dash').defaultValue = v?.dash ?? 'draw'
|
|
289
|
+
this.styleProps('geo', 'fill').defaultValue = v?.fill ?? 'none'
|
|
159
290
|
this.editor.setCurrentTool('highlight')
|
|
160
291
|
},
|
|
161
292
|
laser() {
|
|
162
293
|
this.editor.setCurrentTool('laser')
|
|
163
294
|
},
|
|
164
|
-
undo(){
|
|
295
|
+
undo() {
|
|
165
296
|
this.editor.undo()
|
|
166
297
|
},
|
|
167
|
-
redo(){
|
|
298
|
+
redo() {
|
|
168
299
|
this.editor.redo()
|
|
169
300
|
},
|
|
170
|
-
styleProps(t,e) {
|
|
301
|
+
styleProps(t, e) {
|
|
171
302
|
const style = [...this.editor.styleProps[t]]
|
|
172
303
|
const index = style.findIndex(item => item[1] === e)
|
|
173
304
|
return style[index][0]
|
|
305
|
+
},
|
|
306
|
+
// 重新获取焦点
|
|
307
|
+
isFocused() {
|
|
308
|
+
const top = document.documentElement.scrollTop
|
|
309
|
+
setTimeout(() => {
|
|
310
|
+
this.editor.updateInstanceState({isFocused: true})
|
|
311
|
+
document.documentElement.scrollTop = top
|
|
312
|
+
}, 10)
|
|
174
313
|
}
|
|
175
314
|
}
|
|
176
315
|
}
|
|
177
316
|
</script>
|
|
178
317
|
|
|
179
318
|
<style scoped>
|
|
180
|
-
.react{
|
|
319
|
+
.react {
|
|
181
320
|
width: 100%;
|
|
182
321
|
height: 100%;
|
|
183
322
|
}
|