vue-editify 0.2.14 → 0.2.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/examples/App.vue +41 -88
  2. package/lib/components/button/button.vue.d.ts +62 -60
  3. package/lib/components/button/index.d.ts +4 -0
  4. package/lib/components/button/props.d.ts +12 -1
  5. package/lib/components/checkbox/checkbox.vue.d.ts +9 -9
  6. package/lib/components/checkbox/index.d.ts +4 -0
  7. package/lib/components/checkbox/props.d.ts +2 -2
  8. package/lib/components/colors/colors.vue.d.ts +4 -4
  9. package/lib/components/colors/index.d.ts +4 -0
  10. package/lib/components/colors/props.d.ts +2 -2
  11. package/lib/components/icon/index.d.ts +4 -0
  12. package/lib/components/insertAttachment/index.d.ts +4 -0
  13. package/lib/{plugins/attachment → components}/insertAttachment/insertAttachment.vue.d.ts +3 -3
  14. package/lib/{plugins/attachment → components}/insertAttachment/props.d.ts +1 -1
  15. package/lib/components/insertImage/index.d.ts +4 -0
  16. package/lib/components/insertImage/insertImage.vue.d.ts +3 -3
  17. package/lib/components/insertImage/props.d.ts +1 -1
  18. package/lib/components/insertLink/index.d.ts +4 -0
  19. package/lib/components/insertLink/insertLink.vue.d.ts +6 -6
  20. package/lib/components/insertLink/props.d.ts +3 -3
  21. package/lib/components/insertMathformula/index.d.ts +4 -0
  22. package/lib/{plugins/mathformula → components}/insertMathformula/insertMathformula.vue.d.ts +3 -3
  23. package/lib/{plugins/mathformula → components}/insertMathformula/props.d.ts +2 -2
  24. package/lib/components/insertTable/index.d.ts +4 -0
  25. package/lib/components/insertTable/insertTable.vue.d.ts +3 -3
  26. package/lib/components/insertTable/props.d.ts +2 -2
  27. package/lib/components/insertVideo/index.d.ts +4 -0
  28. package/lib/components/insertVideo/insertVideo.vue.d.ts +3 -3
  29. package/lib/components/insertVideo/props.d.ts +1 -1
  30. package/lib/components/layer/index.d.ts +4 -0
  31. package/lib/components/layer/layer.vue.d.ts +10 -8
  32. package/lib/components/tooltip/index.d.ts +4 -0
  33. package/lib/components/tooltip/tooltip.vue.d.ts +6 -4
  34. package/lib/components/triangle/index.d.ts +4 -0
  35. package/lib/components/triangle/triangle.vue.d.ts +1 -1
  36. package/lib/components/updateLink/index.d.ts +4 -0
  37. package/lib/components/updateLink/props.d.ts +17 -0
  38. package/lib/components/updateLink/updateLink.vue.d.ts +38 -0
  39. package/lib/core/function.d.ts +113 -36
  40. package/lib/core/rule.d.ts +20 -0
  41. package/lib/core/tool.d.ts +36 -34
  42. package/lib/editify/editify.vue.d.ts +18 -28
  43. package/lib/editify/menu/index.d.ts +4 -0
  44. package/lib/{components → editify}/menu/menu.vue.d.ts +3 -4
  45. package/lib/{components → editify}/menu/props.d.ts +1 -1
  46. package/lib/editify/props.d.ts +3 -7
  47. package/lib/editify/toolbar/index.d.ts +4 -0
  48. package/lib/{components → editify}/toolbar/props.d.ts +2 -2
  49. package/lib/{components → editify}/toolbar/toolbar.vue.d.ts +53 -53
  50. package/lib/editify.es.js +38964 -37727
  51. package/lib/editify.umd.js +2 -2
  52. package/lib/feature/align.d.ts +32 -0
  53. package/lib/feature/attachment.d.ts +18 -0
  54. package/lib/feature/backColor.d.ts +32 -0
  55. package/lib/feature/bold.d.ts +32 -0
  56. package/lib/feature/code.d.ts +32 -0
  57. package/lib/feature/codeBlock.d.ts +32 -0
  58. package/lib/feature/fontFamily.d.ts +32 -0
  59. package/lib/feature/fontSize.d.ts +32 -0
  60. package/lib/feature/foreColor.d.ts +32 -0
  61. package/lib/feature/formatClear.d.ts +32 -0
  62. package/lib/feature/fullScreen.d.ts +18 -0
  63. package/lib/feature/heading.d.ts +32 -0
  64. package/lib/feature/image.d.ts +32 -0
  65. package/lib/feature/indent.d.ts +18 -0
  66. package/lib/feature/infoBlock.d.ts +18 -0
  67. package/lib/feature/italic.d.ts +32 -0
  68. package/lib/feature/lineHeight.d.ts +32 -0
  69. package/lib/feature/link.d.ts +26 -0
  70. package/lib/feature/mathformula.d.ts +22 -0
  71. package/lib/feature/orderList.d.ts +32 -0
  72. package/lib/feature/panel.d.ts +18 -0
  73. package/lib/feature/quote.d.ts +18 -0
  74. package/lib/feature/redo.d.ts +18 -0
  75. package/lib/feature/separator.d.ts +18 -0
  76. package/lib/feature/sourceView.d.ts +18 -0
  77. package/lib/feature/strikethrough.d.ts +32 -0
  78. package/lib/feature/sub.d.ts +32 -0
  79. package/lib/feature/super.d.ts +32 -0
  80. package/lib/feature/table.d.ts +32 -0
  81. package/lib/feature/task.d.ts +32 -0
  82. package/lib/feature/underline.d.ts +32 -0
  83. package/lib/feature/undo.d.ts +18 -0
  84. package/lib/feature/unorderList.d.ts +32 -0
  85. package/lib/feature/video.d.ts +38 -0
  86. package/lib/index.d.ts +194 -202
  87. package/package.json +5 -5
  88. package/src/components/button/button.vue +21 -24
  89. package/src/components/button/index.ts +5 -0
  90. package/src/components/button/props.ts +14 -1
  91. package/src/components/checkbox/checkbox.vue +1 -1
  92. package/src/components/checkbox/index.ts +5 -0
  93. package/src/components/checkbox/props.ts +1 -1
  94. package/src/components/colors/colors.vue +3 -3
  95. package/src/components/colors/index.ts +5 -0
  96. package/src/components/colors/props.ts +2 -2
  97. package/src/components/icon/index.ts +5 -0
  98. package/src/components/insertAttachment/index.ts +5 -0
  99. package/src/{plugins/attachment → components}/insertAttachment/insertAttachment.vue +4 -2
  100. package/src/{plugins/attachment → components}/insertAttachment/props.ts +1 -1
  101. package/src/components/insertImage/index.ts +5 -0
  102. package/src/components/insertImage/insertImage.vue +5 -5
  103. package/src/components/insertImage/props.ts +1 -1
  104. package/src/components/insertLink/index.ts +5 -0
  105. package/src/components/insertLink/insertLink.vue +10 -10
  106. package/src/components/insertLink/props.ts +3 -3
  107. package/src/components/insertMathformula/index.ts +5 -0
  108. package/src/{plugins/mathformula → components}/insertMathformula/props.ts +2 -2
  109. package/src/components/insertTable/index.ts +5 -0
  110. package/src/components/insertTable/props.ts +2 -2
  111. package/src/components/insertVideo/index.ts +5 -0
  112. package/src/components/insertVideo/insertVideo.vue +2 -2
  113. package/src/components/insertVideo/props.ts +1 -1
  114. package/src/components/layer/index.ts +5 -0
  115. package/src/components/layer/layer.vue +42 -4
  116. package/src/components/tooltip/index.ts +5 -0
  117. package/src/components/tooltip/tooltip.vue +1 -1
  118. package/src/components/triangle/index.ts +5 -0
  119. package/src/components/triangle/triangle.vue +1 -1
  120. package/src/components/updateLink/index.ts +5 -0
  121. package/src/components/updateLink/props.ts +21 -0
  122. package/src/components/{toolbar/toolbar.less → updateLink/updateLink.less} +4 -20
  123. package/src/components/updateLink/updateLink.vue +74 -0
  124. package/src/core/function.ts +289 -97
  125. package/src/core/rule.ts +108 -29
  126. package/src/core/tool.ts +237 -81
  127. package/src/editify/editify.less +4 -0
  128. package/src/editify/editify.vue +183 -194
  129. package/src/editify/menu/index.ts +5 -0
  130. package/src/editify/menu/menu.vue +215 -0
  131. package/src/{components → editify}/menu/props.ts +1 -1
  132. package/src/editify/props.ts +7 -11
  133. package/src/editify/toolbar/index.ts +5 -0
  134. package/src/{components → editify}/toolbar/props.ts +1 -1
  135. package/src/editify/toolbar/toolbar.less +10 -0
  136. package/src/editify/toolbar/toolbar.vue +103 -0
  137. package/src/feature/align.ts +126 -0
  138. package/src/feature/attachment.ts +108 -0
  139. package/src/feature/backColor.ts +169 -0
  140. package/src/feature/bold.ts +134 -0
  141. package/src/feature/code.ts +134 -0
  142. package/src/feature/codeBlock.ts +201 -0
  143. package/src/feature/fontFamily.ts +138 -0
  144. package/src/feature/fontSize.ts +140 -0
  145. package/src/feature/foreColor.ts +171 -0
  146. package/src/feature/formatClear.ts +116 -0
  147. package/src/feature/fullScreen.ts +57 -0
  148. package/src/feature/heading.ts +152 -0
  149. package/src/feature/image.ts +222 -0
  150. package/src/feature/indent.ts +72 -0
  151. package/src/feature/infoBlock.ts +93 -0
  152. package/src/feature/italic.ts +134 -0
  153. package/src/feature/lineHeight.ts +163 -0
  154. package/src/feature/link.ts +146 -0
  155. package/src/feature/mathformula.ts +146 -0
  156. package/src/feature/orderList.ts +114 -0
  157. package/src/feature/panel.ts +107 -0
  158. package/src/feature/quote.ts +60 -0
  159. package/src/feature/redo.ts +56 -0
  160. package/src/feature/separator.ts +61 -0
  161. package/src/feature/sourceView.ts +59 -0
  162. package/src/feature/strikethrough.ts +134 -0
  163. package/src/feature/sub.ts +134 -0
  164. package/src/feature/super.ts +134 -0
  165. package/src/feature/table.ts +981 -0
  166. package/src/feature/task.ts +114 -0
  167. package/src/feature/underline.ts +134 -0
  168. package/src/feature/undo.ts +56 -0
  169. package/src/feature/unorderList.ts +114 -0
  170. package/src/feature/video.ts +335 -0
  171. package/src/hljs/index.ts +1 -1
  172. package/src/index.ts +82 -25
  173. package/src/locale/en_US.ts +3 -3
  174. package/src/locale/zh_CN.ts +3 -3
  175. package/lib/plugins/attachment/index.d.ts +0 -37
  176. package/lib/plugins/infoBlock/index.d.ts +0 -55
  177. package/lib/plugins/mathformula/index.d.ts +0 -49
  178. package/lib/plugins/panel/index.d.ts +0 -48
  179. package/src/components/menu/menu.vue +0 -1655
  180. package/src/components/toolbar/toolbar.vue +0 -1677
  181. package/src/plugins/attachment/index.ts +0 -237
  182. package/src/plugins/infoBlock/index.ts +0 -238
  183. package/src/plugins/mathformula/index.ts +0 -295
  184. package/src/plugins/panel/index.ts +0 -228
  185. package/tsconfig.json +0 -31
  186. package/tsconfig.node.json +0 -11
  187. /package/src/{plugins/attachment → components}/insertAttachment/insertAttachment.less +0 -0
  188. /package/src/{plugins/mathformula → components}/insertMathformula/insertMathformula.less +0 -0
  189. /package/src/{plugins/mathformula → components}/insertMathformula/insertMathformula.vue +0 -0
  190. /package/src/{components → editify}/menu/menu.less +0 -0
