vue-editify 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -3
- package/examples/App.vue +5668 -5669
- package/examples/main.js +4 -4
- package/lib/editify.es.js +184 -201
- package/lib/editify.umd.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +37 -37
- package/src/Editify.vue +1197 -1178
- package/src/components/Menu.vue +1623 -1623
- package/src/components/Toolbar.vue +1214 -1214
- package/src/components/base/Button.vue +450 -450
- package/src/components/base/Checkbox.vue +196 -196
- package/src/components/base/Icon.vue +31 -31
- package/src/components/base/Layer.vue +713 -712
- package/src/components/base/Tooltip.vue +82 -82
- package/src/components/base/Triangle.vue +159 -159
- package/src/components/common/Colors.vue +138 -138
- package/src/components/common/InsertImage.vue +316 -316
- package/src/components/common/InsertLink.vue +136 -136
- package/src/components/common/InsertTable.vue +157 -157
- package/src/components/common/InsertVideo.vue +316 -316
- package/src/core/function.js +1044 -1044
- package/src/core/rule.js +239 -239
- package/src/core/tool.js +1056 -1051
- package/src/css/base.less +30 -30
- package/src/css/hljs.less +54 -54
- package/src/hljs/index.js +62 -62
- package/src/icon/iconfont.css +219 -219
- package/src/index.js +24 -24
- package/src/locale/en_US.js +86 -86
- package/src/locale/index.js +14 -14
- package/src/locale/zh_CN.js +86 -86
@@ -1,136 +1,136 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="editify-link">
|
3
|
-
<div class="editify-link-label">{{ $editTrans('linkAddress') }}</div>
|
4
|
-
<input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkTextEnterPlaceholder')" v-model.trim="linkText" type="text" />
|
5
|
-
<input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkUrlEnterPlaceholder')" v-model.trim="linkUrl" type="url" />
|
6
|
-
<div class="editify-link-footer">
|
7
|
-
<Checkbox v-model="newOpen" :label="$editTrans('newWindowOpen')" :color="color" :size="10"></Checkbox>
|
8
|
-
<div class="editify-link-operations">
|
9
|
-
<span :style="{ color: color }" @click="insertLink">{{ $editTrans('insertLink') }}</span>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
</div>
|
13
|
-
</template>
|
14
|
-
<script>
|
15
|
-
import Checkbox from '../base/Checkbox'
|
16
|
-
export default {
|
17
|
-
name: 'InsertLink',
|
18
|
-
emits: ['insert'],
|
19
|
-
inject: ['$editTrans'],
|
20
|
-
props: {
|
21
|
-
//主题色
|
22
|
-
color: {
|
23
|
-
type: String,
|
24
|
-
default: ''
|
25
|
-
},
|
26
|
-
//预置的链接文本值
|
27
|
-
text: {
|
28
|
-
type: String,
|
29
|
-
default: ''
|
30
|
-
}
|
31
|
-
},
|
32
|
-
data() {
|
33
|
-
return {
|
34
|
-
//链接地址
|
35
|
-
linkUrl: '',
|
36
|
-
//链接文本
|
37
|
-
linkText: '',
|
38
|
-
//是否新窗口打开
|
39
|
-
newOpen: false
|
40
|
-
}
|
41
|
-
},
|
42
|
-
watch: {
|
43
|
-
text: {
|
44
|
-
immediate: true,
|
45
|
-
handler: function (newValue) {
|
46
|
-
this.linkText = newValue
|
47
|
-
}
|
48
|
-
}
|
49
|
-
},
|
50
|
-
components: {
|
51
|
-
Checkbox
|
52
|
-
},
|
53
|
-
methods: {
|
54
|
-
//输入框获取焦点
|
55
|
-
handleInputFocus(e) {
|
56
|
-
if (this.color) {
|
57
|
-
e.currentTarget.style.borderColor = this.color
|
58
|
-
}
|
59
|
-
},
|
60
|
-
//输入框失去焦点
|
61
|
-
handleInputBlur(e) {
|
62
|
-
e.currentTarget.style.borderColor = ''
|
63
|
-
},
|
64
|
-
//插入链接
|
65
|
-
insertLink() {
|
66
|
-
this.$emit('insert', this.linkText, this.linkUrl, this.newOpen)
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
</script>
|
71
|
-
<style lang="less" scoped>
|
72
|
-
.editify-link {
|
73
|
-
display: block;
|
74
|
-
width: 280px;
|
75
|
-
padding: 10px 14px;
|
76
|
-
|
77
|
-
.editify-link-label {
|
78
|
-
display: block;
|
79
|
-
text-align: left;
|
80
|
-
margin-bottom: 10px;
|
81
|
-
font-size: @font-size;
|
82
|
-
color: @font-color;
|
83
|
-
}
|
84
|
-
|
85
|
-
input {
|
86
|
-
appearance: none;
|
87
|
-
-webkit-appearance: none;
|
88
|
-
-moz-appearance: none;
|
89
|
-
display: block;
|
90
|
-
width: 100%;
|
91
|
-
margin: 0 0 10px 0;
|
92
|
-
padding: 4px 2px;
|
93
|
-
border: none;
|
94
|
-
font-size: @font-size;
|
95
|
-
color: @font-color;
|
96
|
-
border-bottom: 1px solid @border-color;
|
97
|
-
line-height: 1.5;
|
98
|
-
transition: border-color 500ms;
|
99
|
-
background-color: transparent;
|
100
|
-
outline: none;
|
101
|
-
box-sizing: border-box;
|
102
|
-
|
103
|
-
&::-webkit-input-placeholder,
|
104
|
-
&::placeholder {
|
105
|
-
color: @font-color-disabled;
|
106
|
-
font-family: inherit;
|
107
|
-
font-size: inherit;
|
108
|
-
vertical-align: middle;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
.editify-link-footer {
|
113
|
-
display: flex;
|
114
|
-
justify-content: space-between;
|
115
|
-
align-items: center;
|
116
|
-
width: 100%;
|
117
|
-
|
118
|
-
.editify-link-operations {
|
119
|
-
display: flex;
|
120
|
-
justify-content: flex-start;
|
121
|
-
align-items: center;
|
122
|
-
|
123
|
-
& > span {
|
124
|
-
cursor: pointer;
|
125
|
-
opacity: 0.8;
|
126
|
-
transition: all 200ms;
|
127
|
-
font-size: @font-size;
|
128
|
-
|
129
|
-
&:hover {
|
130
|
-
opacity: 1;
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div class="editify-link">
|
3
|
+
<div class="editify-link-label">{{ $editTrans('linkAddress') }}</div>
|
4
|
+
<input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkTextEnterPlaceholder')" v-model.trim="linkText" type="text" />
|
5
|
+
<input @focus="handleInputFocus" @blur="handleInputBlur" :placeholder="$editTrans('linkUrlEnterPlaceholder')" v-model.trim="linkUrl" type="url" />
|
6
|
+
<div class="editify-link-footer">
|
7
|
+
<Checkbox v-model="newOpen" :label="$editTrans('newWindowOpen')" :color="color" :size="10"></Checkbox>
|
8
|
+
<div class="editify-link-operations">
|
9
|
+
<span :style="{ color: color }" @click="insertLink">{{ $editTrans('insertLink') }}</span>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
<script>
|
15
|
+
import Checkbox from '../base/Checkbox'
|
16
|
+
export default {
|
17
|
+
name: 'InsertLink',
|
18
|
+
emits: ['insert'],
|
19
|
+
inject: ['$editTrans'],
|
20
|
+
props: {
|
21
|
+
//主题色
|
22
|
+
color: {
|
23
|
+
type: String,
|
24
|
+
default: ''
|
25
|
+
},
|
26
|
+
//预置的链接文本值
|
27
|
+
text: {
|
28
|
+
type: String,
|
29
|
+
default: ''
|
30
|
+
}
|
31
|
+
},
|
32
|
+
data() {
|
33
|
+
return {
|
34
|
+
//链接地址
|
35
|
+
linkUrl: '',
|
36
|
+
//链接文本
|
37
|
+
linkText: '',
|
38
|
+
//是否新窗口打开
|
39
|
+
newOpen: false
|
40
|
+
}
|
41
|
+
},
|
42
|
+
watch: {
|
43
|
+
text: {
|
44
|
+
immediate: true,
|
45
|
+
handler: function (newValue) {
|
46
|
+
this.linkText = newValue
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
components: {
|
51
|
+
Checkbox
|
52
|
+
},
|
53
|
+
methods: {
|
54
|
+
//输入框获取焦点
|
55
|
+
handleInputFocus(e) {
|
56
|
+
if (this.color) {
|
57
|
+
e.currentTarget.style.borderColor = this.color
|
58
|
+
}
|
59
|
+
},
|
60
|
+
//输入框失去焦点
|
61
|
+
handleInputBlur(e) {
|
62
|
+
e.currentTarget.style.borderColor = ''
|
63
|
+
},
|
64
|
+
//插入链接
|
65
|
+
insertLink() {
|
66
|
+
this.$emit('insert', this.linkText, this.linkUrl, this.newOpen)
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
</script>
|
71
|
+
<style lang="less" scoped>
|
72
|
+
.editify-link {
|
73
|
+
display: block;
|
74
|
+
width: 280px;
|
75
|
+
padding: 10px 14px;
|
76
|
+
|
77
|
+
.editify-link-label {
|
78
|
+
display: block;
|
79
|
+
text-align: left;
|
80
|
+
margin-bottom: 10px;
|
81
|
+
font-size: @font-size;
|
82
|
+
color: @font-color;
|
83
|
+
}
|
84
|
+
|
85
|
+
input {
|
86
|
+
appearance: none;
|
87
|
+
-webkit-appearance: none;
|
88
|
+
-moz-appearance: none;
|
89
|
+
display: block;
|
90
|
+
width: 100%;
|
91
|
+
margin: 0 0 10px 0;
|
92
|
+
padding: 4px 2px;
|
93
|
+
border: none;
|
94
|
+
font-size: @font-size;
|
95
|
+
color: @font-color;
|
96
|
+
border-bottom: 1px solid @border-color;
|
97
|
+
line-height: 1.5;
|
98
|
+
transition: border-color 500ms;
|
99
|
+
background-color: transparent;
|
100
|
+
outline: none;
|
101
|
+
box-sizing: border-box;
|
102
|
+
|
103
|
+
&::-webkit-input-placeholder,
|
104
|
+
&::placeholder {
|
105
|
+
color: @font-color-disabled;
|
106
|
+
font-family: inherit;
|
107
|
+
font-size: inherit;
|
108
|
+
vertical-align: middle;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
.editify-link-footer {
|
113
|
+
display: flex;
|
114
|
+
justify-content: space-between;
|
115
|
+
align-items: center;
|
116
|
+
width: 100%;
|
117
|
+
|
118
|
+
.editify-link-operations {
|
119
|
+
display: flex;
|
120
|
+
justify-content: flex-start;
|
121
|
+
align-items: center;
|
122
|
+
|
123
|
+
& > span {
|
124
|
+
cursor: pointer;
|
125
|
+
opacity: 0.8;
|
126
|
+
transition: all 200ms;
|
127
|
+
font-size: @font-size;
|
128
|
+
|
129
|
+
&:hover {
|
130
|
+
opacity: 1;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
</style>
|
@@ -1,157 +1,157 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="editify-table">
|
3
|
-
<table>
|
4
|
-
<tr v-for="row in tableGrids">
|
5
|
-
<td :class="{ inside: column.inside }" v-for="column in row" @mouseenter="changeTableSize(column)" @click="createTable(column)">
|
6
|
-
<span></span>
|
7
|
-
</td>
|
8
|
-
</tr>
|
9
|
-
</table>
|
10
|
-
<div class="editify-table-footer">
|
11
|
-
<span v-if="specification">{{ specification.x }} x {{ specification.y }}</span>
|
12
|
-
<span v-else>{{ $editTrans('insertTable') }}</span>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
</template>
|
16
|
-
<script>
|
17
|
-
export default {
|
18
|
-
name: 'InsertTable',
|
19
|
-
emits: ['insert'],
|
20
|
-
inject: ['$editTrans'],
|
21
|
-
props: {
|
22
|
-
//主题色
|
23
|
-
color: {
|
24
|
-
type: String,
|
25
|
-
default: ''
|
26
|
-
},
|
27
|
-
//最大行数
|
28
|
-
maxRows: {
|
29
|
-
type: Number,
|
30
|
-
default: 10
|
31
|
-
},
|
32
|
-
//最大列数
|
33
|
-
maxColumns: {
|
34
|
-
type: Number,
|
35
|
-
default: 10
|
36
|
-
}
|
37
|
-
},
|
38
|
-
data() {
|
39
|
-
return {
|
40
|
-
tableGrids: this.getTableGrids()
|
41
|
-
}
|
42
|
-
},
|
43
|
-
computed: {
|
44
|
-
//表格规格
|
45
|
-
specification() {
|
46
|
-
return this.tableGrids
|
47
|
-
.flat()
|
48
|
-
.filter(item => {
|
49
|
-
return item.inside
|
50
|
-
})
|
51
|
-
.sort((a, b) => {
|
52
|
-
if (a.x > b.x && a.y > b.y) {
|
53
|
-
return -1
|
54
|
-
}
|
55
|
-
if (a.x > b.x) {
|
56
|
-
return -1
|
57
|
-
}
|
58
|
-
if (a.y > b.y) {
|
59
|
-
return -1
|
60
|
-
}
|
61
|
-
return 1
|
62
|
-
})[0]
|
63
|
-
}
|
64
|
-
},
|
65
|
-
methods: {
|
66
|
-
//确认创立表格
|
67
|
-
createTable(data) {
|
68
|
-
this.$emit('insert', data.x, data.y)
|
69
|
-
},
|
70
|
-
//改变表格大小
|
71
|
-
changeTableSize(data) {
|
72
|
-
for (let i in this.tableGrids) {
|
73
|
-
const grid = this.tableGrids[i]
|
74
|
-
for (let j in grid) {
|
75
|
-
if (grid[j].x <= data.x && grid[j].y <= data.y) {
|
76
|
-
this.tableGrids[i][j].inside = true
|
77
|
-
} else {
|
78
|
-
this.tableGrids[i][j].inside = false
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
},
|
83
|
-
//获取表格
|
84
|
-
getTableGrids() {
|
85
|
-
const grids = []
|
86
|
-
for (let i = 1; i <= this.maxRows; i++) {
|
87
|
-
let row = []
|
88
|
-
for (let j = 1; j <= this.maxColumns; j++) {
|
89
|
-
row.push({
|
90
|
-
x: i,
|
91
|
-
y: j,
|
92
|
-
inside: false //是否被选中
|
93
|
-
})
|
94
|
-
}
|
95
|
-
grids.push(row)
|
96
|
-
}
|
97
|
-
return grids
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
</script>
|
102
|
-
<style lang="less" scoped>
|
103
|
-
.editify-table {
|
104
|
-
display: block;
|
105
|
-
position: relative;
|
106
|
-
padding: 10px 10px 32px 10px;
|
107
|
-
box-sizing: border-box;
|
108
|
-
|
109
|
-
table {
|
110
|
-
border: 1px solid @border-color;
|
111
|
-
margin: 0;
|
112
|
-
padding: 0;
|
113
|
-
border-collapse: collapse;
|
114
|
-
|
115
|
-
tr {
|
116
|
-
margin: 0;
|
117
|
-
padding: 0;
|
118
|
-
|
119
|
-
td {
|
120
|
-
margin: 0;
|
121
|
-
padding: 0;
|
122
|
-
border: 1px solid @border-color;
|
123
|
-
|
124
|
-
span {
|
125
|
-
display: block;
|
126
|
-
width: 15px;
|
127
|
-
height: 15px;
|
128
|
-
}
|
129
|
-
|
130
|
-
&:hover {
|
131
|
-
cursor: pointer;
|
132
|
-
}
|
133
|
-
|
134
|
-
&.inside {
|
135
|
-
background-color: @background-darker;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
.editify-table-footer {
|
142
|
-
text-align: center;
|
143
|
-
color: @font-color-light;
|
144
|
-
line-height: 1;
|
145
|
-
font-size: 12px;
|
146
|
-
position: absolute;
|
147
|
-
padding: 0 10px;
|
148
|
-
bottom: 10px;
|
149
|
-
left: 0;
|
150
|
-
width: 100%;
|
151
|
-
overflow: hidden;
|
152
|
-
text-overflow: ellipsis;
|
153
|
-
white-space: nowrap;
|
154
|
-
box-sizing: border-box;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
</style>
|
1
|
+
<template>
|
2
|
+
<div class="editify-table">
|
3
|
+
<table>
|
4
|
+
<tr v-for="row in tableGrids">
|
5
|
+
<td :class="{ inside: column.inside }" v-for="column in row" @mouseenter="changeTableSize(column)" @click="createTable(column)">
|
6
|
+
<span></span>
|
7
|
+
</td>
|
8
|
+
</tr>
|
9
|
+
</table>
|
10
|
+
<div class="editify-table-footer">
|
11
|
+
<span v-if="specification">{{ specification.x }} x {{ specification.y }}</span>
|
12
|
+
<span v-else>{{ $editTrans('insertTable') }}</span>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</template>
|
16
|
+
<script>
|
17
|
+
export default {
|
18
|
+
name: 'InsertTable',
|
19
|
+
emits: ['insert'],
|
20
|
+
inject: ['$editTrans'],
|
21
|
+
props: {
|
22
|
+
//主题色
|
23
|
+
color: {
|
24
|
+
type: String,
|
25
|
+
default: ''
|
26
|
+
},
|
27
|
+
//最大行数
|
28
|
+
maxRows: {
|
29
|
+
type: Number,
|
30
|
+
default: 10
|
31
|
+
},
|
32
|
+
//最大列数
|
33
|
+
maxColumns: {
|
34
|
+
type: Number,
|
35
|
+
default: 10
|
36
|
+
}
|
37
|
+
},
|
38
|
+
data() {
|
39
|
+
return {
|
40
|
+
tableGrids: this.getTableGrids()
|
41
|
+
}
|
42
|
+
},
|
43
|
+
computed: {
|
44
|
+
//表格规格
|
45
|
+
specification() {
|
46
|
+
return this.tableGrids
|
47
|
+
.flat()
|
48
|
+
.filter(item => {
|
49
|
+
return item.inside
|
50
|
+
})
|
51
|
+
.sort((a, b) => {
|
52
|
+
if (a.x > b.x && a.y > b.y) {
|
53
|
+
return -1
|
54
|
+
}
|
55
|
+
if (a.x > b.x) {
|
56
|
+
return -1
|
57
|
+
}
|
58
|
+
if (a.y > b.y) {
|
59
|
+
return -1
|
60
|
+
}
|
61
|
+
return 1
|
62
|
+
})[0]
|
63
|
+
}
|
64
|
+
},
|
65
|
+
methods: {
|
66
|
+
//确认创立表格
|
67
|
+
createTable(data) {
|
68
|
+
this.$emit('insert', data.x, data.y)
|
69
|
+
},
|
70
|
+
//改变表格大小
|
71
|
+
changeTableSize(data) {
|
72
|
+
for (let i in this.tableGrids) {
|
73
|
+
const grid = this.tableGrids[i]
|
74
|
+
for (let j in grid) {
|
75
|
+
if (grid[j].x <= data.x && grid[j].y <= data.y) {
|
76
|
+
this.tableGrids[i][j].inside = true
|
77
|
+
} else {
|
78
|
+
this.tableGrids[i][j].inside = false
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
},
|
83
|
+
//获取表格
|
84
|
+
getTableGrids() {
|
85
|
+
const grids = []
|
86
|
+
for (let i = 1; i <= this.maxRows; i++) {
|
87
|
+
let row = []
|
88
|
+
for (let j = 1; j <= this.maxColumns; j++) {
|
89
|
+
row.push({
|
90
|
+
x: i,
|
91
|
+
y: j,
|
92
|
+
inside: false //是否被选中
|
93
|
+
})
|
94
|
+
}
|
95
|
+
grids.push(row)
|
96
|
+
}
|
97
|
+
return grids
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
</script>
|
102
|
+
<style lang="less" scoped>
|
103
|
+
.editify-table {
|
104
|
+
display: block;
|
105
|
+
position: relative;
|
106
|
+
padding: 10px 10px 32px 10px;
|
107
|
+
box-sizing: border-box;
|
108
|
+
|
109
|
+
table {
|
110
|
+
border: 1px solid @border-color;
|
111
|
+
margin: 0;
|
112
|
+
padding: 0;
|
113
|
+
border-collapse: collapse;
|
114
|
+
|
115
|
+
tr {
|
116
|
+
margin: 0;
|
117
|
+
padding: 0;
|
118
|
+
|
119
|
+
td {
|
120
|
+
margin: 0;
|
121
|
+
padding: 0;
|
122
|
+
border: 1px solid @border-color;
|
123
|
+
|
124
|
+
span {
|
125
|
+
display: block;
|
126
|
+
width: 15px;
|
127
|
+
height: 15px;
|
128
|
+
}
|
129
|
+
|
130
|
+
&:hover {
|
131
|
+
cursor: pointer;
|
132
|
+
}
|
133
|
+
|
134
|
+
&.inside {
|
135
|
+
background-color: @background-darker;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
.editify-table-footer {
|
142
|
+
text-align: center;
|
143
|
+
color: @font-color-light;
|
144
|
+
line-height: 1;
|
145
|
+
font-size: 12px;
|
146
|
+
position: absolute;
|
147
|
+
padding: 0 10px;
|
148
|
+
bottom: 10px;
|
149
|
+
left: 0;
|
150
|
+
width: 100%;
|
151
|
+
overflow: hidden;
|
152
|
+
text-overflow: ellipsis;
|
153
|
+
white-space: nowrap;
|
154
|
+
box-sizing: border-box;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
</style>
|