zydx-plus 1.15.65 → 1.16.66
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.
|
|
3
|
+
"version": "1.16.66",
|
|
4
4
|
"description": "Vue.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
"@wangeditor/plugin-formula": "^1.0.11",
|
|
30
30
|
"katex": "^0.15.6",
|
|
31
31
|
"simple-mind-map": "^0.5.8",
|
|
32
|
-
"html2json": "^1.0.2"
|
|
32
|
+
"html2json": "^1.0.2",
|
|
33
|
+
"@tiptap/extension-image": "^2.0.3",
|
|
34
|
+
"@tiptap/starter-kit": "^2.0.3",
|
|
35
|
+
"@tiptap/vue-3": "^2.0.3"
|
|
33
36
|
},
|
|
34
37
|
"peerDependencies": {
|
|
35
38
|
"vue": "^3.2.13"
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="drag-pop" :style="position">
|
|
3
|
+
<div class="drag-head"
|
|
4
|
+
:style="{'background-color':titleColor}"
|
|
5
|
+
@mousedown="mousedown"
|
|
6
|
+
@mousemove="mousemove"
|
|
7
|
+
@mouseup="mouseup"
|
|
8
|
+
@mouseleave="mousemove">
|
|
9
|
+
<span>{{ title }}</span>
|
|
10
|
+
<i @click="close"></i>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="drag-cont" :style="{'border':'2px solid' + titleColor}" @mousemove="footMove" @mouseleave="footMove">
|
|
13
|
+
<slot name="content"></slot>
|
|
14
|
+
<i class="down" v-if="dragStatus" @mousedown="footDown($event,'d')" @mouseup="footUp"></i>
|
|
15
|
+
<i class="in" @mousedown="footDown($event,'in')" @mouseup="footUp"></i>
|
|
16
|
+
<i class="right" v-if="dragStatus" @mousedown="footDown($event,'r')" @mouseup="footUp"></i>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
name: "zydx-drag-popup",
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
x: 0,//left:x
|
|
27
|
+
y: 0,//top:y
|
|
28
|
+
leftOffset: 0,//鼠标距离移动窗口左侧偏移量
|
|
29
|
+
footDownOffset: this.height,//高度
|
|
30
|
+
topOffset: 0,//鼠标距离移动窗口顶部偏移量
|
|
31
|
+
footRightOffset: this.width,//宽度
|
|
32
|
+
isMove: false,//是否移动标识
|
|
33
|
+
footIsMove: false,//是否移动标识
|
|
34
|
+
direction: '',//移动方向
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
width: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 600
|
|
41
|
+
},
|
|
42
|
+
height: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 400
|
|
45
|
+
},
|
|
46
|
+
titleColor: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: '#5daf34'
|
|
49
|
+
},
|
|
50
|
+
title: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '提示弹窗'
|
|
53
|
+
},
|
|
54
|
+
dragStatus: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
created() {
|
|
60
|
+
// 获取游览器可视区域宽高
|
|
61
|
+
let clientWidth = document.documentElement.clientWidth;
|
|
62
|
+
let clientHeight = document.documentElement.clientHeight;
|
|
63
|
+
this.x = clientWidth / 2 - this.footDownOffset / 2;
|
|
64
|
+
this.y = clientHeight / 2 - this.footRightOffset / 2;
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
position() {
|
|
68
|
+
return `top:${this.y}px;left:${this.x}px;width:${this.footRightOffset}px;height:${this.footDownOffset}px;`;
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
footDown(event,v) {
|
|
73
|
+
event.preventDefault()
|
|
74
|
+
this.direction = v
|
|
75
|
+
this.footIsMove = true;
|
|
76
|
+
},
|
|
77
|
+
footMove(event) {
|
|
78
|
+
if(!this.footIsMove) return;
|
|
79
|
+
if(this.direction === 'd') {
|
|
80
|
+
this.footDownOffset = event.clientY - this.y;
|
|
81
|
+
} else if(this.direction === 'in') {
|
|
82
|
+
this.footDownOffset = event.clientY - this.y;
|
|
83
|
+
this.footRightOffset = event.clientX - this.x;
|
|
84
|
+
} else if(this.direction === 'r') {
|
|
85
|
+
this.footRightOffset = event.clientX - this.x;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
footUp() {
|
|
89
|
+
this.footIsMove = false;
|
|
90
|
+
},
|
|
91
|
+
mousedown(event) {
|
|
92
|
+
event.preventDefault()
|
|
93
|
+
//鼠标按下事件
|
|
94
|
+
this.leftOffset = event.offsetX;
|
|
95
|
+
this.topOffset = event.offsetY;
|
|
96
|
+
this.isMove = true;
|
|
97
|
+
},
|
|
98
|
+
//鼠标移动
|
|
99
|
+
mousemove(event) {
|
|
100
|
+
if (!this.isMove) return;
|
|
101
|
+
this.x = event.clientX - this.leftOffset;
|
|
102
|
+
this.y = event.clientY - this.topOffset;
|
|
103
|
+
},
|
|
104
|
+
//鼠标抬起
|
|
105
|
+
mouseup() {
|
|
106
|
+
this.isMove = false;
|
|
107
|
+
},
|
|
108
|
+
close() {
|
|
109
|
+
this.$emit('close');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<style scoped>
|
|
116
|
+
.down{
|
|
117
|
+
position: absolute;
|
|
118
|
+
bottom: -20px;
|
|
119
|
+
right: 20px;
|
|
120
|
+
width: calc(100% - 20px);
|
|
121
|
+
height: 40px;
|
|
122
|
+
z-index: 1;
|
|
123
|
+
display: inline-block;
|
|
124
|
+
cursor: ns-resize;
|
|
125
|
+
}
|
|
126
|
+
.in{
|
|
127
|
+
position: absolute;
|
|
128
|
+
bottom: -20px;
|
|
129
|
+
right: -20px;
|
|
130
|
+
width: 40px;
|
|
131
|
+
height: 40px;
|
|
132
|
+
z-index: 1;
|
|
133
|
+
display: inline-block;
|
|
134
|
+
cursor: nwse-resize;
|
|
135
|
+
}
|
|
136
|
+
.right{
|
|
137
|
+
position: absolute;
|
|
138
|
+
bottom: 20px;
|
|
139
|
+
right: -20px;
|
|
140
|
+
width: 40px;
|
|
141
|
+
height: calc(100% - 20px);
|
|
142
|
+
z-index: 1;
|
|
143
|
+
display: inline-block;
|
|
144
|
+
cursor: ew-resize;
|
|
145
|
+
}
|
|
146
|
+
.drag-head i {
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 0;
|
|
149
|
+
right: 0;
|
|
150
|
+
width: 40px;
|
|
151
|
+
height: 40px;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAADHJJREFUeF7tnbmWJUcVRc9xJFnwDziAtBhM+AJcrNbcrXnoeVbPrdbcmmcxg8SotjD5A2QiWBLg8A9gSXIOKyFbq1SqV5UZeeNV5o1TbmfcF3ff2Fld71S9JPxlAiawkgDNxgRMYDUBC+LTYQLbELAgPh4mYEF8BkygjIC/g5Rx86pGCFiQRgbtNssIWJAybl7VCAEL0sig3WYZAQtSxs2rGiFgQRoZtNssI2BByrh5VSMELEgjg3abZQQsSBk3r2qEgAVpZNBus4yABSnj5lWNELAgjQzabZYRsCBl3LyqEQIWpJFBu80yAhakjJtXNULAgjQyaLdZRsCClHHzqkYIWJBGBu02ywhYkDJuXtUIAQvSyKDdZhkBC1LGzasaIWBBGhm02ywjYEHKuHlVIwQsSCODdptlBCxIGTevaoSABWlk0G6zjIAFKePmVY0QsCCNDNptlhGwIGXcvKoRAhakk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rdzt+TQmyroPk18lDwILkmaU7qUDAglSA6pJ5CFiQPLN0JxUIWJAKUF0yDwELkmeW7qQCAQtSAapL5iFgQfLM0p1UIGBBKkB1yTwELEieWbqTCgQsSAWoLpmHgAXJM0t3UoGABakA1SXzELAgeWbpTioQsCAVoLpkHgIWJM8s3UkFAhakAlSXzEPAguSZpTupQMCCVIDqknkIWJA8s3QnFQhYkApQXTIPAQuSZ5bupAIBC1IBqkvmIWBB8szSnVQgYEEqQHXJPAQsSJ5ZupMKBCxIBagumYeABckzS3dSgYAFqQDVJfMQsCB5ZulOKhCwIBWgumQeAhYkzyzdSQUCFqQCVJfMQ8CC5JmlO6lAwIJUgOqSeQhYkDyzdCcVCFiQClBdMg8BC5Jnlu6kAgELUgGqS+YhYEHyzNKdVCBgQSpAdck8BCxInlm6kwoELEgFqC6Zh4AFyTNLd1KBgAWpANUl8xCwIHlm6U4qELAgFaC6ZB4CFiTPLN1JBQIWpAJUl8xDwILkmaU7qUDAglSA6pJ5CFiQPLN0JxUI/BcKaWz22tMSLQAAAABJRU5ErkJggg==') no-repeat center center;
|
|
154
|
+
background-size: 30px 30px;
|
|
155
|
+
}
|
|
156
|
+
.drag-pop {
|
|
157
|
+
position: fixed;
|
|
158
|
+
box-shadow: 0 0 2px 1px #95a5a6;
|
|
159
|
+
background-color: #fff;
|
|
160
|
+
border-radius: 3px;
|
|
161
|
+
}
|
|
162
|
+
.drag-head{
|
|
163
|
+
height: 40px;
|
|
164
|
+
line-height: 40px;
|
|
165
|
+
padding: 0 20px;
|
|
166
|
+
cursor: move;
|
|
167
|
+
color: #fff;
|
|
168
|
+
border-top-left-radius: 3px;
|
|
169
|
+
border-top-right-radius: 3px;
|
|
170
|
+
}
|
|
171
|
+
.drag-cont{
|
|
172
|
+
padding: 20px;
|
|
173
|
+
height: calc(100% - 40px);
|
|
174
|
+
position: relative;
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ed-head">
|
|
3
|
-
<div class="ed-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
<div class="ed-title">{{ title }}</div>
|
|
4
|
+
<div class="ed-but">
|
|
5
|
+
<div class="ed-head-but" v-for="(item,index) in toolbar">
|
|
6
|
+
<button v-if="item.key === 'but'" class="but" @click="item.onClick" :style="{color: (item.active)? '#00ff00' :'#000'}">{{ item.title }}</button>
|
|
7
|
+
|
|
8
|
+
<label v-else-if="item.key === 'upImg' || item.key === 'uploadAtt'">
|
|
9
|
+
<input type="file" @change="upload($event,item.key)" :accept="(item.key === 'upImg')?'image/*':'application/*'" style="display: none;">
|
|
10
|
+
<span class="but">{{ item.title }}</span>
|
|
11
|
+
</label>
|
|
12
|
+
<button v-else class="but" @click="toolTap(item.key)">{{ item.title }}</button>
|
|
13
|
+
</div>
|
|
10
14
|
</div>
|
|
11
15
|
</div>
|
|
12
16
|
<div class="ed-cont">
|
|
13
|
-
<
|
|
17
|
+
<editor-content class="editor" :style="heightStyle" :editor="editor" />
|
|
18
|
+
<div class="editor-but" v-if="butText !== ''">
|
|
19
|
+
<button class="but" @click="complete">{{ butText }}</button>
|
|
20
|
+
</div>
|
|
14
21
|
<div class="enclosure" v-if="uploadAttData.length > 0">
|
|
15
22
|
<p>附件列表:</p>
|
|
16
23
|
<div class="enclosure-list" v-for="(item,index) in uploadAttData">
|
|
17
24
|
<div class="enclosure-item">
|
|
18
|
-
<span>{{ index + 1 }}. {{ item.
|
|
25
|
+
<span>{{ index + 1 }}. {{ item.fileName }}</span>
|
|
19
26
|
</div>
|
|
20
27
|
<div class="enclosure-item en-but">
|
|
21
28
|
<button class="but" @click="see(index)">查看</button>
|
|
22
|
-
<button class="but">下载</button>
|
|
29
|
+
<button class="but" @click="download(index)">下载</button>
|
|
23
30
|
<button class="but" @click="del(index)">删除</button>
|
|
24
31
|
</div>
|
|
25
32
|
</div>
|
|
@@ -28,35 +35,76 @@
|
|
|
28
35
|
</template>
|
|
29
36
|
<script>
|
|
30
37
|
import { html2json, json2html } from 'html2json'
|
|
38
|
+
import { Editor, EditorContent } from '@tiptap/vue-3'
|
|
39
|
+
import StarterKit from '@tiptap/starter-kit'
|
|
40
|
+
import Image from '@tiptap/extension-image'
|
|
31
41
|
export default {
|
|
32
42
|
name: 'zydx-xiao-editor',
|
|
43
|
+
components: {
|
|
44
|
+
EditorContent
|
|
45
|
+
},
|
|
33
46
|
data() {
|
|
34
47
|
return {
|
|
35
48
|
uploadAttData: [],
|
|
49
|
+
editor: null,
|
|
50
|
+
heightStyle: {}
|
|
36
51
|
};
|
|
37
52
|
},
|
|
53
|
+
beforeUnmount() {
|
|
54
|
+
this.editor.destroy()
|
|
55
|
+
},
|
|
38
56
|
props: {
|
|
39
57
|
data: {
|
|
40
58
|
type: Object,
|
|
41
59
|
default: () => {}
|
|
42
60
|
},
|
|
43
|
-
|
|
61
|
+
toolbar: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: []
|
|
64
|
+
},
|
|
65
|
+
title: {
|
|
44
66
|
type: String,
|
|
45
|
-
default: '
|
|
67
|
+
default: ''
|
|
46
68
|
},
|
|
47
|
-
|
|
69
|
+
readOnly: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: true
|
|
72
|
+
},
|
|
73
|
+
butText: {
|
|
48
74
|
type: String,
|
|
49
|
-
default: '
|
|
75
|
+
default: ''
|
|
50
76
|
},
|
|
51
|
-
|
|
52
|
-
type:
|
|
53
|
-
default:
|
|
77
|
+
height: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: '200px'
|
|
80
|
+
},
|
|
81
|
+
uploadImage: {
|
|
82
|
+
type: Object,
|
|
83
|
+
default: {}
|
|
84
|
+
},
|
|
85
|
+
uploadAttachment: {
|
|
86
|
+
type: Object,
|
|
87
|
+
default: {}
|
|
54
88
|
}
|
|
55
89
|
},
|
|
90
|
+
emits: ['see','complete'],
|
|
56
91
|
mounted() {
|
|
57
92
|
if(this.data === undefined) return
|
|
58
93
|
this.uploadAttData = this.data.enclosure
|
|
59
|
-
|
|
94
|
+
this.heightStyle = (this.height === '100%')? {height: '100%'} : {'min-height': this.height}
|
|
95
|
+
this.editor = new Editor({
|
|
96
|
+
content: json2html({node: "root",child: this.data.html}),
|
|
97
|
+
editable: this.readOnly,
|
|
98
|
+
extensions: [
|
|
99
|
+
StarterKit,
|
|
100
|
+
Image.configure({
|
|
101
|
+
inline: true,
|
|
102
|
+
HTMLAttributes: {
|
|
103
|
+
width: '100%'
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
})
|
|
60
108
|
},
|
|
61
109
|
methods: {
|
|
62
110
|
del(index) {
|
|
@@ -65,44 +113,109 @@ export default {
|
|
|
65
113
|
see(index) {
|
|
66
114
|
this.$emit('see', this.uploadAttData[index])
|
|
67
115
|
},
|
|
116
|
+
uploadFile(file) {
|
|
117
|
+
return new Promise((rl,re) => {
|
|
118
|
+
const meta = Object.keys(this.uploadImage.meta)
|
|
119
|
+
const param = new FormData()
|
|
120
|
+
param.append('file', file)
|
|
121
|
+
for(let i = 0; i < meta.length; i++) {
|
|
122
|
+
param.append(meta[i], this.uploadImage.meta[meta[i]])
|
|
123
|
+
}
|
|
124
|
+
const xhr = new XMLHttpRequest()
|
|
125
|
+
xhr.open('POST', this.uploadImage.server)
|
|
126
|
+
const headers = Object.keys(this.uploadImage.headers)
|
|
127
|
+
for(let i = 0; i < headers.length; i++) {
|
|
128
|
+
xhr.setRequestHeader(headers[i], this.uploadImage.headers[headers[i]])
|
|
129
|
+
}
|
|
130
|
+
xhr.onreadystatechange = () => {
|
|
131
|
+
if(xhr.readyState === 4) {
|
|
132
|
+
if(xhr.status === 200) {
|
|
133
|
+
rl(JSON.parse(xhr.responseText))
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
xhr.send(param)
|
|
138
|
+
})
|
|
139
|
+
},
|
|
68
140
|
upload(e,v) {
|
|
69
141
|
const file = e.target.files[0]
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
142
|
+
this.uploadFile(file).then(r => {
|
|
143
|
+
if(v === 'uploadAtt') {
|
|
144
|
+
this.uploadAttData.push(r.data)
|
|
145
|
+
}else {
|
|
146
|
+
const url = this.uploadImage.url + r.data.filePath
|
|
147
|
+
const html = [
|
|
148
|
+
{
|
|
149
|
+
node: "element",
|
|
150
|
+
tag: "p",
|
|
151
|
+
child: [{
|
|
152
|
+
attr: {
|
|
153
|
+
src: url,
|
|
154
|
+
width:"100%"
|
|
155
|
+
},
|
|
156
|
+
tag: 'img',
|
|
157
|
+
node: "element",
|
|
158
|
+
}]
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
this.insertContent(html)
|
|
81
162
|
}
|
|
82
|
-
}
|
|
163
|
+
})
|
|
83
164
|
e.target.value = ''
|
|
84
165
|
},
|
|
166
|
+
insertContent(v) {
|
|
167
|
+
for(let i=0; i< v.length; i++) {
|
|
168
|
+
let html = json2html(v[i])
|
|
169
|
+
this.editor.chain().focus().insertContentAt(this.selection(),html).run()
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
download(index) {
|
|
173
|
+
const url = this.uploadImage.url + this.uploadAttData[index].filePath
|
|
174
|
+
let a = document.createElement('a');
|
|
175
|
+
a.style = 'display: none';
|
|
176
|
+
a.download = this.uploadAttData[index].filename;
|
|
177
|
+
a.href = url;
|
|
178
|
+
document.body.appendChild(a);
|
|
179
|
+
a.click();
|
|
180
|
+
document.body.removeChild(a);
|
|
181
|
+
},
|
|
182
|
+
selection() {
|
|
183
|
+
const { from } = this.editor.state.selection
|
|
184
|
+
return from
|
|
185
|
+
},
|
|
186
|
+
complete() {
|
|
187
|
+
this.$emit('complete', this.getData())
|
|
188
|
+
if(this.uploadAttData.length > 0) {
|
|
189
|
+
this.$emit('complete', {
|
|
190
|
+
html: this.getData(),
|
|
191
|
+
enclosure: this.uploadAttData
|
|
192
|
+
})
|
|
193
|
+
}else {
|
|
194
|
+
this.$emit('complete', {html: this.getData()})
|
|
195
|
+
}
|
|
196
|
+
},
|
|
85
197
|
// 获取编辑器内容
|
|
86
198
|
getContent(el) {
|
|
87
199
|
// 编辑器内容转json
|
|
88
|
-
|
|
200
|
+
if(this.uploadAttData.length > 0) {
|
|
201
|
+
el({
|
|
202
|
+
html: this.getData(),
|
|
203
|
+
enclosure: this.uploadAttData
|
|
204
|
+
})
|
|
205
|
+
}else {
|
|
206
|
+
el({html: this.getData()})
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
getData() {
|
|
210
|
+
const html = this.editor.getHTML()
|
|
89
211
|
const json = html2json(html)
|
|
90
|
-
json.child
|
|
91
|
-
if(x.tag === undefined) {
|
|
92
|
-
x.tag = 'p'
|
|
93
|
-
x.node = 'element'
|
|
94
|
-
x.child = [{ text: x.text }]
|
|
95
|
-
}
|
|
96
|
-
if(x.tag === 'div') x.tag = 'p'
|
|
97
|
-
return x
|
|
98
|
-
})
|
|
99
|
-
el({
|
|
100
|
-
html: json.child,
|
|
101
|
-
enclosure: this.uploadAttData
|
|
102
|
-
})
|
|
212
|
+
return json.child
|
|
103
213
|
},
|
|
104
214
|
toolTap(v) {
|
|
105
|
-
|
|
215
|
+
if(v === 'h1') this.editor.chain().focus().toggleHeading({level:1}).run()
|
|
216
|
+
if(v === 'h2') this.editor.chain().focus().toggleHeading({level:2}).run()
|
|
217
|
+
if(v === 'h3') this.editor.chain().focus().toggleHeading({level:3}).run()
|
|
218
|
+
if(v === 'p') this.editor.chain().focus().setParagraph().run()
|
|
106
219
|
}
|
|
107
220
|
}
|
|
108
221
|
}
|
|
@@ -110,9 +223,23 @@ export default {
|
|
|
110
223
|
</script>
|
|
111
224
|
|
|
112
225
|
<style scoped>
|
|
226
|
+
.editor-but{
|
|
227
|
+
text-align: right;
|
|
228
|
+
margin: 10px 0;
|
|
229
|
+
}
|
|
230
|
+
.ed-head{
|
|
231
|
+
display: flex;
|
|
232
|
+
justify-content: center;
|
|
233
|
+
}
|
|
113
234
|
.ed-head-but{
|
|
114
235
|
display: inline-block;
|
|
115
236
|
}
|
|
237
|
+
.ed-title{
|
|
238
|
+
flex: 1;
|
|
239
|
+
text-align: left;
|
|
240
|
+
line-height: 22px;
|
|
241
|
+
font-size: 14px;
|
|
242
|
+
}
|
|
116
243
|
.enclosure-list{
|
|
117
244
|
display: flex;
|
|
118
245
|
justify-content: space-between;
|
|
@@ -137,7 +264,10 @@ export default {
|
|
|
137
264
|
border: 1px solid #ccc;
|
|
138
265
|
border-radius: 3px;
|
|
139
266
|
padding: 20px;
|
|
140
|
-
|
|
267
|
+
outline: none;
|
|
268
|
+
}
|
|
269
|
+
.editor img{
|
|
270
|
+
max-width: 100%;
|
|
141
271
|
}
|
|
142
272
|
.ed-head{
|
|
143
273
|
text-align: right;
|
package/src/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import word from './components/word/index';
|
|
|
18
18
|
import mind from './components/mind/index';
|
|
19
19
|
import bizHeader from './components/biz_header/index';
|
|
20
20
|
import editor2 from './components/editor2/index';
|
|
21
|
+
import dragPopup from './components/dragPopup/index';
|
|
21
22
|
|
|
22
23
|
const components = [
|
|
23
24
|
Calendar,
|
|
@@ -37,7 +38,8 @@ const components = [
|
|
|
37
38
|
word,
|
|
38
39
|
mind,
|
|
39
40
|
bizHeader,
|
|
40
|
-
editor2
|
|
41
|
+
editor2,
|
|
42
|
+
dragPopup
|
|
41
43
|
];
|
|
42
44
|
|
|
43
45
|
function install(app) {
|
|
@@ -49,7 +51,7 @@ function install(app) {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
export default {
|
|
52
|
-
version: '1.
|
|
54
|
+
version: '1.16.66',
|
|
53
55
|
install,
|
|
54
56
|
Calendar,
|
|
55
57
|
Message,
|
|
@@ -70,6 +72,7 @@ export default {
|
|
|
70
72
|
word,
|
|
71
73
|
mind,
|
|
72
74
|
bizHeader,
|
|
73
|
-
editor2
|
|
75
|
+
editor2,
|
|
76
|
+
dragPopup
|
|
74
77
|
};
|
|
75
78
|
|