@@ -0,0 +1,335 @@
1
+ import { computed, defineComponent, h, inject, PropType, ref, Ref } from 'vue'
2
+ import { AlexEditor, AlexElementsRangeType } from 'alex-editor'
3
+ import { Button } from '@/components/button'
4
+ import { Icon } from '@/components/icon'
5
+ import { getMatchElementByRange, hasMathformulaInRange, hasPreInRange, insertVideo } from '@/core/function'
6
+ import { InsertVideo } from '@/components/insertVideo'
7
+ import { MenuVideoButtonType } from '@/core/tool'
8
+
9
+ export type VideoConfigType = {
10
+ controls: boolean
11
+ loop: boolean
12
+ autoplay: boolean
13
+ muted: boolean
14
+ }
15
+
16
+ /**
17
+ * feature名称
18
+ */
19
+ const FEATURE_NAME = 'video'
20
+
21
+ /**
22
+ * 工具栏 - 视频操作
23
+ */
24
+ export const VideoToolbar = defineComponent(
25
+ (props, { emit }) => {
26
+ const editor = inject<Ref<AlexEditor>>('editor')!
27
+ const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
28
+ const $editTrans = inject<(key: string) => any>('$editTrans')!
29
+
30
+ //视频参数配置
31
+ const videoConfig = computed<VideoConfigType>(() => {
32
+ const video = getMatchElementByRange(editor.value, dataRangeCaches.value, { parsedom: 'video' })
33
+ if (video) {
34
+ return {
35
+ controls: !!video.marks!['controls'],
36
+ loop: !!video.marks!['loop'],
37
+ autoplay: !!video.marks!['autoplay'],
38
+ muted: !!video.marks!['muted']
39
+ }
40
+ }
41
+ return {
42
+ controls: false,
43
+ loop: false,
44
+ autoplay: false,
45
+ muted: false
46
+ }
47
+ })
48
+
49
+ //设置视频宽度
50
+ const setWidth = (value: string) => {
51
+ const element = editor.value.range!.anchor.element
52
+ if (element) {
53
+ const styles = {
54
+ width: value
55
+ }
56
+ if (element.hasStyles()) {
57
+ element.styles = Object.assign(element.styles!, styles)
58
+ } else {
59
+ element.styles = styles
60
+ }
61
+ editor.value.domRender()
62
+ editor.value.rangeRender()
63
+ //更新工具条位置
64
+ setTimeout(() => {
65
+ emit('reset-toolbar')
66
+ }, 0)
67
+ }
68
+ }
69
+ //设置视频属性
70
+ const setVideo = (prop: 'controls' | 'loop' | 'autoplay' | 'muted') => {
71
+ const element = editor.value.range!.anchor.element
72
+ //当前是拥有该属性
73
+ if (videoConfig.value[prop]) {
74
+ delete element.marks![prop]
75
+ }
76
+ //当前无该属性
77
+ else {
78
+ element.marks![prop] = true
79
+ }
80
+ videoConfig.value[prop] = !videoConfig.value[prop]
81
+ editor.value.domRender()
82
+ editor.value.rangeRender()
83
+ }
84
+
85
+ return () => {
86
+ return [
87
+ //30%
88
+ h(
89
+ Button,
90
+ {
91
+ name: 'set30Width',
92
+ title: $editTrans('width30'),
93
+ tooltip: props.tooltip,
94
+ color: props.color,
95
+ zIndex: props.zIndex,
96
+ onOperate: () => setWidth('30%')
97
+ },
98
+ {
99
+ default: () => ' 30% '
100
+ }
101
+ ),
102
+ //50%
103
+ h(
104
+ Button,
105
+ {
106
+ name: 'set50Width',
107
+ title: $editTrans('width50'),
108
+ tooltip: props.tooltip,
109
+ color: props.color,
110
+ zIndex: props.zIndex,
111
+ onOperate: () => setWidth('50%')
112
+ },
113
+ {
114
+ default: () => ' 50% '
115
+ }
116
+ ),
117
+ //100%
118
+ h(
119
+ Button,
120
+ {
121
+ name: 'set100Width',
122
+ title: $editTrans('width100'),
123
+ tooltip: props.tooltip,
124
+ color: props.color,
125
+ zIndex: props.zIndex,
126
+ onOperate: () => setWidth('100%')
127
+ },
128
+ {
129
+ default: () => ' 100% '
130
+ }
131
+ ),
132
+ //宽度自适应
133
+ h(
134
+ Button,
135
+ {
136
+ name: 'setAutoWidth',
137
+ title: $editTrans('auto'),
138
+ tooltip: props.tooltip,
139
+ color: props.color,
140
+ rightBorder: true,
141
+ zIndex: props.zIndex,
142
+ onOperate: () => setWidth('auto')
143
+ },
144
+ {
145
+ default: () => h(Icon, { value: 'auto-width' })
146
+ }
147
+ ),
148
+ //自动播放
149
+ h(
150
+ Button,
151
+ {
152
+ name: 'autoplay',
153
+ title: videoConfig.value.autoplay ? $editTrans('disabledAutoplay') : $editTrans('autoplay'),
154
+ tooltip: props.tooltip,
155
+ color: props.color,
156
+ zIndex: props.zIndex,
157
+ onOperate: () => setVideo('autoplay')
158
+ },
159
+ {
160
+ default: () =>
161
+ h(Icon, {
162
+ value: videoConfig.value.autoplay ? 'autoplay' : 'stop'
163
+ })
164
+ }
165
+ ),
166
+ //循环
167
+ h(
168
+ Button,
169
+ {
170
+ name: 'loop',
171
+ title: videoConfig.value.loop ? $editTrans('disabledLoop') : $editTrans('loop'),
172
+ tooltip: props.tooltip,
173
+ color: props.color,
174
+ zIndex: props.zIndex,
175
+ onOperate: () => setVideo('loop')
176
+ },
177
+ {
178
+ default: () =>
179
+ h(Icon, {
180
+ value: videoConfig.value.loop ? 'loop' : 'single'
181
+ })
182
+ }
183
+ ),
184
+ //静音
185
+ h(
186
+ Button,
187
+ {
188
+ name: 'muted',
189
+ title: videoConfig.value.muted ? $editTrans('unmuted') : $editTrans('muted'),
190
+ tooltip: props.tooltip,
191
+ color: props.color,
192
+ zIndex: props.zIndex,
193
+ onOperate: () => setVideo('muted')
194
+ },
195
+ {
196
+ default: () =>
197
+ h(Icon, {
198
+ value: videoConfig.value.muted ? 'muted' : 'unmuted'
199
+ })
200
+ }
201
+ ),
202
+ //控制器
203
+ h(
204
+ Button,
205
+ {
206
+ name: 'controls',
207
+ title: $editTrans('controls'),
208
+ tooltip: props.tooltip,
209
+ color: props.color,
210
+ zIndex: props.zIndex,
211
+ leftBorder: true,
212
+ onOperate: () => setVideo('controls')
213
+ },
214
+ {
215
+ default: () =>
216
+ h(Icon, {
217
+ value: 'controls'
218
+ })
219
+ }
220
+ ),
221
+ //删除视频
222
+ h(
223
+ Button,
224
+ {
225
+ name: 'deleteVideo',
226
+ title: $editTrans('deleteVideo'),
227
+ tooltip: props.tooltip,
228
+ color: props.color,
229
+ zIndex: props.zIndex,
230
+ onOperate: () => {
231
+ const element = getMatchElementByRange(editor.value, dataRangeCaches.value, { parsedom: 'video' })
232
+ if (element) {
233
+ element.toEmpty()
234
+ editor.value.domRender()
235
+ editor.value.rangeRender()
236
+ }
237
+ }
238
+ },
239
+ {
240
+ default: () => h(Icon, { value: 'delete' })
241
+ }
242
+ )
243
+ ]
244
+ }
245
+ },
246
+ {
247
+ name: `_${FEATURE_NAME}`,
248
+ props: {
249
+ color: String,
250
+ zIndex: Number,
251
+ tooltip: Boolean
252
+ },
253
+ emits: ['reset-toolbar']
254
+ }
255
+ )
256
+
257
+ /**
258
+ * 菜单栏 - 插入视频
259
+ */
260
+ export const VideoMenuButton = defineComponent(
261
+ props => {
262
+ const editor = inject<Ref<AlexEditor>>('editor')!
263
+ const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
264
+ const $editTrans = inject<(key: string) => any>('$editTrans')!
265
+ const isSourceView = inject<Ref<boolean>>('isSourceView')!
266
+
267
+ const btnRef = ref<InstanceType<typeof Button> | null>(null)
268
+
269
+ return () => {
270
+ return props.config.show
271
+ ? h(
272
+ Button,
273
+ {
274
+ ref: btnRef,
275
+ name: FEATURE_NAME,
276
+ tooltip: props.tooltip,
277
+ color: props.color,
278
+ zIndex: props.zIndex,
279
+ type: 'select',
280
+ hideScroll: true,
281
+ title: $editTrans('insertImage'),
282
+ leftBorder: props.config.leftBorder,
283
+ rightBorder: props.config.rightBorder,
284
+ active: false,
285
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || props.config.disabled
286
+ },
287
+ {
288
+ default: () =>
289
+ h(Icon, {
290
+ value: 'video'
291
+ }),
292
+ layer: () =>
293
+ h(InsertVideo, {
294
+ color: props.color,
295
+ allowedFileType: props.config.allowedFileType,
296
+ multiple: props.config.multiple,
297
+ maxSize: props.config.maxSize,
298
+ minSize: props.config.minSize,
299
+ customUpload: props.config.customUpload,
300
+ handleError: props.config.handleError,
301
+ onChange: () => btnRef.value!.layerRef!.setPosition(),
302
+ onInsert: (val: string[]) => {
303
+ //过滤掉空的地址
304
+ const urls = val.filter(url => {
305
+ return !!url
306
+ })
307
+ //如果数组为0
308
+ if (urls.length == 0) {
309
+ return
310
+ }
311
+ //遍历每个地址进行插入
312
+ urls.forEach(url => {
313
+ insertVideo(editor.value, url)
314
+ })
315
+ editor.value.domRender()
316
+ editor.value.rangeRender()
317
+ btnRef.value!.show = false
318
+ }
319
+ })
320
+ }
321
+ )
322
+ : null
323
+ }
324
+ },
325
+ {
326
+ name: `_${FEATURE_NAME}`,
327
+ props: {
328
+ color: String,
329
+ zIndex: Number,
330
+ config: Object as PropType<MenuVideoButtonType>,
331
+ tooltip: Boolean,
332
+ disabled: Boolean
333
+ }
334
+ }
335
+ )
package/src/hljs/index.ts CHANGED
@@ -29,7 +29,7 @@ import r from 'highlight.js/lib/languages/r'
29
29
  import kotlin from 'highlight.js/lib/languages/kotlin'
