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
@@ -0,0 +1,250 @@
1
+ export const _w = window;
2
+ export const _d = document;
3
+
4
+ export const NO_EVENT = Symbol('noEventHandler');
5
+ export const ON_OVER_COMPONENT = Symbol('onOverComponent');
6
+
7
+ const userAgent = _w.navigator.userAgent.toLowerCase();
8
+
9
+ /**
10
+ * @description Object.values
11
+ * @param {Object.<any>} obj Object parameter.
12
+ * @returns {Array.<any>}
13
+ */
14
+ export function getValues(obj) {
15
+ return !obj
16
+ ? []
17
+ : Object.keys(obj).map(function (i) {
18
+ return obj[i];
19
+ });
20
+ }
21
+
22
+ /**
23
+ * @description Convert the CamelCase To the KebabCase.
24
+ * @param {string|Array.<string>} param [Camel string]
25
+ */
26
+ export function camelToKebabCase(param) {
27
+ if (typeof param === 'string') {
28
+ return param.replace(/[A-Z]/g, (letter) => '-' + letter.toLowerCase());
29
+ } else {
30
+ return param.map(function (str) {
31
+ return camelToKebabCase(str);
32
+ });
33
+ }
34
+ }
35
+
36
+ /**
37
+ * @description Convert the KebabCase To the CamelCase.
38
+ * @param {String|Array} param [KebabCase string]
39
+ * @returns {String|Array}
40
+ */
41
+ export function kebabToCamelCase(param) {
42
+ if (typeof param === 'string') {
43
+ return param.replace(/-[a-zA-Z]/g, (letter) => letter.replace('-', '').toUpperCase());
44
+ } else {
45
+ return param.map(function (str) {
46
+ return camelToKebabCase(str);
47
+ });
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @description Gets XMLHttpRequest object
53
+ * @returns {XMLHttpRequest|ActiveXObject}
54
+ */
55
+ export function getXMLHttpRequest() {
56
+ return new XMLHttpRequest();
57
+ }
58
+
59
+ /**
60
+ * @deprecated
61
+ * @description Returns the CSS text that has been applied to the current page.
62
+ * @param {Document|null} doc To get the CSS text of an document. If null get the current document.
63
+ * @returns {string} Styles string
64
+ */
65
+ export function getPageStyle(doc) {
66
+ let cssText = '';
67
+ const sheets = (doc || _d).styleSheets;
68
+
69
+ for (let i = 0, len = sheets.length, rules; i < len; i++) {
70
+ try {
71
+ rules = sheets[i].cssRules;
72
+ } catch (e) {
73
+ continue;
74
+ }
75
+
76
+ if (rules) {
77
+ for (let c = 0, cLen = rules.length; c < cLen; c++) {
78
+ cssText += rules[c].cssText;
79
+ }
80
+ }
81
+ }
82
+
83
+ return cssText;
84
+ }
85
+
86
+ /**
87
+ * @deprecated
88
+ * @description Get the the tag path of the arguments value
89
+ * If not found, return the first found value
90
+ * @param {Array.<string>} nameArray File name array
91
+ * @param {string} extension js, css
92
+ * @returns {string}
93
+ */
94
+ export function getIncludePath(nameArray, extension) {
95
+ let path = '';
96
+ const pathList = [];
97
+ const tagName = extension === 'js' ? 'script' : 'link';
98
+ const src = extension === 'js' ? 'src' : 'href';
99
+
100
+ let fileName = '(?:';
101
+ for (let i = 0, len = nameArray.length; i < len; i++) {
102
+ fileName += nameArray[i] + (i < len - 1 ? '|' : ')');
103
+ }
104
+
105
+ const regExp = new RegExp(`(^|.*[\\/])${fileName}(\\.[^\\/]+)?.${extension}(?:\\?.*|;.*)?$`, 'i');
106
+ const extRegExp = new RegExp(`.+\\.${extension}(?:\\?.*|;.*)?$`, 'i');
107
+
108
+ for (let c = _d.getElementsByTagName(tagName), i = 0; i < c.length; i++) {
109
+ if (extRegExp.test(c[i][src])) {
110
+ pathList.push(c[i]);
111
+ }
112
+ }
113
+
114
+ for (let i = 0; i < pathList.length; i++) {
115
+ const editorTag = pathList[i][src].match(regExp);
116
+ if (editorTag) {
117
+ path = editorTag[0];
118
+ break;
119
+ }
120
+ }
121
+
122
+ if (path === '') path = pathList.length > 0 ? pathList[0][src] : '';
123
+
124
+ if (!path.includes(':/') && '//' !== path.slice(0, 2)) {
125
+ path = 0 === path.includes('/') ? location.href.match(/^.*?:\/\/[^/]*/)[0] + path : location.href.match(/^[^?]*\/(?:)/)[0] + path;
126
+ }
127
+
128
+ if (!path) {
129
+ throw '[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +' + path + ', extension: ' + extension + ')';
130
+ }
131
+
132
+ return path;
133
+ }
134
+
135
+ /** --- Check browser --- */
136
+ /**
137
+ * @description Check if support ResizeObserver function
138
+ * @returns {boolean} Whether support ResizeObserver function or not.
139
+ */
140
+ export const isResizeObserverSupported = (() => {
141
+ return typeof ResizeObserver === 'function';
142
+ })();
143
+
144
+ /**
145
+ * @description Check if User Agent is Edge
146
+ * @returns {boolean} Whether User Agent is Edge or not.
147
+ */
148
+ export const isEdge = (() => {
149
+ return navigator.appVersion.includes('Edge');
150
+ })();
151
+
152
+ /**
153
+ * @description Check if platform is OSX or IOS
154
+ * @type {boolean}
155
+ */
156
+ export const isOSX_IOS = (() => {
157
+ return /(Mac|iPhone|iPod|iPad)/.test(navigator.platform);
158
+ })();
159
+
160
+ /**
161
+ * @description Check if User Agent Blink engine.
162
+ * @type {boolean}
163
+ */
164
+ export const isBlink = (() => {
165
+ return userAgent.includes('chrome/') && !userAgent.includes('edge/');
166
+ })();
167
+
168
+ /**
169
+ * @description Check if User Agent is Firefox (Gecko).
170
+ * @type {boolean}
171
+ */
172
+ export const isGecko = (() => {
173
+ return !!userAgent.match(/gecko\/\d+/);
174
+ })();
175
+
176
+ /**
177
+ * @description Check if User Agent is Chromium browser.
178
+ * @type {boolean}
179
+ */
180
+ export const isChromium = (() => {
181
+ return !!window.chrome;
182
+ })();
183
+
184
+ /**
185
+ * @description Check if User Agent is Safari.
186
+ * @type {boolean}
187
+ */
188
+ export const isSafari = (() => {
189
+ return userAgent.includes('applewebkit/') && !userAgent.includes('chrome');
190
+ })();
191
+
192
+ /**
193
+ * @description Check if User Agent is Mobile device.
194
+ * when the device is touchable, it is judged as a mobile device.
195
+ * @type {boolean}
196
+ */
197
+ export const isMobile = (() => {
198
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) || 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
199
+ })();
200
+
201
+ /**
202
+ * @description Check if User Agent is Android mobile device.
203
+ * @type {boolean}
204
+ */
205
+ export const isAndroid = (() => {
206
+ return userAgent.includes('android');
207
+ })();
208
+
209
+ /**
210
+ * @description Command(Mac) or CTRL(Window) icon.
211
+ * @type {string}
212
+ */
213
+ export const cmdIcon = isOSX_IOS ? '⌘' : 'CTRL';
214
+
215
+ /**
216
+ * @description SHIFT(Mac, Window) icon.
217
+ * @type {string}
218
+ */
219
+ export const shiftIcon = isOSX_IOS ? '⇧' : '+SHIFT';
220
+
221
+ /** --- editor env --- */
222
+ export const _allowedEmptyNodeList = '.se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details';
223
+ export const KATEX_WEBSITE = 'https://katex.org/docs/supported.html';
224
+
225
+ const env = {
226
+ _w,
227
+ _d,
228
+ NO_EVENT,
229
+ ON_OVER_COMPONENT,
230
+ getValues,
231
+ camelToKebabCase,
232
+ kebabToCamelCase,
233
+ getXMLHttpRequest,
234
+ getPageStyle,
235
+ getIncludePath,
236
+ isResizeObserverSupported,
237
+ isEdge,
238
+ isBlink,
239
+ isGecko,
240
+ isChromium,
241
+ isSafari,
242
+ isOSX_IOS,
243
+ isAndroid,
244
+ isMobile,
245
+ cmdIcon,
246
+ shiftIcon,
247
+ _allowedEmptyNodeList
248
+ };
249
+
250
+ export default env;
@@ -0,0 +1,19 @@
1
+ import Env from './env';
2
+ import Unicode from './unicode';
3
+ import Converter from './converter';
4
+ import DomUtils from './domUtils';
5
+ import Numbers from './numbers';
6
+
7
+ export const env = Env;
8
+ export const unicode = Unicode;
9
+ export const converter = Converter;
10
+ export const domUtils = DomUtils;
11
+ export const numbers = Numbers;
12
+
13
+ export default {
14
+ env,
15
+ unicode,
16
+ converter,
17
+ domUtils,
18
+ numbers
19
+ };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @description Checks for numeric (with decimal point).
3
+ * @param {string|number} text Text string or number
4
+ * @returns {boolean}
5
+ */
6
+ export function is(text) {
7
+ return /^-?\d+(\.\d+)?$/.test(text + '');
8
+ }
9
+
10
+ /**
11
+ * @description Get a number.
12
+ * @param {string|number} value Text string or number
13
+ * @param {number} maxDec Maximum number of decimal places (-1 : Infinity)
14
+ * @returns {number}
15
+ */
16
+ export function get(value, maxDec) {
17
+ if (!value) return 0;
18
+
19
+ let number = (value + '').match(/-?\d+(\.\d+)?/);
20
+ if (!number || !number[0]) return 0;
21
+
22
+ number = number[0];
23
+ return maxDec < 0 ? number * 1 : maxDec === 0 ? Math.round(number * 1) : (number * 1).toFixed(maxDec) * 1;
24
+ }
25
+
26
+ /**
27
+ * @description It compares the start and end indexes of 'a' and 'b' and returns the number of overlapping indexes in the range.
28
+ * ex) 1, 5, 4, 6 => '2' (4,5)
29
+ * @param {number} aStart Start index of 'a'
30
+ * @param {number} aEnd End index of 'a'
31
+ * @param {number} bStart Start index of 'b'
32
+ * @param {number} bEnd Start index of 'b'
33
+ * @returns {number}
34
+ */
35
+ export function getOverlapRangeAtIndex(aStart, aEnd, bStart, bEnd) {
36
+ if (aStart <= bEnd ? aEnd < bStart : aEnd > bStart) return 0;
37
+
38
+ const overlap = (aStart > bStart ? aStart : bStart) - (aEnd < bEnd ? aEnd : bEnd);
39
+ return (overlap < 0 ? overlap * -1 : overlap) + 1;
40
+ }
41
+
42
+ /**
43
+ * @description Discriminate an even number
44
+ * @param {number} value number
45
+ * @returns {boolean}
46
+ */
47
+ export function isEven(value) {
48
+ return (value & 1) === 0;
49
+ }
50
+
51
+ /**
52
+ * @description Discriminate an odd number
53
+ * @param {number} value number
54
+ * @returns {boolean}
55
+ */
56
+ export function isOdd(value) {
57
+ return (value & 1) === 1;
58
+ }
59
+
60
+ const numbers = {
61
+ is,
62
+ get,
63
+ getOverlapRangeAtIndex,
64
+ isEven,
65
+ isOdd
66
+ };
67
+
68
+ export default numbers;
@@ -0,0 +1,43 @@
1
+ const zwsp = 8203;
2
+
3
+ /**
4
+ * @description Unicode Character 'ZERO WIDTH SPACE' (\u200B)
5
+ * @type string
6
+ */
7
+ export const zeroWidthSpace = String.fromCharCode(zwsp);
8
+
9
+ /**
10
+ * @description Regular expression to find 'zero width space' (/\u200B/g)
11
+ * @type RegExp
12
+ */
13
+ export const zeroWidthRegExp = new RegExp(String.fromCharCode(zwsp), 'g');
14
+
15
+ /**
16
+ * @description Regular expression to find only 'zero width space' (/\u200B/g)
17
+ * @type RegExp
18
+ */
19
+ export const onlyZeroWidthRegExp = new RegExp('^' + String.fromCharCode(zwsp) + '+$');
20
+
21
+ /**
22
+ * @description Escape a string for safe use in regular expressions.
23
+ * @param {String} string String to escape
24
+ * @returns {String}
25
+ */
26
+ export function escapeStringRegexp(string) {
27
+ if (typeof string !== 'string') {
28
+ throw new TypeError('Expected a string');
29
+ }
30
+
31
+ // Escape characters with special meaning either inside or outside character sets.
32
+ // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
33
+ return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
34
+ }
35
+
36
+ const unicode = {
37
+ zeroWidthSpace,
38
+ zeroWidthRegExp,
39
+ onlyZeroWidthRegExp,
40
+ escapeStringRegexp
41
+ };
42
+
43
+ export default unicode;
@@ -0,0 +1,161 @@
1
+ (function (global, factory) {
2
+ if (typeof module === 'object' && typeof module.exports === 'object') {
3
+ module.exports = global.document
4
+ ? factory(global, true)
5
+ : function (w) {
6
+ if (!w.document) {
7
+ throw new Error('SUNEDITOR_LANG a window with a document');
8
+ }
9
+ return factory(w);
10
+ };
11
+ } else {
12
+ factory(global);
13
+ }
14
+ })(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
15
+ const lang = {
16
+ code: 'ckb',
17
+ align: 'ئاراسته‌',
18
+ alignCenter: 'ناوه‌ند',
19
+ alignJustify: 'به‌رێكی دابه‌ش بكه‌',
20
+ alignLeft: 'لای چه‌پ',
21
+ alignRight: 'لای راست',
22
+ audio: 'ده‌نگ',
23
+ audio_modal_file: 'فایلێك هه‌ڵبژێره‌',
24
+ audio_modal_title: 'ده‌نگێك دابنێ',
25
+ audio_modal_url: 'به‌سته‌ری ده‌نگ',
26
+ autoSize: 'قه‌باره‌ی خۆكارانه‌',
27
+ backgroundColor: 'ره‌نگی دیاركراو',
28
+ basic: 'سه‌ره‌تایی',
29
+ bold: 'تۆخكردن',
30
+ bulletedList: 'لیستی ریزنه‌كراو',
31
+ caption: 'پێناسه‌یه‌ك دابنێ',
32
+ center: 'ناوەڕاست',
33
+ close: 'داخستن',
34
+ codeView: 'بینینی كۆده‌كان',
35
+ default: 'بنه‌ڕه‌ت',
36
+ deleteColumn: 'ستونێك بسره‌وه‌',
37
+ deleteRow: 'ریز بسره‌وه‌',
38
+ dir_ltr: 'من اليسار إلى اليمين',
39
+ dir_rtl: 'من اليمين الى اليسار',
40
+ edit: 'دەسکاریکردن',
41
+ fixedColumnWidth: 'پانی ستون نه‌گۆربكه‌',
42
+ font: 'فۆنت',
43
+ fontColor: 'ره‌نگی فۆنت',
44
+ fontSize: 'قه‌باره‌',
45
+ formats: 'Formats',
46
+ fullScreen: 'پڕ به‌ شاشه‌',
47
+ height: 'به‌رزی',
48
+ horizontalLine: 'هێڵی ئاسۆیی',
49
+ horizontalSplit: 'جیاكردنه‌وه‌ی ئاسۆیی',
50
+ hr_dashed: 'داش داش',
51
+ hr_dotted: 'نوكته‌ نوكته‌',
52
+ hr_solid: 'پته‌و',
53
+ image: 'وێنه‌',
54
+ imageGallery: 'گاله‌ری وێنه‌كان',
55
+ image_modal_altText: 'نوسینی جێگره‌وه‌',
56
+ image_modal_file: 'فایلێك هه‌ڵبژێره‌',
57
+ image_modal_title: 'وێنه‌یه‌ك دابنێ',
58
+ image_modal_url: 'به‌سته‌ری وێنه‌',
59
+ indent: 'بۆشایی بەجێهێشتن',
60
+ insertColumnAfter: 'ستونێك له‌ دواوه‌ زیادبكه‌',
61
+ insertColumnBefore: 'ستونێك له‌ پێشه‌وه‌ زیادبكه‌',
62
+ insertRowAbove: 'ریزك له‌ سه‌ره‌وه‌ زیادبكه‌',
63
+ insertRowBelow: 'ریزێك له‌ خواره‌وه‌ زیادبكه‌',
64
+ italic: 'لار',
65
+ layout: 'Layout',
66
+ left: 'چه‌پ',
67
+ lineHeight: 'بڵندی دێر',
68
+ link: 'به‌سته‌ر',
69
+ link_modal_bookmark: 'المرجعية',
70
+ link_modal_downloadLinkCheck: 'رابط التحميل',
71
+ link_modal_newWindowCheck: 'له‌ په‌نجه‌ره‌یه‌كی نوێ بكه‌ره‌وه‌',
72
+ link_modal_text: 'تێكستی به‌سته‌ر',
73
+ link_modal_title: 'به‌سته‌ر دابنێ',
74
+ link_modal_url: 'به‌سته‌ر',
75
+ list: 'لیست',
76
+ math: 'بیركاری',
77
+ math_modal_fontSizeLabel: 'قه‌باره‌ی فۆنت',
78
+ math_modal_inputLabel: 'نیشانه‌كانی بیركاری',
79
+ math_modal_previewLabel: 'پێشبینین',
80
+ math_modal_title: 'بیركاری',
81
+ maxSize: 'گه‌وره‌ترین قه‌باره‌',
82
+ mention: 'تنويه ب',
83
+ menu_bordered: 'لێواری هه‌بێت',
84
+ menu_code: 'كۆد',
85
+ menu_neon: 'نیۆن',
86
+ menu_shadow: 'سێبه‌ر',
87
+ menu_spaced: 'بۆشای هه‌بێت',
88
+ menu_translucent: 'كه‌مێك وه‌ك شووشه‌',
89
+ mergeCells: 'خانه‌كان تێكه‌ڵبكه‌',
90
+ minSize: 'بچوكترین قه‌باره‌',
91
+ mirrorHorizontal: 'هه‌ڵگه‌رێنه‌وه‌ به‌ده‌وری ته‌وه‌ره‌ی ئاسۆیی',
92
+ mirrorVertical: 'هه‌ڵگه‌رێنه‌وه‌ به‌ده‌وری ته‌وه‌ره‌ی ستونی',
93
+ numberedList: 'لیستی ریزكراو',
94
+ outdent: 'لابردنی بۆشایی',
95
+ paragraphStyle: 'ستایلی په‌ره‌گراف',
96
+ preview: 'پێشبینین',
97
+ print: 'پرینت',
98
+ proportion: 'رێژه‌كان وه‌ك خۆی بهێڵه‌وه‌',
99
+ ratio: 'رێژه‌',
100
+ redo: 'هەڵگەڕاندنەوە',
101
+ remove: 'سڕینه‌وه‌',
102
+ removeFormat: 'لابردنی فۆرمات',
103
+ resize100: 'قه‌باره‌ بگۆره‌ بۆ ١٠٠%',
104
+ resize25: 'قه‌باره‌ بگۆره‌ بۆ ٢٥%',
105
+ resize50: 'قه‌باره‌ بگۆره‌ بۆ ٥٠%',
106
+ resize75: 'قه‌باره‌ بگۆره‌ بۆ ٧٥%',
107
+ resize: 'Resize',
108
+ revert: 'بیگەڕێنەوە سەر باری سەرەتایی',
109
+ right: 'راست',
110
+ rotateLeft: 'بسوڕێنه‌ به‌لای چه‌پدا',
111
+ rotateRight: 'بسورێنه‌ به‌لای راستدا',
112
+ save: 'پاشه‌كه‌وتكردن',
113
+ search: 'گه‌ران',
114
+ showBlocks: 'بڵۆك نیشانبده',
115
+ size: 'قه‌باره‌',
116
+ splitCells: 'خانه‌كان لێك جیابكه‌وه‌',
117
+ strike: 'هێڵ به‌ناودا بێنه‌',
118
+ submitButton: 'ناردن',
119
+ subscript: 'ژێرسکریپت',
120
+ superscript: 'سەرنووس',
121
+ table: 'خشته‌',
122
+ tableHeader: 'سه‌ردێری خشته‌ك',
123
+ tags: 'تاگه‌كان',
124
+ tag_blockquote: 'ده‌ق',
125
+ tag_div: 'ی ئاسایی (DIV)',
126
+ tag_h: 'سەرپەڕە',
127
+ tag_p: 'په‌ره‌گراف',
128
+ tag_pre: 'كۆد',
129
+ template: 'قاڵب',
130
+ textStyle: 'ستایلی نوسین',
131
+ underline: 'هێڵ به‌ژێردا بێنه‌',
132
+ undo: 'وەک خۆی لێ بکەوە',
133
+ unlink: 'سڕینەوەی بەستەر',
134
+ verticalSplit: 'جیاكردنه‌وه‌ی ستونی',
135
+ video: 'ڤیدیۆ',
136
+ video_modal_file: 'فایلێك هه‌ڵبژێره‌',
137
+ video_modal_title: 'ڤیدیۆیه‌ك دابنێ',
138
+ video_modal_url: 'YouTube/Vimeo به‌سته‌ری له‌ناودانان وه‌ك ',
139
+ width: 'پانی'
140
+ };
141
+
142
+ if (typeof noGlobal === typeof undefined) {
143
+ if (!window.SUNEDITOR_LANG) {
144
+ Object.defineProperty(window, 'SUNEDITOR_LANG', {
145
+ enumerable: true,
146
+ writable: false,
147
+ configurable: false,
148
+ value: {}
149
+ });
150
+ }
151
+
152
+ Object.defineProperty(window.SUNEDITOR_LANG, 'ckb', {
153
+ enumerable: true,
154
+ writable: true,
155
+ configurable: true,
156
+ value: lang
157
+ });
158
+ }
159
+
160
+ return lang;
161
+ });
@@ -0,0 +1,161 @@
1
+ (function (global, factory) {
2
+ if (typeof module === 'object' && typeof module.exports === 'object') {
3
+ module.exports = global.document
4
+ ? factory(global, true)
5
+ : function (w) {
6
+ if (!w.document) {
7
+ throw new Error('SUNEDITOR_LANG a window with a document');
8
+ }
9
+ return factory(w);
10
+ };
11
+ } else {
12
+ factory(global);
13
+ }
14
+ })(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
15
+ const lang = {
16
+ code: 'cs',
17
+ align: 'Zarovnat',
18
+ alignCenter: 'Zarovnat na střed',
19
+ alignJustify: 'Zarovnat do bloku',
20
+ alignLeft: 'Zarovnat vlevo',
21
+ alignRight: 'Zarovnat vpravo',
22
+ audio: 'Zvuk',
23
+ audio_modal_file: 'Vybrat ze souborů',
24
+ audio_modal_title: 'Vložit zvuk',
25
+ audio_modal_url: 'Adresa URL zvuku',
26
+ autoSize: 'Automatická velikost',
27
+ backgroundColor: 'Barva zvýraznění',
28
+ basic: 'Základní',
29
+ bold: 'Tučné',
30
+ bulletedList: 'Neřazený seznam',
31
+ caption: 'Vložit popis',
32
+ center: 'Střed',
33
+ close: 'Zavřít',
34
+ codeView: 'Zobrazení kódu',
35
+ default: 'Výchozí',
36
+ deleteColumn: 'Smazat sloupec',
37
+ deleteRow: 'Smazat řádek',
38
+ dir_ltr: 'Zleva doprava',
39
+ dir_rtl: 'Zprava doleva',
40
+ edit: 'Upravit',
41
+ fixedColumnWidth: 'Pevná šířka sloupce',
42
+ font: 'Písmo',
43
+ fontColor: 'Barva písma',
44
+ fontSize: 'Velikost',
45
+ formats: 'Formáty',
46
+ fullScreen: 'Celá obrazovka',
47
+ height: 'Výška',
48
+ horizontalLine: 'Vodorovná čára',
49
+ horizontalSplit: 'Vodorovné rozdělení',
50
+ hr_dashed: 'Čárkovaná',
51
+ hr_dotted: 'Tečkovaná',
52
+ hr_solid: 'Nepřerušovaná',
53
+ image: 'Obrázek',
54
+ imageGallery: 'Obrázková galerie',
55
+ image_modal_altText: 'Alternativní text',
56
+ image_modal_file: 'Vybrat ze souborů',
57
+ image_modal_title: 'Vložit obrázek',
58
+ image_modal_url: 'URL obrázku',
59
+ indent: 'Odsadit',
60
+ insertColumnAfter: 'Vložit sloupec za',
61
+ insertColumnBefore: 'Vložit sloupec před',
62
+ insertRowAbove: 'Vložit řádek výše',
63
+ insertRowBelow: 'Vložit řádek níže',
64
+ italic: 'Kurzíva',
65
+ layout: '',
66
+ left: 'Vlevo',
67
+ lineHeight: 'Výška řádku',
68
+ link: 'Odkaz',
69
+ link_modal_bookmark: 'Záložka',
70
+ link_modal_downloadLinkCheck: 'Odkaz ke stažení',
71
+ link_modal_newWindowCheck: 'Otevřít v novém okně',
72
+ link_modal_text: 'Text k zobrazení',
73
+ link_modal_title: 'Vložit odkaz',
74
+ link_modal_url: 'URL pro odkaz',
75
+ list: 'Seznam',
76
+ math: 'Matematika',
77
+ math_modal_fontSizeLabel: 'Velikost písma',
78
+ math_modal_inputLabel: 'Matematická notace',
79
+ math_modal_previewLabel: 'Náhled',
80
+ math_modal_title: 'Matematika',
81
+ maxSize: 'Max. velikost',
82
+ mention: 'Zmínka',
83
+ menu_bordered: 'Ohraničené',
84
+ menu_code: 'Kód',
85
+ menu_neon: 'Neon',
86
+ menu_shadow: 'Stín',
87
+ menu_spaced: 'Rozložené',
88
+ menu_translucent: 'Průsvitné',
89
+ mergeCells: 'Spojit buňky',
90
+ minSize: 'Min. velikost',
91
+ mirrorHorizontal: 'Zrcadlo, horizontální',
92
+ mirrorVertical: 'Zrcadlo, vertikální',
93
+ numberedList: 'Seřazený seznam',
94
+ outdent: 'Předsadit',
95
+ paragraphStyle: 'Styl odstavce',
96
+ preview: 'Náhled',
97
+ print: 'tisk',
98
+ proportion: 'Omezení proporcí',
99
+ ratio: 'Poměr',
100
+ redo: 'Opakovat',
101
+ remove: 'Odebrat',
102
+ removeFormat: 'Odebrat formát',
103
+ resize100: 'Změnit velikost 100%',
104
+ resize25: 'Změnit velikost 25%',
105
+ resize50: 'Změnit velikost 50%',
106
+ resize75: 'Změnit velikost 75%',
107
+ resize: 'Změnit velikost',
108
+ revert: 'Vrátit zpět',
109
+ right: 'Vpravo',
110
+ rotateLeft: 'Otočit doleva',
111
+ rotateRight: 'Otočit doprava',
112
+ save: 'Uložit',
113
+ search: 'Hledat',
114
+ showBlocks: 'Zobrazit bloky',
115
+ size: 'Velikost',
116
+ splitCells: 'Rozdělit buňky',
117
+ strike: 'Přeškrtnutí',
118
+ submitButton: 'Odeslat',
119
+ subscript: 'Dolní index',
120
+ superscript: 'Horní index',
121
+ table: 'Tabulka',
122
+ tableHeader: 'Záhlaví tabulky',
123
+ tags: 'Štítky',
124
+ tag_blockquote: 'Citovat',
125
+ tag_div: 'Normální (DIV)',
126
+ tag_h: 'Záhlaví',
127
+ tag_p: 'Odstavec',
128
+ tag_pre: 'Kód',
129
+ template: 'Šablona',
130
+ textStyle: 'Styl textu',
131
+ underline: 'Podtržení',
132
+ undo: 'Zpět',
133
+ unlink: 'Odpojit',
134
+ verticalSplit: 'Svislé rozdělení',
135
+ video: 'Video',
136
+ video_modal_file: 'Vybrat ze souborů',
137
+ video_modal_title: 'Vložit video',
138
+ video_modal_url: 'URL pro vložení médií, YouTube/Vimeo',
139
+ width: 'Šířka'
140
+ };
141
+
142
+ if (typeof noGlobal === typeof undefined) {
143
+ if (!window.SUNEDITOR_LANG) {
144
+ Object.defineProperty(window, 'SUNEDITOR_LANG', {
145
+ enumerable: true,
146
+ writable: false,
147
+ configurable: false,
148
+ value: {}
149
+ });
150
+ }
151
+
152
+ Object.defineProperty(window.SUNEDITOR_LANG, 'cs', {
153
+ enumerable: true,
154
+ writable: true,
155
+ configurable: true,
156
+ value: lang
157
+ });
158
+ }
159
+
160
+ return lang;
161
+ });