zydx-plus 1.32.189 → 1.32.191
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 +1 -1
- package/src/components/choice/src/choice.vue +8 -2
- package/src/components/dragPopup/src/dragPopup.vue +41 -19
- package/src/components/editor/src/editor.vue +291 -196
- package/src/components/word2/src/word.css +4 -4
- package/src/components/word2/src/word.vue +2 -1
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -161,7 +161,7 @@ export default {
|
|
|
161
161
|
})
|
|
162
162
|
})
|
|
163
163
|
return {
|
|
164
|
-
testKey: arr,
|
|
164
|
+
testKey: this.delArr(arr),
|
|
165
165
|
answer: arr.filter(x => x.isRight).map(x => x.index).join(','),
|
|
166
166
|
prompt: (this.single)? prompt : arr.filter(x => x.isRight).length < 2 || prompt
|
|
167
167
|
}
|
|
@@ -173,11 +173,17 @@ export default {
|
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
return {
|
|
176
|
-
testKey: arr,
|
|
176
|
+
testKey: arr.filter(x => x.content[0] !== ''),
|
|
177
177
|
prompt: arr.filter(x => x.content[0] === '').length > 0
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
|
+
delArr(v) {
|
|
182
|
+
return v.map(x => {
|
|
183
|
+
x.content = x.content.filter(y => y !== '')
|
|
184
|
+
return x
|
|
185
|
+
})
|
|
186
|
+
},
|
|
181
187
|
add(str) { // 添加选项
|
|
182
188
|
const index = this.list.length
|
|
183
189
|
if(index === 8) return
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="drag-pop" :class="{'zin': isMove}" :style="position" :id="id">
|
|
3
3
|
<div class="drag-head" :style="{'background-color':titleColor}">
|
|
4
|
-
<span @mousedown="mousedown"
|
|
5
|
-
@mousemove="mousemove"
|
|
6
|
-
@mouseup="mouseup"
|
|
7
|
-
@mouseleave="mousemove" :style="{'text-align': title === ''? 'center':'left'}">{{ title === ''? '按住可拖动弹窗': title }}</span>
|
|
4
|
+
<span @mousedown.stop="mousedown"
|
|
5
|
+
@mousemove.stop="mousemove"
|
|
6
|
+
@mouseup.stop="mouseup"
|
|
7
|
+
@mouseleave.stop="mousemove" :style="{'text-align': title === ''? 'center':'left'}">{{ title === ''? '按住可拖动弹窗': title }}</span>
|
|
8
8
|
<div class="drag-i">
|
|
9
9
|
<i class="disconnect" v-if="disconnectShow" @click.stop="disconnect"></i>
|
|
10
10
|
<i class="enlarge" v-if="enlargeShow" @click.stop="enlarge"></i>
|
|
11
11
|
<i @click.stop="close"></i>
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
|
-
<div :class="{'drag-cont': dragStatus,'drag-conts': !dragStatus}" @mousemove="footMove" @mouseleave="footMove">
|
|
14
|
+
<div :class="{'drag-cont': dragStatus || dragTextShow,'drag-conts': !dragStatus || !dragTextShow}" @mousemove.stop="footMove" @mouseleave.stop="footMove">
|
|
15
15
|
<div class="drag-cont-slot">
|
|
16
16
|
<slot name="content"></slot>
|
|
17
17
|
</div>
|
|
18
|
-
<i class="drag-down" v-if="dragStatus" @mousedown="footDown($event,'d')" @mouseup="footUp"></i>
|
|
19
|
-
<i class="drag-in" v-if="dragStatus" @mousedown="footDown($event,'in')" @mouseup="footUp"></i>
|
|
20
|
-
<i class="drag-right" v-if="dragStatus" @mousedown="footDown($event,'r')" @mouseup="footUp"></i>
|
|
18
|
+
<i class="drag-down" v-if="dragStatus" @mousedown.stop="footDown($event,'d')" @mouseup.stop="footUp"></i>
|
|
19
|
+
<i class="drag-in" v-if="dragStatus" @mousedown.stop="footDown($event,'in')" @mouseup.stop="footUp"></i>
|
|
20
|
+
<i class="drag-right" v-if="dragStatus" @mousedown.stop="footDown($event,'r')" @mouseup.stop="footUp"></i>
|
|
21
21
|
</div>
|
|
22
|
-
<div class="down-text" v-if="dragStatus">
|
|
22
|
+
<div class="down-text" v-if="dragStatus&&dragTextShow">
|
|
23
23
|
<div class="down-text-cont">
|
|
24
24
|
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAFkdJREFUeF7tnQ20HVV1x/ee+14CTYpW+ZIqgoLYgAoUKBYQUCmsKqWUPhBlWRJ4Z88NX5ISEATkQyAQAvjIe/fseS95CJVCQEsp2g9YFQoI4aOxKcGCfKQqVEglSAMY8u6crhNuspKb+bgzb+beuXf2WSsrbyXn7LP3b5//OzNnZs5BkCIEhEAoARQ2QkAIhBMQgcjoEAIRBEQgMjyEgAhExoAQSEdAZpB03KRVSQiIQEqSaAkzHQERSDpu0qokBEQgJUm0hJmOgAgkHTdpVRICIpCSJFrCTEdABJKOm7QqCQERSEkSLWGmIyACScdNWpWEgAikJImWMNMREIGk4yatSkJABFKSREuY6QiIQNJxk1YlISACKUmiJcx0BEQg6bhJq5IQ6KhAarXaLgBwGCLu7zjODGPMngCwXUnYS5jhBFYh4grf95+uVCoPAcCDg4ODv+wEsI4IpFarnew4jgsAf9SJoKXPriTwiO/7XrVavamd3rdVIFrroxHxTAD4fDuDlL56isB9xpgh13X/oR1RtU0gzEwAoNsRlPRRCgI3ENHZeUfaFoEw890AcHTewYj90hG4j4iOyDPq3AXied64MebkmCDWAsBTALDM9/2X8gxYbBefQKVS2QEA9jbG7A0AW8V4fAYRLcwrqlwF0rgZH49w/i5EnL9mzZplc+bMeTuvIMVudxIYHx/fat26dfsaY64GgIPDokDEE5VSt+URZW4Cue6667aePn36o8aYTwY5johzlVLX5hGU2Ow9Asz8XQD4cshYWr5mzZoD8/glm5tAmPlcALDKDypHEtG/9F4aJaI8CXie90VjTNjq1XlEdE3W/ecikKGhoW2mTp36NAD8foDDHhHZFS0pQiAxAc/zXGNMLaDhS1OmTNlr5syZryc2GtEgF4HUarUjHcf5p4B+c191yBKO2ComgYiFn2OJ6K4svc5FIFrrKxHx/CZH1xhj9nVd92dZBiC2ykfAvqLkOI5d9ZzWFH3mz0ZyEQgzPwY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piMgAknHTVqVhIAIpCSJljDTERCBpOMmrUpCQARSkkRLmOkI/D8ja3mb73FFuQAAAABJRU5ErkJggg==" />
|
|
25
25
|
<span>拖动图标调整窗口大小</span>
|
|
@@ -43,6 +43,9 @@ export default {
|
|
|
43
43
|
footIsMove: false,//是否移动标识
|
|
44
44
|
direction: '',//移动方向
|
|
45
45
|
id: '',//id
|
|
46
|
+
state: false,//是否显示
|
|
47
|
+
clientWidth: 0,
|
|
48
|
+
clientHeight: 0,
|
|
46
49
|
}
|
|
47
50
|
},
|
|
48
51
|
props: {
|
|
@@ -73,7 +76,11 @@ export default {
|
|
|
73
76
|
title: {
|
|
74
77
|
type: String,
|
|
75
78
|
default: ''
|
|
76
|
-
}
|
|
79
|
+
},
|
|
80
|
+
dragTextShow: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: true
|
|
83
|
+
},
|
|
77
84
|
},
|
|
78
85
|
watch: {
|
|
79
86
|
width: {
|
|
@@ -98,7 +105,7 @@ export default {
|
|
|
98
105
|
},
|
|
99
106
|
computed: {
|
|
100
107
|
position() {
|
|
101
|
-
return `
|
|
108
|
+
return `top:${this.y}px;left:${this.x}px;width:${this.footRightOffset}px;height:${this.footDownOffset}px;`;
|
|
102
109
|
},
|
|
103
110
|
},
|
|
104
111
|
emits: ['dragStatus','close','enlarge'],
|
|
@@ -107,10 +114,10 @@ export default {
|
|
|
107
114
|
this.$emit('dragStatus')
|
|
108
115
|
},
|
|
109
116
|
init() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.x = clientWidth / 2 - this.footRightOffset / 2;
|
|
113
|
-
this.y = clientHeight / 2 - this.footDownOffset / 2;
|
|
117
|
+
this.clientWidth = document.documentElement.clientWidth;
|
|
118
|
+
this.clientHeight = document.documentElement.clientHeight;
|
|
119
|
+
this.x = this.clientWidth / 2 - this.footRightOffset / 2;
|
|
120
|
+
this.y = this.clientHeight / 2 - this.footDownOffset / 2;
|
|
114
121
|
},
|
|
115
122
|
footDown(event,v) {
|
|
116
123
|
event.preventDefault()
|
|
@@ -118,6 +125,7 @@ export default {
|
|
|
118
125
|
this.footIsMove = true;
|
|
119
126
|
},
|
|
120
127
|
footMove(event) {
|
|
128
|
+
if(this.state) return;
|
|
121
129
|
if(!this.footIsMove) return;
|
|
122
130
|
if(this.direction === 'd') {
|
|
123
131
|
this.footDownOffset = event.clientY - this.y;
|
|
@@ -140,16 +148,30 @@ export default {
|
|
|
140
148
|
},
|
|
141
149
|
//鼠标移动
|
|
142
150
|
mousemove(event) {
|
|
151
|
+
if(this.state) return;
|
|
143
152
|
if (!this.isMove) return;
|
|
144
153
|
this.x = event.clientX - this.leftOffset;
|
|
145
154
|
this.y = event.clientY - this.topOffset;
|
|
155
|
+
// 边界判断
|
|
156
|
+
if(this.x < -this.footRightOffset / 2) {
|
|
157
|
+
this.x = -this.footRightOffset / 2
|
|
158
|
+
}
|
|
159
|
+
if(this.x > this.clientWidth - this.footRightOffset + this.footRightOffset/2) {
|
|
160
|
+
this.x = this.clientWidth - this.footRightOffset + this.footRightOffset/2
|
|
161
|
+
}
|
|
162
|
+
if(this.y < 0) {
|
|
163
|
+
this.y = 0
|
|
164
|
+
}
|
|
165
|
+
if(this.y > this.clientHeight - this.footDownOffset + this.footDownOffset/2) {
|
|
166
|
+
this.y = this.clientHeight - this.footDownOffset + this.footDownOffset/2
|
|
167
|
+
}
|
|
146
168
|
},
|
|
147
169
|
//鼠标抬起
|
|
148
170
|
mouseup() {
|
|
149
171
|
this.isMove = false;
|
|
150
172
|
},
|
|
151
173
|
enlarge() {
|
|
152
|
-
|
|
174
|
+
this.state = false
|
|
153
175
|
let clientWidth = document.documentElement.clientWidth;
|
|
154
176
|
let clientHeight = document.documentElement.clientHeight;
|
|
155
177
|
if(clientWidth === this.footRightOffset && clientHeight === this.footDownOffset) {
|
|
@@ -157,15 +179,15 @@ export default {
|
|
|
157
179
|
this.y = clientHeight / 2 - this.height / 2;
|
|
158
180
|
this.footDownOffset = this.height;
|
|
159
181
|
this.footRightOffset = this.width;
|
|
160
|
-
state = false
|
|
182
|
+
this.state = false
|
|
161
183
|
}else {
|
|
162
184
|
this.x = 0;
|
|
163
185
|
this.y = 0;
|
|
164
186
|
this.footDownOffset = clientHeight;
|
|
165
187
|
this.footRightOffset = clientWidth;
|
|
166
|
-
state = true
|
|
188
|
+
this.state = true
|
|
167
189
|
}
|
|
168
|
-
this.$emit('enlarge', state)
|
|
190
|
+
this.$emit('enlarge', this.state)
|
|
169
191
|
},
|
|
170
192
|
close() {
|
|
171
193
|
this.isMove = false
|
|
@@ -4,19 +4,23 @@
|
|
|
4
4
|
<div class="editor-but" v-for="(item,index) in butData">
|
|
5
5
|
<div class="editor-but-name" v-if="item.key === 'group-upload'">
|
|
6
6
|
<label>
|
|
7
|
-
<input type="file" @change="upload($event,item.key)" accept=".docx,.pptx,.pdf,.xlsx"
|
|
7
|
+
<input type="file" @change="upload($event,item.key)" accept=".docx,.pptx,.pdf,.xlsx"
|
|
8
|
+
style="display: none;">
|
|
8
9
|
<span v-html="item.name"></span>
|
|
9
10
|
</label>
|
|
10
11
|
</div>
|
|
11
12
|
<div v-else class="editor-but-name" @click="butTap(item,0)">
|
|
12
13
|
<span v-html="item.name"></span>
|
|
13
|
-
<img v-if="item.menuKeys.length > 0"
|
|
14
|
+
<img v-if="item.menuKeys.length > 0"
|
|
15
|
+
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAADL5JREFUeF7tnXvIZlUVxn9iSZQlYomEJdEFSTMsS9EuSEZhWSOapmQZkplUNoqWJkmKZSpKTmKkGJWS6BgOaTdSklJRcsokRUmMIikQBKEwjIxn5oTfvMz3vfvd77nsvdez/pl/9mWt39rPnO/sd529d8BmAiawKoEdzMYETGB1AhaIV4cJrEHAAvHyMAELxGvABPII+AmSx829ghCwQIIk2mHmEbBA8ri5VxACFkiQRDvMPAIWSB439wpCwAIJkmiHmUfAAsnj5l5BCFggQRLtM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glj3etgGJOAnyIBwVwy9N/Bwz1MdAtzd85geboaABTLekrgQOKen6VQ5rDsFbQMTsEAGBrxi+J26bd89l5zyX9227t+XHMfdEwhYIAmQemxyEnDNkuOdBVyy5BjunkjAAkkE1WOzOwGdrp5jqhTeL6ej++QRsEDyuC3T61DgjswBjgZuzuzrbhkELJAMaD10+S6gG54WMVUIr1ukg9suT8ACWZ5hzgh7dS/sOy7Q+S3A7xZo76Y9ELBAeoCYOcS5wAWJfS8HTk9s62Y9ErBAeoSZMdSjgO4pX8ue7LZ1n84Y312WJGCBLAlwye7HA9fPGeNzwLeWnMfdMwlYIJngeuz2szVqqlQJfGCPc3moBQlYIAsCG6D5QcA9q4z7AeAnA8zpIRMJWCCJoAZudiVw6swcqgA+buB5PfwcAhZIGUtk927bd+cV7qgC+JEy3IvrhQVSTu7PAC7t3Pka8OVyXIvriQVSVu4fAHbttnWfLcu1mN5YIGXl/chOINeW5VZcbyyQuLl35AkELJAESG4Sl4AFEjf3jjyBgAWSAMlN4hKwQOLm3pEnELBAEiC5SVwCFkjc3DvyBAIWSAIkN4lLwAKJm3tHnkDAAkmA5CZxCVggcXPvyBMIWCAJkNwkLgELJG7uHXkCAQskAZKbxCVggcTNvSNPIGCBJEByk7gELJC4uXfkCQQskARIbhKXgAUSN/eOPIGABZIAyU3iErBA4ubekScQsEASILlJXAIWSNzcO/IEAhZIAiQ3iUvAAombe0eeQMACSYDkJnEJWCBxc+/IEwhYIAmQ3CQugf8B4iUV2AmRzcoAAAAASUVORK5CYII="
|
|
16
|
+
alt=""/>
|
|
14
17
|
</div>
|
|
15
18
|
<div class="editor-but-down" v-if="item.menuKeys.length > 0">
|
|
16
19
|
<ul>
|
|
17
20
|
<li @click="butTap(item,item2)" v-for="(item2,index2) in item.menuKeys">
|
|
18
21
|
<label v-if="item2.key === 'uploadImage'">
|
|
19
|
-
<input type="file" @change="upload($event,item2.key)" accept="image/*"
|
|
22
|
+
<input type="file" @change="upload($event,item2.key)" accept="image/*"
|
|
23
|
+
style="display: none;">
|
|
20
24
|
<span v-html="item2.name"></span>
|
|
21
25
|
</label>
|
|
22
26
|
<span v-else v-html="item2.name"></span>
|
|
@@ -28,10 +32,10 @@
|
|
|
28
32
|
<div class="editor-content" v-show="editableShow">
|
|
29
33
|
<div class="editing">
|
|
30
34
|
<div class="editing-header" v-if="signMenuShow">
|
|
31
|
-
<img :src="menusData('signMenu')?.ico" alt=""
|
|
35
|
+
<img :src="menusData('signMenu')?.ico" alt=""/>
|
|
32
36
|
<span>{{ menusData('signMenu')?.text }}</span>
|
|
33
37
|
</div>
|
|
34
|
-
<editor-content class="editing-cont" :editor="editor"
|
|
38
|
+
<editor-content id="test" class="editing-cont" :editor="editor"></editor-content>
|
|
35
39
|
</div>
|
|
36
40
|
</div>
|
|
37
41
|
<div class="complete" v-if="!readOnly && toolbar.length > 0">
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
</div>
|
|
40
44
|
<div class="read-only" v-if="page&&readOnly">
|
|
41
45
|
<div class="editing-header" v-if="signMenuShow">
|
|
42
|
-
<img :src="menusData('signMenu')?.ico" alt=""
|
|
46
|
+
<img :src="menusData('signMenu')?.ico" alt=""/>
|
|
43
47
|
<span>{{ menusData('signMenu')?.text }}</span>
|
|
44
48
|
</div>
|
|
45
49
|
<div class="read-only-page" v-for="(item,index) in htmlArr">
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
</div>
|
|
50
54
|
<div class="img-pop" v-if="imgPop">
|
|
51
55
|
<p>图片地址:</p>
|
|
52
|
-
<input type="text" v-model="imgUrl"
|
|
56
|
+
<input type="text" v-model="imgUrl"/>
|
|
53
57
|
<div class="img-but">
|
|
54
58
|
<button class="but" @click="imgConfirm">确认</button>
|
|
55
59
|
<button class="but" @click="imgCancel">取消</button>
|
|
@@ -59,23 +63,24 @@
|
|
|
59
63
|
</template>
|
|
60
64
|
|
|
61
65
|
<script>
|
|
62
|
-
import
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
66
|
+
import exportWord from 'js-export-word'
|
|
67
|
+
import {html2json, json2html} from 'html2json'
|
|
68
|
+
import {butJson} from './butJson'
|
|
69
|
+
import {Editor, EditorContent} from '@tiptap/vue-3'
|
|
65
70
|
import StarterKit from '@tiptap/starter-kit'
|
|
66
71
|
import Placeholder from '@tiptap/extension-placeholder'
|
|
67
72
|
import TextStyle from '@tiptap/extension-text-style'
|
|
68
|
-
import
|
|
73
|
+
import Images from '@tiptap/extension-image'
|
|
69
74
|
import TextAlign from '@tiptap/extension-text-align'
|
|
70
75
|
import Color from '@tiptap/extension-color'
|
|
71
76
|
import FontFamily from "@tiptap/extension-font-family";
|
|
72
77
|
import Superscript from "@tiptap/extension-superscript";
|
|
73
78
|
import HorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
74
79
|
import Link from "@tiptap/extension-link";
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
80
|
+
import {FontSize} from "./extend/font-size";
|
|
81
|
+
import {signId} from "./extend/sign-id";
|
|
82
|
+
import {Contenteditable} from "./extend/contenteditable";
|
|
83
|
+
import {titleId} from "./extend/title-id";
|
|
79
84
|
|
|
80
85
|
export default {
|
|
81
86
|
name: 'zydx-editor',
|
|
@@ -131,24 +136,28 @@ export default {
|
|
|
131
136
|
page: {
|
|
132
137
|
type: Boolean,
|
|
133
138
|
default: true
|
|
134
|
-
}
|
|
139
|
+
},
|
|
140
|
+
fileName: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: '题'
|
|
143
|
+
},
|
|
135
144
|
},
|
|
136
145
|
watch: {
|
|
137
146
|
html: {
|
|
138
147
|
handler: function (e, oldVal) {
|
|
139
|
-
if(e[0]?.tag === 'sign') {
|
|
148
|
+
if (e[0]?.tag === 'sign') {
|
|
140
149
|
this.signMenuShow = true
|
|
141
150
|
e.shift()
|
|
142
151
|
}
|
|
143
|
-
this.editor?.commands.setContent(json2html({node: "root",child: (e === undefined || null)? [] : e}))
|
|
144
|
-
if(this.readOnly) {
|
|
145
|
-
if(this.page) this.editableShow = true
|
|
152
|
+
this.editor?.commands.setContent(json2html({node: "root", child: (e === undefined || null) ? [] : e}))
|
|
153
|
+
if (this.readOnly) {
|
|
154
|
+
if (this.page) this.editableShow = true
|
|
146
155
|
setTimeout(() => {
|
|
147
|
-
if(this.page) {
|
|
156
|
+
if (this.page) {
|
|
148
157
|
this.editableShow = false
|
|
149
158
|
this.readOnlyPage()
|
|
150
159
|
}
|
|
151
|
-
},100)
|
|
160
|
+
}, 100)
|
|
152
161
|
}
|
|
153
162
|
},
|
|
154
163
|
deep: true,
|
|
@@ -158,7 +167,7 @@ export default {
|
|
|
158
167
|
this.editor.setOptions({
|
|
159
168
|
editable: !e
|
|
160
169
|
})
|
|
161
|
-
if(this.page) {
|
|
170
|
+
if (this.page) {
|
|
162
171
|
this.editableShow = !e
|
|
163
172
|
this.readOnlyPage()
|
|
164
173
|
}
|
|
@@ -168,8 +177,8 @@ export default {
|
|
|
168
177
|
},
|
|
169
178
|
mounted() {
|
|
170
179
|
const _this = this
|
|
171
|
-
let dataHtml = json2html({node: "root",child: (_this.html === undefined || null)? [] : _this.html})
|
|
172
|
-
if(dataHtml[0]?.tag === 'sign') {
|
|
180
|
+
let dataHtml = json2html({node: "root", child: (_this.html === undefined || null) ? [] : _this.html})
|
|
181
|
+
if (dataHtml[0]?.tag === 'sign') {
|
|
173
182
|
this.signMenuShow = true
|
|
174
183
|
dataHtml.shift()
|
|
175
184
|
}
|
|
@@ -208,7 +217,7 @@ export default {
|
|
|
208
217
|
TextAlign.configure({ // 文本对齐
|
|
209
218
|
types: ['heading', 'paragraph'],
|
|
210
219
|
}),
|
|
211
|
-
|
|
220
|
+
Images.configure({ // 图片
|
|
212
221
|
inline: true,
|
|
213
222
|
HTMLAttributes: {
|
|
214
223
|
class: 'editor-img'
|
|
@@ -217,26 +226,54 @@ export default {
|
|
|
217
226
|
],
|
|
218
227
|
injectCSS: true
|
|
219
228
|
})
|
|
229
|
+
document.addEventListener('keydown', function (e) {
|
|
230
|
+
if (e.keyCode === 13) {
|
|
231
|
+
// 禁止标题回车
|
|
232
|
+
const sid = _this.editor.state.selection.$anchor.path[3].attrs.signId
|
|
233
|
+
const ca = _this.editor.state.selection.$anchor.path[3].attrs.titleId
|
|
234
|
+
if(sid?.split('-')[0] === 'title') {
|
|
235
|
+
const json = _this.editor.getJSON()
|
|
236
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
237
|
+
if (json.content[i].attrs?.titleId === ca) {
|
|
238
|
+
json.content.splice(i + 1, 1)
|
|
239
|
+
_this.editor?.commands.setContent(json)
|
|
240
|
+
break
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
})
|
|
220
246
|
_this.organizeButton()
|
|
221
247
|
},
|
|
222
|
-
emits: ['confirm','enclosure'],
|
|
248
|
+
emits: ['confirm', 'enclosure'],
|
|
223
249
|
methods: {
|
|
224
|
-
|
|
250
|
+
exportToWord() {
|
|
251
|
+
const wrap = document.getElementById('test')
|
|
252
|
+
const config = {
|
|
253
|
+
addStyle: true, // 是否导出样式,默认为true,此操作会将所有样式转换成行内样式导出
|
|
254
|
+
fileName: this.fileName, // 导出文件名
|
|
255
|
+
// toImg:['.editor-img'], // 页面哪些部分需要转化成图片,例如echart图表之类
|
|
256
|
+
success() {
|
|
257
|
+
console.log('导出成功')
|
|
258
|
+
} // 完成之后回调,一般页面篇幅比较大,时间比较长
|
|
259
|
+
}
|
|
260
|
+
exportWord(wrap, config)
|
|
261
|
+
},
|
|
262
|
+
readOnlyPage() {
|
|
225
263
|
this.htmlArr = []
|
|
226
264
|
const data = document.querySelectorAll('.editing-cont')[0].childNodes[0].childNodes
|
|
227
|
-
let max =
|
|
265
|
+
let max = 950
|
|
228
266
|
let pHeight = 0
|
|
229
267
|
let html = ''
|
|
230
268
|
for (let i = 0; i < data.length; i++) {
|
|
231
269
|
let text = data[i].offsetHeight
|
|
232
|
-
if(data[i].dataset?.signid === 'ack') {
|
|
270
|
+
if (data[i].dataset?.signid === 'ack') {
|
|
233
271
|
this.htmlArr.push(html)
|
|
234
272
|
pHeight = 0
|
|
235
273
|
html = ''
|
|
236
274
|
}
|
|
237
|
-
if((pHeight + text) > max) {
|
|
238
|
-
|
|
239
|
-
const {start,end} = this.rows(data[i],pHeight - max)
|
|
275
|
+
if ((pHeight + text) > max) {
|
|
276
|
+
const {start, end} = this.rows(data[i], max - pHeight)
|
|
240
277
|
html += `<p>${start}</p>`
|
|
241
278
|
this.htmlArr.push(html)
|
|
242
279
|
pHeight = 0
|
|
@@ -245,7 +282,7 @@ export default {
|
|
|
245
282
|
}
|
|
246
283
|
pHeight += text + 5
|
|
247
284
|
html += data[i].outerHTML
|
|
248
|
-
if(i === data.length - 1) {
|
|
285
|
+
if (i === data.length - 1) {
|
|
249
286
|
this.htmlArr.push(html)
|
|
250
287
|
pHeight = 0
|
|
251
288
|
html = ''
|
|
@@ -254,23 +291,47 @@ export default {
|
|
|
254
291
|
}
|
|
255
292
|
},
|
|
256
293
|
rows(data,num) {
|
|
294
|
+
let size = parseInt(window.getComputedStyle(data, null).fontSize)
|
|
257
295
|
let line = parseInt(window.getComputedStyle(data, null).lineHeight)
|
|
258
|
-
let
|
|
259
|
-
let rows = Math.round(
|
|
296
|
+
let width = data.offsetWidth
|
|
297
|
+
let rows = Math.round(num / line) // 行数
|
|
260
298
|
let text = data.innerText
|
|
261
|
-
let
|
|
262
|
-
let
|
|
299
|
+
let len = this.measureText(text,size)
|
|
300
|
+
let textLen = Math.round((width / (len/text.length)) * rows)
|
|
301
|
+
let start = text.slice(0, textLen)
|
|
263
302
|
let end = text.slice(textLen)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
303
|
+
return {start, end}
|
|
304
|
+
},
|
|
305
|
+
measureText (text, fontSize=10) {
|
|
306
|
+
text = String(text);
|
|
307
|
+
text = text.split('');
|
|
308
|
+
let width = 0;
|
|
309
|
+
text.forEach(function(item) {
|
|
310
|
+
if (/[a-zA-Z]/.test(item)) { // 英文匹配
|
|
311
|
+
width += 7;
|
|
312
|
+
} else if (/[0-9]/.test(item)) { // 数字匹配
|
|
313
|
+
width += 5.5;
|
|
314
|
+
} else if (/\./.test(item)) { // 英文句点匹配
|
|
315
|
+
width += 2.7;
|
|
316
|
+
} else if (/-/.test(item)) { // 英文减号匹配
|
|
317
|
+
width += 3.25;
|
|
318
|
+
} else if (/[\u4e00-\u9fa5]/.test(item)) { //中文匹配
|
|
319
|
+
width += 10;
|
|
320
|
+
} else if (/\(|\)/.test(item)) { // 括号匹配
|
|
321
|
+
width += 3.73;
|
|
322
|
+
} else if (/\s/.test(item)) { // 空格匹配
|
|
323
|
+
width += 2.5;
|
|
324
|
+
} else if (/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(item)) { // 英文符号匹配
|
|
325
|
+
width += 8;
|
|
326
|
+
} else {
|
|
327
|
+
width += 10;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
return width * fontSize / 10;
|
|
270
331
|
},
|
|
271
332
|
confirm() {
|
|
272
|
-
let data =
|
|
273
|
-
if(this.signMenuShow) {
|
|
333
|
+
let data = html2json(this.editor.getHTML()).child
|
|
334
|
+
if (this.signMenuShow) {
|
|
274
335
|
data.unshift({
|
|
275
336
|
node: 'element',
|
|
276
337
|
tag: 'sign',
|
|
@@ -280,8 +341,8 @@ export default {
|
|
|
280
341
|
this.$emit('confirm', data)
|
|
281
342
|
},
|
|
282
343
|
getConfirm() {
|
|
283
|
-
let data =
|
|
284
|
-
if(this.signMenuShow) {
|
|
344
|
+
let data = html2json(this.editor.getHTML()).child
|
|
345
|
+
if (this.signMenuShow) {
|
|
285
346
|
data.unshift({
|
|
286
347
|
node: 'element',
|
|
287
348
|
tag: 'sign',
|
|
@@ -293,22 +354,22 @@ export default {
|
|
|
293
354
|
// 上传进度
|
|
294
355
|
progressFunction(e) {
|
|
295
356
|
if (e.lengthComputable) {
|
|
296
|
-
if(this.imgType === 'group-upload') {
|
|
357
|
+
if (this.imgType === 'group-upload') {
|
|
297
358
|
this.uploadAttachment.onProgress(Math.round(e.loaded / e.total * 100))
|
|
298
359
|
}
|
|
299
360
|
}
|
|
300
361
|
},
|
|
301
|
-
upSort(editor,v) {
|
|
362
|
+
upSort(editor, v) {
|
|
302
363
|
const data = editor.state.selection.$anchor.path[0].content.content
|
|
303
364
|
let num = 1
|
|
304
365
|
let len = 0
|
|
305
366
|
data.forEach((item, index) => {
|
|
306
367
|
const id = item?.attrs?.signId
|
|
307
|
-
if(id) {
|
|
368
|
+
if (id) {
|
|
308
369
|
let arr = item.attrs.signId.split('-')[0]
|
|
309
|
-
if(arr === 'u') {
|
|
370
|
+
if (arr === 'u') {
|
|
310
371
|
len += item.content.size + 2
|
|
311
|
-
num
|
|
372
|
+
num++
|
|
312
373
|
}
|
|
313
374
|
}
|
|
314
375
|
})
|
|
@@ -317,63 +378,63 @@ export default {
|
|
|
317
378
|
num: num
|
|
318
379
|
}
|
|
319
380
|
},
|
|
320
|
-
upload(e,v) {
|
|
381
|
+
upload(e, v) {
|
|
321
382
|
const file = e.target.files[0]
|
|
322
383
|
let up = this.uploadImage
|
|
323
384
|
this.imgType = v
|
|
324
|
-
if(v === 'group-upload') up = this.uploadAttachment
|
|
325
|
-
this.uploadFile(file,up).then(res => {
|
|
326
|
-
if(res.code === '200') {
|
|
327
|
-
if(v === 'group-upload') {
|
|
328
|
-
up.customInsert(res,file,async (name,url) => {
|
|
385
|
+
if (v === 'group-upload') up = this.uploadAttachment
|
|
386
|
+
this.uploadFile(file, up).then(res => {
|
|
387
|
+
if (res.code === '200') {
|
|
388
|
+
if (v === 'group-upload') {
|
|
389
|
+
up.customInsert(res, file, async (name, url) => {
|
|
329
390
|
const b = await this.signIdData('paragraph')
|
|
330
391
|
const t = await this.signIdData('enclosure')
|
|
331
|
-
const html = butJson(this.editor,this.menusText)[v].html
|
|
332
|
-
if(b === -1) {
|
|
392
|
+
const html = butJson(this.editor, this.menusText)[v].html
|
|
393
|
+
if (b === -1) {
|
|
333
394
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
334
|
-
if(t === -1) this.editor.chain().focus().insertContentAt(last,html).run()
|
|
335
|
-
const num = this.upSort(this.editor,'enclosure')
|
|
395
|
+
if (t === -1) this.editor.chain().focus().insertContentAt(last, html).run()
|
|
396
|
+
const num = this.upSort(this.editor, 'enclosure')
|
|
336
397
|
const html2 = `<p contenteditable="false" data-signId="u-${num.num}"><a href="${url}" ><span>${num.num}. ${name}</span></a></p>`
|
|
337
|
-
this.editor.chain().focus().insertContentAt(num.len,html2).run()
|
|
338
|
-
}else {
|
|
339
|
-
if(t === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('paragraph',b - 1),html).run()
|
|
340
|
-
const num = this.upSort(this.editor,'enclosure')
|
|
398
|
+
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
399
|
+
} else {
|
|
400
|
+
if (t === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('paragraph', b - 1), html).run()
|
|
401
|
+
const num = this.upSort(this.editor, 'enclosure')
|
|
341
402
|
const html2 = `<p contenteditable="false" data-signId="u-${num.num}"><a href="${url}" ><span>${num.num}. ${name}</span></a></p>`
|
|
342
|
-
this.editor.chain().focus().insertContentAt(num.len,html2).run()
|
|
403
|
+
this.editor.chain().focus().insertContentAt(num.len, html2).run()
|
|
343
404
|
}
|
|
344
405
|
})
|
|
345
|
-
}else {
|
|
346
|
-
up.customInsert(res,(data) => {
|
|
406
|
+
} else {
|
|
407
|
+
up.customInsert(res, (data) => {
|
|
347
408
|
const html = `<p><img src="${data}" alt="" /></p>`
|
|
348
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
409
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
349
410
|
})
|
|
350
411
|
}
|
|
351
|
-
up.onSuccess(file,res) // 上传成功回调
|
|
352
|
-
}else {
|
|
353
|
-
up.onFailed(file,res) // 上传失败回调
|
|
412
|
+
up.onSuccess(file, res) // 上传成功回调
|
|
413
|
+
} else {
|
|
414
|
+
up.onFailed(file, res) // 上传失败回调
|
|
354
415
|
}
|
|
355
416
|
})
|
|
356
417
|
e.target.value = ''
|
|
357
418
|
},
|
|
358
|
-
uploadFile(file,data) {
|
|
419
|
+
uploadFile(file, data) {
|
|
359
420
|
let _this = this
|
|
360
|
-
return new Promise((rl,re) => {
|
|
361
|
-
const meta = data.meta? Object.keys(data.meta): []
|
|
421
|
+
return new Promise((rl, re) => {
|
|
422
|
+
const meta = data.meta ? Object.keys(data.meta) : []
|
|
362
423
|
const param = new FormData()
|
|
363
424
|
param.append('file', file)
|
|
364
|
-
for(let i = 0; i < meta.length; i++) {
|
|
425
|
+
for (let i = 0; i < meta.length; i++) {
|
|
365
426
|
param.append(meta[i], data.meta[meta[i]])
|
|
366
427
|
}
|
|
367
428
|
const xhr = new XMLHttpRequest()
|
|
368
429
|
xhr.open('POST', data.server)
|
|
369
430
|
const headers = Object.keys(data.headers)
|
|
370
|
-
for(let i = 0; i < headers.length; i++) {
|
|
431
|
+
for (let i = 0; i < headers.length; i++) {
|
|
371
432
|
xhr.setRequestHeader(headers[i], data.headers[headers[i]])
|
|
372
433
|
}
|
|
373
434
|
xhr.upload.onprogress = _this.progressFunction
|
|
374
435
|
xhr.onreadystatechange = () => {
|
|
375
|
-
if(xhr.readyState === 4) {
|
|
376
|
-
if(xhr.status === 200) {
|
|
436
|
+
if (xhr.readyState === 4) {
|
|
437
|
+
if (xhr.status === 200) {
|
|
377
438
|
rl(JSON.parse(xhr.responseText))
|
|
378
439
|
}
|
|
379
440
|
}
|
|
@@ -384,9 +445,9 @@ export default {
|
|
|
384
445
|
// 确认图片地址
|
|
385
446
|
imgConfirm() {
|
|
386
447
|
this.imgPop = false
|
|
387
|
-
if(this.imgUrl === '') return
|
|
448
|
+
if (this.imgUrl === '') return
|
|
388
449
|
const html = `<p><img src="${this.imgUrl}" alt="" /></p>`
|
|
389
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
450
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
390
451
|
},
|
|
391
452
|
// 取消图片地址
|
|
392
453
|
imgCancel() {
|
|
@@ -403,11 +464,11 @@ export default {
|
|
|
403
464
|
// 整理按钮
|
|
404
465
|
organizeButton() {
|
|
405
466
|
this.toolbar.forEach(item => {
|
|
406
|
-
let obj = butJson(this.editor,this.menusText)[item.key === undefined? item : item.key]
|
|
467
|
+
let obj = butJson(this.editor, this.menusText)[item.key === undefined ? item : item.key]
|
|
407
468
|
if (obj) {
|
|
408
|
-
if(item.key === undefined) {
|
|
469
|
+
if (item.key === undefined) {
|
|
409
470
|
this.butData.push(obj)
|
|
410
|
-
}else {
|
|
471
|
+
} else {
|
|
411
472
|
this.butData.push({
|
|
412
473
|
key: item.key,
|
|
413
474
|
menuKeys: obj.menuKeys,
|
|
@@ -417,147 +478,147 @@ export default {
|
|
|
417
478
|
}
|
|
418
479
|
})
|
|
419
480
|
},
|
|
420
|
-
async butTap(data,key) {
|
|
481
|
+
async butTap(data, key) {
|
|
421
482
|
// 标志
|
|
422
|
-
if(data.key === 'signMenu') this.signMenuShow = !this.signMenuShow
|
|
483
|
+
if (data.key === 'signMenu') this.signMenuShow = !this.signMenuShow
|
|
423
484
|
// 红头文件
|
|
424
|
-
if(data.key === 'redMenu') {
|
|
425
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
485
|
+
if (data.key === 'redMenu') {
|
|
486
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
426
487
|
const r = await this.signIdData('red')
|
|
427
|
-
if(r === -1) {
|
|
428
|
-
this.editor.chain().focus().insertContentAt(0,html).run()
|
|
488
|
+
if (r === -1) {
|
|
489
|
+
this.editor.chain().focus().insertContentAt(0, html).run()
|
|
429
490
|
this.editor.commands.setHorizontalRule() // 添加分割线
|
|
430
491
|
}
|
|
431
492
|
}
|
|
432
493
|
// 标题
|
|
433
|
-
if(data.key === 'titleMenu') {
|
|
434
|
-
const html = butJson(this.editor,this.menusText)[data.key].html[key.key]
|
|
435
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
494
|
+
if (data.key === 'titleMenu') {
|
|
495
|
+
const html = butJson(this.editor, this.menusText)[data.key].html[key.key]
|
|
496
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
436
497
|
}
|
|
437
498
|
// 正文
|
|
438
|
-
if(data.key === 'textMenu') {
|
|
439
|
-
const html = butJson(this.editor,this.menusText)[data.key].html[key.key]
|
|
440
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
499
|
+
if (data.key === 'textMenu') {
|
|
500
|
+
const html = butJson(this.editor, this.menusText)[data.key].html[key.key]
|
|
501
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
441
502
|
}
|
|
442
503
|
// 作者
|
|
443
|
-
if(data.key === 'authorMenu') {
|
|
444
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
504
|
+
if (data.key === 'authorMenu') {
|
|
505
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
445
506
|
const b = await this.signIdData('subject') // 判断是否有题目
|
|
446
507
|
const r = await this.signIdData('author')
|
|
447
|
-
if(b === -1) {
|
|
448
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
449
|
-
}else {
|
|
450
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'),html).run()
|
|
508
|
+
if (b === -1) {
|
|
509
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
510
|
+
} else {
|
|
511
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
451
512
|
}
|
|
452
513
|
}
|
|
453
514
|
// 题目
|
|
454
|
-
if(data.key === 'subjectMenu') {
|
|
455
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
515
|
+
if (data.key === 'subjectMenu') {
|
|
516
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
456
517
|
const b = await this.signIdData('red') // 判断是否有红头文件
|
|
457
518
|
const r = await this.signIdData('subject')
|
|
458
|
-
if(b === -1) {
|
|
459
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(0,html).run()
|
|
460
|
-
}else {
|
|
461
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'),html).run()
|
|
519
|
+
if (b === -1) {
|
|
520
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(0, html).run()
|
|
521
|
+
} else {
|
|
522
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('red'), html).run()
|
|
462
523
|
}
|
|
463
524
|
}
|
|
464
525
|
// 添加落款
|
|
465
|
-
if(data.key === 'paragraphMenu') {
|
|
466
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
526
|
+
if (data.key === 'paragraphMenu') {
|
|
527
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
467
528
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
468
529
|
const b = await this.signIdData('ack')
|
|
469
530
|
const r = await this.signIdData('paragraph')
|
|
470
|
-
if(b === -1) {
|
|
471
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(last,html).run()
|
|
472
|
-
}else {
|
|
473
|
-
const num = this.upSort(this.editor,'ack')
|
|
474
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(num.len-3,html).run()
|
|
531
|
+
if (b === -1) {
|
|
532
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(last, html).run()
|
|
533
|
+
} else {
|
|
534
|
+
const num = this.upSort(this.editor, 'ack')
|
|
535
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(num.len - 3, html).run()
|
|
475
536
|
}
|
|
476
537
|
}
|
|
477
538
|
// 标注编号
|
|
478
|
-
if(data.key === 'numberMenu') {
|
|
479
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
480
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
539
|
+
if (data.key === 'numberMenu') {
|
|
540
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
541
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
481
542
|
}
|
|
482
543
|
// 关键词
|
|
483
|
-
if(data.key === 'keywordMenu') {
|
|
484
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
485
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
544
|
+
if (data.key === 'keywordMenu') {
|
|
545
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
546
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
486
547
|
}
|
|
487
548
|
// 摘要
|
|
488
|
-
if(data.key === 'abstractMenu') {
|
|
489
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
490
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
549
|
+
if (data.key === 'abstractMenu') {
|
|
550
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
551
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
491
552
|
}
|
|
492
553
|
// 致谢
|
|
493
|
-
if(data.key === 'ackMenu') {
|
|
494
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
554
|
+
if (data.key === 'ackMenu') {
|
|
555
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
495
556
|
const last = this.editor.state.selection.$anchor.path[0].content.size
|
|
496
557
|
const r = await this.signIdData('ack')
|
|
497
|
-
if(r === -1) {
|
|
498
|
-
this.editor.chain().focus().insertContentAt(last,html[0]).run()
|
|
499
|
-
this.editor.chain().focus().insertContentAt(last+3,html[1]).run()
|
|
558
|
+
if (r === -1) {
|
|
559
|
+
this.editor.chain().focus().insertContentAt(last, html[0]).run()
|
|
560
|
+
this.editor.chain().focus().insertContentAt(last + 3, html[1]).run()
|
|
500
561
|
}
|
|
501
562
|
}
|
|
502
563
|
// 文献
|
|
503
|
-
if(data.key === 'literatureMenu') {
|
|
504
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
564
|
+
if (data.key === 'literatureMenu') {
|
|
565
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
505
566
|
const t = await this.signIdData('subject') // 判断是否有题目
|
|
506
567
|
const b = await this.signIdData('author') // 判断是否有作者
|
|
507
568
|
const r = await this.signIdData('literature')
|
|
508
|
-
if(b === -1) {
|
|
509
|
-
if(t === -1) {
|
|
510
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
511
|
-
}else {
|
|
512
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'),html).run()
|
|
569
|
+
if (b === -1) {
|
|
570
|
+
if (t === -1) {
|
|
571
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selection(), html).run()
|
|
572
|
+
} else {
|
|
573
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('subject'), html).run()
|
|
513
574
|
}
|
|
514
|
-
}else {
|
|
515
|
-
if(r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('author'),html).run()
|
|
575
|
+
} else {
|
|
576
|
+
if (r === -1) this.editor.chain().focus().insertContentAt(this.selectionPath('author'), html).run()
|
|
516
577
|
}
|
|
517
578
|
}
|
|
518
579
|
// 添加标注
|
|
519
|
-
if(data.key === 'taggingMenu') {
|
|
580
|
+
if (data.key === 'taggingMenu') {
|
|
520
581
|
const index = this.editor.state.selection.$anchor.path[1] // 获取当前光标所行数
|
|
521
582
|
const content = this.editor.state.selection.$anchor.path[0].content.content // 获取内容
|
|
522
583
|
const name = content[index + 1]?.type.name
|
|
523
|
-
const num = this.cursorPosition(content,index) // 获取当前光标位置
|
|
524
|
-
const html = butJson(this.editor,this.menusText)[data.key].html
|
|
525
|
-
this.editor.chain().focus().insertContentAt(this.selection(),html[0]).run()
|
|
526
|
-
const si = butJson(this.editor,this.menusText)[data.key].index - 1 // 获取标记的位置
|
|
584
|
+
const num = this.cursorPosition(content, index) // 获取当前光标位置
|
|
585
|
+
const html = butJson(this.editor, this.menusText)[data.key].html
|
|
586
|
+
this.editor.chain().focus().insertContentAt(this.selection(), html[0]).run()
|
|
587
|
+
const si = butJson(this.editor, this.menusText)[data.key].index - 1 // 获取标记的位置
|
|
527
588
|
const signID = this.selectionPath(`s-${si}`)
|
|
528
|
-
if(name !== 'horizontalRule') {
|
|
529
|
-
this.editor.chain().focus().insertContentAt(num,html[1]).run()
|
|
530
|
-
this.editor.chain().focus().insertContentAt(num+2,html[2]).run()
|
|
531
|
-
}else {
|
|
532
|
-
this.editor.chain().focus().insertContentAt(signID,html[2]).run()
|
|
589
|
+
if (name !== 'horizontalRule') {
|
|
590
|
+
this.editor.chain().focus().insertContentAt(num, html[1]).run()
|
|
591
|
+
this.editor.chain().focus().insertContentAt(num + 2, html[2]).run()
|
|
592
|
+
} else {
|
|
593
|
+
this.editor.chain().focus().insertContentAt(signID, html[2]).run()
|
|
533
594
|
}
|
|
534
595
|
}
|
|
535
596
|
// 添加图片
|
|
536
|
-
if(data.key === 'group-image') {
|
|
537
|
-
if(key.key === 'insertImage') {
|
|
597
|
+
if (data.key === 'group-image') {
|
|
598
|
+
if (key.key === 'insertImage') {
|
|
538
599
|
this.imgUrl = ''
|
|
539
600
|
this.imgPop = true
|
|
540
601
|
}
|
|
541
602
|
}
|
|
542
603
|
},
|
|
543
|
-
cursorPosition(data,index) {
|
|
604
|
+
cursorPosition(data, index) {
|
|
544
605
|
let num = 0
|
|
545
|
-
for(let i=0; i<data.length; i++) {
|
|
606
|
+
for (let i = 0; i < data.length; i++) {
|
|
546
607
|
num += data[i].nodeSize
|
|
547
|
-
if(i === index) break
|
|
608
|
+
if (i === index) break
|
|
548
609
|
}
|
|
549
610
|
return num
|
|
550
611
|
},
|
|
551
|
-
selectionPath(v,n) {
|
|
612
|
+
selectionPath(v, n) {
|
|
552
613
|
let num = 0
|
|
553
614
|
const path = this.editor.state.selection.$head.path[0].content.content
|
|
554
|
-
for(let i=0; i<path.length; i++) {
|
|
615
|
+
for (let i = 0; i < path.length; i++) {
|
|
555
616
|
num += path[i].nodeSize
|
|
556
|
-
if(n !== undefined) {
|
|
557
|
-
if(i === n) break
|
|
558
|
-
}else {
|
|
559
|
-
if(path[i].attrs?.signId === v) {
|
|
560
|
-
if(v=== 'red') num += 1
|
|
617
|
+
if (n !== undefined) {
|
|
618
|
+
if (i === n) break
|
|
619
|
+
} else {
|
|
620
|
+
if (path[i].attrs?.signId === v) {
|
|
621
|
+
if (v === 'red') num += 1
|
|
561
622
|
break
|
|
562
623
|
}
|
|
563
624
|
}
|
|
@@ -568,8 +629,8 @@ export default {
|
|
|
568
629
|
return this.$nextTick(() => {
|
|
569
630
|
let state = -1
|
|
570
631
|
const json = this.editor.getJSON()
|
|
571
|
-
for(let i = 0; i< json.content.length; i++) {
|
|
572
|
-
if(json.content[i].attrs?.signId === id) {
|
|
632
|
+
for (let i = 0; i < json.content.length; i++) {
|
|
633
|
+
if (json.content[i].attrs?.signId === id) {
|
|
573
634
|
state = i
|
|
574
635
|
break
|
|
575
636
|
}
|
|
@@ -578,7 +639,7 @@ export default {
|
|
|
578
639
|
})
|
|
579
640
|
},
|
|
580
641
|
selection() {
|
|
581
|
-
const {
|
|
642
|
+
const {from} = this.editor.state.selection
|
|
582
643
|
return from
|
|
583
644
|
},
|
|
584
645
|
}
|
|
@@ -586,12 +647,13 @@ export default {
|
|
|
586
647
|
</script>
|
|
587
648
|
|
|
588
649
|
<style scoped>
|
|
589
|
-
.read-only{
|
|
650
|
+
.read-only {
|
|
590
651
|
position: relative;
|
|
591
652
|
width: 794px;
|
|
592
653
|
margin: 0 auto;
|
|
593
654
|
}
|
|
594
|
-
|
|
655
|
+
|
|
656
|
+
.read-only-page {
|
|
595
657
|
width: 100%;
|
|
596
658
|
height: 1123px;
|
|
597
659
|
padding: 100px;
|
|
@@ -601,14 +663,17 @@ export default {
|
|
|
601
663
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
602
664
|
margin: 20px 0;
|
|
603
665
|
}
|
|
604
|
-
|
|
666
|
+
|
|
667
|
+
.read-only-p {
|
|
605
668
|
width: 100%;
|
|
606
669
|
height: 100%;
|
|
607
670
|
}
|
|
671
|
+
|
|
608
672
|
:deep(.read-only-p p) {
|
|
609
673
|
line-height: 25px;
|
|
610
674
|
}
|
|
611
|
-
|
|
675
|
+
|
|
676
|
+
.read-only-a {
|
|
612
677
|
position: absolute;
|
|
613
678
|
bottom: 25px;
|
|
614
679
|
left: 50%;
|
|
@@ -617,47 +682,56 @@ export default {
|
|
|
617
682
|
transform: translateX(-50%);
|
|
618
683
|
color: #999;
|
|
619
684
|
}
|
|
620
|
-
|
|
685
|
+
|
|
686
|
+
.complete {
|
|
621
687
|
padding: 0 10px 10px 10px;
|
|
622
688
|
text-align: right;
|
|
623
689
|
}
|
|
624
|
-
|
|
690
|
+
|
|
691
|
+
label {
|
|
625
692
|
cursor: pointer;
|
|
626
693
|
}
|
|
694
|
+
|
|
627
695
|
:deep(.custom-link) {
|
|
628
696
|
color: #333;
|
|
629
697
|
text-decoration: none;
|
|
630
698
|
}
|
|
631
|
-
|
|
699
|
+
|
|
700
|
+
:deep(.editor-img) {
|
|
632
701
|
max-width: 100%;
|
|
633
702
|
}
|
|
634
|
-
|
|
703
|
+
|
|
704
|
+
.img-pop {
|
|
635
705
|
position: absolute;
|
|
636
706
|
top: 100px;
|
|
637
707
|
left: 100px;
|
|
638
708
|
z-index: 10;
|
|
639
709
|
background-color: #fff;
|
|
640
710
|
border-radius: 5px;
|
|
641
|
-
box-shadow: 0 0 10px rgba(0,0,0
|
|
711
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, .2);
|
|
642
712
|
padding: 30px;
|
|
643
713
|
}
|
|
644
|
-
|
|
714
|
+
|
|
715
|
+
.img-pop p {
|
|
645
716
|
margin-bottom: 10px;
|
|
646
717
|
font-size: 14px;
|
|
647
718
|
color: #333;
|
|
648
719
|
}
|
|
649
|
-
|
|
720
|
+
|
|
721
|
+
.img-pop input {
|
|
650
722
|
width: 300px;
|
|
651
723
|
height: 30px;
|
|
652
724
|
padding: 0 10px;
|
|
653
725
|
border: 1px solid #999;
|
|
654
726
|
border-radius: 5px;
|
|
655
727
|
}
|
|
656
|
-
|
|
728
|
+
|
|
729
|
+
.img-but {
|
|
657
730
|
padding-top: 20px;
|
|
658
731
|
text-align: right;
|
|
659
732
|
}
|
|
660
|
-
|
|
733
|
+
|
|
734
|
+
.but {
|
|
661
735
|
margin-left: 1px;
|
|
662
736
|
font-size: 12px;
|
|
663
737
|
background-color: transparent;
|
|
@@ -668,22 +742,26 @@ label{
|
|
|
668
742
|
min-width: 60px;
|
|
669
743
|
height: 21px;
|
|
670
744
|
}
|
|
671
|
-
|
|
745
|
+
|
|
746
|
+
.editing-header {
|
|
672
747
|
position: absolute;
|
|
673
748
|
top: 10px;
|
|
674
749
|
left: 10px;
|
|
675
750
|
display: flex;
|
|
676
751
|
z-index: 1;
|
|
677
752
|
}
|
|
678
|
-
|
|
753
|
+
|
|
754
|
+
.editing-header img {
|
|
679
755
|
width: 15px;
|
|
680
756
|
height: 15px;
|
|
681
757
|
margin-right: 5px;
|
|
682
758
|
}
|
|
683
|
-
|
|
759
|
+
|
|
760
|
+
.editing-header span {
|
|
684
761
|
font-size: 12px;
|
|
685
762
|
font-weight: 400;
|
|
686
763
|
}
|
|
764
|
+
|
|
687
765
|
:deep(.ProseMirror) p.is-editor-empty:first-child::before {
|
|
688
766
|
content: attr(data-placeholder);
|
|
689
767
|
float: left;
|
|
@@ -691,25 +769,31 @@ label{
|
|
|
691
769
|
pointer-events: none;
|
|
692
770
|
height: 0;
|
|
693
771
|
}
|
|
772
|
+
|
|
694
773
|
:deep(.custom-link) {
|
|
695
774
|
margin: 10px 0;
|
|
696
775
|
}
|
|
776
|
+
|
|
697
777
|
.editing-cont :deep(p) {
|
|
698
778
|
line-height: 25px;
|
|
699
779
|
}
|
|
700
|
-
|
|
780
|
+
|
|
781
|
+
li {
|
|
701
782
|
list-style: none;
|
|
702
783
|
}
|
|
703
|
-
|
|
784
|
+
|
|
785
|
+
.z-editor {
|
|
704
786
|
border: 1px solid rgba(204, 204, 204, 1);
|
|
705
787
|
position: relative;
|
|
706
788
|
}
|
|
707
|
-
|
|
789
|
+
|
|
790
|
+
.editor-header {
|
|
708
791
|
display: flex;
|
|
709
792
|
border-bottom: 1px solid rgba(204, 204, 204, 1);
|
|
710
793
|
user-select: none;
|
|
711
794
|
}
|
|
712
|
-
|
|
795
|
+
|
|
796
|
+
.editor-but {
|
|
713
797
|
flex: 1;
|
|
714
798
|
height: 30px;
|
|
715
799
|
line-height: 30px;
|
|
@@ -718,25 +802,31 @@ li{
|
|
|
718
802
|
position: relative;
|
|
719
803
|
border-right: 1px solid rgba(204, 204, 204, 1);
|
|
720
804
|
}
|
|
721
|
-
|
|
805
|
+
|
|
806
|
+
.editor-but:hover .editor-but-down {
|
|
722
807
|
display: block;
|
|
723
808
|
}
|
|
724
|
-
|
|
809
|
+
|
|
810
|
+
.editor-but:last-child {
|
|
725
811
|
border-right: none;
|
|
726
812
|
}
|
|
727
|
-
|
|
813
|
+
|
|
814
|
+
.editor-but-name {
|
|
728
815
|
width: 100%;
|
|
729
816
|
height: 100%;
|
|
730
817
|
cursor: pointer;
|
|
731
818
|
}
|
|
732
|
-
|
|
819
|
+
|
|
820
|
+
.editor-but span {
|
|
733
821
|
font-weight: 400;
|
|
734
822
|
}
|
|
735
|
-
|
|
823
|
+
|
|
824
|
+
.editor-but img {
|
|
736
825
|
width: 8px;
|
|
737
826
|
margin-left: 4px;
|
|
738
827
|
}
|
|
739
|
-
|
|
828
|
+
|
|
829
|
+
.editor-but-down {
|
|
740
830
|
position: absolute;
|
|
741
831
|
top: 30px;
|
|
742
832
|
left: 0;
|
|
@@ -746,27 +836,32 @@ li{
|
|
|
746
836
|
display: none;
|
|
747
837
|
background-color: #fff;
|
|
748
838
|
}
|
|
749
|
-
|
|
839
|
+
|
|
840
|
+
.editor-but-down li {
|
|
750
841
|
font-size: 12px;
|
|
751
842
|
padding: 6px 0;
|
|
752
843
|
text-align: center;
|
|
753
844
|
line-height: 18px;
|
|
754
845
|
cursor: pointer;
|
|
755
846
|
}
|
|
756
|
-
|
|
847
|
+
|
|
848
|
+
.editor-but-down li:hover {
|
|
757
849
|
color: #666;
|
|
758
850
|
}
|
|
759
|
-
|
|
851
|
+
|
|
852
|
+
.editor-content {
|
|
760
853
|
margin: 10px;
|
|
761
854
|
border: 1px solid rgba(204, 204, 204, 1);
|
|
762
855
|
}
|
|
763
|
-
|
|
856
|
+
|
|
857
|
+
.editing {
|
|
764
858
|
width: 794px;
|
|
765
859
|
min-height: 1123px;
|
|
766
860
|
margin: 0 auto;
|
|
767
861
|
position: relative;
|
|
768
862
|
}
|
|
769
|
-
|
|
863
|
+
|
|
864
|
+
.editing-cont {
|
|
770
865
|
padding: 100px;
|
|
771
866
|
box-sizing: border-box;
|
|
772
867
|
width: 794px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.page-cont{
|
|
2
|
-
width:
|
|
2
|
+
width: 100%;
|
|
3
3
|
margin: 0 auto;
|
|
4
4
|
position: relative;
|
|
5
5
|
}
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
background-color: #fff;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
position: relative;
|
|
13
|
-
|
|
14
|
-
margin: 20px
|
|
13
|
+
border: 1px solid rgb(204, 204, 204);
|
|
14
|
+
margin-bottom: 20px;
|
|
15
15
|
}
|
|
16
16
|
.page-cont-num{
|
|
17
17
|
position: absolute;
|
|
18
|
-
bottom:
|
|
18
|
+
bottom: 72px;
|
|
19
19
|
left: 50%;
|
|
20
20
|
z-index: 1;
|
|
21
21
|
font-size: 14px;
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
data() {
|
|
22
22
|
return {
|
|
23
23
|
htmlArr: [],
|
|
24
|
-
max:
|
|
24
|
+
max: 0,
|
|
25
25
|
pHeight: 0,
|
|
26
26
|
html: ''
|
|
27
27
|
}
|
|
@@ -54,6 +54,7 @@ export default {
|
|
|
54
54
|
this.html = ''
|
|
55
55
|
setTimeout(() => {
|
|
56
56
|
const data = document.getElementById('test').children[0].childNodes
|
|
57
|
+
this.max = (document.getElementsByClassName('word-page')[0].offsetWidth * 1.4) - 320
|
|
57
58
|
this.children(data)
|
|
58
59
|
},0)
|
|
59
60
|
},
|