suneditor 2.46.2 → 3.0.0-alpha.1

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 (290) 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 +174 -805
  6. package/dist/suneditor.min.css +1 -0
  7. package/dist/suneditor.min.js +1 -2
  8. package/package.json +96 -69
  9. package/src/assets/icons/_default.js +194 -0
  10. package/src/assets/suneditor-content.css +646 -0
  11. package/src/assets/suneditor.css +3378 -0
  12. package/src/core/base/eventHandlers/handler_toolbar.js +114 -0
  13. package/src/core/base/eventHandlers/handler_ww_clipboard.js +31 -0
  14. package/src/core/base/eventHandlers/handler_ww_dragDrop.js +69 -0
  15. package/src/core/base/eventHandlers/handler_ww_key_input.js +975 -0
  16. package/src/core/base/eventHandlers/handler_ww_mouse.js +118 -0
  17. package/src/core/base/eventManager.js +1115 -0
  18. package/src/core/base/events.js +320 -0
  19. package/src/core/base/history.js +301 -0
  20. package/src/core/class/char.js +146 -0
  21. package/src/core/class/component.js +627 -0
  22. package/src/core/class/format.js +3255 -0
  23. package/src/core/class/html.js +1621 -0
  24. package/src/core/class/menu.js +260 -0
  25. package/src/core/class/nodeTransform.js +379 -0
  26. package/src/core/class/notice.js +42 -0
  27. package/src/core/class/offset.js +578 -0
  28. package/src/core/class/selection.js +508 -0
  29. package/src/core/class/shortcuts.js +38 -0
  30. package/src/core/class/toolbar.js +440 -0
  31. package/src/core/class/viewer.js +646 -0
  32. package/src/core/editor.js +1593 -0
  33. package/src/core/section/actives.js +107 -0
  34. package/src/core/section/constructor.js +1237 -0
  35. package/src/core/section/context.js +97 -0
  36. package/src/editorInjector/_classes.js +22 -0
  37. package/src/editorInjector/_core.js +28 -0
  38. package/src/editorInjector/index.js +13 -0
  39. package/src/helper/converter.js +313 -0
  40. package/src/helper/domUtils.js +1177 -0
  41. package/src/helper/env.js +250 -0
  42. package/src/helper/index.js +19 -0
  43. package/src/helper/numbers.js +68 -0
  44. package/src/helper/unicode.js +43 -0
  45. package/src/langs/ckb.js +161 -0
  46. package/src/langs/cs.js +161 -0
  47. package/src/langs/da.js +161 -0
  48. package/src/langs/de.js +162 -0
  49. package/src/langs/en.js +199 -0
  50. package/src/langs/es.js +162 -0
  51. package/src/langs/fa.js +159 -0
  52. package/src/langs/fr.js +161 -0
  53. package/src/langs/he.js +162 -0
  54. package/src/{lang → langs}/index.js +0 -2
  55. package/src/langs/it.js +162 -0
  56. package/src/langs/ja.js +162 -0
  57. package/src/langs/ko.js +162 -0
  58. package/src/langs/lv.js +162 -0
  59. package/src/langs/nl.js +162 -0
  60. package/src/langs/pl.js +162 -0
  61. package/src/langs/pt_br.js +162 -0
  62. package/src/langs/ro.js +162 -0
  63. package/src/langs/ru.js +162 -0
  64. package/src/langs/se.js +162 -0
  65. package/src/langs/tr.js +159 -0
  66. package/src/langs/ua.js +162 -0
  67. package/src/langs/ur.js +162 -0
  68. package/src/langs/zh_cn.js +162 -0
  69. package/src/modules/ApiManager.js +168 -0
  70. package/src/modules/ColorPicker.js +302 -0
  71. package/src/modules/Controller.js +315 -0
  72. package/src/modules/Figure.js +1160 -0
  73. package/src/modules/FileBrowser.js +271 -0
  74. package/src/modules/FileManager.js +290 -0
  75. package/src/modules/HueSlider.js +513 -0
  76. package/src/modules/Modal.js +177 -0
  77. package/src/modules/ModalAnchorEditor.js +494 -0
  78. package/src/modules/SelectMenu.js +447 -0
  79. package/src/modules/_DragHandle.js +16 -0
  80. package/src/modules/index.js +14 -0
  81. package/src/plugins/command/blockquote.js +47 -47
  82. package/src/plugins/command/exportPdf.js +168 -0
  83. package/src/plugins/command/fileUpload.js +389 -0
  84. package/src/plugins/command/list_bulleted.js +112 -0
  85. package/src/plugins/command/list_numbered.js +115 -0
  86. package/src/plugins/dropdown/align.js +143 -0
  87. package/src/plugins/dropdown/backgroundColor.js +73 -0
  88. package/src/plugins/dropdown/font.js +113 -0
  89. package/src/plugins/dropdown/fontColor.js +73 -0
  90. package/src/plugins/dropdown/formatBlock.js +141 -0
  91. package/src/plugins/dropdown/hr.js +111 -0
  92. package/src/plugins/dropdown/layout.js +72 -0
  93. package/src/plugins/dropdown/lineHeight.js +114 -0
  94. package/src/plugins/dropdown/list.js +107 -0
  95. package/src/plugins/dropdown/paragraphStyle.js +117 -0
  96. package/src/plugins/dropdown/table.js +2810 -0
  97. package/src/plugins/dropdown/template.js +71 -0
  98. package/src/plugins/dropdown/textStyle.js +137 -0
  99. package/src/plugins/field/mention.js +172 -0
  100. package/src/plugins/fileBrowser/imageGallery.js +76 -59
  101. package/src/plugins/index.js +86 -24
  102. package/src/plugins/input/fontSize.js +357 -0
  103. package/src/plugins/modal/audio.js +510 -0
  104. package/src/plugins/modal/image.js +1062 -0
  105. package/src/plugins/modal/link.js +211 -0
  106. package/src/plugins/modal/math.js +347 -0
  107. package/src/plugins/modal/video.js +870 -0
  108. package/src/suneditor.js +62 -67
  109. package/src/themes/test.css +61 -0
  110. package/typings/CommandPlugin.d.ts +8 -0
  111. package/typings/DialogPlugin.d.ts +20 -0
  112. package/typings/FileBrowserPlugin.d.ts +30 -0
  113. package/typings/Lang.d.ts +124 -0
  114. package/typings/Module.d.ts +15 -0
  115. package/typings/Plugin.d.ts +42 -0
  116. package/typings/SubmenuPlugin.d.ts +8 -0
  117. package/typings/_classes.d.ts +17 -0
  118. package/typings/_colorPicker.d.ts +60 -0
  119. package/typings/_core.d.ts +55 -0
  120. package/typings/align.d.ts +5 -0
  121. package/{src/plugins/dialog → typings}/audio.d.ts +1 -1
  122. package/typings/backgroundColor.d.ts +5 -0
  123. package/{src/plugins/command → typings}/blockquote.d.ts +1 -1
  124. package/typings/char.d.ts +39 -0
  125. package/typings/component.d.ts +38 -0
  126. package/typings/context.d.ts +39 -0
  127. package/typings/converter.d.ts +33 -0
  128. package/typings/dialog.d.ts +28 -0
  129. package/typings/domUtils.d.ts +361 -0
  130. package/typings/editor.d.ts +7 -0
  131. package/typings/editor.ts +542 -0
  132. package/typings/env.d.ts +70 -0
  133. package/typings/eventManager.d.ts +37 -0
  134. package/typings/events.d.ts +262 -0
  135. package/typings/fileBrowser.d.ts +42 -0
  136. package/typings/fileManager.d.ts +67 -0
  137. package/typings/font.d.ts +5 -0
  138. package/typings/fontColor.d.ts +5 -0
  139. package/typings/fontSize.d.ts +5 -0
  140. package/typings/format.d.ts +191 -0
  141. package/typings/formatBlock.d.ts +5 -0
  142. package/typings/history.d.ts +48 -0
  143. package/typings/horizontalRule.d.ts +5 -0
  144. package/{src/plugins/dialog → typings}/image.d.ts +1 -1
  145. package/{src/plugins/fileBrowser → typings}/imageGallery.d.ts +1 -1
  146. package/typings/index.d.ts +21 -0
  147. package/{src/plugins/modules/index.d.ts → typings/index.modules.d.ts} +3 -3
  148. package/typings/index.plugins.d.ts +58 -0
  149. package/typings/lineHeight.d.ts +5 -0
  150. package/{src/plugins/dialog → typings}/link.d.ts +1 -1
  151. package/typings/list.d.ts +5 -0
  152. package/{src/plugins/dialog → typings}/math.d.ts +1 -1
  153. package/typings/mediaContainer.d.ts +25 -0
  154. package/typings/node.d.ts +57 -0
  155. package/typings/notice.d.ts +16 -0
  156. package/typings/numbers.d.ts +29 -0
  157. package/typings/offset.d.ts +24 -0
  158. package/typings/options.d.ts +589 -0
  159. package/typings/paragraphStyle.d.ts +5 -0
  160. package/typings/resizing.d.ts +141 -0
  161. package/typings/selection.d.ts +94 -0
  162. package/typings/shortcuts.d.ts +13 -0
  163. package/typings/suneditor.d.ts +9 -0
  164. package/typings/table.d.ts +5 -0
  165. package/typings/template.d.ts +5 -0
  166. package/typings/textStyle.d.ts +5 -0
  167. package/typings/toolbar.d.ts +32 -0
  168. package/typings/unicode.d.ts +25 -0
  169. package/{src/plugins/dialog → typings}/video.d.ts +1 -1
  170. package/dist/css/suneditor.min.css +0 -1
  171. package/src/assets/css/suneditor-contents.css +0 -562
  172. package/src/assets/css/suneditor.css +0 -566
  173. package/src/assets/defaultIcons.js +0 -103
  174. package/src/lang/Lang.d.ts +0 -144
  175. package/src/lang/ckb.d.ts +0 -5
  176. package/src/lang/ckb.js +0 -188
  177. package/src/lang/cs.d.ts +0 -5
  178. package/src/lang/cs.js +0 -188
  179. package/src/lang/da.d.ts +0 -5
  180. package/src/lang/da.js +0 -191
  181. package/src/lang/de.d.ts +0 -5
  182. package/src/lang/de.js +0 -188
  183. package/src/lang/en.d.ts +0 -5
  184. package/src/lang/en.js +0 -188
  185. package/src/lang/es.d.ts +0 -5
  186. package/src/lang/es.js +0 -188
  187. package/src/lang/fa.d.ts +0 -5
  188. package/src/lang/fa.js +0 -188
  189. package/src/lang/fr.d.ts +0 -5
  190. package/src/lang/fr.js +0 -188
  191. package/src/lang/he.d.ts +0 -5
  192. package/src/lang/he.js +0 -188
  193. package/src/lang/index.d.ts +0 -23
  194. package/src/lang/it.d.ts +0 -5
  195. package/src/lang/it.js +0 -188
  196. package/src/lang/ja.d.ts +0 -5
  197. package/src/lang/ja.js +0 -188
  198. package/src/lang/ko.d.ts +0 -5
  199. package/src/lang/ko.js +0 -188
  200. package/src/lang/lv.d.ts +0 -5
  201. package/src/lang/lv.js +0 -188
  202. package/src/lang/nl.d.ts +0 -5
  203. package/src/lang/nl.js +0 -188
  204. package/src/lang/pl.d.ts +0 -5
  205. package/src/lang/pl.js +0 -188
  206. package/src/lang/pt_br.d.ts +0 -5
  207. package/src/lang/pt_br.js +0 -189
  208. package/src/lang/ro.d.ts +0 -5
  209. package/src/lang/ro.js +0 -188
  210. package/src/lang/ru.d.ts +0 -5
  211. package/src/lang/ru.js +0 -188
  212. package/src/lang/se.d.ts +0 -5
  213. package/src/lang/se.js +0 -191
  214. package/src/lang/tr.d.ts +0 -5
  215. package/src/lang/tr.js +0 -191
  216. package/src/lang/ua.d.ts +0 -5
  217. package/src/lang/ua.js +0 -188
  218. package/src/lang/ur.d.ts +0 -5
  219. package/src/lang/ur.js +0 -188
  220. package/src/lang/zh_cn.d.ts +0 -5
  221. package/src/lang/zh_cn.js +0 -187
  222. package/src/lib/constructor.js +0 -954
  223. package/src/lib/context.d.ts +0 -42
  224. package/src/lib/context.js +0 -71
  225. package/src/lib/core.d.ts +0 -1135
  226. package/src/lib/core.js +0 -9395
  227. package/src/lib/history.d.ts +0 -48
  228. package/src/lib/history.js +0 -219
  229. package/src/lib/util.d.ts +0 -678
  230. package/src/lib/util.js +0 -2131
  231. package/src/options.d.ts +0 -608
  232. package/src/plugins/CommandPlugin.d.ts +0 -8
  233. package/src/plugins/DialogPlugin.d.ts +0 -20
  234. package/src/plugins/FileBrowserPlugin.d.ts +0 -30
  235. package/src/plugins/Module.d.ts +0 -15
  236. package/src/plugins/Plugin.d.ts +0 -42
  237. package/src/plugins/SubmenuPlugin.d.ts +0 -8
  238. package/src/plugins/dialog/audio.js +0 -559
  239. package/src/plugins/dialog/image.js +0 -1126
  240. package/src/plugins/dialog/link.js +0 -223
  241. package/src/plugins/dialog/math.js +0 -295
  242. package/src/plugins/dialog/mention.js +0 -242
  243. package/src/plugins/dialog/video.js +0 -979
  244. package/src/plugins/index.d.ts +0 -79
  245. package/src/plugins/modules/_anchor.js +0 -461
  246. package/src/plugins/modules/_colorPicker.d.ts +0 -60
  247. package/src/plugins/modules/_colorPicker.js +0 -201
  248. package/src/plugins/modules/_notice.d.ts +0 -21
  249. package/src/plugins/modules/_notice.js +0 -72
  250. package/src/plugins/modules/_selectMenu.js +0 -119
  251. package/src/plugins/modules/component.d.ts +0 -25
  252. package/src/plugins/modules/component.js +0 -81
  253. package/src/plugins/modules/dialog.d.ts +0 -28
  254. package/src/plugins/modules/dialog.js +0 -175
  255. package/src/plugins/modules/fileBrowser.d.ts +0 -42
  256. package/src/plugins/modules/fileBrowser.js +0 -374
  257. package/src/plugins/modules/fileManager.d.ts +0 -67
  258. package/src/plugins/modules/fileManager.js +0 -326
  259. package/src/plugins/modules/index.js +0 -9
  260. package/src/plugins/modules/resizing.d.ts +0 -154
  261. package/src/plugins/modules/resizing.js +0 -903
  262. package/src/plugins/submenu/align.d.ts +0 -5
  263. package/src/plugins/submenu/align.js +0 -160
  264. package/src/plugins/submenu/font.d.ts +0 -5
  265. package/src/plugins/submenu/font.js +0 -123
  266. package/src/plugins/submenu/fontColor.d.ts +0 -5
  267. package/src/plugins/submenu/fontColor.js +0 -101
  268. package/src/plugins/submenu/fontSize.d.ts +0 -5
  269. package/src/plugins/submenu/fontSize.js +0 -112
  270. package/src/plugins/submenu/formatBlock.d.ts +0 -5
  271. package/src/plugins/submenu/formatBlock.js +0 -273
  272. package/src/plugins/submenu/hiliteColor.d.ts +0 -5
  273. package/src/plugins/submenu/hiliteColor.js +0 -102
  274. package/src/plugins/submenu/horizontalRule.d.ts +0 -5
  275. package/src/plugins/submenu/horizontalRule.js +0 -98
  276. package/src/plugins/submenu/lineHeight.d.ts +0 -5
  277. package/src/plugins/submenu/lineHeight.js +0 -104
  278. package/src/plugins/submenu/list.d.ts +0 -5
  279. package/src/plugins/submenu/list.js +0 -456
  280. package/src/plugins/submenu/paragraphStyle.d.ts +0 -5
  281. package/src/plugins/submenu/paragraphStyle.js +0 -135
  282. package/src/plugins/submenu/table.d.ts +0 -5
  283. package/src/plugins/submenu/table.js +0 -1431
  284. package/src/plugins/submenu/template.d.ts +0 -5
  285. package/src/plugins/submenu/template.js +0 -72
  286. package/src/plugins/submenu/textStyle.d.ts +0 -5
  287. package/src/plugins/submenu/textStyle.js +0 -167
  288. package/src/suneditor.d.ts +0 -9
  289. package/src/suneditor_build.js +0 -18
  290. /package/{src/plugins/dialog → typings}/mention.d.ts +0 -0
