vue-editify 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/README.md +3 -3
  2. package/examples/App.vue +62 -61
  3. package/examples/main.ts +4 -4
  4. package/lib/components/button/button.vue.d.ts +11 -11
  5. package/lib/components/checkbox/checkbox.vue.d.ts +8 -8
  6. package/lib/components/colors/colors.vue.d.ts +4 -4
  7. package/lib/components/icon/icon.vue.d.ts +1 -1
  8. package/lib/components/insertImage/insertImage.vue.d.ts +9 -9
  9. package/lib/components/insertLink/insertLink.vue.d.ts +2 -2
  10. package/lib/components/insertTable/insertTable.vue.d.ts +2 -2
  11. package/lib/components/insertVideo/insertVideo.vue.d.ts +9 -9
  12. package/lib/components/layer/layer.vue.d.ts +9 -9
  13. package/lib/components/menu/menu.vue.d.ts +4 -4
  14. package/lib/components/toolbar/toolbar.vue.d.ts +9 -9
  15. package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
  16. package/lib/components/triangle/triangle.vue.d.ts +4 -4
  17. package/lib/editify/editify.vue.d.ts +68 -68
  18. package/lib/editify.es.js +17 -17
  19. package/lib/editify.umd.js +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/style.css +1 -1
  22. package/package.json +45 -45
  23. package/src/components/button/button.less +145 -145
  24. package/src/components/button/button.vue +197 -197
  25. package/src/components/button/props.ts +95 -95
  26. package/src/components/checkbox/checkbox.less +84 -84
  27. package/src/components/checkbox/checkbox.vue +68 -68
  28. package/src/components/checkbox/props.ts +49 -49
  29. package/src/components/colors/colors.less +75 -75
  30. package/src/components/colors/colors.vue +36 -36
  31. package/src/components/colors/props.ts +29 -29
  32. package/src/components/icon/icon.less +14 -14
  33. package/src/components/icon/icon.vue +12 -12
  34. package/src/components/icon/props.ts +11 -11
  35. package/src/components/insertImage/insertImage.less +135 -135
  36. package/src/components/insertImage/insertImage.vue +146 -146
  37. package/src/components/insertImage/props.ts +43 -43
  38. package/src/components/insertLink/insertLink.less +64 -64
  39. package/src/components/insertLink/insertLink.vue +58 -58
  40. package/src/components/insertLink/props.ts +16 -16
  41. package/src/components/insertTable/insertTable.less +54 -54
  42. package/src/components/insertTable/insertTable.vue +85 -85
  43. package/src/components/insertTable/props.ts +27 -27
  44. package/src/components/insertVideo/insertVideo.less +135 -135
  45. package/src/components/insertVideo/insertVideo.vue +146 -146
  46. package/src/components/insertVideo/props.ts +43 -43
  47. package/src/components/layer/layer.less +49 -49
  48. package/src/components/layer/layer.vue +598 -598
  49. package/src/components/layer/props.ts +71 -71
  50. package/src/components/menu/menu.less +63 -63
  51. package/src/components/menu/menu.vue +1569 -1569
  52. package/src/components/menu/props.ts +17 -17
  53. package/src/components/toolbar/props.ts +35 -35
  54. package/src/components/toolbar/toolbar.less +89 -89
  55. package/src/components/toolbar/toolbar.vue +1101 -1101
  56. package/src/components/tooltip/props.ts +21 -21
  57. package/src/components/tooltip/tooltip.less +23 -23
  58. package/src/components/tooltip/tooltip.vue +37 -37
  59. package/src/components/triangle/props.ts +26 -26
  60. package/src/components/triangle/triangle.less +79 -79
  61. package/src/components/triangle/triangle.vue +65 -65
  62. package/src/core/function.ts +1144 -1144
  63. package/src/core/rule.ts +259 -259
  64. package/src/core/tool.ts +1137 -1137
  65. package/src/css/base.less +30 -30
  66. package/src/css/hljs.less +54 -54
  67. package/src/editify/editify.less +404 -403
  68. package/src/editify/editify.vue +803 -803
  69. package/src/editify/props.ts +156 -156
  70. package/src/hljs/index.ts +197 -197
  71. package/src/icon/iconfont.css +219 -219
  72. package/src/index.ts +32 -32
  73. package/src/locale/en_US.ts +88 -88
  74. package/src/locale/index.ts +12 -12
  75. package/src/locale/zh_CN.ts +88 -88
  76. package/tsconfig.json +27 -27
  77. package/tsconfig.node.json +11 -11
  78. package/vite-env.d.ts +1 -1
  79. package/vite.config.ts +42 -42
