vue-editify 0.2.14 → 0.2.15

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 +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 +18 -27
  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 +8797 -7560
  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 +36 -43
  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
package/src/core/tool.ts CHANGED
@@ -1,11 +1,10 @@
1
+ import { App, Component, VNode } from 'vue'
1
2
  import { common as DapCommon, string as DapString, color as DapColor, element as DapElement } from 'dap-util'
2
- import { App, Component, ComponentInternalInstance, VNode } from 'vue'
3
- import { AlexElement } from 'alex-editor'
4
3
  import { languages } from '@/hljs'
5
- import { ButtonOptionsItemType, ButtonTypeType } from '@/components/button/props'
6
4
  import { LocaleType } from '@/locale'
7
- import { InsertImageUploadErrorType } from '@/components/insertImage/props'
8
- import Button from '@/components/button/button.vue'
5
+ import { Button, ButtonOptionsItemType, ButtonTypeType } from '@/components/button'
6
+ import { InsertImageUploadErrorType } from '@/components/insertImage'
7
+ import { InsertAttachmentUploadErrorType } from '@/components/insertAttachment'
9
8
 
10
9
  export type ObjectType = {
11
10
  [key: string]: any
@@ -26,6 +25,7 @@ export interface MenuButtonType {
26
25
  show?: boolean
27
26
  leftBorder?: boolean
28
27
  rightBorder?: boolean
28
+ disabled?: boolean
29
29
  }
30
30
 
31
31
  export interface MenuSelectButtonType extends MenuButtonType {
@@ -41,19 +41,19 @@ export interface MenuDisplayButtonType extends MenuSelectButtonType {
41
41
  export interface MenuImageButtonType extends MenuButtonType {
42
42
  allowedFileType?: string[]
43
43
  multiple?: boolean
44
- maxSize?: number | null
45
- minSize?: number | null
46
- customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>) | null
47
- handleError?: ((error: InsertImageUploadErrorType, file: File) => void) | null
44
+ maxSize?: number
45
+ minSize?: number
46
+ customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)
47
+ handleError?: (error: InsertImageUploadErrorType, file: File) => void
48
48
  }
49
49
 
50
50
  export interface MenuVideoButtonType extends MenuButtonType {
51
51
  allowedFileType?: string[]
52
52
  multiple?: boolean
53
- maxSize?: number | null
54
- minSize?: number | null
55
- customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>) | null
56
- handleError?: ((error: InsertImageUploadErrorType, file: File) => void) | null
53
+ maxSize?: number
54
+ minSize?: number
55
+ customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)
56
+ handleError?: (error: InsertImageUploadErrorType, file: File) => void
57
57
  }
58
58
 