package/src/suneditor.js CHANGED
@@ -1,75 +1,70 @@
1
- /*
2
- * wysiwyg web editor
3
- *
4
- * suneditor.js
5
- * Copyright 2017 JiHong Lee.
6
- * MIT license.
7
- */
8
- 'use strict';
1
+ import Editor from './core/editor';
9
2
 
10
- import core from './lib/core';
11
- import util from './lib/util';
12
- import _Constructor from './lib/constructor';
13
- import _Context from './lib/context';
3
+ import EditorInjector from './editorInjector';
4
+ import Plugins from './plugins';
5
+ import Langs from './langs';
6
+ import Modules from './modules';
7
+ import Helper from './helper';
14
8
 
15
- export default {
16
- /**
17
- * @description Returns the create function with preset options.
18
- * If the options overlap, the options of the 'create' function take precedence.
19
- * @param {Json} options Initialization options
20
- * @returns {Object}
21
- */
22
- init: function (init_options) {
23
- return {
24
- create: function (idOrElement, options) {
25
- return this.create(idOrElement, options, init_options);
26
- }.bind(this)
27
- };
28
- },
29
-
30
- /**
31
- * @description Create the suneditor
32
- * @param {String|Element} idOrElement textarea Id or textarea element
33
- * @param {JSON|Object} options user options
34
- * @returns {Object}
35
- */
36
- create: function (idOrElement, options, _init_options) {
37
- util._propertiesInit();
9
+ export const editorInjector = EditorInjector;
10
+ export const plugins = Plugins;
11
+ export const modules = Modules;
12
+ export const langs = Langs;
13
+ export const helper = Helper;
38
14
 
39
- if (typeof options !== 'object') options = {};
40
- if (_init_options) {
41
- options = [_init_options, options].reduce(function (init, option) {
42
- for (let key in option) {
43
- if (!util.hasOwn(option, key)) continue;
44
- if (key === 'plugins' && option[key] && init[key]) {
45
- let i = init[key], o = option[key];
46
- i = i.length ? i : Object.keys(i).map(function(name) { return i[name]; });
47
- o = o.length ? o : Object.keys(o).map(function(name) { return o[name]; });
48
- init[key] = (o.filter(function(val) { return i.indexOf(val) === -1; })).concat(i);
49
- } else {
50
- init[key] = option[key];
51
- }
52
- }
53
- return init;
54
- }, {});
55
- }
56
-
57
- const element = typeof idOrElement === 'string' ? document.getElementById(idOrElement) : idOrElement;
58
-
59
- if (!element) {
60
- if (typeof idOrElement === 'string') {
61
- throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"' + idOrElement + '")');
62
- }
15
+ export default {
16
+ /**
17
+ * @description Returns the create function with preset options.
18
+ * If the options overlap, the options of the 'create' function take precedence.
19
+ * @param {Json} options Initialization options
20
+ * @returns {Object}
21
+ */
22
+ init(init_options) {
23
+ return {
24
+ create: (targets, options) => this.create(targets, options, init_options)
25
+ };
26
+ },
63
27
 
64
- throw Error('[SUNEDITOR.create.fail] suneditor requires textarea\'s element or id value');
65
- }
28
+ /**
29
+ * @description Create the suneditor
30
+ * @param {string|Element|Array.<string|Element>} target textarea Id or textarea element
31
+ * @param {JSON|Object} options user options
32
+ * @returns {Object}
33
+ */
34
+ create(target, options, _init_options) {
35
+ if (typeof options !== 'object') options = {};
36
+ if (_init_options) {
37
+ options = (() => {
38
+ return [_init_options, options].reduce((init, option) => {
39
+ Object.entries(option).forEach(([key, value]) => {
40
+ if (key === 'plugins' && value && init[key]) {
41
+ const i = Array.isArray(init[key]) ? init[key] : Object.values(init[key]);
42
+ const o = Array.isArray(value) ? value : Object.values(value);
43
+ init[key] = [...o.filter((val) => !i.includes(val)), ...i];
44
+ } else {
45
+ init[key] = value;
46
+ }
47
+ });
48
+ return init;
49
+ }, {});
50
+ })();
51
+ }
66
52
 
67
- const cons = _Constructor.init(element, options);
53
+ if (!target) throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element");
68
54
 
69
- if (cons.constructed._top.id && document.getElementById(cons.constructed._top.id)) {
70
- throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"' + cons.constructed._top.id + '")');
71
- }
55
+ const multiTargets = [];
56
+ if (target.nodeType === 1) {
57
+ multiTargets.push({ target: target });
58
+ } else {
59
+ let props;
60
+ for (const key in target) {
61
+ props = target[key];
62
+ if (!props.target || props.target.nodeType !== 1) throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');
63
+ props.key = key;
64
+ multiTargets.push(props);
65
+ }
66
+ }
72
67
 
73
- return core(_Context(element, cons.constructed, cons.options), cons.pluginCallButtons, cons.plugins, cons.options.lang, options, cons._responsiveButtons);
74
- }
68
+ return new Editor(multiTargets, options);
69
+ }
75
70
  };