30
30
  import rust from 'highlight.js/lib/languages/rust'
31
31
  //引入css样式主题
32
- import '../css/hljs.less'
32
+ import '@/css/hljs.less'
33
33
  //import 'highlight.js/styles/github.css'
34
34
  //import 'highlight.js/styles/atom-one-light.css'
35
35
  //import 'highlight.js/styles/lightfair.css'
package/src/index.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  import { App } from 'vue'
2
+ import { AlexElement } from 'alex-editor'
2
3
  import { withInstall } from '@/core/tool'
4
+
5
+ //重写AlexElement.isPreStyle,将td加入到代码块样式中去
6
+ const originFn = AlexElement.prototype.isPreStyle
7
+ AlexElement.prototype.isPreStyle = function () {
8
+ const block = this.getInblock() || this.getBlock()
9
+ if (block.parsedom == 'td') {
10
+ return true
11
+ }
12
+ return originFn.apply(this)
13
+ }
14
+
3
15
  //引入根节点颜色变量样式
4
16
  import '@/css/var.less'
5
17
  //引入字体图标样式
@@ -10,40 +22,85 @@ import editify from '@/editify/editify.vue'
10
22
  const Editify = withInstall(editify)
11
23
 
12
24
  //导出类型
13
- export type { ButtonTypeType, ButtonOptionsItemType, ButtonSelectConfigType, ButtonDisplayConfigType } from '@/components/button/props'
14
- export type { InsertImageUploadErrorType } from '@/components/insertImage/props'
15
- export type { InsertVideoUploadErrorType } from '@/components/insertVideo/props'
16
- export type { MenuButtonType, MenuSelectButtonType, MenuDisplayButtonType, MenuImageButtonType, MenuVideoButtonType, MenuTableButtonType, MenuCustomButtonType, CodeBlockToolbarType, TextToolbarType, ToolbarConfigType, MenuSequenceType, MenuModeType, MenuExtendType, MenuConfigType, PluginMenuConfigType, PluginType, PluginResultType } from '@/core/tool'
17
- export type { ElementMatchConfigType } from '@/core/function'
25
+ export type * from '@/components/button'
26
+ export type * from '@/components/checkbox'
27
+ export type * from '@/components/colors'
28
+ export type * from '@/components/icon'
29
+ export type * from '@/components/insertImage'
30
+ export type * from '@/components/insertLink'
31
+ export type * from '@/components/insertTable'
32
+ export type * from '@/components/insertVideo'
33
+ export type * from '@/components/layer'
34
+ export type * from '@/components/tooltip'
35
+ export type * from '@/components/triangle'
36
+ export type * from '@/components/updateLink'
37
+ export type * from '@/core/tool'
38
+ export type * from '@/core/function'
39
+ export type * from '@/editify/menu'
40
+ export type * from '@/editify/toolbar'
18
41
 