59
59
  export interface MenuTableButtonType extends MenuButtonType {
@@ -61,6 +61,21 @@ export interface MenuTableButtonType extends MenuButtonType {
61
61
  maxColumns?: number
62
62
  }
63
63
 
64
+ export interface MenuAttachmentButtonType extends MenuButtonType {
65
+ accept?: string
66
+ allowedFileType?: string[]
67
+ multiple?: boolean
68
+ maxSize?: number
69
+ minSize?: number
70
+ customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)
71
+ //处理上传附件异常
72
+ handleError?: (error: InsertAttachmentUploadErrorType, file: File) => void
73
+ }
74
+
75
+ export interface MenuMathformulaButtonType extends MenuButtonType {
76
+ handleError?: (error: Error) => void
77
+ }
78
+
64
79
  export type MenuCustomButtonType = {
65
80
  type?: ButtonTypeType
66
81
  title?: string
@@ -109,11 +124,10 @@ export type TextToolbarType = {
109
124
 
110
125
  export type ToolbarConfigType = {
111
126
  use?: boolean
112
- style?: ObjectType | null
127
+ style?: ObjectType
113
128
  tooltip?: boolean
114
129
  codeBlock?: CodeBlockToolbarType
115
130
  text?: TextToolbarType
116
- extraDisabled?: ((name: string) => boolean) | null
117
131
  }
118
132
 
119
133
  export type MenuSequenceType = {
@@ -147,6 +161,10 @@ export type MenuSequenceType = {
147
161
  codeBlock?: number
148
162
  sourceView?: number
149
163
  fullScreen?: number
164
+ attachment?: number
165
+ mathformula?: number
166
+ panel?: number
167
+ infoBlock?: number
150
168
  }
151
169
 
152
170
  export type MenuModeType = 'default' | 'inner' | 'fixed'
@@ -159,8 +177,7 @@ export type MenuConfigType = {
159
177
  use?: boolean
160
178
  tooltip?: boolean
161
179
  mode?: MenuModeType
162
- extraDisabled?: ((name: string) => boolean) | null
163
- style?: ObjectType | null
180
+ style?: ObjectType
164
181
  sequence?: MenuSequenceType
165
182
  undo?: MenuButtonType
166
183
  redo?: MenuButtonType
@@ -189,35 +206,16 @@ export type MenuConfigType = {
189
206
  image?: MenuImageButtonType
190
207
  video?: MenuVideoButtonType
191
208
  table?: MenuTableButtonType
192
- //代码块
193
209
  codeBlock?: MenuButtonType
194
- //代码视图
195
210
  sourceView?: MenuButtonType
196
- //全屏
197
211
  fullScreen?: MenuButtonType
198
- //拓展菜单,每个key表示拓展菜单的唯一名称,value是对象,包含type/title/rightBorder/leftBorder/disabled/active/width/maxHeight/options/value/hideScroll/onLayerShow/onLayerShown/onLayerHidden/onOperate/default/layer/option属性
212
+ attachment?: MenuAttachmentButtonType
213
+ mathformula?: MenuMathformulaButtonType
214
+ panel?: MenuButtonType
215
+ infoBlock?: MenuButtonType
199
216
  extends?: MenuExtendType
200
217
  }
201
218
 
202
- export type PluginMenuConfigType = {
203
- extraDisabled?: ((name: string) => boolean) | null
204
- sequence: number
205
- extend: MenuCustomButtonType
206
- }
207
-
208
- export type PluginResultType = {
209
- name: string
210
- menu?: PluginMenuConfigType
211
- updateView?: () => void
212
- customParseNode?: (element: AlexElement) => AlexElement
213
- extraKeepTags?: string[]
214
- renderRule?: (el: AlexElement) => void
215
- pasteKeepMarks?: (el: AlexElement) => ObjectType
216
- pasteKeepStyles?: (el: AlexElement) => ObjectType
217
- }
218
-
219
- export type PluginType = (editifyInstance: ComponentInternalInstance, editTrans: (key: string) => any) => PluginResultType
220
-
221
219
  export type SFCWithInstall<T> = T & { install(app: App): void }
222
220
 
223
221
  /**
@@ -513,7 +511,7 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
513
511
  //是否使用工具条
514
512
  use: true,
515
513
  // 工具条的样式设置
516
- style: null,
514
+ style: undefined,
517
515
  // 是否使用工具提示
518
516
  tooltip: true,
519
517
  // 代码块工具条配置
@@ -522,6 +520,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
522
520
  languages: {
523
521
  //是否显示此工具
524
522
  show: true,
523
+ //是否禁用此工具
524
+ disabled: false,
525
525
  //列表配置
526
526
  options: [
527
527
  {
@@ -546,12 +546,14 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
546
546
  heading: {
547
547
  //是否显示此工具
548
548
  show: true,
549
+ //是否禁用此工具
550
+ disabled: false,
549
551
  //列表配置
550
552
  options: getButtonOptionsConfig(editTrans).heading,
551
553
  //按钮默认显示的值
552
554
  defaultValue: 'p',
553
555
  //浮层宽度
554
- width: editLocale == 'en_US' ? 150 : 130,
556
+ width: editLocale == 'zh_CN' ? 130 : 150,
555
557
  //浮层最大高度
556
558
  maxHeight: '',
557
559
  //左侧边框是否显示
@@ -563,6 +565,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
563
565
  align: {
564
566
  //是否显示此工具
565
567
  show: false,
568
+ //是否禁用此工具
569
+ disabled: false,
566
570
  //列表配置
567
571
  options: getButtonOptionsConfig(editTrans).align,
568
572
  //浮层宽度
@@ -578,6 +582,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
578
582
  orderList: {
579
583
  //是否显示此工具
580
584
  show: false,
585
+ //是否禁用此工具
586
+ disabled: false,
581
587
  //左侧边框是否显示
582
588
  leftBorder: false,
583
589
  //右侧边框是否显示
@@ -587,6 +593,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
587
593
  unorderList: {
588
594
  //是否显示此工具
589
595
  show: false,
596
+ //是否禁用此工具
597
+ disabled: false,
590
598
  //左侧边框是否显示
591
599
  leftBorder: false,
592
600
  //右侧边框是否显示
@@ -596,6 +604,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
596
604
  task: {
597
605
  //是否显示此工具
598
606
  show: false,
607
+ //是否禁用此工具
608
+ disabled: false,
599
609
  //左侧边框是否显示
600
610
  leftBorder: false,
601
611
  //右侧边框是否显示
@@ -605,6 +615,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
605
615
  bold: {
606
616
  //是否显示此工具
607
617
  show: true,
618
+ //是否禁用此工具
619
+ disabled: false,
608
620
  //左侧边框是否显示
609
621
  leftBorder: false,
610
622
  //右侧边框是否显示
@@ -614,6 +626,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
614
626
  italic: {
615
627
  //是否显示此工具
616
628
  show: true,
629
+ //是否禁用此工具
630
+ disabled: false,
617
631
  //左侧边框是否显示
618
632
  leftBorder: false,
619
633
  //右侧边框是否显示
@@ -623,6 +637,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
623
637
  strikethrough: {
624
638
  //是否显示此工具
625
639
  show: true,
640
+ //是否禁用此工具
641
+ disabled: false,
626
642
  //左侧边框是否显示
627
643
  leftBorder: false,
628
644
  //右侧边框是否显示
@@ -632,6 +648,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
632
648
  underline: {
633
649
  //是否显示此工具
634
650
  show: true,
651
+ //是否禁用此工具
652
+ disabled: false,
635
653
  //左侧边框是否显示
636
654
  leftBorder: false,
637
655
  //右侧边框是否显示
@@ -641,6 +659,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
641
659
  code: {
642
660
  //是否显示此工具
643
661
  show: true,
662
+ //是否禁用此工具
663
+ disabled: false,
644
664
  //左侧边框是否显示
645
665
  leftBorder: false,
646
666
  //右侧边框是否显示
@@ -650,6 +670,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
650
670
  super: {
651
671
  //是否显示此工具
652
672
  show: false,
673
+ //是否禁用此工具
674
+ disabled: false,
653
675
  //左侧边框是否显示
654
676
  leftBorder: false,
655
677
  //右侧边框是否显示
@@ -659,6 +681,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
659
681
  sub: {
660
682
  //是否显示此工具
661
683
  show: false,
684
+ //是否禁用此工具
685
+ disabled: false,
662
686
  //左侧边框是否显示
663
687
  leftBorder: false,
664
688
  //右侧边框是否显示
@@ -668,6 +692,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
668
692
  fontSize: {
669
693
  //是否显示此工具
670
694
  show: true,
695
+ //是否禁用此工具
696
+ disabled: false,
671
697
  //列表配置
672
698
  options: getButtonOptionsConfig(editTrans).fontSize,
673
699
  //按钮默认显示的值
@@ -685,6 +711,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
685
711
  fontFamily: {
686
712
  //是否显示此工具
687
713
  show: false,
714
+ //是否禁用此工具
715
+ disabled: false,
688
716
  //列表配置
689
717
  options: getButtonOptionsConfig(editTrans).fontFamily,
690
718
  //按钮默认显示的值
@@ -702,6 +730,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
702
730
  lineHeight: {
703
731
  //是否显示此工具
704
732
  show: false,
733
+ //是否禁用此工具
734
+ disabled: false,
705
735
  //列表配置
706
736
  options: getButtonOptionsConfig(editTrans).lineHeight,
707
737
  //按钮默认显示的值
@@ -719,6 +749,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
719
749
  foreColor: {
720
750
  //是否显示此工具
721
751
  show: true,
752
+ //是否禁用此工具
753
+ disabled: false,
722
754
  //列表配置
723
755
  options: getButtonOptionsConfig(editTrans).foreColor,
724
756
  //左侧边框是否显示
@@ -730,6 +762,8 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
730
762
  backColor: {
731
763
  //是否显示此工具
732
764
  show: true,
765
+ //是否禁用此工具
766
+ disabled: false,
733
767
  //列表配置
734
768
  options: getButtonOptionsConfig(editTrans).backColor,
735
769
  //左侧边框是否显示
@@ -741,14 +775,14 @@ export const getToolbarConfig = (editTrans: (key: string) => any, editLocale: Lo
741
775
  formatClear: {
742
776
  //是否显示此工具
743
777
  show: true,
778
+ //是否禁用此工具
779
+ disabled: false,
744
780
  //左侧边框是否显示
745
781
  leftBorder: true,
746
782
  //右侧边框是否显示
747
783
  rightBorder: false
748
784
  }
749
- },
750
- //(只对文本工具条中的按钮生效)添加额外的按钮禁用判定,回调参数为name
751
- extraDisabled: null
785
+ }
752
786
  }
753
787
  }
754
788
 
@@ -766,10 +800,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
766
800
  tooltip: true,
767
801
  //菜单栏显示模式,支持default/inner/fixed
768
802
  mode: 'default',
769
- //添加额外的按钮禁用判定,回调参数为name
770
- extraDisabled: null,
771
803
  //菜单栏的样式自定义
772
- style: null,
804
+ style: undefined,
773
805
  //菜单排序
774
806
  sequence: {
775
807
  undo: 0,
@@ -801,12 +833,18 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
801
833
  table: 26,
802
834
  codeBlock: 27,
803
835
  sourceView: 28,
804
- fullScreen: 29
836
+ fullScreen: 29,
837
+ attachment: 30,
838
+ mathformula: 31,
839
+ panel: 32,
840
+ infoBlock: 33
805
841
  },
806
842
  //撤销按钮配置
807
843
  undo: {
808
844
  //是否显示此按钮
809
845
  show: true,
846
+ //是否禁用此按钮
847
+ disabled: false,
810
848
  //左侧边框是否显示
811
849
  leftBorder: false,
812
850
  //右侧边框是否显示
@@ -816,6 +854,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
816
854
  redo: {
817
855
  //是否显示此按钮
818
856
  show: true,
857
+ //是否禁用此按钮
858
+ disabled: false,
819
859
  //左侧边框是否显示
820
860
  leftBorder: false,
821
861
  //右侧边框是否显示
@@ -825,12 +865,14 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
825
865
  heading: {
826
866
  //是否显示此按钮
827
867
  show: true,
868
+ //是否禁用此按钮
869
+ disabled: false,
828
870
  //列表配置
829
871
  options: getButtonOptionsConfig(editTrans).heading,
830
872
  //按钮默认显示的值
831
873
  defaultValue: 'p',
832
874
  //浮层宽度
833
- width: editLocale == 'en_US' ? 150 : 130,
875
+ width: editLocale == 'zh_CN' ? 130 : 150,
834
876
  //浮层最大高度
835
877
  maxHeight: '',
836
878
  //左侧边框是否显示
@@ -840,12 +882,14 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
840
882
  },
841
883
  //缩进
842
884
  indent: {
843
- //是否显示此工具
885
+ //是否显示此按钮
844
886
  show: true,
887
+ //是否禁用此按钮
888
+ disabled: false,
845
889
  //列表配置
846
890
  options: getButtonOptionsConfig(editTrans).indent,
847
891
  //浮层宽度
848
- width: editLocale == 'en_US' ? 150 : 110,
892
+ width: editLocale == 'zh_CN' ? 110 : 150,
849
893
  //浮层最大高度
850
894
  maxHeight: '',
851
895
  //左侧边框是否显示
@@ -857,6 +901,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
857
901
  quote: {
858
902
  //是否显示此按钮
859
903
  show: true,
904
+ //是否禁用此按钮
905
+ disabled: false,
860
906
  //左侧边框是否显示
861
907
  leftBorder: false,
862
908
  //右侧边框是否显示
@@ -866,6 +912,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
866
912
  separator: {
867
913
  //是否显示此按钮
868
914
  show: true,
915
+ //是否禁用此按钮
916
+ disabled: false,
869
917
  //左侧边框是否显示
870
918
  leftBorder: false,
871
919
  //右侧边框是否显示
@@ -873,8 +921,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
873
921
  },
874
922
  //对齐方式
875
923
  align: {
876
- //是否显示此工具
924
+ //是否显示此按钮
877
925
  show: true,
926
+ //是否禁用此按钮
927
+ disabled: false,
878
928
  //列表配置
879
929
  options: getButtonOptionsConfig(editTrans).align,
880
930
  //浮层宽度
@@ -890,6 +940,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
890
940
  orderList: {
891
941
  //是否显示此按钮
892
942
  show: true,
943
+ //是否禁用此按钮
944
+ disabled: false,
893
945
  //左侧边框是否显示
894
946
  leftBorder: false,
895
947
  //右侧边框是否显示
@@ -899,6 +951,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
899
951
  unorderList: {
900
952
  //是否显示此按钮
901
953
  show: true,
954
+ //是否禁用此按钮
955
+ disabled: false,
902
956
  //左侧边框是否显示
903
957
  leftBorder: false,
904
958
  //右侧边框是否显示
@@ -908,6 +962,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
908
962
  task: {
909
963
  //是否显示此按钮
910
964
  show: true,
965
+ //是否禁用此按钮
966
+ disabled: false,
911
967
  //左侧边框是否显示
912
968
  leftBorder: false,
913
969
  //右侧边框是否显示
@@ -917,6 +973,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
917
973
  bold: {
918
974
  //是否显示此按钮
919
975
  show: true,
976
+ //是否禁用此按钮
977
+ disabled: false,
920
978
  //左侧边框是否显示
921
979
  leftBorder: true,
922
980
  //右侧边框是否显示
@@ -926,6 +984,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
926
984
  underline: {
927
985
  //是否显示此按钮
928
986
  show: true,
987
+ //是否禁用此按钮
988
+ disabled: false,
929
989
  //左侧边框是否显示
930
990
  leftBorder: false,
931
991
  //右侧边框是否显示
@@ -935,6 +995,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
935
995
  italic: {
936
996
  //是否显示此按钮
937
997
  show: true,
998
+ //是否禁用此按钮
999
+ disabled: false,
938
1000
  //左侧边框是否显示
939
1001
  leftBorder: false,
940
1002
  //右侧边框是否显示
@@ -944,6 +1006,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
944
1006
  strikethrough: {
945
1007
  //是否显示此按钮
946
1008
  show: true,
1009
+ //是否禁用此按钮
1010
+ disabled: false,
947
1011
  //左侧边框是否显示
948
1012
  leftBorder: false,
949
1013
  //右侧边框是否显示
@@ -953,6 +1017,8 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
953
1017
  code: {
954
1018
  //是否显示此按钮
955
1019
  show: true,
1020
+ //是否禁用此按钮
1021
+ disabled: false,
956
1022
  //左侧边框是否显示
957
1023
  leftBorder: false,
958
1024
  //右侧边框是否显示
@@ -960,8 +1026,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
960
1026
  },
961
1027
  //上标
962
1028
  super: {
963
- //是否显示此工具
1029
+ //是否显示此按钮
964
1030
  show: true,
1031
+ //是否禁用此按钮
1032
+ disabled: false,
965
1033
  //左侧边框是否显示
966
1034
  leftBorder: false,
967
1035
  //右侧边框是否显示
@@ -969,8 +1037,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
969
1037
  },
970
1038
  //下标
971
1039
  sub: {
972
- //是否显示此工具
1040
+ //是否显示此按钮
973
1041
  show: true,
1042
+ //是否禁用此按钮
1043
+ disabled: false,
974
1044
  //左侧边框是否显示
975
1045
  leftBorder: false,
976
1046
  //右侧边框是否显示
@@ -978,8 +1048,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
978
1048
  },
979
1049
  //清除格式
980
1050
  formatClear: {
981
- //是否显示此工具
1051
+ //是否显示此按钮
982
1052
  show: true,
1053
+ //是否禁用此按钮
1054
+ disabled: false,
983
1055
  //左侧边框是否显示
984
1056
  leftBorder: false,
985
1057
  //右侧边框是否显示
@@ -987,8 +1059,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
987
1059
  },
988
1060
  //字号
989
1061
  fontSize: {
990
- //是否显示此工具
1062
+ //是否显示此按钮
991
1063
  show: true,
1064
+ //是否禁用此按钮
1065
+ disabled: false,
992
1066
  //列表配置
993
1067
  options: getButtonOptionsConfig(editTrans).fontSize,
994
1068
  //按钮默认显示的值
@@ -1004,8 +1078,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1004
1078
  },
1005
1079
  //字体
1006
1080
  fontFamily: {
1007
- //是否显示此工具
1081
+ //是否显示此按钮
1008
1082
  show: true,
1083
+ //是否禁用此按钮
1084
+ disabled: false,
1009
1085
  //列表配置
1010
1086
  options: getButtonOptionsConfig(editTrans).fontFamily,
1011
1087
  //按钮默认显示的值
@@ -1021,8 +1097,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1021
1097
  },
1022
1098
  //行高
1023
1099
  lineHeight: {
1024
- //是否显示此工具
1100
+ //是否显示此按钮
1025
1101
  show: true,
1102
+ //是否禁用此按钮
1103
+ disabled: false,
1026
1104
  //列表配置
1027
1105
  options: getButtonOptionsConfig(editTrans).lineHeight,
1028
1106
  //按钮默认显示的值
@@ -1038,8 +1116,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1038
1116
  },
1039
1117
  //前景色
1040
1118
  foreColor: {
1041
- //是否显示此工具
1119
+ //是否显示此按钮
1042
1120
  show: true,
1121
+ //是否禁用此按钮
1122
+ disabled: false,
1043
1123
  //列表配置
1044
1124
  options: getButtonOptionsConfig(editTrans).foreColor,
1045
1125
  //左侧边框是否显示
@@ -1049,8 +1129,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1049
1129
  },
1050
1130
  //背景色
1051
1131
  backColor: {
1052
- //是否显示此工具
1132
+ //是否显示此按钮
1053
1133
  show: true,
1134
+ //是否禁用此按钮
1135
+ disabled: false,
1054
1136
  //列表配置
1055
1137
  options: getButtonOptionsConfig(editTrans).backColor,
1056
1138
  //左侧边框是否显示
@@ -1060,8 +1142,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1060
1142
  },
1061
1143
  //链接
1062
1144
  link: {
1063
- //是否显示此工具
1145
+ //是否显示此按钮
1064
1146
  show: true,
1147
+ //是否禁用此按钮
1148
+ disabled: false,
1065
1149
  //左侧边框是否显示
1066
1150
  leftBorder: true,
1067
1151
  //右侧边框是否显示
@@ -1069,8 +1153,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1069
1153
  },
1070
1154
  //图片
1071
1155
  image: {
1072
- //是否显示此工具
1156
+ //是否显示此按钮
1073
1157
  show: true,
1158
+ //是否禁用此按钮
1159
+ disabled: false,
1074
1160
  //左侧边框是否显示
1075
1161
  leftBorder: false,
1076
1162
  //右侧边框是否显示
@@ -1080,18 +1166,20 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1080
1166
  //是否多选图片
1081
1167
  multiple: false,
1082
1168
  //单张图片的最大值,单位kb
1083
- maxSize: null,
1169
+ maxSize: undefined,
1084
1170
  //单张图片的最小值,单位kb
1085
- minSize: null,
1171
+ minSize: undefined,
1086
1172
  //自定义上传图片
1087
- customUpload: null,
1173
+ customUpload: undefined,
1088
1174
  //异常处理函数
1089
- handleError: null
1175
+ handleError: undefined
1090
1176
  },
1091
1177
  //视频
1092
1178
  video: {
1093
- //是否显示此工具
1179
+ //是否显示此按钮
1094
1180
  show: true,
1181
+ //是否禁用此按钮
1182
+ disabled: false,
1095
1183
  //左侧边框是否显示
1096
1184
  leftBorder: false,
1097
1185
  //右侧边框是否显示
@@ -1101,18 +1189,20 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1101
1189
  //是否多选视频
1102
1190
  multiple: false,
1103
1191
  //单个视频的的最大值,单位kb
1104
- maxSize: null,
1192
+ maxSize: undefined,
1105
1193
  //单个视频的最小值,单位kb
1106
- minSize: null,
1194
+ minSize: undefined,
1107
1195
  //自定义上传视频
1108
- customUpload: null,
1196
+ customUpload: undefined,
1109
1197
  //异常处理函数
1110
- handleError: null
1198
+ handleError: undefined
1111
1199
  },
1112
1200
  //表格
1113
1201
  table: {
1114
- //是否显示此工具
1202
+ //是否显示此按钮
1115
1203
  show: true,
1204
+ //是否禁用此按钮
1205
+ disabled: false,
1116
1206
  //左侧边框是否显示
1117
1207
  leftBorder: false,
1118
1208
  //右侧边框是否显示
@@ -1124,8 +1214,10 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1124
1214
  },
1125
1215
  //代码块
1126
1216
  codeBlock: {
1127
- //是否显示此工具
1217
+ //是否显示此按钮
1128
1218
  show: true,
1219
+ //是否禁用此按钮
1220
+ disabled: false,
1129
1221
  //左侧边框是否显示
1130
1222
  leftBorder: false,
1131
1223
  //右侧边框是否显示
@@ -1133,23 +1225,87 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
1133
1225
  },
1134
1226
  //代码视图
1135
1227
  sourceView: {
1136
- //是否显示此工具
1228
+ //是否显示此按钮
1137
1229
  show: false,
1230
+ //是否禁用此按钮
1231
+ disabled: false,
1138
1232
  //左侧边框是否显示
1139
- leftBorder: true,
1233
+ leftBorder: false,
1140
1234
  //右侧边框是否显示
1141
1235
  rightBorder: false
1142
1236
  },
1143
1237
  //全屏
1144
1238
  fullScreen: {
1145
- //是否显示此工具
1239
+ //是否显示此按钮
1240
+ show: false,
1241
+ //是否禁用此按钮
1242
+ disabled: false,
1243
+ //左侧边框是否显示
1244
+ leftBorder: false,
1245
+ //右侧边框是否显示
1246
+ rightBorder: false
1247
+ },
1248
+ //附件
1249
+ attachment: {
1250
+ //是否显示此按钮
1251
+ show: false,
1252
+ //是否禁用此按钮
1253
+ disabled: false,
1254
+ //左侧边框是否显示
1255
+ leftBorder: false,
1256
+ //右侧边框是否显示
1257
+ rightBorder: false,
1258
+ //可选择的附件类型,默认不限制类型,设定此参数后选择文件时会自动过滤非符合的文件类型
1259
+ accept: '',
1260
+ //附件支持上传的类型,不区分大小写
1261
+ allowedFileType: [],
1262
+ //是否多选附件
1263
+ multiple: false,
1264
+ //单个附件的的最大值,单位kb
1265
+ maxSize: undefined,
1266
+ //单个附件的最小值,单位kb
1267
+ minSize: undefined,
1268
+ //自定义上传附件
1269
+ customUpload: undefined,
1270
+ //异常处理函数
1271
+ handleError: undefined
1272
+ },
1273
+ //数学公式
1274
+ mathformula: {
1275
+ //是否显示此按钮
1276
+ show: false,
1277
+ //是否禁用此按钮
1278
+ disabled: false,
1279
+ //左侧边框是否显示
1280
+ leftBorder: false,
1281
+ //右侧边框是否显示
1282
+ rightBorder: false,
1283
+ //异常处理函数
1284
+ handleError: undefined
1285
+ },
1286
+ //面板
1287
+ panel: {
1288
+ //是否显示此按钮
1289
+ show: false,
1290
+ //是否禁用此按钮
1291
+ disabled: false,
1292
+ //左侧边框是否显示
1293
+ leftBorder: false,
1294
+ //右侧边框是否显示
1295
+ rightBorder: false
1296
+ },
1297
+ //信息块
1298
+ infoBlock: {
1299
+ //是否显示此按钮
1146
1300
  show: false,
1301
+ //是否禁用此按钮
1302
+ disabled: false,
1147
1303
  //左侧边框是否显示
1148
1304
  leftBorder: false,
1149
1305
  //右侧边框是否显示
1150
1306
  rightBorder: false
1151
1307
  },
1152
- //拓展菜单,每个key表示拓展菜单的唯一名称,value是对象,包含type/title/rightBorder/leftBorder/disabled/active/width/maxHeight/options/value/hideScroll/onLayerShow/onLayerShown/onLayerHidden/onOperate/default/layer/option属性
1308
+ //拓展菜单
1153
1309
  extends: {}
1154
1310
  }
1155
1311
  }