@@ -0,0 +1,61 @@
1
+ .sun-editor button > svg,
2
+ .sun-editor .se-svg {
3
+ width: 14px;
4
+ height: 14px;
5
+ }
6
+
7
+ /** se-btn button */
8
+ .sun-editor .se-btn {
9
+ width: 32px;
10
+ font-size: 12px;
11
+ line-height: 1.8;
12
+ }
13
+
14
+ .sun-editor .close > svg,
15
+ .sun-editor .se-modal .se-close-btn > svg {
16
+ width: 10px;
17
+ height: 10px;
18
+ }
19
+
20
+ /* se-select-btn icon */
21
+ .sun-editor .se-btn-select > svg {
22
+ width: 8px;
23
+ height: 8px;
24
+ }
25
+
26
+ /* se-btn-list inner icon */
27
+ .sun-editor .se-btn-list > .se-list-icon {
28
+ width: 12px;
29
+ height: 14px;
30
+ }
31
+
32
+ /* modal */
33
+ .sun-editor .se-modal .se-modal-inner .se-modal-form input,
34
+ .sun-editor .se-modal .se-modal-inner .se-modal-form select {
35
+ height: 32px;
36
+ font-size: 13px;
37
+ line-height: 1.7;
38
+ }
39
+
40
+ .sun-editor .se-modal .se-modal-inner .se-modal-content .se-btn-primary {
41
+ padding: 5px 11px;
42
+ }
43
+
44
+ .sun-editor .se-modal .se-modal-inner .se-modal-footer > div {
45
+ line-height: 1.7;
46
+ }
47
+
48
+ .sun-editor .se-line-breaker-component {
49
+ width: 22px;
50
+ height: 22px;
51
+ }
52
+
53
+ .sun-editor .se-modal label,
54
+ .sun-editor .se-modal input,
55
+ .sun-editor .se-modal button {
56
+ font-size: 14px;
57
+ }
58
+
59
+ .sun-editor .se-modal .se-modal-inner .se-modal-header .se-modal-title {
60
+ font-size: 15px;
61
+ }
@@ -0,0 +1,8 @@
1
+ import { Plugin } from './Plugin';
2
+
3
+ export interface CommandPlugin extends Plugin {
4
+ /**
5
+ * @description The behavior of the "command plugin" must be defined in the "action" method.
6
+ */
7
+ action: () => void;
8
+ }
@@ -0,0 +1,20 @@
1
+ import { Plugin } from './Plugin';
2
+
3
+ export interface DialogPlugin extends Plugin {
4
+ /**
5
+ * @description This method is called when the plugin button is clicked.
6
+ * Open the modal window here.
7
+ */
8
+ open: () => void;
9
+
10
+ /**
11
+ * @description Called after the dropdown has been rendered
12
+ */
13
+ on?: () => void;
14
+
15
+ /**
16
+ * @description This method is called when the dialog window is closed.
17
+ * Initialize the properties.
18
+ */
19
+ init: () => void;
20
+ }
@@ -0,0 +1,30 @@
1
+ import { Plugin } from './Plugin';
2
+
3
+ export interface FileBrowserPlugin extends Plugin {
4
+ /**
5
+ * @description Open a file browser window
6
+ * @param pluginName Plugin name using the file browser
7
+ * @param selectorHandler When the function comes as an argument value, it substitutes "context.selectorHandler".
8
+ * @example this.plugins.fileBrowser.open.call(this, 'imageGallery', (selectorHandler || null));
9
+ */
10
+ open(kind: string, update: boolean): void;
11
+
12
+ /**
13
+ * @description Define the HTML of the item to be put in "div.se-file-item-column".
14
+ * @param item Item of the response data's array
15
+ */
16
+ drawItems: (item: object) => string;
17
+
18
+ /**
19
+ * @description Close a file browser window
20
+ * The plugin's "init" method is called.
21
+ * @example this.plugins.fileBrowser.close.call(this);
22
+ */
23
+ close(): void;
24
+
25
+ /**
26
+ * @description This method is called when the file browser window is closed.
27
+ * Initialize the properties.
28
+ */
29
+ init?: () => void;
30
+ }
@@ -0,0 +1,124 @@
1
+ export interface Lang {
2
+ code: string;
3
+ default: string;
4
+ save: string;
5
+ font: string;
6
+ formats: string;
7
+ fontSize: string;
8
+ bold: string;
9
+ underline: string;
10
+ italic: string;
11
+ strike: string;
12
+ subscript: string;
13
+ superscript: string;
14
+ removeFormat: string;
15
+ fontColor: string;
16
+ backgroundColor: string;
17
+ indent: string;
18
+ outdent: string;
19
+ align: string;
20
+ alignLeft: string;
21
+ alignRight: string;
22
+ alignCenter: string;
23
+ alignJustify: string;
24
+ list: string;
25
+ numberedList: string;
26
+ bulletedList: string;
27
+ horizontalLine: string;
28
+ hr_solid: string;
29
+ hr_dotted: string;
30
+ hr_dashed: string;
31
+ table: string;
32
+ link: string;
33
+ math: string;
34
+ image: string;
35
+ video: string;
36
+ audio: string;
37
+ fullScreen: string;
38
+ showBlocks: string;
39
+ codeView: string;
40
+ undo: string;
41
+ redo: string;
42
+ preview: string;
43
+ print: string;
44
+ tag_p: string;
45
+ tag_div: string;
46
+ tag_h: string;
47
+ tag_blockquote: string;
48
+ tag_pre: string;
49
+ template: string;
50
+ lineHeight: string;
51
+ paragraphStyle: string;
52
+ textStyle: string;
53
+ imageGallery: string;
54
+ dir_ltr: string;
55
+ dir_rtl: string;
56
+ mention: string;
57
+ tags: string;
58
+ search: string;
59
+ caption: string;
60
+ close: string;
61
+ submitButton: string;
62
+ revertButton: string;
63
+ proportion: string;
64
+ basic: string;
65
+ left: string;
66
+ right: string;
67
+ center: string;
68
+ width: string;
69
+ height: string;
70
+ size: string;
71
+ ratio: string;
72
+ edit: string;
73
+ unlink: string;
74
+ remove: string;
75
+ link_modal_title: string;
76
+ link_modal_url: string;
77
+ link_modal_text: string;
78
+ link_modal_newWindowCheck: string;
79
+ link_modal_downloadLinkCheck: string;
80
+ link_modal_bookmark: string;
81
+ math_modal_title: string;
82
+ math_modal_inputLabel: string;
83
+ math_modal_fontSizeLabel: string;
84
+ math_modal_previewLabel: string;
85
+ image_modal_title: string;
86
+ image_modal_file: string;
87
+ image_modal_url: string;
88
+ image_modal_altText: string;
89
+ video_modal_title: string;
90
+ video_modal_file: string;
91
+ video_modal_url: string;
92
+ audio_modal_title: string;
93
+ audio_modal_file: string;
94
+ audio_modal_url: string;
95
+ insertRowAbove: string;
96
+ insertRowBelow: string;
97
+ deleteRow: string;
98
+ insertColumnBefore: string;
99
+ insertColumnAfter: string;
100
+ deleteColumn: string;
101
+ fixedColumnWidth: string;
102
+ resize100: string;
103
+ resize75: string;
104
+ resize50: string;
105
+ resize25: string;
106
+ autoSize: string;
107
+ mirrorHorizontal: string;
108
+ mirrorVertical: string;
109
+ rotateLeft: string;
110
+ rotateRight: string;
111
+ maxSize: string;
112
+ minSize: string;
113
+ tableHeader: string;
114
+ mergeCells: string;
115
+ splitCells: string;
116
+ horizontalSplit: string;
117
+ verticalSplit: string;
118
+ menu_spaced: string;
119
+ menu_bordered: string;
120
+ menu_neon: string;
121
+ menu_translucent: string;
122
+ menu_shadow: string;
123
+ menu_code: string;
124
+ }
@@ -0,0 +1,15 @@
1
+ import SunEditor from '../lib/core';
2
+
3
+ export interface Module {
4
+ /**
5
+ * @description Module name
6
+ */
7
+ name: string;
8
+
9
+ /**
10
+ * @description Constructor, It will run automatically.
11
+ * @param core Core object
12
+ * @example core.addModule([dialog, resizing, fileManager])
13
+ */
14
+ add?: (core: SunEditor) => void;
15
+ }
@@ -0,0 +1,42 @@
1
+ export interface Plugin {
2
+ /**
3
+ * @description Plugin name
4
+ */
5
+ name: string;
6
+
7
+ /**
8
+ * @description Plugin type ('container', 'command', 'dropdown', 'dialog')
9
+ */
10
+ display: string;
11
+
12
+ /**
13
+ * @description Constructor
14
+ * @param core Core object
15
+ * @param targetElement Target button Element
16
+ */
17
+ add: (core: any, targetElement?: any) => void;
18
+
19
+ /**
20
+ * @description Plugins with active methods load immediately when the editor loads.
21
+ * Called each time the selection is moved.
22
+ * @param element Selected elements
23
+ */
24
+ active?: (element: any) => boolean;
25
+
26
+ /**
27
+ * @description TML title attribute (tooltip) - default: plugin's name
28
+ */
29
+ title?: string;
30
+
31
+ /**
32
+ * @description HTML to be append to button (icon)
33
+ * Recommend using the inline svg icon. - default: "<span class="se-icon-text">!</span>"
34
+ */
35
+ innerHTML?: string;
36
+
37
+ /**
38
+ * @description The class of the button. - default: "se-btn"
39
+ * Do not recommend using it unless it is a special situation.
40
+ */
41
+ className?: string;
42
+ }
@@ -0,0 +1,8 @@
1
+ import { Plugin } from './Plugin';
2
+
3
+ export interface DropdownPlugin extends Plugin {
4
+ /**
5
+ * @description Called after the dropdown has been rendered
6
+ */
7
+ on?: () => void;
8
+ }
@@ -0,0 +1,17 @@
1
+ class ClassInterface {
2
+ char: any;
3
+ component: any;
4
+ format: any;
5
+ html: any;
6
+ menu: any;
7
+ nodeTransform: any;
8
+ notice: any;
9
+ offset: any;
10
+ selection: any;
11
+ shortcuts: any;
12
+ toolbar: any;
13
+ viewer: any;
14
+ subToolbar?: any;
15
+ }
16
+
17
+ export default ClassInterface;
@@ -0,0 +1,60 @@
1
+ import SunEditor from '../../lib/core';
2
+ import { Module } from '../Module';
3
+
4
+ declare interface _colorPicker extends Module {
5
+ /**
6
+ * @description Create color list
7
+ * @param core Core object
8
+ * @param makeColor this._makeColorList
9
+ * @returns HTML string
10
+ */
11
+ createColorList(core: SunEditor, makeColor: (color: string) => string): string;
12
+
13
+ /**
14
+ * @description Displays or resets the currently selected color at color list.
15
+ * @param node Current Selected node
16
+ * @param color Color value
17
+ */
18
+ init(node: Node, color: string): void;
19
+
20
+ /**
21
+ * @description Store color values
22
+ * @param hexColorStr Hax color value
23
+ */
24
+ setCurrentColor(hexColorStr: string): void;
25
+
26
+ /**
27
+ * @description Set color at input element
28
+ * @param hexColorStr Hax color value
29
+ */
30
+ setInputText(hexColorStr: string): void;
31
+
32
+ /**
33
+ * @description Gets color value at color property of node
34
+ * @param node Selected node
35
+ * @returns
36
+ */
37
+ getColorInNode(node: Node): string;
38
+
39
+ /**
40
+ * @description Function to check hex format color
41
+ * @param str Color value
42
+ */
43
+ isHexColor(str: string): boolean;
44
+
45
+ /**
46
+ * @description Function to convert hex format to a rgb color
47
+ * @param rgb RGB color format
48
+ * @returns
49
+ */
50
+ rgb2hex(rgb: string): string;
51
+
52
+ /**
53
+ * @description Converts color values of other formats to hex color values and returns.
54
+ * @param colorName Color value
55
+ * @returns
56
+ */
57
+ colorName2hex(colorName: string): string;
58
+ }
59
+
60
+ export default _colorPicker;
@@ -0,0 +1,55 @@
1
+ import { Core, status } from '../lib/core.d';
2
+ import { Lang } from '../langs/Lang.d';
3
+ import { Plugin } from '../plugins/Plugin.d';
4
+ import { SunEditorOptions } from '../options.d';
5
+ import { Context } from '../lib/context.d';
6
+ import { History } from '../lib/history.d';
7
+ import Helper from '../helper/index.d';
8
+
9
+ class CoreInterface {
10
+ editor: Core;
11
+
12
+ /**
13
+ * @description window object.
14
+ */
15
+ _w: Window;
16
+
17
+ /**
18
+ * @description document object.
19
+ */
20
+ _d: Document;
21
+
22
+ /**
23
+ * @description window obejct.(If in iframe mode, the window object of the iframe )
24
+ */
25
+ _ww: Document;
26
+
27
+ /**
28
+ * @description document object.(If in iframe mode, the document object of the iframe )
29
+ */
30
+ _wd: Window;
31
+
32
+ /**
33
+ * @description Closest ShadowRoot to editor if found
34
+ */
35
+ shadowRoot: Document;
36
+
37
+ /**
38
+ * @description Loaded plugins
39
+ */
40
+ plugins: Record<string, Plugin>;
41
+
42
+ /**
43
+ * @description Default icons object
44
+ */
45
+ icons: Record<string, string>;
46
+
47
+ status: status;
48
+ options: SunEditorOptions;
49
+ context: Context;
50
+ history: History;
51
+ lang: Lang;
52
+ helper: Helper;
53
+ }
54
+
55
+ export default CoreInterface;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const align: DropdownPlugin;
4
+
5
+ export default align;
@@ -2,4 +2,4 @@ import { DialogPlugin } from '../DialogPlugin';
2
2
 