19
42
  //导出编辑器操作方法
20
- export { elementIsMatch, getMatchElementByElement, getMatchElementByRange, isList, isTask, elementIsInList, elementIsInTask, hasPreInRange, hasQuoteInRange, hasListInRange, hasTaskInRange, hasLinkInRange, hasTableInRange, hasImageInRange, hasVideoInRange, isRangeInQuote, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getRangeText, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setTextStyle, setTextMark, removeTextStyle, removeTextMark, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, insertSeparator } from '@/core/function'
43
+ export {
44
+ elementIsMatch,
45
+ getMatchElementByElement,
46
+ getMatchElementByRange,
47
+ elementIsList,
48
+ getListByElement,
49
+ hasListInRange,
50
+ rangeIsInList,
51
+ elementIsTask,
52
+ getTaskByElement,
53
+ hasTaskInRange,
54
+ rangeIsInTask,
55
+ elementIsAttachment,
56
+ hasAttachmentInRange,
57
+ elementIsMathformula,
58
+ getMathformulaByElement,
59
+ hasMathformulaInRange,
60
+ elementIsPanel,
61
+ getPanelByElement,
62
+ hasPanelInRange,
63
+ elementIsInfoBlock,
64
+ getInfoBlockByElement,
65
+ hasInfoBlockInRange,
66
+ rangeIsInInfoBlock,
67
+ hasPreInRange,
68
+ hasQuoteInRange,
69
+ hasLinkInRange,
70
+ hasTableInRange,
71
+ hasImageInRange,
72
+ hasVideoInRange,
73
+ rangeIsInQuote,
74
+ queryTextStyle,
75
+ queryTextMark,
76
+ getRangeText,
77
+ setIndentIncrease,
78
+ setIndentDecrease,
79
+ setQuote,
80
+ setAlign,
81
+ setList,
82
+ setTask,
83
+ setTextStyle,
84
+ setTextMark,
85
+ removeTextStyle,
86
+ removeTextMark,
87
+ setLineHeight,
88
+ insertLink,
89
+ insertImage,
90
+ insertVideo,
91
+ insertTable,
92
+ insertCodeBlock,
93
+ insertSeparator
94
+ } from '@/core/function'
21
95
 
