vue-editify 0.2.13 → 0.2.15

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.
Files changed (190) hide show
  1. package/examples/App.vue +49 -67
  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 +86 -53
  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 +8879 -7668
  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 +104 -69
  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 +96 -7
  126. package/src/core/tool.ts +234 -78
  127. package/src/editify/editify.less +2 -0
  128. package/src/editify/editify.vue +182 -185
  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 +128 -0
  138. package/src/feature/attachment.ts +109 -0
  139. package/src/feature/backColor.ts +171 -0
  140. package/src/feature/bold.ts +136 -0
  141. package/src/feature/code.ts +136 -0
  142. package/src/feature/codeBlock.ts +204 -0
  143. package/src/feature/fontFamily.ts +140 -0
  144. package/src/feature/fontSize.ts +142 -0
  145. package/src/feature/foreColor.ts +173 -0
  146. package/src/feature/formatClear.ts +118 -0
  147. package/src/feature/fullScreen.ts +57 -0
  148. package/src/feature/heading.ts +154 -0
  149. package/src/feature/image.ts +225 -0
  150. package/src/feature/indent.ts +73 -0
  151. package/src/feature/infoBlock.ts +94 -0
  152. package/src/feature/italic.ts +136 -0
  153. package/src/feature/lineHeight.ts +165 -0
  154. package/src/feature/link.ts +149 -0
  155. package/src/feature/mathformula.ts +147 -0
  156. package/src/feature/orderList.ts +116 -0
  157. package/src/feature/panel.ts +108 -0
  158. package/src/feature/quote.ts +61 -0
  159. package/src/feature/redo.ts +56 -0
  160. package/src/feature/separator.ts +62 -0
  161. package/src/feature/sourceView.ts +59 -0
  162. package/src/feature/strikethrough.ts +136 -0
  163. package/src/feature/sub.ts +136 -0
  164. package/src/feature/super.ts +136 -0
  165. package/src/feature/table.ts +994 -0
  166. package/src/feature/task.ts +116 -0
  167. package/src/feature/underline.ts +136 -0
  168. package/src/feature/undo.ts +56 -0
  169. package/src/feature/unorderList.ts +116 -0
  170. package/src/feature/video.ts +339 -0
  171. package/src/hljs/index.ts +1 -1
  172. package/src/index.ts +69 -21
  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,339 @@
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.formatElementStack()
62
+ editor.value.domRender()
63
+ editor.value.rangeRender()
64
+ //更新工具条位置
65
+ setTimeout(() => {
66
+ emit('reset-toolbar')
67
+ }, 0)
68
+ }
69
+ }
70
+ //设置视频属性
71
+ const setVideo = (prop: 'controls' | 'loop' | 'autoplay' | 'muted') => {
72
+ const element = editor.value.range!.anchor.element
73
+ //当前是拥有该属性
74
+ if (videoConfig.value[prop]) {
75
+ delete element.marks![prop]
76
+ }
77
+ //当前无该属性
78
+ else {
79
+ element.marks![prop] = true
80
+ }
81
+ videoConfig.value[prop] = !videoConfig.value[prop]
82
+ editor.value.formatElementStack()
83
+ editor.value.domRender()
84
+ editor.value.rangeRender()
85
+ }
86
+
87
+ return () => {
88
+ return [
89
+ //30%
90
+ h(
91
+ Button,
92
+ {
93
+ name: 'set30Width',
94
+ title: $editTrans('width30'),
95
+ tooltip: props.tooltip,
96
+ color: props.color,
97
+ zIndex: props.zIndex,
98
+ onOperate: () => setWidth('30%')
99
+ },
100
+ {
101
+ default: () => ' 30% '
102
+ }
103
+ ),
104
+ //50%
105
+ h(
106
+ Button,
107
+ {
108
+ name: 'set50Width',
109
+ title: $editTrans('width50'),
110
+ tooltip: props.tooltip,
111
+ color: props.color,
112
+ zIndex: props.zIndex,
113
+ onOperate: () => setWidth('50%')
114
+ },
115
+ {
116
+ default: () => ' 50% '
117
+ }
118
+ ),
119
+ //100%
120
+ h(
121
+ Button,
122
+ {
123
+ name: 'set100Width',
124
+ title: $editTrans('width100'),
125
+ tooltip: props.tooltip,
126
+ color: props.color,
127
+ zIndex: props.zIndex,
128
+ onOperate: () => setWidth('100%')
129
+ },
130
+ {
131
+ default: () => ' 100% '
132
+ }
133
+ ),
134
+ //宽度自适应
135
+ h(
136
+ Button,
137
+ {
138
+ name: 'setAutoWidth',
139
+ title: $editTrans('auto'),
140
+ tooltip: props.tooltip,
141
+ color: props.color,
142
+ rightBorder: true,
143
+ zIndex: props.zIndex,
144
+ onOperate: () => setWidth('auto')
145
+ },
146
+ {
147
+ default: () => h(Icon, { value: 'auto-width' })
148
+ }
149
+ ),
150
+ //自动播放
151
+ h(
152
+ Button,
153
+ {
154
+ name: 'autoplay',
155
+ title: videoConfig.value.autoplay ? $editTrans('disabledAutoplay') : $editTrans('autoplay'),
156
+ tooltip: props.tooltip,
157
+ color: props.color,
158
+ zIndex: props.zIndex,
159
+ onOperate: () => setVideo('autoplay')
160
+ },
161
+ {
162
+ default: () =>
163
+ h(Icon, {
164
+ value: videoConfig.value.autoplay ? 'autoplay' : 'stop'
165
+ })
166
+ }
167
+ ),
168
+ //循环
169
+ h(
170
+ Button,
171
+ {
172
+ name: 'loop',
173
+ title: videoConfig.value.loop ? $editTrans('disabledLoop') : $editTrans('loop'),
174
+ tooltip: props.tooltip,
175
+ color: props.color,
176
+ zIndex: props.zIndex,
177
+ onOperate: () => setVideo('loop')
178
+ },
179
+ {
180
+ default: () =>
181
+ h(Icon, {
182
+ value: videoConfig.value.loop ? 'loop' : 'single'
183
+ })
184
+ }
185
+ ),
186
+ //静音
187
+ h(
188
+ Button,
189
+ {
190
+ name: 'muted',
191
+ title: videoConfig.value.muted ? $editTrans('unmuted') : $editTrans('muted'),
192
+ tooltip: props.tooltip,
193
+ color: props.color,
194
+ zIndex: props.zIndex,
195
+ onOperate: () => setVideo('muted')
196
+ },
197
+ {
198
+ default: () =>
199
+ h(Icon, {
200
+ value: videoConfig.value.muted ? 'muted' : 'unmuted'
201
+ })
202
+ }
203
+ ),
204
+ //控制器
205
+ h(
206
+ Button,
207
+ {
208
+ name: 'controls',
209
+ title: $editTrans('controls'),
210
+ tooltip: props.tooltip,
211
+ color: props.color,
212
+ zIndex: props.zIndex,
213
+ leftBorder: true,
214
+ onOperate: () => setVideo('controls')
215
+ },
216
+ {
217
+ default: () =>
218
+ h(Icon, {
219
+ value: 'controls'
220
+ })
221
+ }
222
+ ),
223
+ //删除视频
224
+ h(
225
+ Button,
226
+ {
227
+ name: 'deleteVideo',
228
+ title: $editTrans('deleteVideo'),
229
+ tooltip: props.tooltip,
230
+ color: props.color,
231
+ zIndex: props.zIndex,
232
+ onOperate: () => {
233
+ const element = getMatchElementByRange(editor.value, dataRangeCaches.value, { parsedom: 'video' })
234
+ if (element) {
235
+ element.toEmpty()
236
+ editor.value.formatElementStack()
237
+ editor.value.domRender()
238
+ editor.value.rangeRender()
239
+ }
240
+ }
241
+ },
242
+ {
243
+ default: () => h(Icon, { value: 'delete' })
244
+ }
245
+ )
246
+ ]
247
+ }
248
+ },
249
+ {
250
+ name: `_${FEATURE_NAME}`,
251
+ props: {
252
+ color: String,
253
+ zIndex: Number,
254
+ tooltip: Boolean
255
+ },
256
+ emits: ['reset-toolbar']
257
+ }
258
+ )
259
+
260
+ /**
261
+ * 菜单栏 - 插入视频
262
+ */
263
+ export const VideoMenuButton = defineComponent(
264
+ props => {
265
+ const editor = inject<Ref<AlexEditor>>('editor')!
266
+ const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
267
+ const $editTrans = inject<(key: string) => any>('$editTrans')!
268
+ const isSourceView = inject<Ref<boolean>>('isSourceView')!
269
+
270
+ const btnRef = ref<InstanceType<typeof Button> | null>(null)
271
+
272
+ return () => {
273
+ return props.config.show
274
+ ? h(
275
+ Button,
276
+ {
277
+ ref: btnRef,
278
+ name: FEATURE_NAME,
279
+ tooltip: props.tooltip,
280
+ color: props.color,
281
+ zIndex: props.zIndex,
282
+ type: 'select',
283
+ hideScroll: true,
284
+ title: $editTrans('insertImage'),
285
+ leftBorder: props.config.leftBorder,
286
+ rightBorder: props.config.rightBorder,
287
+ active: false,
288
+ disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || props.config.disabled
289
+ },
290
+ {
291
+ default: () =>
292
+ h(Icon, {
293
+ value: 'video'
294
+ }),
295
+ layer: () =>
296
+ h(InsertVideo, {
297
+ color: props.color,
298
+ allowedFileType: props.config.allowedFileType,
299
+ multiple: props.config.multiple,
300
+ maxSize: props.config.maxSize,
301
+ minSize: props.config.minSize,
302
+ customUpload: props.config.customUpload,
303
+ handleError: props.config.handleError,
304
+ onChange: () => btnRef.value!.layerRef!.setPosition(),
305
+ onInsert: (val: string[]) => {
306
+ //过滤掉空的地址
307
+ const urls = val.filter(url => {
308
+ return !!url
309
+ })
310
+ //如果数组为0
311
+ if (urls.length == 0) {
312
+ return
313
+ }
314
+ //遍历每个地址进行插入
315
+ urls.forEach(url => {
316
+ insertVideo(editor.value, url)
317
+ })
318
+ editor.value.formatElementStack()
319
+ editor.value.domRender()
320
+ editor.value.rangeRender()
321
+ btnRef.value!.show = false
322
+ }
323
+ })
324
+ }
325
+ )
326
+ : null
327
+ }
328
+ },
329
+ {
330
+ name: `_${FEATURE_NAME}`,
331
+ props: {
332
+ color: String,
333
+ zIndex: Number,
334
+ config: Object as PropType<MenuVideoButtonType>,
335
+ tooltip: Boolean,
336
+ disabled: Boolean
337
+ }
338
+ }
339
+ )
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
@@ -10,39 +10,87 @@ import editify from '@/editify/editify.vue'
10
10
  const Editify = withInstall(editify)