3
3
  declare const audio: DialogPlugin;
4
4
 
5
- export default audio;
5
+ export default audio;
@@ -0,0 +1,5 @@
1
+ import { DropdownPlugin } from '../DropdownPlugin';
2
+
3
+ declare const backgroundColor: DropdownPlugin;
4
+
5
+ export default backgroundColor;
@@ -2,4 +2,4 @@ import { CommandPlugin } from '../CommandPlugin';
2
2
 
3
3
  declare const blockquote: CommandPlugin;
4
4
 
5
- export default blockquote;
5
+ export default blockquote;
@@ -0,0 +1,39 @@
1
+ import EditorDependency from '../src/editorInjector';
2
+
3
+ class Char extends EditorDependency {
4
+ /**
5
+ * @description Returns false if char count is greater than "options.charCounter_max" when "html" is added to the current editor.
6
+ * @param element Element node or String.
7
+ */
8
+ check(html: Node | string): boolean;
9
+
10
+ /**
11
+ * @description Get the [content]'s number of characters or binary data size. (options.charCounter_type)
12
+ * If [content] is undefined, get the current editor's number of characters or binary data size.
13
+ * @param content Content to count. (defalut: this.editor.frameContext.get('wysiwyg'))
14
+ */
15
+ getLength(content?: string): number;
16
+
17
+ /**
18
+ * @descriptionGets Get the length in bytes of a string.
19
+ * @param text String text
20
+ * @returns
21
+ */
22
+ getByteLength(text: string): number;
23
+
24
+ /**
25
+ * @description Set the char count to charCounter element textContent.
26
+ */
27
+ display(): void;
28
+
29
+ /**
30
+ * @description Returns false if char count is greater than "options.charCounter_max" when "inputText" is added to the current editor.
31
+ * If the current number of characters is greater than "charCounter_max", the excess characters are removed.
32
+ * And call the char.display()
33
+ * @param inputText Text added.
34
+ * @returns
35
+ */
36
+ test(inputText: string): boolean;
37
+ }
38
+
39
+ export default Char;