22
96
  //安装函数
23
97
  const install = (app: App) => {
24
98
  app.component(Editify.name!, Editify)
25
99
  }
26
100
  //版本号
27
- const version = '0.2.14'
28
-
29
- //导出AlexElement元素
30
- export { AlexElement } from 'alex-editor'
31
-
32
- //导出attachment插件相关的方法和类型
33
- export type { AttachmentOptionsType } from '@/plugins/attachment'
34
- export type { InsertAttachmentUploadErrorType } from '@/plugins/attachment/insertAttachment/props'
35
- export { attachment, isAttachment, hasAttachmentInRange } from '@/plugins/attachment'
36
- //导出mathformula插件相关的方法和类型
37
- export type { MathformulaOptionsType } from '@/plugins/mathformula'
38
- export { mathformula, isMathformula, isUnderMathformula, getMathformulaElement, hasMathformulaInRange, getMathformulaElementByRange } from '@/plugins/mathformula'
39
- //导出panel插件相关的方法和类型
40
- export type { PanelOptionsType } from '@/plugins/panel'
41
- export { panel, isPanel, isUnderPanel, getPanelElement, hasPanelInRange, getPanelElementByRange } from '@/plugins/panel'
42
- //导出infoBlock插件相关的方法和类型
43
- export type { InfoBlockOptionsType } from '@/plugins/infoBlock'
44
- export { infoBlock, isInfoBlock, isUnderInfoBlock, getInfoBlockElement, hasInfoBlockInRange, getInfoBlockElementByRange } from '@/plugins/infoBlock'
101
+ const version = '0.2.16'
45
102
 
