suneditor 2.46.2 → 3.0.0-alpha.2

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 (289) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc.json +64 -0
  3. package/CONTRIBUTING.md +36 -0
  4. package/LICENSE.txt +1 -1
  5. package/README.md +11 -1560
  6. package/package.json +94 -70
  7. package/src/assets/icons/_default.js +194 -0
  8. package/src/assets/suneditor-content.css +642 -0
  9. package/src/assets/suneditor.css +3378 -0
  10. package/src/core/base/eventHandlers/handler_toolbar.js +114 -0
  11. package/src/core/base/eventHandlers/handler_ww_clipboard.js +31 -0
  12. package/src/core/base/eventHandlers/handler_ww_dragDrop.js +69 -0
  13. package/src/core/base/eventHandlers/handler_ww_key_input.js +978 -0
  14. package/src/core/base/eventHandlers/handler_ww_mouse.js +118 -0
  15. package/src/core/base/eventManager.js +1129 -0
  16. package/src/core/base/events.js +320 -0
  17. package/src/core/base/history.js +301 -0
  18. package/src/core/class/char.js +146 -0
  19. package/src/core/class/component.js +624 -0
  20. package/src/core/class/format.js +3255 -0
  21. package/src/core/class/html.js +1621 -0
  22. package/src/core/class/menu.js +260 -0
  23. package/src/core/class/nodeTransform.js +379 -0
  24. package/src/core/class/notice.js +42 -0
  25. package/src/core/class/offset.js +578 -0
  26. package/src/core/class/selection.js +508 -0
  27. package/src/core/class/shortcuts.js +38 -0
  28. package/src/core/class/toolbar.js +440 -0
  29. package/src/core/class/viewer.js +646 -0
  30. package/src/core/editor.js +1588 -0
  31. package/src/core/section/actives.js +107 -0
  32. package/src/core/section/constructor.js +1237 -0
  33. package/src/core/section/context.js +97 -0
  34. package/src/editorInjector/_classes.js +22 -0
  35. package/src/editorInjector/_core.js +28 -0
  36. package/src/editorInjector/index.js +13 -0
  37. package/src/helper/converter.js +313 -0
  38. package/src/helper/domUtils.js +1177 -0
  39. package/src/helper/env.js +250 -0
  40. package/src/helper/index.js +19 -0
  41. package/src/helper/numbers.js +68 -0
  42. package/src/helper/unicode.js +43 -0
  43. package/src/langs/ckb.js +161 -0
  44. package/src/langs/cs.js +161 -0
  45. package/src/langs/da.js +161 -0
  46. package/src/langs/de.js +162 -0
  47. package/src/langs/en.js +199 -0
  48. package/src/langs/es.js +162 -0
  49. package/src/langs/fa.js +159 -0
  50. package/src/langs/fr.js +161 -0
  51. package/src/langs/he.js +162 -0
  52. package/src/{lang → langs}/index.js +0 -2
  53. package/src/langs/it.js +162 -0
  54. package/src/langs/ja.js +162 -0
  55. package/src/langs/ko.js +162 -0
  56. package/src/langs/lv.js +162 -0
  57. package/src/langs/nl.js +162 -0
  58. package/src/langs/pl.js +162 -0
  59. package/src/langs/pt_br.js +162 -0
  60. package/src/langs/ro.js +162 -0
  61. package/src/langs/ru.js +162 -0
  62. package/src/langs/se.js +162 -0
  63. package/src/langs/tr.js +159 -0
  64. package/src/langs/ua.js +162 -0
  65. package/src/langs/ur.js +162 -0
  66. package/src/langs/zh_cn.js +162 -0
  67. package/src/modules/ApiManager.js +168 -0
  68. package/src/modules/ColorPicker.js +302 -0
  69. package/src/modules/Controller.js +315 -0
  70. package/src/modules/Figure.js +1174 -0
  71. package/src/modules/FileBrowser.js +271 -0
  72. package/src/modules/FileManager.js +290 -0
  73. package/src/modules/HueSlider.js +513 -0
  74. package/src/modules/Modal.js +177 -0
  75. package/src/modules/ModalAnchorEditor.js +494 -0
  76. package/src/modules/SelectMenu.js +447 -0
  77. package/src/modules/_DragHandle.js +16 -0
  78. package/src/modules/index.js +14 -0
  79. package/src/plugins/command/blockquote.js +47 -47
  80. package/src/plugins/command/exportPdf.js +168 -0
  81. package/src/plugins/command/fileUpload.js +389 -0
  82. package/src/plugins/command/list_bulleted.js +112 -0
  83. package/src/plugins/command/list_numbered.js +115 -0
  84. package/src/plugins/dropdown/align.js +143 -0
  85. package/src/plugins/dropdown/backgroundColor.js +73 -0
  86. package/src/plugins/dropdown/font.js +113 -0
  87. package/src/plugins/dropdown/fontColor.js +73 -0
  88. package/src/plugins/dropdown/formatBlock.js +141 -0
  89. package/src/plugins/dropdown/hr.js +111 -0
  90. package/src/plugins/dropdown/layout.js +72 -0
  91. package/src/plugins/dropdown/lineHeight.js +114 -0
  92. package/src/plugins/dropdown/list.js +107 -0
  93. package/src/plugins/dropdown/paragraphStyle.js +117 -0
  94. package/src/plugins/dropdown/table.js +2810 -0
  95. package/src/plugins/dropdown/template.js +71 -0
  96. package/src/plugins/dropdown/textStyle.js +137 -0
  97. package/src/plugins/field/mention.js +172 -0
  98. package/src/plugins/fileBrowser/imageGallery.js +76 -59
  99. package/src/plugins/index.js +86 -24
  100. package/src/plugins/input/fontSize.js +357 -0
  101. package/src/plugins/modal/audio.js +492 -0
  102. package/src/plugins/modal/image.js +1062 -0
  103. package/src/plugins/modal/link.js +211 -0
  104. package/src/plugins/modal/math.js +347 -0
  105. package/src/plugins/modal/video.js +870 -0
  106. package/src/suneditor.js +62 -67
  107. package/src/themes/test.css +61 -0
  108. package/typings/CommandPlugin.d.ts +8 -0
  109. package/typings/DialogPlugin.d.ts +20 -0
  110. package/typings/FileBrowserPlugin.d.ts +30 -0
  111. package/typings/Lang.d.ts +124 -0
  112. package/typings/Module.d.ts +15 -0
  113. package/typings/Plugin.d.ts +42 -0
  114. package/typings/SubmenuPlugin.d.ts +8 -0
  115. package/typings/_classes.d.ts +17 -0
  116. package/typings/_colorPicker.d.ts +60 -0
  117. package/typings/_core.d.ts +55 -0
  118. package/typings/align.d.ts +5 -0
  119. package/{src/plugins/dialog → typings}/audio.d.ts +1 -1
  120. package/typings/backgroundColor.d.ts +5 -0
  121. package/{src/plugins/command → typings}/blockquote.d.ts +1 -1
  122. package/typings/char.d.ts +39 -0
  123. package/typings/component.d.ts +38 -0
  124. package/typings/context.d.ts +39 -0
  125. package/typings/converter.d.ts +33 -0
  126. package/typings/dialog.d.ts +28 -0
  127. package/typings/domUtils.d.ts +361 -0
  128. package/typings/editor.d.ts +7 -0
  129. package/typings/editor.ts +542 -0
  130. package/typings/env.d.ts +70 -0
  131. package/typings/eventManager.d.ts +37 -0
  132. package/typings/events.d.ts +262 -0
  133. package/typings/fileBrowser.d.ts +42 -0
  134. package/typings/fileManager.d.ts +67 -0
  135. package/typings/font.d.ts +5 -0
  136. package/typings/fontColor.d.ts +5 -0
  137. package/typings/fontSize.d.ts +5 -0
  138. package/typings/format.d.ts +191 -0
  139. package/typings/formatBlock.d.ts +5 -0
  140. package/typings/history.d.ts +48 -0
  141. package/typings/horizontalRule.d.ts +5 -0
  142. package/{src/plugins/dialog → typings}/image.d.ts +1 -1
  143. package/{src/plugins/fileBrowser → typings}/imageGallery.d.ts +1 -1
  144. package/typings/index.d.ts +21 -0
  145. package/{src/plugins/modules/index.d.ts → typings/index.modules.d.ts} +3 -3
  146. package/typings/index.plugins.d.ts +58 -0
  147. package/typings/lineHeight.d.ts +5 -0
  148. package/{src/plugins/dialog → typings}/link.d.ts +1 -1
  149. package/typings/list.d.ts +5 -0
  150. package/{src/plugins/dialog → typings}/math.d.ts +1 -1
  151. package/typings/mediaContainer.d.ts +25 -0
  152. package/typings/node.d.ts +57 -0
  153. package/typings/notice.d.ts +16 -0
  154. package/typings/numbers.d.ts +29 -0
  155. package/typings/offset.d.ts +24 -0
  156. package/typings/options.d.ts +589 -0
  157. package/typings/paragraphStyle.d.ts +5 -0
  158. package/typings/resizing.d.ts +141 -0
  159. package/typings/selection.d.ts +94 -0
  160. package/typings/shortcuts.d.ts +13 -0
  161. package/typings/suneditor.d.ts +9 -0
  162. package/typings/table.d.ts +5 -0
  163. package/typings/template.d.ts +5 -0
  164. package/typings/textStyle.d.ts +5 -0
  165. package/typings/toolbar.d.ts +32 -0
  166. package/typings/unicode.d.ts +25 -0
  167. package/{src/plugins/dialog → typings}/video.d.ts +1 -1
  168. package/dist/css/suneditor.min.css +0 -1
  169. package/dist/suneditor.min.js +0 -2
  170. package/src/assets/css/suneditor-contents.css +0 -562
  171. package/src/assets/css/suneditor.css +0 -566
  172. package/src/assets/defaultIcons.js +0 -103
  173. package/src/lang/Lang.d.ts +0 -144
  174. package/src/lang/ckb.d.ts +0 -5
  175. package/src/lang/ckb.js +0 -188
  176. package/src/lang/cs.d.ts +0 -5
  177. package/src/lang/cs.js +0 -188
  178. package/src/lang/da.d.ts +0 -5
  179. package/src/lang/da.js +0 -191
  180. package/src/lang/de.d.ts +0 -5
  181. package/src/lang/de.js +0 -188
  182. package/src/lang/en.d.ts +0 -5
  183. package/src/lang/en.js +0 -188
  184. package/src/lang/es.d.ts +0 -5
  185. package/src/lang/es.js +0 -188
  186. package/src/lang/fa.d.ts +0 -5
  187. package/src/lang/fa.js +0 -188
  188. package/src/lang/fr.d.ts +0 -5
  189. package/src/lang/fr.js +0 -188
  190. package/src/lang/he.d.ts +0 -5
  191. package/src/lang/he.js +0 -188
  192. package/src/lang/index.d.ts +0 -23
  193. package/src/lang/it.d.ts +0 -5
  194. package/src/lang/it.js +0 -188
  195. package/src/lang/ja.d.ts +0 -5
  196. package/src/lang/ja.js +0 -188
  197. package/src/lang/ko.d.ts +0 -5
  198. package/src/lang/ko.js +0 -188
  199. package/src/lang/lv.d.ts +0 -5
  200. package/src/lang/lv.js +0 -188
  201. package/src/lang/nl.d.ts +0 -5
  202. package/src/lang/nl.js +0 -188
  203. package/src/lang/pl.d.ts +0 -5
  204. package/src/lang/pl.js +0 -188
  205. package/src/lang/pt_br.d.ts +0 -5
  206. package/src/lang/pt_br.js +0 -189
  207. package/src/lang/ro.d.ts +0 -5
  208. package/src/lang/ro.js +0 -188
  209. package/src/lang/ru.d.ts +0 -5
  210. package/src/lang/ru.js +0 -188
  211. package/src/lang/se.d.ts +0 -5
  212. package/src/lang/se.js +0 -191
  213. package/src/lang/tr.d.ts +0 -5
  214. package/src/lang/tr.js +0 -191
  215. package/src/lang/ua.d.ts +0 -5
  216. package/src/lang/ua.js +0 -188
  217. package/src/lang/ur.d.ts +0 -5
  218. package/src/lang/ur.js +0 -188
  219. package/src/lang/zh_cn.d.ts +0 -5
  220. package/src/lang/zh_cn.js +0 -187
  221. package/src/lib/constructor.js +0 -954
  222. package/src/lib/context.d.ts +0 -42
  223. package/src/lib/context.js +0 -71
  224. package/src/lib/core.d.ts +0 -1135
  225. package/src/lib/core.js +0 -9395
  226. package/src/lib/history.d.ts +0 -48
  227. package/src/lib/history.js +0 -219
  228. package/src/lib/util.d.ts +0 -678
  229. package/src/lib/util.js +0 -2131
  230. package/src/options.d.ts +0 -608
  231. package/src/plugins/CommandPlugin.d.ts +0 -8
  232. package/src/plugins/DialogPlugin.d.ts +0 -20
  233. package/src/plugins/FileBrowserPlugin.d.ts +0 -30
  234. package/src/plugins/Module.d.ts +0 -15
  235. package/src/plugins/Plugin.d.ts +0 -42
  236. package/src/plugins/SubmenuPlugin.d.ts +0 -8
  237. package/src/plugins/dialog/audio.js +0 -559
  238. package/src/plugins/dialog/image.js +0 -1126
  239. package/src/plugins/dialog/link.js +0 -223
  240. package/src/plugins/dialog/math.js +0 -295
  241. package/src/plugins/dialog/mention.js +0 -242
  242. package/src/plugins/dialog/video.js +0 -979
  243. package/src/plugins/index.d.ts +0 -79
  244. package/src/plugins/modules/_anchor.js +0 -461
  245. package/src/plugins/modules/_colorPicker.d.ts +0 -60
  246. package/src/plugins/modules/_colorPicker.js +0 -201
  247. package/src/plugins/modules/_notice.d.ts +0 -21
  248. package/src/plugins/modules/_notice.js +0 -72
  249. package/src/plugins/modules/_selectMenu.js +0 -119
  250. package/src/plugins/modules/component.d.ts +0 -25
  251. package/src/plugins/modules/component.js +0 -81
  252. package/src/plugins/modules/dialog.d.ts +0 -28
  253. package/src/plugins/modules/dialog.js +0 -175
  254. package/src/plugins/modules/fileBrowser.d.ts +0 -42
  255. package/src/plugins/modules/fileBrowser.js +0 -374
  256. package/src/plugins/modules/fileManager.d.ts +0 -67
  257. package/src/plugins/modules/fileManager.js +0 -326
  258. package/src/plugins/modules/index.js +0 -9
  259. package/src/plugins/modules/resizing.d.ts +0 -154
  260. package/src/plugins/modules/resizing.js +0 -903
  261. package/src/plugins/submenu/align.d.ts +0 -5
  262. package/src/plugins/submenu/align.js +0 -160
  263. package/src/plugins/submenu/font.d.ts +0 -5
  264. package/src/plugins/submenu/font.js +0 -123
  265. package/src/plugins/submenu/fontColor.d.ts +0 -5
  266. package/src/plugins/submenu/fontColor.js +0 -101
  267. package/src/plugins/submenu/fontSize.d.ts +0 -5
  268. package/src/plugins/submenu/fontSize.js +0 -112
  269. package/src/plugins/submenu/formatBlock.d.ts +0 -5
  270. package/src/plugins/submenu/formatBlock.js +0 -273
  271. package/src/plugins/submenu/hiliteColor.d.ts +0 -5
  272. package/src/plugins/submenu/hiliteColor.js +0 -102
  273. package/src/plugins/submenu/horizontalRule.d.ts +0 -5
  274. package/src/plugins/submenu/horizontalRule.js +0 -98
  275. package/src/plugins/submenu/lineHeight.d.ts +0 -5
  276. package/src/plugins/submenu/lineHeight.js +0 -104
  277. package/src/plugins/submenu/list.d.ts +0 -5
  278. package/src/plugins/submenu/list.js +0 -456
  279. package/src/plugins/submenu/paragraphStyle.d.ts +0 -5
  280. package/src/plugins/submenu/paragraphStyle.js +0 -135
  281. package/src/plugins/submenu/table.d.ts +0 -5
  282. package/src/plugins/submenu/table.js +0 -1431
  283. package/src/plugins/submenu/template.d.ts +0 -5
  284. package/src/plugins/submenu/template.js +0 -72
  285. package/src/plugins/submenu/textStyle.d.ts +0 -5
  286. package/src/plugins/submenu/textStyle.js +0 -167
  287. package/src/suneditor.d.ts +0 -9
  288. package/src/suneditor_build.js +0 -18
  289. /package/{src/plugins/dialog → typings}/mention.d.ts +0 -0
