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
package/src/lib/core.d.ts DELETED
@@ -1,1135 +0,0 @@
1
- import { History } from './history.d';
2
- import { Plugin } from './../plugins/Plugin.d';
3
- import { Lang } from './../lang/Lang.d';
4
- import { SunEditorOptions } from './../options.d';
5
- import { Context } from './context';
6
- import Util from './util';
7
- import { Module } from '../plugins/Module';
8
- import _Notice from '../plugins/modules/_notice';
9
-
10
- type Controllers = Array<string | Function | Element>;
11
- type fileInfo = {
12
- index: number;
13
- name: string;
14
- size: string | number;
15
- select: Function;
16
- delete: Function;
17
- element: Element;
18
- src: string;
19
- };
20
- type seledtedFileInfo = {target: Element; component: Element; pluginName: string;};
21
- type commands = 'selectAll' | 'codeView' | 'fullScreen' | 'indent' | 'outdent' | 'undo' | 'redo' | 'removeFormat' | 'print' | 'preview' | 'showBlocks' | 'save' | 'bold' | 'underline' | 'italic' | 'strike' | 'subscript' | 'superscript' | 'copy' | 'cut' | 'paste';
22
- ​​
23
- interface Core {
24
- /**
25
- * @description Util object
26
- */
27
- util: Util;
28
-
29
- /**
30
- * @description Functions object
31
- */
32
- functions: SunEditor;
33
-
34
- /**
35
- * @description Editor options
36
- */
37
- options: SunEditorOptions;
38
-
39
- /**
40
- * @description Computed style of the wysiwyg area (window.getComputedStyle(context.element.wysiwyg))
41
- */
42
- wwComputedStyle: any;
43
-
44
- /**
45
- * @description Notice object
46
- */
47
- notice: _Notice;
48
-
49
- /**
50
- * @description Default icons object
51
- */
52
- icons: Record<string, string>;
53
-
54
- /**
55
- * @description History object for undo, redo
56
- */
57
- history: History;
58
-
59
- /**
60
- * @description Elements and user options parameters of the suneditor
61
- */
62
- context: Context;
63
-
64
- /**
65
- * @description Plugin buttons
66
- */
67
- pluginCallButtons: Record<string, Element>;
68
-
69
- /**
70
- * @description Loaded plugins
71
- */
72
- plugins: Record<string, Plugin>;
73
-
74
- /**
75
- * @description Whether the plugin is initialized
76
- */
77
- initPlugins: Record<string, boolean>;
78
-
79
- /**
80
- * @description loaded language
81
- */
82
- lang: Lang;
83
-
84
- /**
85
- * @description The selection node (core.getSelectionNode()) to which the effect was last applied
86
- */
87
- effectNode: Node;
88
-
89
- /**
90
- * @description submenu element
91
- */
92
- submenu: Element;
93
-
94
- /**
95
- * @description container element
96
- */
97
- container: Element;
98
-
99
- /**
100
- * @description active button element in submenu
101
- */
102
- submenuActiveButton: Element;
103
-
104
- /**
105
- * @description active button element in container
106
- */
107
- containerActiveButton: Element;
108
-
109
- /**
110
- * @description The elements array to be processed unvisible when the controllersOff function is executed (resizing, link modified button, table controller)
111
- */
112
- controllerArray: Controllers;
113
-
114
- /**
115
- * @description The name of the plugin that called the currently active controller
116
- */
117
- currentControllerName: string;
118
-
119
- /**
120
- * @description The target element of current controller
121
- */
122
- currentControllerTarget: Element;
123
-
124
- /**
125
- * @description The file component object of current selected file tag (getFileComponent(): {target, component, pluginName})
126
- */
127
- currentFileComponentInfo: seledtedFileInfo;
128
-
129
- /**
130
- * @description An array of buttons whose class name is not "se-code-view-enabled"
131
- */
132
- codeViewDisabledButtons: Element[];
133
-
134
- /**
135
- * @description An array of buttons whose class name is not "se-resizing-enabled"
136
- */
137
- resizingDisabledButtons: Element[],
138
-
139
- /**
140
- * @description Editor tags whitelist (RegExp object)
141
- * util.createTagsWhitelist(options._editorTagsWhitelist)
142
- */
143
- editorTagsWhitelistRegExp: RegExp;
144
-
145
- /**
146
- * @description Editor tags blacklist (RegExp object)
147
- * util.createTagsBlacklist(options.tagsBlacklist)
148
- */
149
- editorTagsBlacklistRegExp: RegExp;
150
-
151
- /**
152
- * @description Tag whitelist when pasting (RegExp object)
153
- * util.createTagsWhitelist(options.pasteTagsWhitelist)
154
- */
155
- pasteTagsWhitelistRegExp: RegExp;
156
-
157
- /**
158
- * @description Tag blacklist when pasting (RegExp object)
159
- * util.createTagsBlacklist(options.pasteTagsBlacklist)
160
- */
161
- pasteTagsBlacklistRegExp: RegExp;
162
-
163
- /**
164
- * @description Boolean value of whether the editor has focus
165
- */
166
- hasFocus: boolean;
167
-
168
- /**
169
- * @description Plugins array with "active" method.
170
- * "activePlugins" runs the "add" method when creating the editor.
171
- */
172
- activePlugins: Plugin[];
173
-
174
- /**
175
- * @description Plugins array with "checkFiletInfo" and "resetFileInfo" methods.
176
- * "fileInfoPlugins" runs the "add" method when creating the editor.
177
- * "checkFileInfo" method is always call just before the "change" event.
178
- */
179
- fileInfoPlugins: Function[],
180
-
181
- /**
182
- * @description Elements that need to change text or className for each selection change
183
- * After creating the editor, "activePlugins" are added.
184
- * @property STRONG bold button
185
- * @property U underline button
186
- * @property EM italic button
187
- * @property DEL strike button
188
- * @property SUB subscript button
189
- * @property SUP superscript button
190
- * @property OUTDENT outdent button
191
- * @property INDENT indent button
192
- */
193
- commandMap: Record<string, Element>;
194
-
195
- /**
196
- * @description If the plugin is not added, add the plugin and call the 'add' function.
197
- * If the plugin is added call callBack function.
198
- * @param pluginName The name of the plugin to call
199
- * @param callBackFunction Function to be executed immediately after module call
200
- * @param _target Plugin target button (This is not necessary if you have a button list when creating the editor)
201
- */
202
- callPlugin(pluginName: string, callBackFunction: Function, _target?: Element): void;
203
-
204
- /**
205
- * @description If the module is not added, add the module and call the 'add' function
206
- * @param moduleArray module object's Array [dialog, resizing]
207
- */
208
- addModule(moduleArray: Module[]): void;
209
-
210
- /**
211
- * @description Gets the current editor-relative scroll offset.
212
- */
213
- getGlobalScrollOffset(): {top: number; left: number};
214
-
215
- /**
216
- * @description Method for managing submenu element.
217
- * You must add the "submenu" element using the this method at custom plugin.
218
- * @param pluginName Plugin name
219
- * @param target Target button
220
- * @param menu Submenu element
221
- */
222
- initMenuTarget(pluginName: string, target: Element | null, menu: Element): void;
223
-
224
- /**
225
- * @description Enable submenu
226
- * @param element Submenu's button element to call
227
- */
228
- submenuOn(element: Element): void;
229
-
230
- /**
231
- * @description Disable submenu
232
- */
233
- submenuOff(): void;
234
-
235
- /**
236
- * @description Disable more layer
237
- */
238
- moreLayerOff(): void;
239
-
240
- /**
241
- * @description Enable container
242
- * @param element Container's button element to call
243
- */
244
- containerOn(element: Element): void;
245
-
246
- /**
247
- * @description Disable container
248
- */
249
- containerOff(): void;
250
-
251
- /**
252
- * @description Show controller at editor area (controller elements, function, "controller target element(@Required)", "controller name(@Required)", etc..)
253
- * @param arguments controller elements, functions..
254
- */
255
- controllersOn(...arguments: Controllers): void;
256
-
257
- /**
258
- * @description Hide controller at editor area (link button, image resize button..)
259
- * @param e Event object when called from mousedown and keydown events registered in "core.controllersOn"
260
- */
261
- controllersOff(e?: KeyboardEvent | MouseEvent): void;
262
-
263
- /**
264
- * @description Specify the position of the controller.
265
- * @param controller Controller element.
266
- * @param referEl Element that is the basis of the controller's position.
267
- * @param position Type of position ("top" | "bottom")
268
- * When using the "top" position, there should not be an arrow on the controller.
269
- * When using the "bottom" position there should be an arrow on the controller.
270
- * @param addOffset These are the left and top values that need to be added specially.
271
- * This argument is required. - {left: 0, top: 0}
272
- * Please enter the value based on ltr mode.
273
- * Calculated automatically in rtl mode.
274
- */
275
- setControllerPosition(controller: Element, referEl: Element, position: 'top' | 'bottom', addOffset: {left: number, top: number}): void;
276
-
277
- /**
278
- * @description javascript execCommand
279
- * @param command javascript execCommand function property
280
- * @param showDefaultUI javascript execCommand function property
281
- * @param value javascript execCommand function property
282
- */
283
- execCommand(command: string, showDefaultUI?: boolean, value?: string): void;
284
-
285
- /**
286
- * @description Focus to wysiwyg area using "native focus function"
287
- */
288
- nativeFocus(): void;
289
-
290
- /**
291
- * @description Focus to wysiwyg area
292
- */
293
- focus(): void;
294
-
295
- /**
296
- * @description If "focusEl" is a component, then that component is selected; if it is a format element, the last text is selected
297
- * If "focusEdge" is null, then selected last element
298
- * @param focusEl Focus element
299
- */
300
- focusEdge(focusEl: Element | null): void;
301
-
302
- /**
303
- * @description Focusout to wysiwyg area (.blur())
304
- */
305
- blur(): void;
306
-
307
- /**
308
- * @description Set current editor's range object and return.
309
- * @param startCon The startContainer property of the selection object.
310
- * @param startOff The startOffset property of the selection object.
311
- * @param endCon The endContainer property of the selection object.
312
- * @param endOff The endOffset property of the selection object.
313
- * @returns
314
- */
315
- setRange(startCon: Node, startOff: number, endCon: Node, endOff: number): Range;
316
-
317
- /**
318
- * @description Remove range object and button effect
319
- */
320
- removeRange(): void;
321
-
322
- /**
323
- * @description Get current editor's range object
324
- * @returns
325
- */
326
- getRange(): Range;
327
-
328
- /**
329
- * @description If the "range" object is a non-editable area, add a line at the top of the editor and update the "range" object.
330
- * Returns a new "range" or argument "range".
331
- * @param range core.getRange()
332
- * @param container If there is "container" argument, it creates a line in front of the container.
333
- */
334
- getRange_addLine(range: Range, container?: Element): Range;
335
-
336
- /**
337
- * @description Get window selection obejct
338
- * @returns
339
- */
340
- getSelection(): Selection;
341
-
342
- /**
343
- * @description Get current select node
344
- * @returns
345
- */
346
- getSelectionNode(): Node;
347
-
348
- /**
349
- * @description Returns a "formatElement"(util.isFormatElement) array from the currently selected range.
350
- * @param validation The validation function. (Replaces the default validation function-util.isFormatElement(current))
351
- * @returns
352
- */
353
- getSelectedElements(validation?: Function): Node[];
354
-
355
- /**
356
- * @description Get format elements and components from the selected area. (P, DIV, H[1-6], OL, UL, TABLE..)
357
- * If some of the component are included in the selection, get the entire that component.
358
- * @param removeDuplicate If true, if there is a parent and child tag among the selected elements, the child tag is excluded.
359
- * @returns
360
- */
361
- getSelectedElementsAndComponents(removeDuplicate: boolean): Node[];
362
-
363
- /**
364
- * @description Determine if this offset is the edge offset of container
365
- * @param container The container property of the selection object.
366
- * @param offset The offset property of the selection object.
367
- * @param dir Select check point - Both edge, Front edge or End edge. ("front": Front edge, "end": End edge, undefined: Both edge)
368
- * @returns
369
- */
370
- isEdgePoint(container: Node, offset: number, dir?: 'front' | 'end'): boolean;
371
-
372
- /**
373
- * @description Show loading box
374
- */
375
- showLoading(): void;
376
-
377
- /**
378
- * @description Close loading box
379
- */
380
- closeLoading(): void;
381
-
382
- /**
383
- * @description Append format element to sibling node of argument element.
384
- * If the "formatNodeName" argument value is present, the tag of that argument value is inserted,
385
- * If not, the currently selected format tag is inserted.
386
- * @param element Insert as siblings of that element
387
- * @param formatNode Node name or node obejct to be inserted
388
- * @returns
389
- */
390
- appendFormatTag(element: Element, formatNode?: string | Element): Element;
391
-
392
- /**
393
- * @description The method to insert a element and return. (used elements : table, hr, image, video)
394
- * If "element" is "HR", insert and return the new line.
395
- * @param element Element to be inserted
396
- * @param notHistoryPush When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)
397
- * @param checkCharCount If true, if "options.maxCharCount" is exceeded when "element" is added, null is returned without addition.
398
- * @param notSelect If true, Do not automatically select the inserted component.
399
- * @returns
400
- */
401
- insertComponent(element: Element, notHistoryPush?: boolean, checkCharCount?: boolean, notSelect?:boolean): Element;
402
-
403
- /**
404
- * @description Gets the file component and that plugin name
405
- * return: {target, component, pluginName} | null
406
- * @param element Target element (figure tag, component div, file tag)
407
- * @returns
408
- */
409
- getFileComponent(element: Element): seledtedFileInfo | null;
410
-
411
- /**
412
- * @description The component(image, video) is selected and the resizing module is called.
413
- * @param element Element tag (img, iframe, video)
414
- * @param pluginName Plugin name (image, video)
415
- */
416
- selectComponent(element: Element, pluginName: string): void;
417
-
418
- /**
419
- * @description Delete selected node and insert argument value node and return.
420
- * If the "afterNode" exists, it is inserted after the "afterNode"
421
- * Inserting a text node merges with both text nodes on both sides and returns a new "{ container, startOffset, endOffset }".
422
- * @param oNode Element to be inserted
423
- * @param afterNode If the node exists, it is inserted after the node
424
- * @returns
425
- */
426
- insertNode(oNode: Node, afterNode?: Node, checkCharCount?: boolean): { startOffset: Node, endOffset: number } | Node | null;
427
-
428
- /**
429
- * @description Delete the currently selected nodes and reset selection range
430
- * Returns {container: "the last element after deletion", offset: "offset", prevContainer: "previousElementSibling Of the deleted area"}
431
- * @returns
432
- */
433
- removeNode(): { container: Node; offset: number; prevContainer?: Node };
434
-
435
- /**
436
- * @description Appended all selected format Element to the argument element and insert
437
- * @param rangeElement Element of wrap the arguments (BLOCKQUOTE...)
438
- */
439
- applyRangeFormatElement(rangeElement: Element): void;
440
-
441
- /**
442
- * @description The elements of the "selectedFormats" array are detached from the "rangeElement" element. ("LI" tags are converted to "P" tags)
443
- * When "selectedFormats" is null, all elements are detached and return {cc: parentNode, sc: nextSibling, ec: previousSibling, removeArray: [Array of removed elements]}.
444
- * @param rangeElement Range format element (PRE, BLOCKQUOTE, OL, UL...)
445
- * @param selectedFormats Array of format elements (P, DIV, LI...) to remove.
446
- * If null, Applies to all elements and return {cc: parentNode, sc: nextSibling, ec: previousSibling}
447
- * @param newRangeElement The node(rangeElement) to replace the currently wrapped node.
448
- * @param remove If true, deleted without detached.
449
- * @param notHistoryPush When true, it does not update the history stack and the selection object and return EdgeNodes (util.getEdgeChildNodes)
450
- * @returns
451
- */
452
- detachRangeFormatElement(rangeElement: Element, selectedFormats: Element[] | null, newRangeElement: Element | null, remove: boolean, notHistoryPush: boolean): {cc: Node, sc: Node, ec: Node, removeArray: Element[]}
453
-
454
- /**
455
- * @description "selectedFormats" array are detached from the list element.
456
- * The return value is applied when the first and last lines of "selectedFormats" are "LI" respectively.
457
- * @param selectedFormats Array of format elements (LI, P...) to remove.
458
- * @param remove If true, deleted without detached.
459
- * @returns {sc: <LI>, ec: <LI>}.
460
- */
461
- detachList(selectedFormats: Element[], remove: boolean): {sc: Element, ec: Element};
462
-
463
- /**
464
- * @description Add, update, and delete nodes from selected text.
465
- * 1. If there is a node in the "appendNode" argument, a node with the same tags and attributes as "appendNode" is added to the selection text.
466
- * 2. If it is in the same tag, only the tag's attributes are changed without adding a tag.
467
- * 3. If the "appendNode" argument is null, the node of the selection is update or remove without adding a new node.
468
- * 4. The same style as the style attribute of the "styleArray" argument is deleted.
469
- * (Styles should be put with attribute names from css. ["background-color"])
470
- * 5. The same class name as the class attribute of the "styleArray" argument is deleted.
471
- * (The class name is preceded by "." [".className"])
472
- * 6. Use a list of styles and classes of "appendNode" in "styleArray" to avoid duplicate property values.
473
- * 7. If a node with all styles and classes removed has the same tag name as "appendNode" or "removeNodeArray", or "appendNode" is null, that node is deleted.
474
- * 8. Regardless of the style and class of the node, the tag with the same name as the "removeNodeArray" argument value is deleted.
475
- * 9. If the "strictRemove" argument is true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.
476
- * 10. It won't work if the parent node has the same class and same value style.
477
- * However, if there is a value in "removeNodeArray", it works and the text node is separated even if there is no node to replace.
478
- * @param appendNode The element to be added to the selection. If it is null, only delete the node.
479
- * @param styleArray The style or className attribute name Array to check (['font-size'], ['.className'], ['font-family', 'color', '.className']...])
480
- * @param removeNodeArray An array of node names to remove types from, remove all formats when "appendNode" is null and there is an empty array or null value. (['span'], ['strong', 'em'] ...])
481
- * @param strictRemove If true, only nodes with all styles and classes removed from the nodes of "removeNodeArray" are removed.
482
- */
483
- nodeChange(appendNode?: Element, styleArray?: string[], removeNodeArray?: string[], strictRemove?: boolean): void;
484
-
485
- /**
486
- * @description Run plugin calls and basic commands.
487
- * @param command Command string
488
- * @param display Display type string ('command', 'submenu', 'dialog', 'container')
489
- * @param target The element of command button
490
- */
491
- actionCall(command: string, display: 'command' | 'submenu' | 'dialog' | 'container', target: Element): void;
492
-
493
- /**
494
- * @description Execute command of command button(All Buttons except submenu and dialog)
495
- * (undo, redo, bold, underline, italic, strikethrough, subscript, superscript, removeFormat, indent, outdent, fullscreen, showBlocks, codeview, preview, print, copy, cut, paste)
496
- * @param target The element of command button
497
- * @param command Property of command button (data-value)
498
- */
499
- commandHandler(target: Element | null, command: commands): void;
500
-
501
- /**
502
- * @description Remove format of the currently selected range
503
- */
504
- removeFormat(): void;
505
-
506
- /**
507
- * @description This method implements indentation to selected range.
508
- * Setted "margin-left" to "25px" in the top "P" tag of the parameter node.
509
- * @param command Separator ("indent" or "outdent")
510
- */
511
- indent(command: 'indent' | 'outdent'): void;
512
-
513
- /**
514
- * @description Add or remove the class name of "body" so that the code block is visible
515
- */
516
- toggleDisplayBlocks(): void;
517
-
518
- /**
519
- * @description Changes to code view or wysiwyg view
520
- */
521
- toggleCodeView(): void;
522
-
523
- /**
524
- * @description Changes to full screen or default screen
525
- * @param element full screen button
526
- */
527
- toggleFullScreen(element: Element | null): void;
528
-
529
- /**
530
- * @description Prints the current contents of the editor.
531
- */
532
- print(): void;
533
-
534
- /**
535
- * @description Open the preview window.
536
- */
537
- preview(): void;
538
-
539
- /**
540
- * @description Set direction to "rtl" or "ltr".
541
- * @param dir "rtl" or "ltr"
542
- */
543
- setDir(dir: 'rtl' | 'ltr'): void;
544
-
545
- /**
546
- * @description Sets the HTML string
547
- * @param html HTML string
548
- */
549
- setContents(html: string): void;
550
-
551
- /**
552
- * @description Sets the contents of the iframe's head tag and body tag when using the "iframe" or "fullPage" option.
553
- * @param ctx { head: HTML string, body: HTML string}
554
- */
555
- setIframeContents(ctx: { head?: string, body?: string }): void;
556
-
557
- /**
558
- * @description Gets the current contents
559
- * @param onlyContents Return only the contents of the body without headers when the "fullPage" option is true
560
- * @returns
561
- */
562
- getContents(onlyContents: boolean): string;
563
-
564
- /**
565
- * @description Gets the current contents with containing parent div(div.sun-editor-editable).
566
- * <div class="sun-editor-editable">{contents}</div>
567
- * @param onlyContents Return only the contents of the body without headers when the "fullPage" option is true
568
- * @returns
569
- */
570
- getFullContents(onlyContents: boolean): string;
571
-
572
- /**
573
- * @description Gets the clean HTML code for editor
574
- * @param html HTML string
575
- * @param whitelist Regular expression of allowed tags.
576
- * RegExp object is create by util.createTagsWhitelist method. (core.pasteTagsWhitelistRegExp)
577
- * @param blacklist Regular expression of disallowed tags.
578
- * RegExp object is create by util.createTagsBlacklist method. (core.pasteTagsBlacklistRegExp)
579
- * @returns
580
- */
581
- cleanHTML(html: string, whitelist?: string | RegExp, blacklist?: string | RegExp): string;
582
-
583
- /**
584
- * @description Converts contents into a format that can be placed in an editor
585
- * @param contents contents
586
- * @returns
587
- */
588
- convertContentsForEditor(contents: string): string;
589
-
590
- /**
591
- * @description Converts wysiwyg area element into a format that can be placed in an editor of code view mode
592
- * @param html WYSIWYG element (context.element.wysiwyg) or HTML string.
593
- * @param comp If true, does not line break and indentation of tags.
594
- * @returns
595
- */
596
- convertHTMLForCodeView(html: Element | string, comp?: boolean): string;
597
-
598
- /**
599
- * @description Add an event to document.
600
- * When created as an Iframe, the same event is added to the document in the Iframe.
601
- * @param type Event type
602
- * @param listener Event listener
603
- * @param useCapture Use event capture
604
- */
605
- addDocEvent(type: string, listener: EventListener, useCapture: boolean): void;
606
-
607
- /**
608
- * @description Remove events from document.
609
- * When created as an Iframe, the event of the document inside the Iframe is also removed.
610
- * @param type Event type
611
- * @param listener Event listener
612
- */
613
- removeDocEvent(type: string, listener: EventListener): void;
614
-
615
- /**
616
- * @description When "element" is added, if it is greater than "options.maxCharCount", false is returned.
617
- * @param element Element node or String.
618
- * @param charCounterType charCounterType. If it is null, the options.charCounterType
619
- */
620
- checkCharCount(element: Node | string, charCounterType?: string): boolean;
621
-
622
- /**
623
- * @description Get the length of the content.
624
- * Depending on the option, the length of the character is taken. (charCounterType)
625
- * @param content Content to count
626
- * @param charCounterType options.charCounterType
627
- */
628
- getCharLength(content: string, charCounterType: string): number;
629
- }
630
-
631
- interface Toolbar {
632
- /**
633
- * @description Disable the toolbar
634
- */
635
- disable(): void;
636
-
637
- /**
638
- * @description Enable the toolbar
639
- */
640
- enable(): void;
641
-
642
- /**
643
- * @description Show the toolbar
644
- */
645
- show(): void;
646
-
647
- /**
648
- * @description Hide the toolbar
649
- */
650
- hide(): void;
651
- }
652
-
653
- interface Wysiwyg {
654
- /**
655
- * @description Disable the wysiwyg area
656
- */
657
- disable(): void;
658
-
659
- /**
660
- * @description Enable the wysiwyg area
661
- */
662
- enable(): void;
663
- }
664
-
665
- type EventFn = (e: Event, core: Core) => void;
666
-
667
- type imageInputInformation = { linkValue: string, linkNewWindow: Window, inputWidth: number, inputHeight: number, align: string, isUpdate: boolean, element: any };
668
- type videoInputInformation = { inputWidth: number, inputHeight: number, align: string, isUpdate: boolean, element: any };
669
- type audioInputInformation = { isUpdate: boolean, element: any };
670
-
671
- export default class SunEditor {
672
- constructor(context: Context,
673
- pluginCallButtons: Record<string, Element>,
674
- plugins: Record<string, Plugin>,
675
- lang: Lang,
676
- options: SunEditorOptions,
677
- _icons: Record<string, string>)
678
-
679
- core: Core;
680
- util: Util;
681
-
682
- onload: (core: Core, reload: boolean) => void;
683
- onScroll: EventFn;
684
- onFocus: EventFn;
685
- onMouseDown: EventFn;
686
- onClick: EventFn;
687
- onInput: EventFn;
688
- onKeyDown: EventFn;
689
- onKeyUp: EventFn;
690
- onChange: (contents: string, core: Core) => void;
691
- onBlur: (e: FocusEvent, core: Core) => void;
692
- onDrop: (e: Event, cleanData: string, maxCharCount: number, core: Core) => boolean | string;
693
- onPaste: (e: Event, cleanData: string, maxCharCount: number, core: Core) => boolean | string;
694
- onCopy: (e: Event, clipboardData: any, core: Core) => boolean;
695
- onCut: (e: Event, clipboardData: any, core: Core) => boolean;
696
-
697
- /**
698
- * @description Called just after the save was executed.
699
- * @param contents Editor content
700
- * @param core Core object
701
- */
702
- onSave: (contents: string, core: Core) => void;
703
-
704
- /**
705
- * @description Called just before the inline toolbar is positioned and displayed on the screen.
706
- * @param toolbar Toolbar Element
707
- * @param context The editor's context object (editor.getContext())
708
- * @param core Core object
709
- */
710
- showInline: (toolbar: Element, context: Context, core: Core) => void;
711
-
712
- /**
713
- * @description Called just after the controller is positioned and displayed on the screen.
714
- * controller - editing elements displayed on the screen [image resizing, table editor, link editor..]]
715
- * @param name The name of the plugin that called the controller
716
- * @param controllers Array of Controller elements
717
- * @param core Core object
718
- */
719
- showController: (name: String, controllers: Controllers, core: Core) => void;
720
-
721
- /**
722
- * @description It replaces the default callback function of the image upload
723
- * @param xmlHttp xmlHttpRequest object
724
- * @param info Input information
725
- * - linkValue: Link url value
726
- * - linkNewWindow: Open in new window Check Value
727
- * - inputWidth: Value of width input
728
- * - inputHeight: Value of height input
729
- * - align: Align Check Value
730
- * - isUpdate: Update image if true, create image if false
731
- * - element: If isUpdate is true, the currently selected image.
732
- * @param core Core object
733
- */
734
- imageUploadHandler: (xmlHttp: XMLHttpRequest, info: imageInputInformation, core: Core) => void;
735
-
736
- /**
737
- * @description It replaces the default callback function of the video upload
738
- * @param xmlHttp xmlHttpRequest object
739
- * @param info Input information
740
- * - inputWidth: Value of width input
741
- * - inputHeight: Value of height input
742
- * - align: Align Check Value
743
- * - isUpdate: Update video if true, create video if false
744
- * - element: If isUpdate is true, the currently selected video.
745
- * @param core Core object
746
- */
747
- videoUploadHandler: (xmlHttp: XMLHttpRequest, info: videoInputInformation, core: Core) => void;
748
-
749
- /**
750
- * @description It replaces the default callback function of the audio upload
751
- * @param xmlHttp xmlHttpRequest object
752
- * @param info Input information
753
- * - isUpdate: Update audio if true, create audio if false
754
- * - element: If isUpdate is true, the currently selected audio.
755
- * @param core Core object
756
- */
757
- audioUploadHandler: (xmlHttp: XMLHttpRequest, info: audioInputInformation, core: Core) => void;
758
-
759
- /**
760
- * @description An event when toggling between code view and wysiwyg view.
761
- * @param isCodeView Whether the current code view mode
762
- * @param core Core object
763
- */
764
- toggleCodeView: (isCodeView: boolean, core: Core) => void;
765
-
766
- /**
767
- * @description An event when toggling full screen.
768
- * @param isFullScreen Whether the current full screen mode
769
- * @param core Core object
770
- */
771
- toggleFullScreen: (isFullScreen: boolean, core: Core) => void;
772
-
773
- /**
774
- * @description Called before the image is uploaded
775
- * If true is returned, the internal upload process runs normally.
776
- * If false is returned, no image upload is performed.
777
- * If new fileList are returned, replaced the previous fileList
778
- * If undefined is returned, it waits until "uploadHandler" is executed.
779
- * @param files Files array
780
- * @param info Input information
781
- * @param core Core object
782
- * @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
783
- * "uploadHandler" is an upload function with "core" and "info" bound.
784
- * [upload files] : uploadHandler(files or [new File(...),])
785
- * [error] : uploadHandler("Error message")
786
- * [Just finish] : uploadHandler()
787
- * [directly register] : uploadHandler(response) // Same format as "imageUploadUrl" response
788
- * ex) {
789
- * // "errorMessage": "insert error message",
790
- * "result": [ { "url": "...", "name": "...", "size": "999" }, ]
791
- * }
792
- * @returns
793
- */
794
- onImageUploadBefore: (files: any[], info: imageInputInformation, core: Core, uploadHandler: Function) => boolean | any[] | undefined;
795
-
796
- /**
797
- * @description Called before the video is uploaded
798
- * If true is returned, the internal upload process runs normally.
799
- * If false is returned, no video upload is performed.
800
- * If new fileList are returned, replaced the previous fileList
801
- * If undefined is returned, it waits until "uploadHandler" is executed.
802
- * @param files Files array
803
- * @param info Input information
804
- * @param core Core object
805
- * @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
806
- * "uploadHandler" is an upload function with "core" and "info" bound.
807
- * [upload files] : uploadHandler(files or [new File(...),])
808
- * [error] : uploadHandler("Error message")
809
- * [Just finish] : uploadHandler()
810
- * [directly register] : uploadHandler(response) // Same format as "videoUploadUrl" response
811
- * ex) {
812
- * // "errorMessage": "insert error message",
813
- * "result": [ { "url": "...", "name": "...", "size": "999" }, ]
814
- * }
815
- * @returns
816
- */
817
- onVideoUploadBefore: (files: any[], info: videoInputInformation, core: Core, uploadHandler: Function) => boolean | any[] | undefined;
818
-
819
- /**
820
- * @description Called before the audio is uploaded
821
- * If true is returned, the internal upload process runs normally.
822
- * If false is returned, no audio upload is performed.
823
- * If new fileList are returned, replaced the previous fileList
824
- * If undefined is returned, it waits until "uploadHandler" is executed.
825
- * @param files Files array
826
- * @param info Input information
827
- * @param core Core object
828
- * @param uploadHandler If undefined is returned, it waits until "uploadHandler" is executed.
829
- * "uploadHandler" is an upload function with "core" and "info" bound.
830
- * [upload files] : uploadHandler(files or [new File(...),])
831
- * [error] : uploadHandler("Error message")
832
- * [Just finish] : uploadHandler()
833
- * [directly register] : uploadHandler(response) // Same format as "audioUploadUrl" response
834
- * ex) {
835
- * // "errorMessage": "insert error message",
836
- * "result": [ { "url": "...", "name": "...", "size": "999" }, ]
837
- * }
838
- * @returns
839
- */
840
- onAudioUploadBefore: (files: any[], info: audioInputInformation, core: Core, uploadHandler: Function) => boolean | any[] | undefined;
841
-
842
- /**
843
- * @description Called when the image is uploaded, updated, deleted
844
- * @param targetElement Target element
845
- * @param index Uploaded index
846
- * @param state Upload status ('create', 'update', 'delete')
847
- * @param info Info object
848
- * - index: data index
849
- * - name: file name
850
- * - size: file size
851
- * - select: select function
852
- * - delete: delete function
853
- * - element: target element
854
- * - src: src attribute of tag
855
- * @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
856
- * @param core Core object
857
- */
858
- onImageUpload: (targetElement: HTMLImageElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number, core: Core) => void;
859
-
860
- /**
861
- * @description Called when the video(iframe, video) is uploaded, updated, deleted
862
- * @param targetElement Target element
863
- * @param index Uploaded index
864
- * @param state Upload status ('create', 'update', 'delete')
865
- * @param info Info object
866
- * - index: data index
867
- * - name: file name
868
- * - size: file size
869
- * - select: select function
870
- * - delete: delete function
871
- * - element: target element
872
- * - src: src attribute of tag
873
- * @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
874
- * @param core Core object
875
- */
876
- onVideoUpload: (targetElement: HTMLIFrameElement | HTMLVideoElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number, core: Core) => void;
877
-
878
- /**
879
- * @description Called when the audio is uploaded, updated, deleted
880
- * @param targetElement Target element
881
- * @param index Uploaded index
882
- * @param state Upload status ('create', 'update', 'delete')
883
- * @param info Info object
884
- * - index: data index
885
- * - name: file name
886
- * - size: file size
887
- * - select: select function
888
- * - delete: delete function
889
- * - element: target element
890
- * - src: src attribute of tag
891
- * @param remainingFilesCount Count of remaining files to upload (0 when added as a url)
892
- * @param core Core object
893
- */
894
- onAudioUpload: (targetElement: HTMLAudioElement, index: number, state: 'create' | 'update' | 'delete', info: fileInfo, remainingFilesCount: number, core: Core) => void;
895
-
896
- /**
897
- * @description Called when the image is upload failed
898
- * @param errorMessage Error message
899
- * @param result Response Object
900
- * @param core Core object
901
- * @returns
902
- */
903
- onImageUploadError: (errorMessage: string, result: any, core: Core) => boolean;
904
-
905
- /**
906
- * @description Called when the video(iframe, video) upload failed
907
- * @param errorMessage Error message
908
- * @param result Response Object
909
- * @param core Core object
910
- * @returns
911
- */
912
- onVideoUploadError: (errorMessage: string, result: any, core: Core) => boolean;
913
-
914
- /**
915
- * @description Called when the audio upload failed
916
- * @param errorMessage Error message
917
- * @param result Response Object
918
- * @param core Core object
919
- * @returns
920
- */
921
- onAudioUploadError: (errorMessage: string, result: any, core: Core) => boolean;
922
-
923
- /**
924
- * @description Called when the audio image delete before.
925
- * "false" is returned, the event will be aborted.
926
- * @param targetElement target element
927
- * @param container target's container
928
- * @param dataIndex target's dataIndex
929
- * @param core Core object
930
- * @returns {boolean|undefined}
931
- */
932
- onAudioDeleteBefore: (targetElement: Element, container: Element, dataIndex: number, core: Core) => boolean;
933
-
934
- /**
935
- * @description Called when the image image delete before.
936
- * "false" is returned, the event will be aborted.
937
- * @param targetElement target element
938
- * @param container target's container
939
- * @param dataIndex target's dataIndex
940
- * @param core Core object
941
- * @returns {boolean|undefined}
942
- */
943
- onImageDeleteBefore: (targetElement: Element, container: Element, dataIndex: number, core: Core) => boolean;
944
-
945
- /**
946
- * @description Called when the image image delete before.
947
- * "false" is returned, the event will be aborted.
948
- * @param targetElement target element
949
- * @param container target's container
950
- * @param dataIndex target's dataIndex
951
- * @param core Core object
952
- * @returns {boolean|undefined}
953
- */
954
- onVideoDeleteBefore: (targetElement: Element, container: Element, dataIndex: number, core: Core) => boolean;
955
-
956
- /**
957
- * @description Called when the audio upload failed
958
- * @param height Height after resized (px)
959
- * @param prevHeight Prev height before resized (px)
960
- * @param core Core object
961
- * @param resizeObserverEntry ResizeObserverEntry object (This is not provided in IE Browser.)
962
- * @returns
963
- */
964
- onResizeEditor: (height: number, prevHeight: number, core: Core, resizeObserverEntry: ResizeObserverEntry | null) => {};
965
-
966
- /**
967
- * @description Called after the "setToolbarButtons" invocation.
968
- * Can be used to tweak buttons properties (useful for custom buttons)
969
- * @param buttonList Button list
970
- * @param core Core object
971
- */
972
- onSetToolbarButtons: (buttonList: any[], core: Core) => void;
973
-
974
- /**
975
- * @description Reset the buttons on the toolbar. (Editor is not reloaded)
976
- * You cannot set a new plugin for the button.
977
- * @param buttonList Button list
978
- */
979
- setToolbarButtons(buttonList: any[]): void;
980
-
981
- /**
982
- * @description Add or reset option property
983
- * @param options Options
984
- */
985
- setOptions(options: SunEditorOptions): void;
986
-
987
- /**
988
- * @description Set "options.defaultStyle" style.
989
- * Define the style of the edit area
990
- * It can also be defined with the "setOptions" method, but the "setDefaultStyle" method does not render the editor again.
991
- * @param style Style string
992
- */
993
- setDefaultStyle(style: string): void;
994
-
995
- /**
996
- * @description Open a notice area
997
- * @param message Notice message
998
- */
999
- noticeOpen(message: string): void;
1000
-
1001
- /**
1002
- * @description Close a notice area
1003
- */
1004
- noticeClose(): void;
1005
-
1006
- /**
1007
- * @description Copying the contents of the editor to the original textarea
1008
- */
1009
- save(): void;
1010
-
1011
- /**
1012
- * @description Gets the suneditor's context object. Contains settings, plugins, and cached element objects
1013
- * @returns
1014
- */
1015
- getContext(): Context;
1016
-
1017
- /**
1018
- * @description Gets the contents of the suneditor
1019
- * @param onlyContents - Return only the contents of the body without headers when the "fullPage" option is true
1020
- * @returns
1021
- */
1022
- getContents(onlyContents: boolean): string;
1023
-
1024
- /**
1025
- * @description Gets only the text of the suneditor contents
1026
- * @returns
1027
- */
1028
- getText(): string;
1029
-
1030
- /**
1031
- * @description Get the editor's number of characters or binary data size.
1032
- * You can use the "charCounterType" option format.
1033
- * @param charCounterType options - charCounterType ('char', 'byte', 'byte-html')
1034
- * If argument is no value, the currently set "charCounterType" option is used.
1035
- * @returns
1036
- */
1037
- getCharCount(charCounterType?: string): number;
1038
-
1039
- /**
1040
- * @description Gets uploaded images informations
1041
- * - index: data index
1042
- * - name: file name
1043
- * - size: file size
1044
- * - select: select function
1045
- * - delete: delete function
1046
- * - element: img element
1047
- * - src: src attribute of img tag
1048
- * @returns
1049
- */
1050
- getImagesInfo(): fileInfo[];
1051
-
1052
- /**
1053
- * @description Gets uploaded files(plugin using fileManager) information list.
1054
- * image: [img], video: [video, iframe], audio: [audio]
1055
- * When the argument value is 'image', it is the same function as "getImagesInfo".
1056
- * - index: data index
1057
- * - name: file name
1058
- * - size: file size
1059
- * - select: select function
1060
- * - delete: delete function
1061
- * - element: img element
1062
- * - src: src attribute of img tag
1063
- * @param pluginName Plugin name (image, video, audio)
1064
- * @returns
1065
- */
1066
- getFilesInfo(pluginName: string): fileInfo[];
1067
-
1068
- /**
1069
- * @description Upload images using image plugin
1070
- * @param files FileList
1071
- */
1072
- insertImage(files: FileList): void;
1073
-
1074
- /**
1075
- * @description Inserts an HTML element or HTML string or plain string at the current cursor position
1076
- * @param html HTML Element or HTML string or plain string
1077
- * @param notCleaningData If true, inserts the HTML string without refining it with core.cleanHTML.
1078
- * @param checkCharCount If true, if "options.maxCharCount" is exceeded when "element" is added, null is returned without addition.
1079
- * @param rangeSelection If true, range select the inserted node.
1080
- */
1081
- insertHTML(html: Element | string, notCleaningData?: boolean, checkCharCount?: boolean, rangeSelection?: boolean): void;
1082
-
1083
- /**
1084
- * @description Change the contents of the suneditor
1085
- * @param contents Contents to Input
1086
- */
1087
- setContents(contents: string): void;
1088
-
1089
- /**
1090
- * @description Add contents to the suneditor
1091
- * @param contents Contents to Input
1092
- */
1093
- appendContents(contents: string): void;
1094
-
1095
- /**
1096
- * @description Switch to or off "ReadOnly" mode.
1097
- * @param value "readOnly" boolean value.
1098
- */
1099
- readOnly(value: boolean): void;
1100
-
1101
- /**
1102
- * @description Disable the suneditor
1103
- */
1104
- disable(): void;
1105
-
1106
- /**
1107
- * @description Enable the suneditor
1108
- */
1109
- enable(): void;
1110
-
1111
- /**
1112
- * @description Show the suneditor
1113
- */
1114
- show(): void;
1115
-
1116
- /**
1117
- * @description Hide the suneditor
1118
- */
1119
- hide(): void;
1120
-
1121
- /**
1122
- * @description Destroy the suneditor
1123
- */
1124
- destroy(): void;
1125
-
1126
- /**
1127
- * @description Toolbar methods
1128
- */
1129
- toolbar: Toolbar;
1130
-
1131
- /**
1132
- * @description Wysiwyg methods
1133
- */
1134
- wysiwyg: Wysiwyg;
1135
- }