46
103
  //导出组件和安装函数
47
- export { Editify as default, Editify, install, version }
104
+ export { Editify as default, Editify, install, AlexElement, version }
48
105
 
49
106
  console.log(`%c vue-editify %c v${version} `, 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;')
@@ -1,4 +1,4 @@
1
- import { ObjectType } from '../core/tool'
1
+ import { ObjectType } from '@/core/tool'
2
2
 
3
3
  export const en_US: ObjectType = {
4
4
  textWrapUp: 'Up feed',
@@ -49,8 +49,8 @@ export const en_US: ObjectType = {
49
49
  strikethrough: 'Strikethrough',
50
50
  underline: 'Underline',
51
51
  code: 'Inline code',
52
- superscript: 'Superscript',
53
- subscript: 'Subscript',
52
+ super: 'Superscript',
53
+ sub: 'Subscript',
54
54
  fontSize: 'Font size',
55
55
  fontFamily: 'Font family',
56
56
  defaultFontFamily: 'Default',
@@ -1,4 +1,4 @@
1
- import { ObjectType } from '../core/tool'
1
+ import { ObjectType } from '@/core/tool'
2
2
 
3
3
  export const zh_CN: ObjectType = {
4
4
  textWrapUp: '向上换行',
@@ -49,8 +49,8 @@ export const zh_CN: ObjectType = {
49
49
  strikethrough: '删除线',
50
50
  underline: '下划线',
51
51
  code: '行内代码',
52
- superscript: '上标',
53
- subscript: '下标',
52
+ super: '上标',
53
+ sub: '下标',
54
54
  fontSize: '字号',
55
55
  fontFamily: '字体',
56
56
  defaultFontFamily: '默认字体',
@@ -1,37 +0,0 @@
1
- import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
- import { PluginType } from '../../core/tool';
3
- import { InsertAttachmentUploadErrorType } from './insertAttachment/props';
4
-
5
- export type AttachmentOptionsType = {
6
- sequence?: number;
7
- title?: string;
8
- leftBorder?: boolean;
9
- rightBorder?: boolean;
10
- disabled?: boolean;
11
- accept?: string;
12
- allowedFileType?: string[];
13
- multiple?: boolean;
14
- maxSize?: number;
15
- minSize?: number;
16
- customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>);
17
- handleError?: (error: InsertAttachmentUploadErrorType, file: File) => void;
18
- };
19
- /**
20
- * 元素是否附件
21
- * @param element
22
- * @returns
23
- */
24
- export declare const isAttachment: (element: AlexElement) => any;
25
- /**
26
- * 选区是否含有附件
27
- * @param editor
28
- * @param dataRangeCaches
29
- * @returns
30
- */
31
- export declare const hasAttachmentInRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => any;
32
- /**
33
- * 附件插件
34
- * @param options
35
- * @returns
36
- */
37
- export declare const attachment: (options?: AttachmentOptionsType) => PluginType;
@@ -1,55 +0,0 @@
1
- import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
- import { PluginType } from '../../core/tool';
3
-
4
- export type InfoBlockOptionsType = {
5
- sequence?: number;
6
- title?: string;
7
- leftBorder?: boolean;
8
- rightBorder?: boolean;
9
- disabled?: boolean;
10
- };
11
- /**
12
- * 是否信息元素
13
- * @param el
14
- * @returns
15
- */
16
- export declare const isInfoBlock: (el: AlexElement) => any;
17
- /**
18
- * 判断某个元素是否在信息元素内
19
- * @param el
20
- * @returns
21
- */
22
- export declare const isUnderInfoBlock: (el: AlexElement) => boolean;
23
- /**
24
- * 根据某个元素获取所在的信息元素,如果不在信息元素内则返回null
25
- * @param el
26
- * @returns
27
- */
28
- export declare const getInfoBlockElement: (el: AlexElement) => AlexElement | null;
29
- /**
30
- * 选区是否含有信息元素
31
- * @param editor
32
- * @param dataRangeCaches
33
- * @returns
34
- */
35
- export declare const hasInfoBlockInRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => boolean;
36
- /**
37
- * 选区是否都在信息块内
38
- * @param editor
39
- * @param dataRangeCaches
40
- * @returns
41
- */
42
- export declare const isRangeInInfoBlock: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => boolean;
43
- /**
44
- * 选区是否在某个信息元素下,如果是返回该信息元素否则返回null
45
- * @param editor
46
- * @param dataRangeCaches
47
- * @returns
48
- */
49
- export declare const getInfoBlockElementByRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => AlexElement | null;
50
- /**
51
- * 信息插件
52
- * @param options
53
- * @returns
54
- */
55
- export declare const infoBlock: (options?: InfoBlockOptionsType) => PluginType;
@@ -1,49 +0,0 @@
1
- import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
- import { PluginType } from '../../core/tool';
3
-
4
- export type MathformulaOptionsType = {
5
- sequence?: number;
6
- title?: string;
7
- leftBorder?: boolean;
8
- rightBorder?: boolean;
9
- disabled?: boolean;
10
- handleError?: (error: Error) => void;
11
- };
12
- /**
13
- * 是否公式元素
14
- * @param el
15
- * @returns
16
- */
17
- export declare const isMathformula: (el: AlexElement) => any;
18
- /**
19
- * 判断某个元素是否在公式元素内
20
- * @param el
21
- * @returns
22
- */
23
- export declare const isUnderMathformula: (el: AlexElement) => boolean;
24
- /**
25
- * 根据某个元素获取所在的公式元素,如果不在公式元素内则返回null
26
- * @param el
27
- * @returns
28
- */
29
- export declare const getMathformulaElement: (el: AlexElement) => AlexElement | null;
30
- /**
31
- * 选区是否含有公式元素
32
- * @param editor
33
- * @param dataRangeCaches
34
- * @returns
35
- */
36
- export declare const hasMathformulaInRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => boolean;
37
- /**
38
- * 选区是否在某个公式元素下,如果是返回该公式元素否则返回null
39
- * @param editor
40
- * @param dataRangeCaches
41
- * @returns
42
- */
43
- export declare const getMathformulaElementByRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => AlexElement | null;
44
- /**
45
- * 数学公式插件
46
- * @param options
47
- * @returns
48
- */
49
- export declare const mathformula: (options?: MathformulaOptionsType) => PluginType;
@@ -1,48 +0,0 @@
1
- import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
- import { PluginType } from '../../core/tool';
3
-
4
- export type PanelOptionsType = {
5
- sequence?: number;
6
- title?: string;
7
- leftBorder?: boolean;
8
- rightBorder?: boolean;
9
- disabled?: boolean;
10
- };
11
- /**
12
- * 是否面板元素
13
- * @param el
14
- * @returns
15
- */
16
- export declare const isPanel: (el: AlexElement) => any;
17
- /**
18
- * 判断某个元素是否在面板元素内
19
- * @param el
20
- * @returns
21
- */
22
- export declare const isUnderPanel: (el: AlexElement) => boolean;
23
- /**
24
- * 根据某个元素获取所在的面板元素,如果不在面板元素内则返回null
25
- * @param el
26
- * @returns
27
- */
28
- export declare const getPanelElement: (el: AlexElement) => AlexElement | null;
29
- /**
30
- * 选区是否含有面板元素
31
- * @param editor
32
- * @param dataRangeCaches
33
- * @returns
34
- */
35
- export declare const hasPanelInRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => boolean;
36
- /**
37
- * 选区是否在某个面板元素下,如果是返回该面板元素否则返回null
38
- * @param editor
39
- * @param dataRangeCaches
40
- * @returns
41
- */
42
- export declare const getPanelElementByRange: (editor: AlexEditor, dataRangeCaches: AlexElementsRangeType) => AlexElement | null;
43
- /**
44
- * 面板插件
45
- * @param options
46
- * @returns
47
- */
48
- export declare const panel: (options?: PanelOptionsType) => PluginType;