@@ -0,0 +1,262 @@
1
+ import EditorInterface from '../interface/editor';
2
+
3
+ class Events extends EditorInterface {
4
+ onload: (reload: boolean) => void;
5
+ onScroll: EventFn;
6
+ onFocus: EventFn;
7
+ onMouseDown: EventFn;
8
+ onClick: EventFn;
9
+ onInput: EventFn;
10
+ onMouseLeave: EventFn;
11
+ onKeyDown: EventFn;
12
+ onKeyUp: EventFn;
13
+ onChange: (content: string) => void;
14
+ onBlur: (e: FocusEvent) => void;
15
+ onDrop: (e: Event, cleanData: string, maxCharCount: number) => boolean | string;
16
+ onPaste: (e: Event, cleanData: string, maxCharCount: number) => boolean | string;
17
+ onCopy: (e: Event, clipboardData: any) => boolean;
18
+ onCut: (e: Event, clipboardData: any) => boolean;
19
+
20
+ /**
21
+ * @description Called just after the save was executed.
22
+ * @param content Editor content
23
+ * @param core Core object
24
+ */
25
+ onSave: (content: string, core: Core) => void;
26
+
27
+ /**
28
+ * @description Called just before the inline toolbar is positioned and displayed on the screen.
29
+ * @param toolbar Toolbar Element
30
+ */
31
+ onShowToolbar: (toolbar: Element) => void;
32
+
33
+ /**
34
+ * @description Called just after the controller is positioned and displayed on the screen.
35
+ * controller - editing elements displayed on the screen [image resizing, table editor, link editor..]]
36
+ * @param name The name of the plugin that called the controller
37
+ * @param controllers Array of Controller elements
38
+ * @param core Core object
39
+ */
40
+ onShowController: (name: string, controllers: Controllers) => void;
41
+
42
+ /**
43
+ * @description It replaces the default callback function of the image upload
44
+ * @param xmlHttp xmlHttpRequest object
45
+ * @param info Input information
46
+ * - linkValue: Link url value
47
+ * - linkNewWindow: Open in new window Check Value
48
+ * - inputWidth: Value of width input
49
+ * - inputHeight: Value of height input
50
+ * - align: Align Check Value
51
+ * - isUpdate: Update image if true, create image if false
52
+ * - element: If isUpdate is true, the currently selected image.
53
+ * @param core Core object
54
+ */
55
+ imageUploadHandler: (xmlHttp: XMLHttpRequest, info: imageInputInformation) => void;
56
+
57
+ /**
58
+ * @description It replaces the default callback function of the video upload
59
+ * @param xmlHttp xmlHttpRequest object
60
+ * @param info Input information
61
+ * - inputWidth: Value of width input
62
+ * - inputHeight: Value of height input
63
+ * - align: Align Check Value
64
+ * - isUpdate: Update video if true, create video if false
65
+ * - element: If isUpdate is true, the currently selected video.
66
+ * @param core Core object
67
+ */
68
+ videoUploadHandler: (xmlHttp: XMLHttpRequest, info: videoInputInformation) => void;
69
+
70
+ /**
71
+ * @description It replaces the default callback function of the audio upload
72
+ * @param xmlHttp xmlHttpRequest object
73
+ * @param info Input information
74
+ * - isUpdate: Update audio if true, create audio if false
75
+ * - element: If isUpdate is true, the currently selected audio.
76
+ * @param core Core object
77
+ */
78
+ audioUploadHandler: (xmlHttp: XMLHttpRequest, info: audioInputInformation) => void;
79
+
80
+ /**
81
+ * @description An event when toggling between code view and wysiwyg view.
82
+ * @param isCodeView Whether the current code view mode
83
+ * @param core Core object
84
+ */
85
+ onToggleCodeView: (isCodeView: boolean) => void;
86
+
87
+ /**
88
+ * @description An event when toggling full screen.
89
+ * @param isFullScreen Whether the current full screen mode
90
+ * @param core Core object
91
+ */
92
+ onToggleFullScreen: (isFullScreen: boolean) => void;
93
+
94
+ /**
95
+ * @description Called before the image is uploaded
96
+ * If true is returned, the internal upload process runs normally.
97
+ * If false is returned, no image upload is performed.
98
+ * If new fileList are returned, replaced the previous fileList
99
+ * If undefined is returned, it waits until "uploadHandler" is executed.
100
+ * @param files Files array
101
+ * @param info Input information
102
+ * @param core Core object
103
+ * @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
104
+ * "uploadHandler" is an upload function with "core" and "info" bound.
105
+ * [upload files] : uploadHandler(files or [new File(...),])
106
+ * [error] : uploadHandler("Error message")
107
+ * [Just finish] : uploadHandler()
108
+ * [directly register] : uploadHandler(response) // Same format as "imageUploadUrl" response
109
+ * ex) {
110
+ * // "errorMessage": "insert error message",
111
+ * "result": [ { "url": "...", "name": "...", "size": "999" }, ]
112
+ * }
113
+ * @returns
114
+ */
115
+ onImageUploadBefore: (files: any[], info: imageInputInformation, uploadHandler: Function) => boolean | any[] | undefined;
116
+
117
+ /**
118
+ * @description Called before the video is uploaded
119
+ * If true is returned, the internal upload process runs normally.
120
+ * If false is returned, no video upload is performed.
121
+ * If new fileList are returned, replaced the previous fileList
122
+ * If undefined is returned, it waits until "uploadHandler" is executed.
123
+ * @param files Files array
124
+ * @param info Input information
125
+ * @param core Core object
126
+ * @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
127
+ * "uploadHandler" is an upload function with "core" and "info" bound.
128
+ * [upload files] : uploadHandler(files or [new File(...),])
129
+ * [error] : uploadHandler("Error message")
130
+ * [Just finish] : uploadHandler()
131
+ * [directly register] : uploadHandler(response) // Same format as "videoUploadUrl" response
132
+ * ex) {
133
+ * // "errorMessage": "insert error message",
134
+ * "result": [ { "url": "...", "name": "...", "size": "999" }, ]
135
+ * }
136
+ * @returns
137
+ */
138
+ onVideoUploadBefore: (files: any[], info: videoInputInformation, uploadHandler: Function) => boolean | any[] | undefined;
139
+
140
+ /**
141
+ * @description Called before the audio is uploaded
142
+ * If true is returned, the internal upload process runs normally.
143
+ * If false is returned, no audio upload is performed.
144
+ * If new fileList are returned, replaced the previous fileList
145
+ * If undefined is returned, it waits until "uploadHandler" is executed.
146
+ * @param files Files array
147
+ * @param info Input information
148
+ * @param core Core object
149
+ * @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
150
+ * "uploadHandler" is an upload function with "core" and "info" bound.
151
+ * [upload files] : uploadHandler(files or [new File(...),])
152
+ * [error] : uploadHandler("Error message")
153
+ * [Just finish] : uploadHandler()
154
+ * [directly register] : uploadHandler(response) // Same format as "audioUploadUrl" response
155
+ * ex) {
156
+ * // "errorMessage": "insert error message",
157
+ * "result": [ { "url": "...", "name": "...", "size": "999" }, ]
158
+ * }
159
+ * @returns
160
+ */
161
+ onAudioUploadBefore: (files: any[], info: audioInputInformation, uploadHandler: Function) => boolean | any[] | undefined;
162
+
163
+ /**
164
+ * @description Called when the image is uploaded, updated, deleted
165
+ * @param targetElement Target element
166
+ * @param index Uploaded index
167
+ * @param state Upload status ('create', 'update', 'delete')
168
+ * @param info Info object
169
+ * - index: data index
170
+ * - name: file name
171
+ * - size: file size
172
+ * - select: select function
173
+ * - delete: delete function
174
+ * - element: target element
175
+ * - src: src attribute of tag
176
+ * @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
177
+ * @param core Core object
178
+ */
179
+ onImageAction: (targetElement: HTMLImageElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number) => void;
180
+
181
+ /**
182
+ * @description Called when the video(iframe, video) is uploaded, updated, deleted
183
+ * @param targetElement Target element
184
+ * @param index Uploaded index
185
+ * @param state Upload status ('create', 'update', 'delete')
186
+ * @param info Info object
187
+ * - index: data index
188
+ * - name: file name
189
+ * - size: file size
190
+ * - select: select function
191
+ * - delete: delete function
192
+ * - element: target element
193
+ * - src: src attribute of tag
194
+ * @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
195
+ * @param core Core object
196
+ */
197
+ onVideoAction: (targetElement: HTMLIFrameElement | HTMLVideoElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number) => void;
198
+
199
+ /**
200
+ * @description Called when the audio is uploaded, updated, deleted
201
+ * @param targetElement Target element
202
+ * @param index Uploaded index
203
+ * @param state Upload status ('create', 'update', 'delete')
204
+ * @param info Info object
205
+ * - index: data index
206
+ * - name: file name
207
+ * - size: file size
208
+ * - select: select function
209
+ * - delete: delete function
210
+ * - element: target element
211
+ * - src: src attribute of tag
212
+ * @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
213
+ * @param core Core object
214
+ */
215
+ onAudioAction: (targetElement: HTMLAudioElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number) => void;
216
+
217
+ /**
218
+ * @description Called when the image is upload failed
219
+ * @param errorMessage Error message
220
+ * @param result Response Object
221
+ * @param core Core object
222
+ * @returns
223
+ */
224
+ onImageUploadError: (errorMessage: string, result: any) => boolean;
225
+
226
+ /**
227
+ * @description Called when the video(iframe, video) upload failed
228
+ * @param errorMessage Error message
229
+ * @param result Response Object
230
+ * @param core Core object
231
+ * @returns
232
+ */
233
+ onVideoUploadError: (errorMessage: string, result: any) => boolean;
234
+
235
+ /**
236
+ * @description Called when the audio upload failed
237
+ * @param errorMessage Error message
238
+ * @param result Response Object
239
+ * @param core Core object
240
+ * @returns
241
+ */
242
+ onAudioUploadError: (errorMessage: string, result: any) => boolean;
243
+
244
+ /**
245
+ * @description Called when the audio upload failed
246
+ * @param height Height after resized (px)
247
+ * @param prevHeight Prev height before resized (px)
248
+ * @param resizeObserverEntry ResizeObserverEntry object
249
+ * @returns
250
+ */
251
+ onResizeEditor: (height: number, prevHeight: number, core: Core, resizeObserverEntry: ResizeObserverEntry | null) => {};
252
+
253
+ /**
254
+ * @description Called after the "setToolbarButtons" invocation.
255
+ * Can be used to tweak buttons properties (useful for custom buttons)
256
+ * @param buttonTray Button tray element
257
+ * @param core Core object
258
+ */
259
+ onSetToolbarButtons: (buttonTray: Element, core: Core) => void;
260
+ }
261
+
262
+ export default Events;
@@ -0,0 +1,42 @@
1
+ import { Module } from '../Module';
2
+
3
+ /**
4
+ * @description This is a required module of fileBrowser plugin.
5
+ Require context properties when using fileBrowser module:
6
+ title(@Required): "File browser window title",
7
+ url(@Required): "File server url",
8
+ listClass(@Required): "Class name of list div",
9
+ itemTemplateHandler(@Required): "Function that defines the HTML of an file item",
10
+ selectorHandler(@Required): "Function that action when item click",
11
+ columnSize(@Option): "Number of "div.se-file-item-column" to be created (default: 4)"
12
+ */
13
+ declare interface fileBrowser extends Module {
14
+ /**
15
+ * @description Open a file browser window
16
+ * @param pluginName Plugin name using the file browser
17
+ * @param selectorHandler When the function comes as an argument value, it substitutes "context.selectorHandler".
18
+ * @example this.plugins.fileBrowser.open.call(this, 'imageGallery', (selectorHandler || null));
19
+ */
20
+ open(kind: string, update: boolean): void;
21
+
22
+ /**
23
+ * @description Define the HTML of the item to be put in "div.se-file-item-column".
24
+ * @param item Item of the response data's array
25
+ */
26
+ drawItems: (item: object) => string;
27
+
28
+ /**
29
+ * @description Close a file browser window
30
+ * The plugin's "init" method is called.
31
+ * @example this.plugins.fileBrowser.close.call(this);
32
+ */
33
+ close(): void;
34
+
35
+ /**
36
+ * @description This method is called when the file browser window is closed.
37
+ * Initialize the properties.
38
+ */
39
+ init?: () => void;
40
+ }
41
+
42
+ export default fileBrowser;
@@ -0,0 +1,67 @@
1
+ import { Module } from '../Module';
2
+
3
+ /**
4
+ * @description Require context properties when fileManager module
5
+ _infoList: [],
6
+ _infoIndex: 0,
7
+ _uploadFileLength: 0
8
+ */
9
+ declare interface fileManager extends Module {
10
+ /**
11
+ * @description Upload the file to the server.
12
+ * @param uploadUrl Upload server url
13
+ * @param uploadHeader Request header
14
+ * @param formData FormData in body
15
+ * @param callBack Success call back function
16
+ * @param errorCallBack Error call back function
17
+ * @example this.plugins.fileManager.upload.call(this, imageUploadUrl, this.options.imageUploadHeader, formData, this.plugins.image.callBack_imgUpload.bind(this, info), this.events.onImageUploadError);
18
+ */
19
+ upload(uploadUrl: string, uploadHeader: Record<string, string> | null, formData: FormData, callBack: Function | null, errorCallBack: Function | null): void;
20
+
21
+ /**
22
+ * @description Checke the file's information and modify the tag that does not fit the format.
23
+ * @param pluginName Plugin name
24
+ * @param tagNames Tag array to check
25
+ * @param uploadEventHandler Event handler to process updated file info after checking (used in "setInfo")
26
+ * @param modifyHandler A function to modify a tag that does not fit the format (Argument value: Tag element)
27
+ * @param resizing True if the plugin is using a resizing module
28
+ * @example
29
+ * const modifyHandler = function (tag) {
30
+ * imagePlugin.onModifyMode.call(this, tag, null);
31
+ * imagePlugin.openModify.call(this, true);
32
+ * imagePlugin.update_image.call(this, true, false, true);
33
+ * }.bind(this);
34
+ * this.plugins.fileManager.checkInfo.call(this, 'image', ['img'], this.events.onImageUpload, modifyHandler, true);
35
+ */
36
+ checkInfo(pluginName: string, tagNames: string[], uploadEventHandler: Function | null, modifyHandler: Function | null, resizing: boolean): void;
37
+
38
+ /**
39
+ * @description Create info object of file and add it to "_infoList" (this.context[pluginName]._infoList[])
40
+ * @param pluginName Plugin name
41
+ * @param element
42
+ * @param uploadEventHandler Event handler to process updated file info (created in setInfo)
43
+ * @param file
44
+ * @param resizing True if the plugin is using a resizing module
45
+ * @example
46
+ * uploadCallBack {.. file = { name: fileList[i].name, size: fileList[i].size };
47
+ * this.plugins.fileManager.setInfo.call(this, 'image', oImg, this.events.onImageUpload, file, true);
48
+ */
49
+ setInfo(pluginName: string, element, uploadEventHandler: Function | null, file: Record<string, string | number> | null, resizing: boolean): void;
50
+
51
+ /**
52
+ * @description Delete info object at "_infoList"
53
+ * @param pluginName Plugin name
54
+ * @param index index of info object (this.context[pluginName]._infoList[].index)
55
+ * @param uploadEventHandler Event handler to process updated file info (created in setInfo)
56
+ */
57
+ deleteInfo(pluginName: string, index, uploadEventHandler: Function | null): void;
58
+
59
+ /**
60
+ * @description Reset info object and "_infoList = []", "_infoIndex = 0"
61
+ * @param pluginName Plugin name
62
+ * @param uploadEventHandler Event handler to process updated file info (created in setInfo)
63
+ */
64
+ resetInfo(pluginName: string, uploadEventHandler: Function | null): void;
65
+ }
66
+
67
+ export default fileManager;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const font: DropdownPlugin;
4
+
5
+ export default font;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const fontColor: DropdownPlugin;
4
+
5
+ export default fontColor;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const fontSize: DropdownPlugin;
4
+
5
+ export default fontSize;
@@ -0,0 +1,191 @@
1
+ import EditorInterface from '../../interface/editor';
2
+
3
+ class Format extends EditorInterface {
4
+ /**
5
+ * @description Replace the line tag of the current selection.
6
+ * @param element Line element (P, DIV..)
7
+ */
8
+ setLine(element: Element): void;
9
+
10
+ /**
11
+ * @description If a parent node that contains an argument node finds a format node (format.isLine), it returns that node.
12
+ * @param node Reference node.
13
+ * @param validation Additional validation function.
14
+ * @returns
15
+ */
16
+ getLine(node: Node, validation?: Function | null): Element | null;
17
+
18
+ /**
19
+ * @description Replace the br-line tag of the current selection.
20
+ * @param element Line element (P, DIV..)
21
+ */
22
+ setBrLine(element: Element);
23
+
24
+ /**
25
+ * @description If a parent node that contains an argument node finds a free format node (format.isBrLine), it returns that node.
26
+ * @param element Reference node.
27
+ * @param validation Additional validation function.
28
+ * @returns
29
+ */
30
+ getBrLine(node: Node, validation?: Function | null): Element | null;
31
+
32
+ /**
33
+ * @description Append format element to sibling node of argument element.
34
+ * If the "formatNodeName" argument value is present, the tag of that argument value is inserted,
35
+ * If not, the currently selected format tag is inserted.
36
+ * @param element Insert as siblings of that element
37
+ * @param formatNode Node name or node obejct to be inserted
38
+ * @returns
39
+ */
40
+ addLine(element: Element, formatNode?: string | Element): Element;
41
+
42
+ /**
43
+ * @description If a parent node that contains an argument node finds a format node (editor.format.isBlock), it returns that node.
44
+ * @param element Reference node.
45
+ * @param validation Additional validation function.
46
+ * @returns
47
+ */
48
+ getBlock(element: Node, validation?: Function): Element | null;
49
+
50
+ /**
51
+ * @description Appended all selected format Element to the argument element and insert
52
+ * @param block Element of wrap the arguments (BLOCKQUOTE...)
53
+ */
54
+ applyBlock(block: Element): void;
55
+
56
+ /**
57
+ * @description The elements of the "selectedFormats" array are detached from the "rangeElement" element. ("LI" tags are converted to "P" tags)
58
+ * When "selectedFormats" is null, all elements are detached and return {cc: parentNode, sc: nextSibling, ec: previousSibling, removeArray: [Array of removed elements]}.
59
+ * @param rangeElement Range format element (PRE, BLOCKQUOTE, OL, UL...)
60
+ * @param selectedFormats Array of format elements (P, DIV, LI...) to remove.
61
+ * If null, Applies to all elements and return {cc: parentNode, sc: nextSibling, ec: previousSibling}
62
+ * @param newRangeElement The node(rangeElement) to replace the currently wrapped node.
63
+ * @param remove If true, deleted without detached.
64
+ * @param notHistoryPush When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)
65
+ * @returns
66
+ */
67
+ removeBlock(rangeElement: Element, selectedFormats: Element[] | null, newRangeElement: Element | null, remove: boolean, notHistoryPush: boolean): { cc: Node; sc: Node; ec: Node; removeArray: Element[] };
68
+
69
+ /**
70
+ * @description Append all selected format Element to the list and insert.
71
+ * @param type List type. (bullet | numbered):[listStyleType]
72
+ * @param selectedCells Format elements or list cells.
73
+ * @param nested If true, indenting existing list cells.
74
+ */
75
+ applyList(type: string, selectedCells: Element[], nested: boolean);
76
+
77
+ /**
78
+ * @description "selectedCells" array are detached from the list element.
79
+ * The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
80
+ * @param selectedCells Array of format elements (LI, P...) to remove.
81
+ * @param remove If true, It does not just remove the list, it deletes the content.
82
+ * @returns {sc: <LI>, ec: <LI>}.
83
+ */
84
+ removeList(selectedCells: Element[], remove: boolean): { sc: Element; ec: Element };
85
+
86
+ /**
87
+ * @description Indent more the selected lines.
88
+ * margin size - "status.indentSize"px
89
+ */
90
+ indent(): void;
91
+
92
+ /**
93
+ * @description Indent less the selected lines.
94
+ * margin size - "status.indentSize"px
95
+ */
96
+ outdent(): void;
97
+
98
+ /**
99
+ * @description Add, update, and delete style node from selected text. (a, span, strong, ect.)
100
+ * 1. If there is a node in the "styleNode" argument, a node with the same tags and attributes as "styleNode" is added to the selection text.
101
+ * 2. If it is in the same tag, only the tag's attributes are changed without adding a tag.
102
+ * 3. If the "styleNode" argument is null, the node of the selection is update or remove without adding a new node.
103
+ * 4. The same style as the style attribute of the "styleArray" argument is deleted.
104
+ * (Styles should be put with attribute names from css. ["background-color"])
105
+ * 5. The same class name as the class attribute of the "styleArray" argument is deleted.
106
+ * (The class name is preceded by "." [".className"])
107
+ * 6. Use a list of styles and classes of "styleNode" in "styleArray" to avoid duplicate property values.
108
+ * 7. If a node with all styles and classes removed has the same tag name as "styleNode" or "removeNodeArray", or "styleNode" is null, that node is deleted.
109
+ * 8. Regardless of the style and class of the node, the tag with the same name as the "removeNodeArray" argument value is deleted.
110
+ * 9. If the "strictRemove" argument is true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.
111
+ * 10. It won't work if the parent node has the same class and same value style.
112
+ * However, if there is a value in "removeNodeArray", it works and the text node is separated even if there is no node to replace.
113
+ * @param styleNode The element to be added to the selection. If it is null, only delete the node.
114
+ * @param styleArray The style or className attribute name Array to check (['font-size'], ['.className'], ['font-family', 'color', '.className']...])
115
+ * @param removeNodeArray An array of node names to remove types from, remove all formats when "styleNode" is null and there is an empty array or null value. (['span'], ['strong', 'em'] ...])
116
+ * @param strictRemove If true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.
117
+ */
118
+ applyTextStyle(styleNode?: Element, styleArray?: string[], removeNodeArray?: string[], strictRemove?: boolean): void;
119
+
120
+ /**
121
+ * @description Remove format of the currently selected text
122
+ */
123
+ removeTextStyle(): void;
124
+
125
+ /**
126
+ * @description Check if the container and offset values are the edges of the "line"
127
+ * @param container The container property of the selection object.
128
+ * @param offset The offset property of the selection object.
129
+ * @param dir Select check point - "front": Front edge, "end": End edge, undefined: Both edge.
130
+ * @returns
131
+ */
132
+ isEdgeLine(container: Node, offset: number, dir: 'front' | 'end'): boolean;
133
+
134
+ /**
135
+ * @description It is judged whether it is a node related to the text style.
136
+ * (strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label)
137
+ * @param element The node to check
138
+ * @returns
139
+ */
140
+ isTextStyleNode(element: Node): boolean;
141
+
142
+ /**
143
+ * @description It is judged whether it is the format element (P, DIV, H[1-6], PRE, LI | class="__se__format__line_xxx")
144
+ * Format element also contain "free format Element"
145
+ * @param element The node to check
146
+ * @returns
147
+ */
148
+ isLine(element: Node): boolean;
149
+
150
+ /**
151
+ * @description It is judged whether it is the free format element. (PRE | class="__se__format__br_line_xxx")
152
+ * Free format elements is included in the format element.
153
+ * Free format elements's line break is "BR" tag.
154
+ * ※ Entering the Enter key in the space on the last line ends "Free Format" and appends "Format".
155
+ * @param element The node to check
156
+ * @returns
157
+ */
158
+ isBrLine(element: Node): boolean;
159
+
160
+ /**
161
+ * @description It is judged whether it is the closure free format element. (class="__se__format__br_line__closure_xxx")
162
+ * Closure free format elements is included in the free format element.
163
+ * - Closure free format elements's line break is "BR" tag.
164
+ * ※ You cannot exit this format with the Enter key.
165
+ * ※ Use it only in special cases. ([ex] format of table cells)
166
+ * @param element The node to check
167
+ * @returns
168
+ */
169
+ isClosureBrLine(element: Node): boolean;
170
+
171
+ /**
172
+ * @description It is judged whether it is the range format element. (BLOCKQUOTE, OL, UL, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD | class="__se__format__block_xxx")
173
+ * * Range format element is wrap the line element
174
+ * @param element The node to check
175
+ * @returns
176
+ */
177
+ isBlock(element: Node): boolean;
178
+
179
+ /**
180
+ * @description It is judged whether it is the closure range format element. (TH, TD | class="__se__format__block_closure_xxx")
181
+ * Closure range format elements is included in the range format element.
182
+ * - Closure range format element is wrap the "format element" and "component"
183
+ * ※ You cannot exit this format with the Enter key or Backspace key.
184
+ * ※ Use it only in special cases. ([ex] format of table cells)
185
+ * @param element The node to check
186
+ * @returns
187
+ */
188
+ isClosureBlock(element: Node): boolean;
189
+ }
190
+
191
+ export default Format;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const formatBlock: DropdownPlugin;
4
+
5
+ export default formatBlock;
@@ -0,0 +1,48 @@
1
+ import { Core } from './editor';
2
+
3
+ export interface History {
4
+ /**
5
+ * @description History stack
6
+ */
7
+ stack: any[];
8
+ /**
9
+ * @description Saving the current status to the history object stack
10
+ * If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds
11
+ * If the function is called again with the "delay" argument true before it is saved, the delay time is renewal
12
+ * You can specify the delay time by sending a number.
13
+ * @param {boolean} delay If true, Add stack without delay time.
14
+ */
15
+ push: (delay: boolean | number) => void;
16
+ /**
17
+ * @description Undo function
18
+ */
19
+ undo: () => void;
20
+ /**
21
+ * @description Redo function
22
+ */
23
+ redo: () => void;
24
+ /**
25
+ * @description Go to the history stack for that index.
26
+ * If "index" is -1, go to the last stack
27
+ * @param {number} index Stack index
28
+ */
29
+ go: (index: number) => void;
30
+
31
+ /**
32
+ * @description Get the current history stack index.
33
+ * @returns
34
+ */
35
+ getCurrentIndex: () => number;
36
+
37
+ /**
38
+ * @description Reset the history object
39
+ */
40
+ reset: (ignoreChangeEvent: any) => void;
41
+ /**
42
+ * @description Remove all stacks and remove the timeout function.
43
+ * @private
44
+ */
45
+ destroy: () => void;
46
+ }
47
+
48
+ export default function _default(core: Core, change: any): History;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const horizontalLine: DropdownPlugin;
4
+
5
+ export default horizontalLine;
@@ -2,4 +2,4 @@ import { DialogPlugin } from '../DialogPlugin';
2
2
 
3
3
  declare const image: DialogPlugin;
4
4
 
5
- export default image;
5
+ export default image;
@@ -2,4 +2,4 @@ import { FileBrowserPlugin } from '../FileBrowserPlugin';
2
2
 
3
3
  declare const imageGallery: FileBrowserPlugin;
4
4
 
5
- export default imageGallery;
5
+ export default imageGallery;