11
11
 
12
12
  //导出类型
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'
13
+ export type * from '@/components/button'
14
+ export type * from '@/components/checkbox'
15
+ export type * from '@/components/colors'
16
+ export type * from '@/components/icon'
17
+ export type * from '@/components/insertImage'
18
+ export type * from '@/components/insertLink'
19
+ export type * from '@/components/insertTable'
20
+ export type * from '@/components/insertVideo'
21
+ export type * from '@/components/layer'
22
+ export type * from '@/components/tooltip'
23
+ export type * from '@/components/triangle'
24
+ export type * from '@/components/updateLink'
25
+ export type * from '@/core/tool'
26
+ export type * from '@/core/function'
27
+ export type * from '@/editify/menu'
28
+ export type * from '@/editify/toolbar'
18
29
 
19
30
  //导出编辑器操作方法
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'
31
+ export {
32
+ elementIsMatch,
33
+ getMatchElementByElement,
34
+ getMatchElementByRange,
35
+ elementIsList,
36
+ getListByElement,
37
+ hasListInRange,
38
+ rangeIsInList,
39
+ elementIsTask,
40
+ getTaskByElement,
41
+ hasTaskInRange,
42
+ rangeIsInTask,
43
+ elementIsAttachment,
44
+ hasAttachmentInRange,
45
+ elementIsMathformula,
46
+ getMathformulaByElement,
47
+ hasMathformulaInRange,
48
+ elementIsPanel,
49
+ getPanelByElement,
50
+ hasPanelInRange,
51
+ elementIsInfoBlock,
52
+ getInfoBlockByElement,
53
+ hasInfoBlockInRange,
54
+ rangeIsInInfoBlock,
55
+ hasPreInRange,
56
+ hasQuoteInRange,
57
+ hasLinkInRange,
58
+ hasTableInRange,
59
+ hasImageInRange,
60
+ hasVideoInRange,
61
+ rangeIsInQuote,
62
+ queryTextStyle,
63
+ queryTextMark,
64
+ getRangeText,
65
+ setIndentIncrease,
66
+ setIndentDecrease,
67
+ setQuote,
68
+ setAlign,
69
+ setList,
70
+ setTask,
71
+ setTextStyle,
72
+ setTextMark,
73
+ removeTextStyle,
74
+ removeTextMark,
75
+ setLineHeight,
76
+ insertLink,
77
+ insertImage,
78
+ insertVideo,
79
+ insertTable,
80
+ insertCodeBlock,
81
+ insertSeparator
82
+ } from '@/core/function'
21
83
 
22
84
  //安装函数
23
85
  const install = (app: App) => {
24
86
  app.component(Editify.name!, Editify)
25
87
  }
26
88
  //版本号
27
- const version = '0.2.13'
89
+ const version = '0.2.15'
28
90
 
29
91
  //导出AlexElement元素
30
92
  export { AlexElement } from 'alex-editor'
31
93
 
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'
45
-
46
94
  //导出组件和安装函数
47
95
  export { Editify as default, Editify, install, version }
48
96
 
@@ -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;