@@ -1,54 +1,54 @@
1
- .editify-table {
2
- display: block;
3
- position: relative;
4
- padding: 10px 10px 32px 10px;
5
- box-sizing: border-box;
6
-
7
- table {
8
- border: 1px solid @border-color;
9
- margin: 0;
10
- padding: 0;
11
- border-collapse: collapse;
12
-
13
- tr {
14
- margin: 0;
15
- padding: 0;
16
-
17
- td {
18
- margin: 0;
19
- padding: 0;
20
- border: 1px solid @border-color;
21
-
22
- span {
23
- display: block;
24
- width: 15px;
25
- height: 15px;
26
- }
27
-
28
- &:hover {
29
- cursor: pointer;
30
- }
31
-
32
- &.inside {
33
- background-color: @background-darker;
34
- }
35
- }
36
- }
37
- }
38
-
39
- .editify-table-footer {
40
- text-align: center;
41
- color: @font-color-light;
42
- line-height: 1;
43
- font-size: 12px;
44
- position: absolute;
45
- padding: 0 10px;
46
- bottom: 10px;
47
- left: 0;
48
- width: 100%;
49
- overflow: hidden;
50
- text-overflow: ellipsis;
51
- white-space: nowrap;
52
- box-sizing: border-box;
53
- }
54
- }
1
+ .editify-table {
2
+ display: block;
3
+ position: relative;
4
+ padding: 10px 10px 32px 10px;
5
+ box-sizing: border-box;
6
+
7
+ table {
8
+ border: 1px solid @border-color;
9
+ margin: 0;
10
+ padding: 0;
11
+ border-collapse: collapse;
12
+
13
+ tr {
14
+ margin: 0;
15
+ padding: 0;
16
+
17
+ td {
18
+ margin: 0;
19
+ padding: 0;
20
+ border: 1px solid @border-color;
21
+
22
+ span {
23
+ display: block;
24
+ width: 15px;
25
+ height: 15px;
26
+ }
27
+
28
+ &:hover {
29
+ cursor: pointer;
30
+ }
31
+
32
+ &.inside {
33
+ background-color: @background-darker;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ .editify-table-footer {
40
+ text-align: center;
41
+ color: @font-color-light;
42
+ line-height: 1;
43
+ font-size: 12px;
44
+ position: absolute;
45
+ padding: 0 10px;
46
+ bottom: 10px;
47
+ left: 0;
48
+ width: 100%;
49
+ overflow: hidden;
50
+ text-overflow: ellipsis;
51
+ white-space: nowrap;
52
+ box-sizing: border-box;
53
+ }
54
+ }
@@ -1,85 +1,85 @@
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 setup lang="ts">
17
- import { computed, inject, ref } from 'vue'
18
- import { InsertTableGridType, InsertTableProps } from './props'
19
-
20
- defineOptions({
21
- name: 'InsertTable'
22
- })
23
- const props = defineProps(InsertTableProps)
24
- const emits = defineEmits(['insert'])
25
-
26
- const $editTrans = inject<(key: string) => any>('$editTrans')!
27
-
28
- //获取表格
29
- const getTableGrids = () => {
30
- const grids: InsertTableGridType[][] = []
31
- for (let i = 1; i <= props.maxRows; i++) {
32
- let row: InsertTableGridType[] = []
33
- for (let j = 1; j <= props.maxColumns; j++) {
34
- row.push({
35
- x: i,
36
- y: j,
37
- inside: false //是否被选中
38
- })
39
- }
40
- grids.push(row)
41
- }
42
- return grids
43
- }
44
-
45
- const tableGrids = ref<InsertTableGridType[][]>(getTableGrids())
46
-
47
- //表格规格
48
- const specification = computed<InsertTableGridType>(() => {
49
- return tableGrids.value
50
- .flat()
51
- .filter(item => {
52
- return item.inside
53
- })
54
- .sort((a, b) => {
55
- if (a.x > b.x && a.y > b.y) {
56
- return -1
57
- }
58
- if (a.x > b.x) {
59
- return -1
60
- }
61
- if (a.y > b.y) {
62
- return -1
63
- }
64
- return 1
65
- })[0]
66
- })
67
- //改变表格大小
68
- const changeTableSize = (data: InsertTableGridType) => {
69
- for (let i in tableGrids.value) {
70
- const grid = tableGrids.value[i]
71
- for (let j in grid) {
72
- if (grid[j].x <= data.x && grid[j].y <= data.y) {
73
- tableGrids.value[i][j].inside = true
74
- } else {
75
- tableGrids.value[i][j].inside = false
76
- }
77
- }
78
- }
79
- }
80
- //确认创立表格
81
- const createTable = (data: InsertTableGridType) => {
82
- emits('insert', data.x, data.y)
83
- }
84
- </script>
85
- <style scoped src="./insertTable.less"></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 setup lang="ts">
17
+ import { computed, inject, ref } from 'vue'
18
+ import { InsertTableGridType, InsertTableProps } from './props'
19
+
20
+ defineOptions({
21
+ name: 'InsertTable'
22
+ })
23
+ const props = defineProps(InsertTableProps)
24
+ const emits = defineEmits(['insert'])
25
+
26
+ const $editTrans = inject<(key: string) => any>('$editTrans')!
27
+
28
+ //获取表格
29
+ const getTableGrids = () => {
30
+ const grids: InsertTableGridType[][] = []
31
+ for (let i = 1; i <= props.maxRows; i++) {
32
+ let row: InsertTableGridType[] = []
33
+ for (let j = 1; j <= props.maxColumns; j++) {
34
+ row.push({
35
+ x: i,
36
+ y: j,
37
+ inside: false //是否被选中
38
+ })
39
+ }
40
+ grids.push(row)
41
+ }
42
+ return grids
43
+ }
44
+
45
+ const tableGrids = ref<InsertTableGridType[][]>(getTableGrids())
46
+
47
+ //表格规格
48
+ const specification = computed<InsertTableGridType>(() => {
49
+ return tableGrids.value
50
+ .flat()
51
+ .filter(item => {
52
+ return item.inside
53
+ })
54
+ .sort((a, b) => {
55
+ if (a.x > b.x && a.y > b.y) {
56
+ return -1
57
+ }
58
+ if (a.x > b.x) {
59
+ return -1
60
+ }
61
+ if (a.y > b.y) {
62
+ return -1
63
+ }
64
+ return 1
65
+ })[0]
66
+ })
67
+ //改变表格大小
68
+ const changeTableSize = (data: InsertTableGridType) => {
69
+ for (let i in tableGrids.value) {
70
+ const grid = tableGrids.value[i]
71
+ for (let j in grid) {
72
+ if (grid[j].x <= data.x && grid[j].y <= data.y) {
73
+ tableGrids.value[i][j].inside = true
74
+ } else {
75
+ tableGrids.value[i][j].inside = false
76
+ }
77
+ }
78
+ }
79
+ }
80
+ //确认创立表格
81
+ const createTable = (data: InsertTableGridType) => {
82
+ emits('insert', data.x, data.y)
83
+ }
84
+ </script>
85
+ <style scoped src="./insertTable.less"></style>
@@ -1,27 +1,27 @@
1
- import { ExtractPublicPropTypes } from 'vue'
2
-
3
- export type InsertTableGridType = {
4
- x: number
5
- y: number
6
- inside: boolean
7
- }
8
-
9
- export const InsertTableProps = {
10
- //主题色
11
- color: {
12
- type: String,
13
- default: ''
14
- },
15
- //最大行数
16
- maxRows: {
17
- type: Number,
18
- default: 10
19
- },
20
- //最大列数
21
- maxColumns: {
22
- type: Number,
23
- default: 10
24
- }
25
- }
26
-
27
- export type InsertTablePropsType = ExtractPublicPropTypes<typeof InsertTableProps>
1
+ import { ExtractPublicPropTypes } from 'vue'
2
+
3
+ export type InsertTableGridType = {
4
+ x: number
5
+ y: number
6
+ inside: boolean
7
+ }
8
+
9
+ export const InsertTableProps = {
10
+ //主题色
11
+ color: {
12
+ type: String,
13
+ default: ''
14
+ },
15
+ //最大行数
16
+ maxRows: {
17
+ type: Number,
18
+ default: 10
19
+ },
20
+ //最大列数
21
+ maxColumns: {
22
+ type: Number,
23
+ default: 10
24
+ }
25
+ }
26
+
27
+ export type InsertTablePropsType = ExtractPublicPropTypes<typeof InsertTableProps>
@@ -1,135 +1,135 @@
1
- .editify-video {
2
- display: block;
3
- width: 280px;
4
- padding: 10px 14px;
5
-
6
- .editify-video-header {
7
- display: flex;
8
- justify-content: flex-start;
9
- align-items: center;
10
- width: 100%;
11
- margin-bottom: 20px;
12
- position: relative;
13
- padding-bottom: 6px;
14
-
15
- .editify-video-header-slider {
16
- position: absolute;
17
- width: 50px;
18
- height: 2px;
19
- border-radius: 2px;
20
- left: 0;
21
- bottom: 0;
22
- transition: left 200ms;
23
-
24
- &.upload {
25
- left: 5px;
26
- }
27
-
28
- &.remote {
29
- left: 85px;
30
- }
31
- }
32
-
33
- .editify-video-header-item {
34
- display: block;
35
- text-align: center;
36
- font-size: @font-size;
37
- color: @font-color;
38
- opacity: 0.8;
39
- transition: all 200ms;
40
- width: 60px;
41
- overflow: hidden;
42
- white-space: nowrap;
43
- text-overflow: ellipsis;
44
-
45
- &:hover {
46
- opacity: 1;
47
- cursor: pointer;
48
- }
49
-
50
- &:first-child {
51
- margin-right: 20px;
52
- }
53
-
54
- &.active {
55
- opacity: 1;
56
- color: @font-color-dark;
57
- }
58
- }
59
- }
60
-
61
- .editify-video-remote {
62
- display: block;
63
- width: 100%;
64
-
65
- input {
66
- appearance: none;
67
- -webkit-appearance: none;
68
- -moz-appearance: none;
69
- display: block;
70
- width: 100%;
71
- margin: 0 0 10px 0;
72
- padding: 4px 2px;
73
- border: none;
74
- font-size: @font-size;
75
- color: @font-color;
76
- border-bottom: 1px solid @border-color;
77
- line-height: 1.5;
78
- transition: border-color 500ms;
79
- background-color: transparent;
80
- outline: none;
81
- box-sizing: border-box;
82
-
83
- &::-webkit-input-placeholder,
84
- &::placeholder {
85
- color: @font-color-disabled;
86
- font-family: inherit;
87
- font-size: inherit;
88
- vertical-align: middle;
89
- }
90
- }
91
-
92
- .editify-video-remote-footer {
93
- display: flex;
94
- justify-content: flex-end;
95
- align-items: center;
96
- width: 100%;
97
- font-size: @font-size;
98
- opacity: 0.8;
99
- transition: all 200ms;
100
-
101
- &:hover {
102
- cursor: pointer;
103
- opacity: 1;
104
- }
105
- }
106
- }
107
-
108
- .editify-video-upload {
109
- display: flex;
110
- justify-content: center;
111
- align-items: center;
112
- width: 100%;
113
- padding: 15px 0;
114
- font-size: 36px;
115
- opacity: 0.8;
116
- transition: all 200ms;
117
- position: relative;
118
-
119
- &:hover {
120
- cursor: pointer;
121
- opacity: 1;
122
- }
123
-
124
- input {
125
- opacity: 0;
126
- position: absolute;
127
- left: 0;
128
- top: 0;
129
- width: 100%;
130
- height: 100%;
131
- z-index: 1;
132
- cursor: pointer;
133
- }
134
- }
135
- }
1
+ .editify-video {
2
+ display: block;
3
+ width: 280px;
4
+ padding: 10px 14px;
5
+
6
+ .editify-video-header {
7
+ display: flex;
8
+ justify-content: flex-start;
9
+ align-items: center;
10
+ width: 100%;
11
+ margin-bottom: 20px;
12
+ position: relative;
13
+ padding-bottom: 6px;
14
+
15
+ .editify-video-header-slider {
16
+ position: absolute;
17
+ width: 50px;
18
+ height: 2px;
19
+ border-radius: 2px;
20
+ left: 0;
21
+ bottom: 0;
22
+ transition: left 200ms;
23
+
24
+ &.upload {
25
+ left: 5px;
26
+ }
27
+
28
+ &.remote {
29
+ left: 85px;
30
+ }
31
+ }
32
+
33
+ .editify-video-header-item {
34
+ display: block;
35
+ text-align: center;
36
+ font-size: @font-size;
37
+ color: @font-color;
38
+ opacity: 0.8;
39
+ transition: all 200ms;
40
+ width: 60px;
41
+ overflow: hidden;
42
+ white-space: nowrap;
43
+ text-overflow: ellipsis;
44
+
45
+ &:hover {
46
+ opacity: 1;
47
+ cursor: pointer;
48
+ }
49
+
50
+ &:first-child {
51
+ margin-right: 20px;
52
+ }
53
+
54
+ &.active {
55
+ opacity: 1;
56
+ color: @font-color-dark;
57
+ }
58
+ }
59
+ }
60
+
61
+ .editify-video-remote {
62
+ display: block;
63
+ width: 100%;
64
+
65
+ input {
66
+ appearance: none;
67
+ -webkit-appearance: none;
68
+ -moz-appearance: none;
69
+ display: block;
70
+ width: 100%;
71
+ margin: 0 0 10px 0;
72
+ padding: 4px 2px;
73
+ border: none;
74
+ font-size: @font-size;
75
+ color: @font-color;
76
+ border-bottom: 1px solid @border-color;
77
+ line-height: 1.5;
78
+ transition: border-color 500ms;
79
+ background-color: transparent;
80
+ outline: none;
81
+ box-sizing: border-box;
82
+
83
+ &::-webkit-input-placeholder,
84
+ &::placeholder {
85
+ color: @font-color-disabled;
86
+ font-family: inherit;
87
+ font-size: inherit;
88
+ vertical-align: middle;
89
+ }
90
+ }
91
+
92
+ .editify-video-remote-footer {
93
+ display: flex;
94
+ justify-content: flex-end;
95
+ align-items: center;
96
+ width: 100%;
97
+ font-size: @font-size;
98
+ opacity: 0.8;
99
+ transition: all 200ms;
100
+
101
+ &:hover {
102
+ cursor: pointer;
103
+ opacity: 1;
104
+ }
105
+ }
106
+ }
107
+
108
+ .editify-video-upload {
109
+ display: flex;
110
+ justify-content: center;
111
+ align-items: center;
112
+ width: 100%;
113
+ padding: 15px 0;
114
+ font-size: 36px;
115
+ opacity: 0.8;
116
+ transition: all 200ms;
117
+ position: relative;
118
+
119
+ &:hover {
120
+ cursor: pointer;
121
+ opacity: 1;
122
+ }
123
+
124
+ input {
125
+ opacity: 0;
126
+ position: absolute;
127
+ left: 0;
128
+ top: 0;
129
+ width: 100%;
130
+ height: 100%;
131
+ z-index: 1;
132
+ cursor: pointer;
133
+ }
134
+ }
135
+ }