@syncfusion/ej2-richtexteditor 29.2.4-760237 → 29.2.4-771571

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 (401) hide show
  1. package/.eslintrc.json +260 -262
  2. package/dist/ej2-richtexteditor.umd.min.js +1 -1
  3. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-richtexteditor.es2015.js +22 -2
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +23 -2
  7. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/common/util.js +21 -1
  10. package/src/editor-manager/plugin/inserthtml.js +2 -1
  11. package/styles/bds-lite.css +278 -29
  12. package/styles/bds.css +289 -30
  13. package/styles/bootstrap-dark-lite.css +276 -27
  14. package/styles/bootstrap-dark.css +288 -29
  15. package/styles/bootstrap-lite.css +278 -29
  16. package/styles/bootstrap.css +290 -31
  17. package/styles/bootstrap4-lite.css +276 -27
  18. package/styles/bootstrap4.css +287 -28
  19. package/styles/bootstrap5-dark-lite.css +278 -29
  20. package/styles/bootstrap5-dark.css +289 -30
  21. package/styles/bootstrap5-lite.css +278 -29
  22. package/styles/bootstrap5.3-lite.css +276 -27
  23. package/styles/bootstrap5.3.css +288 -29
  24. package/styles/bootstrap5.css +289 -30
  25. package/styles/fabric-dark-lite.css +276 -27
  26. package/styles/fabric-dark.css +287 -28
  27. package/styles/fabric-lite.css +276 -27
  28. package/styles/fabric.css +287 -28
  29. package/styles/fluent-dark-lite.css +278 -29
  30. package/styles/fluent-dark.css +289 -31
  31. package/styles/fluent-lite.css +278 -29
  32. package/styles/fluent.css +289 -31
  33. package/styles/fluent2-lite.css +280 -31
  34. package/styles/fluent2.css +292 -33
  35. package/styles/highcontrast-light-lite.css +276 -27
  36. package/styles/highcontrast-light.css +287 -28
  37. package/styles/highcontrast-lite.css +276 -27
  38. package/styles/highcontrast.css +287 -28
  39. package/styles/material-dark-lite.css +276 -27
  40. package/styles/material-dark.css +287 -28
  41. package/styles/material-lite.css +276 -27
  42. package/styles/material.css +287 -28
  43. package/styles/material3-dark-lite.css +278 -27
  44. package/styles/material3-dark.css +289 -28
  45. package/styles/material3-lite.css +278 -27
  46. package/styles/material3.css +289 -28
  47. package/styles/rich-text-editor/_bds-definition.scss +9 -1
  48. package/styles/rich-text-editor/_bigger.scss +16 -3
  49. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +9 -1
  50. package/styles/rich-text-editor/_bootstrap-definition.scss +10 -2
  51. package/styles/rich-text-editor/_bootstrap4-definition.scss +9 -1
  52. package/styles/rich-text-editor/_bootstrap5-definition.scss +10 -2
  53. package/styles/rich-text-editor/_bootstrap5.3-definition.scss +9 -1
  54. package/styles/rich-text-editor/_fabric-dark-definition.scss +9 -1
  55. package/styles/rich-text-editor/_fabric-definition.scss +9 -1
  56. package/styles/rich-text-editor/_fluent-definition.scss +9 -2
  57. package/styles/rich-text-editor/_fluent2-definition.scss +10 -2
  58. package/styles/rich-text-editor/_fusionnew-definition.scss +8 -1
  59. package/styles/rich-text-editor/_highcontrast-definition.scss +9 -1
  60. package/styles/rich-text-editor/_highcontrast-light-definition.scss +9 -1
  61. package/styles/rich-text-editor/_layout.scss +208 -25
  62. package/styles/rich-text-editor/_material-dark-definition.scss +9 -1
  63. package/styles/rich-text-editor/_material-definition.scss +9 -1
  64. package/styles/rich-text-editor/_material3-definition.scss +9 -1
  65. package/styles/rich-text-editor/_tailwind-definition.scss +9 -1
  66. package/styles/rich-text-editor/_tailwind3-definition.scss +11 -3
  67. package/styles/rich-text-editor/_theme.scss +3 -0
  68. package/styles/rich-text-editor/bds.css +289 -30
  69. package/styles/rich-text-editor/bootstrap-dark.css +288 -29
  70. package/styles/rich-text-editor/bootstrap.css +290 -31
  71. package/styles/rich-text-editor/bootstrap4.css +287 -28
  72. package/styles/rich-text-editor/bootstrap5-dark.css +289 -30
  73. package/styles/rich-text-editor/bootstrap5.3.css +288 -29
  74. package/styles/rich-text-editor/bootstrap5.css +289 -30
  75. package/styles/rich-text-editor/fabric-dark.css +287 -28
  76. package/styles/rich-text-editor/fabric.css +287 -28
  77. package/styles/rich-text-editor/fluent-dark.css +289 -31
  78. package/styles/rich-text-editor/fluent.css +289 -31
  79. package/styles/rich-text-editor/fluent2.css +292 -33
  80. package/styles/rich-text-editor/highcontrast-light.css +287 -28
  81. package/styles/rich-text-editor/highcontrast.css +287 -28
  82. package/styles/rich-text-editor/icons/_bds.scss +4 -1
  83. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +4 -1
  84. package/styles/rich-text-editor/icons/_bootstrap.scss +4 -2
  85. package/styles/rich-text-editor/icons/_bootstrap4.scss +4 -2
  86. package/styles/rich-text-editor/icons/_bootstrap5.3.scss +4 -2
  87. package/styles/rich-text-editor/icons/_bootstrap5.scss +4 -2
  88. package/styles/rich-text-editor/icons/_fabric-dark.scss +4 -2
  89. package/styles/rich-text-editor/icons/_fabric.scss +4 -2
  90. package/styles/rich-text-editor/icons/_fluent.scss +5 -1
  91. package/styles/rich-text-editor/icons/_fluent2.scss +4 -2
  92. package/styles/rich-text-editor/icons/_fusionnew.scss +4 -2
  93. package/styles/rich-text-editor/icons/_highcontrast-light.scss +5 -1
  94. package/styles/rich-text-editor/icons/_highcontrast.scss +5 -1
  95. package/styles/rich-text-editor/icons/_material-dark.scss +5 -1
  96. package/styles/rich-text-editor/icons/_material.scss +5 -1
  97. package/styles/rich-text-editor/icons/_material3.scss +5 -1
  98. package/styles/rich-text-editor/icons/_tailwind.scss +5 -1
  99. package/styles/rich-text-editor/icons/_tailwind3.scss +5 -1
  100. package/styles/rich-text-editor/material-dark.css +287 -28
  101. package/styles/rich-text-editor/material.css +287 -28
  102. package/styles/rich-text-editor/material3-dark.css +289 -28
  103. package/styles/rich-text-editor/material3.css +289 -28
  104. package/styles/rich-text-editor/tailwind-dark.css +289 -30
  105. package/styles/rich-text-editor/tailwind.css +289 -30
  106. package/styles/rich-text-editor/tailwind3.css +291 -32
  107. package/styles/tailwind-dark-lite.css +278 -29
  108. package/styles/tailwind-dark.css +289 -30
  109. package/styles/tailwind-lite.css +278 -29
  110. package/styles/tailwind.css +289 -30
  111. package/styles/tailwind3-lite.css +280 -31
  112. package/styles/tailwind3.css +291 -32
  113. package/aceconfig.js +0 -17
  114. package/blazorGlobalSrc/common/config.d.ts +0 -63
  115. package/blazorGlobalSrc/common/config.js +0 -123
  116. package/blazorGlobalSrc/common/constant.d.ts +0 -117
  117. package/blazorGlobalSrc/common/constant.js +0 -23
  118. package/blazorGlobalSrc/common/editor-styles.d.ts +0 -1
  119. package/blazorGlobalSrc/common/editor-styles.js +0 -5
  120. package/blazorGlobalSrc/common/index.d.ts +0 -7
  121. package/blazorGlobalSrc/common/index.js +0 -9
  122. package/blazorGlobalSrc/common/interface.d.ts +0 -119
  123. package/blazorGlobalSrc/common/interface.js +0 -4
  124. package/blazorGlobalSrc/common/types.d.ts +0 -25
  125. package/blazorGlobalSrc/common/types.js +0 -4
  126. package/blazorGlobalSrc/common/user-agent.d.ts +0 -41
  127. package/blazorGlobalSrc/common/user-agent.js +0 -71
  128. package/blazorGlobalSrc/common/util.d.ts +0 -70
  129. package/blazorGlobalSrc/common/util.js +0 -222
  130. package/blazorGlobalSrc/components.d.ts +0 -8
  131. package/blazorGlobalSrc/components.js +0 -12
  132. package/blazorGlobalSrc/editor-manager/base/classes.d.ts +0 -31
  133. package/blazorGlobalSrc/editor-manager/base/classes.js +0 -28
  134. package/blazorGlobalSrc/editor-manager/base/constant.d.ts +0 -97
  135. package/blazorGlobalSrc/editor-manager/base/constant.js +0 -41
  136. package/blazorGlobalSrc/editor-manager/base/editor-manager.d.ts +0 -95
  137. package/blazorGlobalSrc/editor-manager/base/editor-manager.js +0 -339
  138. package/blazorGlobalSrc/editor-manager/base/enum.d.ts +0 -17
  139. package/blazorGlobalSrc/editor-manager/base/enum.js +0 -4
  140. package/blazorGlobalSrc/editor-manager/base/interface.d.ts +0 -263
  141. package/blazorGlobalSrc/editor-manager/base/interface.js +0 -4
  142. package/blazorGlobalSrc/editor-manager/base/types.d.ts +0 -7
  143. package/blazorGlobalSrc/editor-manager/base/types.js +0 -4
  144. package/blazorGlobalSrc/editor-manager/base.d.ts +0 -8
  145. package/blazorGlobalSrc/editor-manager/base.js +0 -10
  146. package/blazorGlobalSrc/editor-manager/index.d.ts +0 -5
  147. package/blazorGlobalSrc/editor-manager/index.js +0 -9
  148. package/blazorGlobalSrc/editor-manager/plugin/alignments.d.ts +0 -26
  149. package/blazorGlobalSrc/editor-manager/plugin/alignments.js +0 -105
  150. package/blazorGlobalSrc/editor-manager/plugin/audio.d.ts +0 -34
  151. package/blazorGlobalSrc/editor-manager/plugin/audio.js +0 -145
  152. package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.d.ts +0 -24
  153. package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.js +0 -47
  154. package/blazorGlobalSrc/editor-manager/plugin/clearformat.d.ts +0 -29
  155. package/blazorGlobalSrc/editor-manager/plugin/clearformat.js +0 -249
  156. package/blazorGlobalSrc/editor-manager/plugin/dom-node.d.ts +0 -351
  157. package/blazorGlobalSrc/editor-manager/plugin/dom-node.js +0 -737
  158. package/blazorGlobalSrc/editor-manager/plugin/dom-tree.d.ts +0 -84
  159. package/blazorGlobalSrc/editor-manager/plugin/dom-tree.js +0 -164
  160. package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.d.ts +0 -10
  161. package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.js +0 -86
  162. package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.d.ts +0 -47
  163. package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.js +0 -622
  164. package/blazorGlobalSrc/editor-manager/plugin/formats.d.ts +0 -43
  165. package/blazorGlobalSrc/editor-manager/plugin/formats.js +0 -597
  166. package/blazorGlobalSrc/editor-manager/plugin/image.d.ts +0 -48
  167. package/blazorGlobalSrc/editor-manager/plugin/image.js +0 -399
  168. package/blazorGlobalSrc/editor-manager/plugin/indents.d.ts +0 -24
  169. package/blazorGlobalSrc/editor-manager/plugin/indents.js +0 -106
  170. package/blazorGlobalSrc/editor-manager/plugin/insert-methods.d.ts +0 -48
  171. package/blazorGlobalSrc/editor-manager/plugin/insert-methods.js +0 -37
  172. package/blazorGlobalSrc/editor-manager/plugin/insert-text.d.ts +0 -22
  173. package/blazorGlobalSrc/editor-manager/plugin/insert-text.js +0 -36
  174. package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.d.ts +0 -22
  175. package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.js +0 -49
  176. package/blazorGlobalSrc/editor-manager/plugin/inserthtml.d.ts +0 -51
  177. package/blazorGlobalSrc/editor-manager/plugin/inserthtml.js +0 -985
  178. package/blazorGlobalSrc/editor-manager/plugin/isformatted.d.ts +0 -89
  179. package/blazorGlobalSrc/editor-manager/plugin/isformatted.js +0 -199
  180. package/blazorGlobalSrc/editor-manager/plugin/link.d.ts +0 -41
  181. package/blazorGlobalSrc/editor-manager/plugin/link.js +0 -550
  182. package/blazorGlobalSrc/editor-manager/plugin/lists.d.ts +0 -74
  183. package/blazorGlobalSrc/editor-manager/plugin/lists.js +0 -1503
  184. package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.d.ts +0 -61
  185. package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.js +0 -1136
  186. package/blazorGlobalSrc/editor-manager/plugin/nodecutter.d.ts +0 -64
  187. package/blazorGlobalSrc/editor-manager/plugin/nodecutter.js +0 -167
  188. package/blazorGlobalSrc/editor-manager/plugin/selection-commands.d.ts +0 -41
  189. package/blazorGlobalSrc/editor-manager/plugin/selection-commands.js +0 -1069
  190. package/blazorGlobalSrc/editor-manager/plugin/selection-exec.d.ts +0 -24
  191. package/blazorGlobalSrc/editor-manager/plugin/selection-exec.js +0 -49
  192. package/blazorGlobalSrc/editor-manager/plugin/table-selection.d.ts +0 -26
  193. package/blazorGlobalSrc/editor-manager/plugin/table-selection.js +0 -210
  194. package/blazorGlobalSrc/editor-manager/plugin/table.d.ts +0 -56
  195. package/blazorGlobalSrc/editor-manager/plugin/table.js +0 -1100
  196. package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.d.ts +0 -39
  197. package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.js +0 -384
  198. package/blazorGlobalSrc/editor-manager/plugin/undo.d.ts +0 -85
  199. package/blazorGlobalSrc/editor-manager/plugin/undo.js +0 -216
  200. package/blazorGlobalSrc/editor-manager/plugin/video.d.ts +0 -38
  201. package/blazorGlobalSrc/editor-manager/plugin/video.js +0 -311
  202. package/blazorGlobalSrc/editor-manager/plugin.d.ts +0 -27
  203. package/blazorGlobalSrc/editor-manager/plugin.js +0 -31
  204. package/blazorGlobalSrc/global.d.ts +0 -1
  205. package/blazorGlobalSrc/global.js +0 -3
  206. package/blazorGlobalSrc/index.d.ts +0 -8
  207. package/blazorGlobalSrc/index.js +0 -12
  208. package/blazorGlobalSrc/markdown-parser/base/constant.d.ts +0 -39
  209. package/blazorGlobalSrc/markdown-parser/base/constant.js +0 -10
  210. package/blazorGlobalSrc/markdown-parser/base/interface.d.ts +0 -169
  211. package/blazorGlobalSrc/markdown-parser/base/interface.js +0 -4
  212. package/blazorGlobalSrc/markdown-parser/base/markdown-parser.d.ts +0 -69
  213. package/blazorGlobalSrc/markdown-parser/base/markdown-parser.js +0 -87
  214. package/blazorGlobalSrc/markdown-parser/base/types.d.ts +0 -7
  215. package/blazorGlobalSrc/markdown-parser/base/types.js +0 -4
  216. package/blazorGlobalSrc/markdown-parser/base.d.ts +0 -7
  217. package/blazorGlobalSrc/markdown-parser/base.js +0 -9
  218. package/blazorGlobalSrc/markdown-parser/index.d.ts +0 -5
  219. package/blazorGlobalSrc/markdown-parser/index.js +0 -9
  220. package/blazorGlobalSrc/markdown-parser/plugin/clearformat.d.ts +0 -28
  221. package/blazorGlobalSrc/markdown-parser/plugin/clearformat.js +0 -110
  222. package/blazorGlobalSrc/markdown-parser/plugin/formats.d.ts +0 -32
  223. package/blazorGlobalSrc/markdown-parser/plugin/formats.js +0 -225
  224. package/blazorGlobalSrc/markdown-parser/plugin/insert-text.d.ts +0 -24
  225. package/blazorGlobalSrc/markdown-parser/plugin/insert-text.js +0 -49
  226. package/blazorGlobalSrc/markdown-parser/plugin/link.d.ts +0 -24
  227. package/blazorGlobalSrc/markdown-parser/plugin/link.js +0 -50
  228. package/blazorGlobalSrc/markdown-parser/plugin/lists.d.ts +0 -39
  229. package/blazorGlobalSrc/markdown-parser/plugin/lists.js +0 -462
  230. package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.d.ts +0 -140
  231. package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.js +0 -104
  232. package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.d.ts +0 -31
  233. package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.js +0 -335
  234. package/blazorGlobalSrc/markdown-parser/plugin/table.d.ts +0 -52
  235. package/blazorGlobalSrc/markdown-parser/plugin/table.js +0 -216
  236. package/blazorGlobalSrc/markdown-parser/plugin/undo.d.ts +0 -83
  237. package/blazorGlobalSrc/markdown-parser/plugin/undo.js +0 -147
  238. package/blazorGlobalSrc/markdown-parser/plugin.d.ts +0 -11
  239. package/blazorGlobalSrc/markdown-parser/plugin.js +0 -15
  240. package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.d.ts +0 -114
  241. package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.js +0 -465
  242. package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.d.ts +0 -58
  243. package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.js +0 -216
  244. package/blazorGlobalSrc/rich-text-editor/actions/color-picker.d.ts +0 -52
  245. package/blazorGlobalSrc/rich-text-editor/actions/color-picker.js +0 -241
  246. package/blazorGlobalSrc/rich-text-editor/actions/count.d.ts +0 -55
  247. package/blazorGlobalSrc/rich-text-editor/actions/count.js +0 -117
  248. package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.d.ts +0 -72
  249. package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.js +0 -552
  250. package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.d.ts +0 -51
  251. package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.js +0 -853
  252. package/blazorGlobalSrc/rich-text-editor/actions/enter-key.d.ts +0 -28
  253. package/blazorGlobalSrc/rich-text-editor/actions/enter-key.js +0 -821
  254. package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.d.ts +0 -11
  255. package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.js +0 -28
  256. package/blazorGlobalSrc/rich-text-editor/actions/file-manager.d.ts +0 -45
  257. package/blazorGlobalSrc/rich-text-editor/actions/file-manager.js +0 -249
  258. package/blazorGlobalSrc/rich-text-editor/actions/format-painter.d.ts +0 -25
  259. package/blazorGlobalSrc/rich-text-editor/actions/format-painter.js +0 -156
  260. package/blazorGlobalSrc/rich-text-editor/actions/full-screen.d.ts +0 -40
  261. package/blazorGlobalSrc/rich-text-editor/actions/full-screen.js +0 -148
  262. package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.d.ts +0 -15
  263. package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.js +0 -50
  264. package/blazorGlobalSrc/rich-text-editor/actions/html-editor.d.ts +0 -120
  265. package/blazorGlobalSrc/rich-text-editor/actions/html-editor.js +0 -1244
  266. package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.d.ts +0 -14
  267. package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.js +0 -47
  268. package/blazorGlobalSrc/rich-text-editor/actions/import-export.d.ts +0 -21
  269. package/blazorGlobalSrc/rich-text-editor/actions/import-export.js +0 -117
  270. package/blazorGlobalSrc/rich-text-editor/actions/keyboard-model.d.ts +0 -30
  271. package/blazorGlobalSrc/rich-text-editor/actions/keyboard.d.ts +0 -110
  272. package/blazorGlobalSrc/rich-text-editor/actions/keyboard.js +0 -163
  273. package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.d.ts +0 -66
  274. package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.js +0 -142
  275. package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.d.ts +0 -23
  276. package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.js +0 -124
  277. package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.d.ts +0 -86
  278. package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.js +0 -1071
  279. package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.d.ts +0 -151
  280. package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.js +0 -548
  281. package/blazorGlobalSrc/rich-text-editor/actions/resize.d.ts +0 -37
  282. package/blazorGlobalSrc/rich-text-editor/actions/resize.js +0 -188
  283. package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.d.ts +0 -11
  284. package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.js +0 -168
  285. package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.d.ts +0 -18
  286. package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.js +0 -76
  287. package/blazorGlobalSrc/rich-text-editor/actions/toolbar.d.ts +0 -185
  288. package/blazorGlobalSrc/rich-text-editor/actions/toolbar.js +0 -512
  289. package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.d.ts +0 -25
  290. package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.js +0 -166
  291. package/blazorGlobalSrc/rich-text-editor/actions.d.ts +0 -26
  292. package/blazorGlobalSrc/rich-text-editor/actions.js +0 -30
  293. package/blazorGlobalSrc/rich-text-editor/audio.d.ts +0 -4
  294. package/blazorGlobalSrc/rich-text-editor/audio.js +0 -8
  295. package/blazorGlobalSrc/rich-text-editor/base/classes.d.ts +0 -628
  296. package/blazorGlobalSrc/rich-text-editor/base/classes.js +0 -129
  297. package/blazorGlobalSrc/rich-text-editor/base/constant.d.ts +0 -808
  298. package/blazorGlobalSrc/rich-text-editor/base/constant.js +0 -334
  299. package/blazorGlobalSrc/rich-text-editor/base/enum.d.ts +0 -81
  300. package/blazorGlobalSrc/rich-text-editor/base/enum.js +0 -37
  301. package/blazorGlobalSrc/rich-text-editor/base/interface.d.ts +0 -1577
  302. package/blazorGlobalSrc/rich-text-editor/base/interface.js +0 -194
  303. package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor-model.d.ts +0 -1032
  304. package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.d.ts +0 -1699
  305. package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.js +0 -2645
  306. package/blazorGlobalSrc/rich-text-editor/base/util.d.ts +0 -212
  307. package/blazorGlobalSrc/rich-text-editor/base/util.js +0 -610
  308. package/blazorGlobalSrc/rich-text-editor/base.d.ts +0 -10
  309. package/blazorGlobalSrc/rich-text-editor/base.js +0 -13
  310. package/blazorGlobalSrc/rich-text-editor/formatter/formatter.d.ts +0 -87
  311. package/blazorGlobalSrc/rich-text-editor/formatter/formatter.js +0 -223
  312. package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.d.ts +0 -34
  313. package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.js +0 -44
  314. package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.d.ts +0 -39
  315. package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.js +0 -48
  316. package/blazorGlobalSrc/rich-text-editor/formatter.d.ts +0 -6
  317. package/blazorGlobalSrc/rich-text-editor/formatter.js +0 -10
  318. package/blazorGlobalSrc/rich-text-editor/html-editor.d.ts +0 -4
  319. package/blazorGlobalSrc/rich-text-editor/html-editor.js +0 -8
  320. package/blazorGlobalSrc/rich-text-editor/image.d.ts +0 -4
  321. package/blazorGlobalSrc/rich-text-editor/image.js +0 -8
  322. package/blazorGlobalSrc/rich-text-editor/index.d.ts +0 -9
  323. package/blazorGlobalSrc/rich-text-editor/index.js +0 -12
  324. package/blazorGlobalSrc/rich-text-editor/link.d.ts +0 -4
  325. package/blazorGlobalSrc/rich-text-editor/link.js +0 -8
  326. package/blazorGlobalSrc/rich-text-editor/markdown-editor.d.ts +0 -4
  327. package/blazorGlobalSrc/rich-text-editor/markdown-editor.js +0 -8
  328. package/blazorGlobalSrc/rich-text-editor/models/default-locale.d.ts +0 -25
  329. package/blazorGlobalSrc/rich-text-editor/models/default-locale.js +0 -391
  330. package/blazorGlobalSrc/rich-text-editor/models/iframe-settings-model.d.ts +0 -68
  331. package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.d.ts +0 -61
  332. package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.js +0 -60
  333. package/blazorGlobalSrc/rich-text-editor/models/inline-mode-model.d.ts +0 -24
  334. package/blazorGlobalSrc/rich-text-editor/models/inline-mode.d.ts +0 -20
  335. package/blazorGlobalSrc/rich-text-editor/models/inline-mode.js +0 -37
  336. package/blazorGlobalSrc/rich-text-editor/models/items.d.ts +0 -36
  337. package/blazorGlobalSrc/rich-text-editor/models/items.js +0 -1011
  338. package/blazorGlobalSrc/rich-text-editor/models/models.d.ts +0 -7
  339. package/blazorGlobalSrc/rich-text-editor/models/models.js +0 -4
  340. package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings-model.d.ts +0 -40
  341. package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.d.ts +0 -50
  342. package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.js +0 -143
  343. package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings-model.d.ts +0 -1130
  344. package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.d.ts +0 -992
  345. package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.js +0 -510
  346. package/blazorGlobalSrc/rich-text-editor/models.d.ts +0 -4
  347. package/blazorGlobalSrc/rich-text-editor/models.js +0 -4
  348. package/blazorGlobalSrc/rich-text-editor/quick-toolbar.d.ts +0 -4
  349. package/blazorGlobalSrc/rich-text-editor/quick-toolbar.js +0 -8
  350. package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.d.ts +0 -82
  351. package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.js +0 -886
  352. package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.d.ts +0 -65
  353. package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.js +0 -49
  354. package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.d.ts +0 -39
  355. package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.js +0 -111
  356. package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.d.ts +0 -33
  357. package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.js +0 -101
  358. package/blazorGlobalSrc/rich-text-editor/renderer/image-module.d.ts +0 -199
  359. package/blazorGlobalSrc/rich-text-editor/renderer/image-module.js +0 -2494
  360. package/blazorGlobalSrc/rich-text-editor/renderer/link-module.d.ts +0 -63
  361. package/blazorGlobalSrc/rich-text-editor/renderer/link-module.js +0 -596
  362. package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.d.ts +0 -65
  363. package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.js +0 -38
  364. package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.d.ts +0 -54
  365. package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.js +0 -35
  366. package/blazorGlobalSrc/rich-text-editor/renderer/render.d.ts +0 -46
  367. package/blazorGlobalSrc/rich-text-editor/renderer/render.js +0 -70
  368. package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.d.ts +0 -20
  369. package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.js +0 -224
  370. package/blazorGlobalSrc/rich-text-editor/renderer/table-module.d.ts +0 -155
  371. package/blazorGlobalSrc/rich-text-editor/renderer/table-module.js +0 -2206
  372. package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -131
  373. package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.js +0 -747
  374. package/blazorGlobalSrc/rich-text-editor/renderer/video-module.d.ts +0 -120
  375. package/blazorGlobalSrc/rich-text-editor/renderer/video-module.js +0 -1507
  376. package/blazorGlobalSrc/rich-text-editor/renderer/view-source.d.ts +0 -74
  377. package/blazorGlobalSrc/rich-text-editor/renderer/view-source.js +0 -225
  378. package/blazorGlobalSrc/rich-text-editor/renderer.d.ts +0 -17
  379. package/blazorGlobalSrc/rich-text-editor/renderer.js +0 -21
  380. package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.d.ts +0 -33
  381. package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.js +0 -29
  382. package/blazorGlobalSrc/rich-text-editor/services/service-locator.d.ts +0 -29
  383. package/blazorGlobalSrc/rich-text-editor/services/service-locator.js +0 -25
  384. package/blazorGlobalSrc/rich-text-editor/services.d.ts +0 -5
  385. package/blazorGlobalSrc/rich-text-editor/services.js +0 -9
  386. package/blazorGlobalSrc/rich-text-editor/toolbar.d.ts +0 -4
  387. package/blazorGlobalSrc/rich-text-editor/toolbar.js +0 -8
  388. package/blazorGlobalSrc/rich-text-editor/video.d.ts +0 -4
  389. package/blazorGlobalSrc/rich-text-editor/video.js +0 -8
  390. package/blazorGlobalSrc/rich-text-editor.d.ts +0 -4
  391. package/blazorGlobalSrc/rich-text-editor.js +0 -8
  392. package/blazorGlobalSrc/selection/index.d.ts +0 -4
  393. package/blazorGlobalSrc/selection/index.js +0 -8
  394. package/blazorGlobalSrc/selection/selection.d.ts +0 -244
  395. package/blazorGlobalSrc/selection/selection.js +0 -309
  396. package/helpers/e2e/index.d.ts +0 -1
  397. package/helpers/e2e/index.js +0 -8
  398. package/helpers/e2e/rte-helper.d.ts +0 -79
  399. package/helpers/e2e/rte-helper.js +0 -81
  400. package/src/global.d.ts +0 -1
  401. package/tslint.json +0 -111
@@ -1,1100 +0,0 @@
1
- define(["require", "exports", "@syncfusion/ej2-base", "./../base/constant", "./inserthtml", "../../common/util", "../../common/constant"], function (require, exports, ej2_base_1, CONSTANT, inserthtml_1, util_1, EVENTS) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- var TableCommand = (function () {
5
- function TableCommand(parent) {
6
- this.parent = parent;
7
- this.addEventListener();
8
- }
9
- TableCommand.prototype.addEventListener = function () {
10
- this.parent.observer.on(CONSTANT.TABLE, this.createTable, this);
11
- this.parent.observer.on(CONSTANT.INSERT_ROW, this.insertRow, this);
12
- this.parent.observer.on(CONSTANT.INSERT_COLUMN, this.insertColumn, this);
13
- this.parent.observer.on(CONSTANT.DELETEROW, this.deleteRow, this);
14
- this.parent.observer.on(CONSTANT.DELETECOLUMN, this.deleteColumn, this);
15
- this.parent.observer.on(CONSTANT.REMOVETABLE, this.removeTable, this);
16
- this.parent.observer.on(CONSTANT.TABLEHEADER, this.tableHeader, this);
17
- this.parent.observer.on(CONSTANT.TABLE_VERTICAL_ALIGN, this.tableVerticalAlign, this);
18
- this.parent.observer.on(CONSTANT.TABLE_MERGE, this.cellMerge, this);
19
- this.parent.observer.on(CONSTANT.TABLE_HORIZONTAL_SPLIT, this.HorizontalSplit, this);
20
- this.parent.observer.on(CONSTANT.TABLE_VERTICAL_SPLIT, this.VerticalSplit, this);
21
- this.parent.observer.on(CONSTANT.TABLE_DASHED, this.tableStyle, this);
22
- this.parent.observer.on(CONSTANT.TABLE_BACKGROUND_COLOR, this.setBGColor, this);
23
- this.parent.observer.on(CONSTANT.TABLE_ALTERNATE, this.tableStyle, this);
24
- this.parent.observer.on(CONSTANT.TABLE_MOVE, this.tableMove, this);
25
- this.parent.observer.on(EVENTS.INTERNAL_DESTROY, this.destroy, this);
26
- };
27
- TableCommand.prototype.removeEventListener = function () {
28
- this.parent.observer.off(CONSTANT.TABLE, this.createTable);
29
- this.parent.observer.off(CONSTANT.INSERT_ROW, this.insertRow);
30
- this.parent.observer.off(CONSTANT.INSERT_COLUMN, this.insertColumn);
31
- this.parent.observer.off(CONSTANT.DELETEROW, this.deleteRow);
32
- this.parent.observer.off(CONSTANT.DELETECOLUMN, this.deleteColumn);
33
- this.parent.observer.off(CONSTANT.REMOVETABLE, this.removeTable);
34
- this.parent.observer.off(CONSTANT.TABLEHEADER, this.tableHeader);
35
- this.parent.observer.off(CONSTANT.TABLE_VERTICAL_ALIGN, this.tableVerticalAlign);
36
- this.parent.observer.off(CONSTANT.TABLE_MERGE, this.cellMerge);
37
- this.parent.observer.off(CONSTANT.TABLE_HORIZONTAL_SPLIT, this.HorizontalSplit);
38
- this.parent.observer.off(CONSTANT.TABLE_VERTICAL_SPLIT, this.VerticalSplit);
39
- this.parent.observer.off(CONSTANT.TABLE_DASHED, this.tableStyle);
40
- this.parent.observer.off(CONSTANT.TABLE_ALTERNATE, this.tableStyle);
41
- this.parent.observer.off(CONSTANT.TABLE_BACKGROUND_COLOR, this.setBGColor);
42
- this.parent.observer.off(CONSTANT.TABLE_MOVE, this.tableMove);
43
- this.parent.observer.off(EVENTS.INTERNAL_DESTROY, this.destroy);
44
- };
45
- TableCommand.prototype.createTable = function (e) {
46
- var table = ej2_base_1.createElement('table', { className: 'e-rte-table' });
47
- var tblBody = ej2_base_1.createElement('tbody');
48
- if (!ej2_base_1.isNullOrUndefined(e.item.width.width)) {
49
- table.style.width = this.calculateStyleValue(e.item.width.width);
50
- }
51
- if (!ej2_base_1.isNullOrUndefined(e.item.width.minWidth)) {
52
- table.style.minWidth = this.calculateStyleValue(e.item.width.minWidth);
53
- }
54
- if (!ej2_base_1.isNullOrUndefined(e.item.width.maxWidth)) {
55
- table.style.maxWidth = this.calculateStyleValue(e.item.width.maxWidth);
56
- }
57
- var tdWid = parseInt(e.item.width.width, 10) > 100 ?
58
- 100 / e.item.columns : parseInt(e.item.width.width, 10) / e.item.columns;
59
- for (var i = 0; i < e.item.rows; i++) {
60
- var row = ej2_base_1.createElement('tr');
61
- for (var j = 0; j < e.item.columns; j++) {
62
- var cell = ej2_base_1.createElement('td');
63
- cell.appendChild(ej2_base_1.createElement('br'));
64
- cell.style.width = tdWid + '%';
65
- row.appendChild(cell);
66
- }
67
- tblBody.appendChild(row);
68
- }
69
- table.appendChild(tblBody);
70
- e.item.selection.restore();
71
- inserthtml_1.InsertHtml.Insert(this.parent.currentDocument, table, this.parent.editableElement);
72
- e.item.selection.setSelectionText(this.parent.currentDocument, table.querySelector('td'), table.querySelector('td'), 0, 0);
73
- if (table.nextElementSibling === null && !table.classList.contains('ignore-table')) {
74
- var insertElem = void 0;
75
- if (e.enterAction === 'DIV') {
76
- insertElem = ej2_base_1.createElement('div');
77
- insertElem.appendChild(ej2_base_1.createElement('br'));
78
- }
79
- else if (e.enterAction === 'BR') {
80
- insertElem = ej2_base_1.createElement('br');
81
- }
82
- else {
83
- insertElem = ej2_base_1.createElement('p');
84
- insertElem.appendChild(ej2_base_1.createElement('br'));
85
- }
86
- this.insertAfter(insertElem, table);
87
- }
88
- if (table.classList.contains('ignore-table')) {
89
- util_1.removeClassWithAttr([table], ['ignore-table']);
90
- }
91
- table.querySelector('td').classList.add('e-cell-select');
92
- if (e.callBack) {
93
- e.callBack({
94
- requestType: 'Table',
95
- editorMode: 'HTML',
96
- event: e.event,
97
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
98
- elements: [table]
99
- });
100
- }
101
- return table;
102
- };
103
- TableCommand.prototype.calculateStyleValue = function (value) {
104
- var styleValue;
105
- if (typeof (value) === 'string') {
106
- if (value.indexOf('px') >= 0 || value.indexOf('%') >= 0 || value.indexOf('auto') >= 0) {
107
- styleValue = value;
108
- }
109
- else {
110
- styleValue = value + 'px';
111
- }
112
- }
113
- else {
114
- styleValue = value + 'px';
115
- }
116
- return styleValue;
117
- };
118
- TableCommand.prototype.insertAfter = function (newNode, referenceNode) {
119
- referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
120
- };
121
- TableCommand.prototype.getSelectedCellMinMaxIndex = function (e) {
122
- var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
123
- var a = 0;
124
- var minI = e.length;
125
- var maxI = 0;
126
- var minJ = e[0].length;
127
- var maxJ = 0;
128
- for (var i = 0; a < selectedCells.length; a++) {
129
- var selectedCellIndex = this.getCorrespondingIndex(selectedCells[a], e);
130
- var minMaxIndex = this.FindIndex(selectedCellIndex[0], selectedCellIndex[1], e);
131
- minI = Math.min(selectedCellIndex[0], minI),
132
- maxI = Math.max(minMaxIndex[0], maxI),
133
- minJ = Math.min(selectedCellIndex[1], minJ),
134
- maxJ = Math.max(minMaxIndex[1], maxJ);
135
- }
136
- return {
137
- startRow: minI,
138
- endRow: maxI,
139
- startColumn: minJ,
140
- endColumn: maxJ
141
- };
142
- };
143
- TableCommand.prototype.insertRow = function (e) {
144
- var isBelow = e.item.subCommand === 'InsertRowBefore' ? false : true;
145
- var selectedCell = e.item.selection.range.startContainer;
146
- if (!(selectedCell.nodeName === 'TH' || selectedCell.nodeName === 'TD')) {
147
- selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
148
- }
149
- this.curTable = ej2_base_1.closest(this.parent.nodeSelection.range.startContainer.parentElement, 'table');
150
- if (this.curTable.querySelectorAll('.e-cell-select').length === 0) {
151
- var lastRow = this.curTable.rows[this.curTable.rows.length - 1];
152
- var cloneRow = lastRow.cloneNode(true);
153
- cloneRow.removeAttribute('rowspan');
154
- this.insertAfter(cloneRow, lastRow);
155
- }
156
- else {
157
- var allCells = this.getCorrespondingColumns();
158
- var minMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
159
- var minVal = isBelow ? minMaxIndex.endRow : minMaxIndex.startRow;
160
- var newRow = ej2_base_1.createElement('tr');
161
- var isHeaderSelect = this.curTable.querySelectorAll('th.e-cell-select').length > 0;
162
- for (var i = 0; i < allCells[minVal].length; i++) {
163
- if (isBelow && minVal < allCells.length - 1 && allCells[minVal][i] === allCells[minVal + 1][i] ||
164
- !isBelow && 0 < minVal && allCells[minVal][i] === allCells[minVal - 1][i]) {
165
- if (0 === i || 0 < i && allCells[minVal][i] !== allCells[minVal][i - 1]) {
166
- allCells[minVal][i].setAttribute('rowspan', (parseInt(allCells[minVal][i].getAttribute('rowspan'), 10) + 1).toString());
167
- }
168
- }
169
- else {
170
- var tdElement = ej2_base_1.createElement('td');
171
- tdElement.appendChild(ej2_base_1.createElement('br'));
172
- newRow.appendChild(tdElement);
173
- var styleValue = allCells[(isHeaderSelect && isBelow) ? allCells[(minVal + 1)] ? (minVal + 1) : minVal : minVal][i].getAttribute('style');
174
- if (styleValue) {
175
- var updatedStyle = this.cellStyleCleanup(styleValue);
176
- tdElement.style.cssText = updatedStyle;
177
- }
178
- }
179
- }
180
- var selectedRow = void 0;
181
- if (isHeaderSelect && isBelow) {
182
- selectedRow = this.curTable.querySelector('tbody').childNodes[0];
183
- }
184
- else {
185
- selectedRow = this.curTable.rows[minVal];
186
- }
187
- (e.item.subCommand === 'InsertRowBefore') ? selectedRow.parentElement.insertBefore(newRow, selectedRow) :
188
- (isHeaderSelect ? selectedRow.parentElement.insertBefore(newRow, selectedRow) :
189
- this.insertAfter(newRow, selectedRow));
190
- }
191
- e.item.selection.setSelectionText(this.parent.currentDocument, e.item.selection.range.startContainer, e.item.selection.range.startContainer, 0, 0);
192
- if (e.callBack) {
193
- e.callBack({
194
- requestType: e.item.subCommand,
195
- editorMode: 'HTML',
196
- event: e.event,
197
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
198
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
199
- });
200
- }
201
- };
202
- TableCommand.prototype.insertColumn = function (e) {
203
- var selectedCell = e.item.selection.range.startContainer;
204
- if (!(selectedCell.nodeName === 'TH' || selectedCell.nodeName === 'TD')) {
205
- selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
206
- }
207
- var curRow = ej2_base_1.closest(selectedCell, 'tr');
208
- var curCell;
209
- var allRows = ej2_base_1.closest((curRow), 'table').rows;
210
- var colIndex = Array.prototype.slice.call(curRow.querySelectorAll(':scope > td, :scope > th')).indexOf(selectedCell);
211
- var previousWidth = parseInt(e.item.width, 10) / (curRow.querySelectorAll(':scope > td, :scope > th').length);
212
- var currentWidth = parseInt(e.item.width, 10) / (curRow.querySelectorAll(':scope > td, :scope > th').length + 1);
213
- var currentTabElm = ej2_base_1.closest(curRow, 'table');
214
- var thTdElm = ej2_base_1.closest(curRow, 'table').querySelectorAll('th,td');
215
- for (var i = 0; i < thTdElm.length; i++) {
216
- thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + '%';
217
- }
218
- if (ej2_base_1.isNullOrUndefined(currentTabElm.style.width) || currentTabElm.style.width === '') {
219
- currentTabElm.style.width = currentTabElm.offsetWidth + 'px';
220
- }
221
- for (var i = 0; i < allRows.length; i++) {
222
- curCell = allRows[i].querySelectorAll(':scope > td, :scope > th')[colIndex];
223
- var colTemplate = curCell.cloneNode(true);
224
- var style = colTemplate.getAttribute('style');
225
- if (style) {
226
- var updatedStyle = this.cellStyleCleanup(style);
227
- colTemplate.style.cssText = updatedStyle;
228
- }
229
- colTemplate.innerHTML = '';
230
- colTemplate.appendChild(ej2_base_1.createElement('br'));
231
- colTemplate.removeAttribute('class');
232
- colTemplate.removeAttribute('colspan');
233
- colTemplate.removeAttribute('rowspan');
234
- (e.item.subCommand === 'InsertColumnLeft') ? curCell.parentElement.insertBefore(colTemplate, curCell) :
235
- this.insertAfter(colTemplate, curCell);
236
- colTemplate.style.width = currentWidth.toFixed(4) + '%';
237
- delete colTemplate.dataset.oldWidth;
238
- }
239
- for (var i = 0; i < thTdElm.length; i++) {
240
- thTdElm[i].style.width = (Number(thTdElm[i].dataset.oldWidth.split('%')[0]) * currentWidth / previousWidth).toFixed(4) + '%';
241
- delete thTdElm[i].dataset.oldWidth;
242
- }
243
- e.item.selection.setSelectionText(this.parent.currentDocument, selectedCell, selectedCell, 0, 0);
244
- if (e.callBack) {
245
- e.callBack({
246
- requestType: e.item.subCommand,
247
- editorMode: 'HTML',
248
- event: e.event,
249
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
250
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
251
- });
252
- }
253
- };
254
- TableCommand.prototype.setBGColor = function (args) {
255
- var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
256
- var start = range.startContainer.nodeType === 3 ?
257
- range.startContainer.parentNode : range.startContainer;
258
- this.curTable = start.closest('table');
259
- var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
260
- for (var i = 0; i < selectedCells.length; i++) {
261
- selectedCells[i].style.backgroundColor = args.value.toString();
262
- }
263
- this.parent.undoRedoManager.saveData();
264
- if (args.callBack) {
265
- args.callBack({
266
- requestType: args.subCommand,
267
- editorMode: 'HTML',
268
- event: args.event,
269
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
270
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
271
- });
272
- }
273
- };
274
- TableCommand.prototype.deleteColumn = function (e) {
275
- var selectedCell = e.item.selection.range.startContainer;
276
- if (selectedCell.nodeType === 3) {
277
- selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
278
- }
279
- var tBodyHeadEle = ej2_base_1.closest(selectedCell, selectedCell.tagName === 'TH' ? 'thead' : 'tbody');
280
- var rowIndex = tBodyHeadEle && Array.prototype.indexOf.call(tBodyHeadEle.childNodes, selectedCell.parentNode);
281
- this.curTable = ej2_base_1.closest(selectedCell, 'table');
282
- var curRow = ej2_base_1.closest(selectedCell, 'tr');
283
- if (curRow.querySelectorAll('th,td').length === 1) {
284
- e.item.selection.restore();
285
- ej2_base_1.detach(ej2_base_1.closest(selectedCell.parentElement, 'table'));
286
- }
287
- else {
288
- var deleteIndex = void 0;
289
- var allCells = this.getCorrespondingColumns();
290
- var selectedMinMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
291
- var minCol = selectedMinMaxIndex.startColumn;
292
- var maxCol = selectedMinMaxIndex.endColumn;
293
- for (var i = 0; i < allCells.length; i++) {
294
- var currentRow = allCells[i];
295
- for (var j = 0; j < currentRow.length; j++) {
296
- var currentCell = currentRow[j];
297
- var currentCellIndex = this.getCorrespondingIndex(currentCell, allCells);
298
- var colSpanVal = parseInt(currentCell.getAttribute('colspan'), 10) || 1;
299
- if (currentCellIndex[1] + (colSpanVal - 1) >= minCol && currentCellIndex[1] <= maxCol) {
300
- if (colSpanVal > 1) {
301
- currentCell.setAttribute('colspan', (colSpanVal - 1).toString());
302
- }
303
- else {
304
- ej2_base_1.detach(currentCell);
305
- deleteIndex = j;
306
- if (ej2_base_1.Browser.isIE) {
307
- e.item.selection.setSelectionText(this.parent.currentDocument, this.curTable.querySelector('td'), this.curTable.querySelector('td'), 0, 0);
308
- this.curTable.querySelector('td, th').classList.add('e-cell-select');
309
- }
310
- }
311
- }
312
- }
313
- }
314
- if (deleteIndex > -1) {
315
- var rowHeadEle = tBodyHeadEle.children[rowIndex];
316
- var nextFocusCell = rowHeadEle &&
317
- rowHeadEle.children[(deleteIndex <= rowHeadEle.children.length - 1 ? deleteIndex : deleteIndex - 1)];
318
- if (nextFocusCell) {
319
- e.item.selection.setSelectionText(this.parent.currentDocument, nextFocusCell, nextFocusCell, 0, 0);
320
- nextFocusCell.classList.add('e-cell-select');
321
- }
322
- }
323
- }
324
- if (e.callBack) {
325
- var sContainer = this.parent.nodeSelection.getRange(this.parent.currentDocument).startContainer;
326
- if (sContainer.nodeName !== 'TD') {
327
- var startChildLength = this.parent.nodeSelection.getRange(this.parent.currentDocument).startOffset;
328
- var focusNode = sContainer.children[startChildLength];
329
- if (focusNode) {
330
- this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, focusNode, 0);
331
- }
332
- }
333
- e.callBack({
334
- requestType: e.item.subCommand,
335
- editorMode: 'HTML',
336
- event: e.event,
337
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
338
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
339
- });
340
- }
341
- };
342
- TableCommand.prototype.deleteRow = function (e) {
343
- var selectedCell = e.item.selection.range.startContainer;
344
- if (selectedCell.nodeType === 3) {
345
- selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
346
- }
347
- var colIndex = Array.prototype.indexOf.call(selectedCell.parentNode.childNodes, selectedCell);
348
- this.curTable = ej2_base_1.closest(selectedCell, 'table');
349
- var currentRow;
350
- var allCells = this.getCorrespondingColumns();
351
- var minMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
352
- var maxI;
353
- var j;
354
- if (this.curTable.rows.length === 1) {
355
- e.item.selection.restore();
356
- ej2_base_1.detach(ej2_base_1.closest(selectedCell.parentElement, 'table'));
357
- }
358
- else {
359
- for (maxI = minMaxIndex.endRow; maxI >= minMaxIndex.startRow; maxI--) {
360
- currentRow = this.curTable.rows[maxI];
361
- for (j = 0; j < allCells[maxI].length; j++) {
362
- if (j === 0 || allCells[maxI][j] !== allCells[maxI][j - 1]) {
363
- if (1 < parseInt(allCells[maxI][j].getAttribute('rowspan'), 10)) {
364
- var rowSpanVal = parseInt(allCells[maxI][j].getAttribute('rowspan'), 10) - 1;
365
- if (1 === rowSpanVal) {
366
- allCells[maxI][j].removeAttribute('rowspan');
367
- var cell = this.getMergedRow(this.getCorrespondingColumns())[j];
368
- if (cell) {
369
- var cloneNode = cell.cloneNode(true);
370
- cloneNode.innerHTML = '<br>';
371
- if (cell.parentElement) {
372
- cell.parentElement.insertBefore(cloneNode, cell);
373
- }
374
- }
375
- }
376
- else {
377
- allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
378
- }
379
- }
380
- }
381
- if (maxI < allCells.length - 1 && allCells[maxI][j] === allCells[maxI + 1][j] && (0 === maxI ||
382
- allCells[maxI][j] !== allCells[maxI - 1][j])) {
383
- var element = allCells[maxI][j];
384
- var index = void 0;
385
- for (index = j; 0 < index && allCells[maxI][index] === allCells[maxI][index - 1]; index--) {
386
- if (index === 0) {
387
- this.curTable.rows[maxI + 1].prepend(element);
388
- }
389
- else {
390
- allCells[maxI + 1][index - 1].insertAdjacentElement('afterend', element);
391
- }
392
- }
393
- }
394
- }
395
- var deleteIndex = currentRow.rowIndex;
396
- this.curTable.deleteRow(deleteIndex);
397
- var focusTrEle = !ej2_base_1.isNullOrUndefined(this.curTable.rows[deleteIndex]) ? this.curTable.querySelectorAll('tbody tr')[deleteIndex]
398
- : this.curTable.querySelectorAll('tbody tr')[deleteIndex - 1];
399
- var nextFocusCell = focusTrEle && focusTrEle.querySelectorAll('td')[colIndex];
400
- if (nextFocusCell) {
401
- e.item.selection.setSelectionText(this.parent.currentDocument, nextFocusCell, nextFocusCell, 0, 0);
402
- nextFocusCell.classList.add('e-cell-select');
403
- }
404
- else {
405
- e.item.selection.setSelectionText(this.parent.currentDocument, this.curTable.querySelector('td'), this.curTable.querySelector('td'), 0, 0);
406
- this.curTable.querySelector('td, th').classList.add('e-cell-select');
407
- }
408
- }
409
- }
410
- if (e.callBack) {
411
- e.callBack({
412
- requestType: e.item.subCommand,
413
- editorMode: 'HTML',
414
- event: e.event,
415
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
416
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
417
- });
418
- }
419
- };
420
- TableCommand.prototype.getMergedRow = function (cells) {
421
- var mergedRow;
422
- for (var i = 0; i < cells.length; i++) {
423
- if (cells[i].length !== this.curTable.rows[0].childNodes.length) {
424
- mergedRow = cells[i];
425
- }
426
- }
427
- return mergedRow;
428
- };
429
- TableCommand.prototype.removeTable = function (e) {
430
- var selectedCell = e.item.selection.range.startContainer;
431
- selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
432
- var selectedTable = ej2_base_1.closest(selectedCell.parentElement, 'table');
433
- if (selectedTable) {
434
- ej2_base_1.detach(selectedTable);
435
- e.item.selection.restore();
436
- }
437
- if (e.callBack) {
438
- e.callBack({
439
- requestType: e.item.subCommand,
440
- editorMode: 'HTML',
441
- event: e.event,
442
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
443
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
444
- });
445
- }
446
- };
447
- TableCommand.prototype.tableHeader = function (e) {
448
- var headerExit = false;
449
- var selectedCell = e.item.selection.range.startContainer;
450
- selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
451
- var table = ej2_base_1.closest(selectedCell.parentElement, 'table');
452
- [].slice.call(table.childNodes).forEach(function (el) {
453
- if (el.nodeName === 'THEAD') {
454
- headerExit = true;
455
- }
456
- });
457
- if (table && !headerExit) {
458
- var cellCount = table.querySelector('tr').childElementCount;
459
- var colSpanCount = 0;
460
- for (var i = 0; i < cellCount; i++) {
461
- colSpanCount = colSpanCount + (parseInt(table.querySelector('tr').children[i].getAttribute('colspan'), 10) || 1);
462
- }
463
- var header = table.createTHead();
464
- var row = header.insertRow(0);
465
- for (var j = 0; j < colSpanCount; j++) {
466
- var th = ej2_base_1.createElement('th');
467
- th.appendChild(ej2_base_1.createElement('br'));
468
- row.appendChild(th);
469
- }
470
- }
471
- else {
472
- table.deleteTHead();
473
- }
474
- if (e.callBack) {
475
- e.callBack({
476
- requestType: e.item.subCommand,
477
- editorMode: 'HTML',
478
- event: e.event,
479
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
480
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
481
- });
482
- }
483
- };
484
- TableCommand.prototype.tableVerticalAlign = function (e) {
485
- var value = '';
486
- switch (e.item.subCommand) {
487
- case 'AlignTop':
488
- value = 'top';
489
- break;
490
- case 'AlignMiddle':
491
- value = 'middle';
492
- break;
493
- case 'AlignBottom':
494
- value = 'bottom';
495
- break;
496
- }
497
- e.item.tableCell.style.verticalAlign = value;
498
- if (value && value !== '' && e.item.tableCell.getAttribute('valign')) {
499
- e.item.tableCell.removeAttribute('valign');
500
- }
501
- if (e.callBack) {
502
- e.callBack({
503
- requestType: e.item.subCommand,
504
- editorMode: 'HTML',
505
- event: e.event,
506
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
507
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
508
- });
509
- }
510
- };
511
- TableCommand.prototype.cellMerge = function (e) {
512
- if (ej2_base_1.isNullOrUndefined(this.curTable)) {
513
- this.curTable = ej2_base_1.closest(this.parent.nodeSelection.range.startContainer.parentElement, 'table');
514
- }
515
- var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
516
- if (selectedCells.length < 2) {
517
- return;
518
- }
519
- this.mergeCellContent();
520
- var minMaxIndexes = this.getSelectedMinMaxIndexes(this.getCorrespondingColumns());
521
- var firstCell = selectedCells[0];
522
- var rowSelectedCells = firstCell.parentElement.querySelectorAll('.e-cell-select');
523
- var maxHeight = 0;
524
- for (var j = 0; j < rowSelectedCells.length; j++) {
525
- var cellHeight = rowSelectedCells[j].offsetHeight;
526
- if (cellHeight > maxHeight) {
527
- maxHeight = cellHeight;
528
- }
529
- }
530
- if (minMaxIndexes.startColumn < minMaxIndexes.endColumn) {
531
- firstCell.setAttribute('colspan', (minMaxIndexes.endColumn - minMaxIndexes.startColumn + 1).toString());
532
- }
533
- if (minMaxIndexes.startRow < minMaxIndexes.endRow) {
534
- firstCell.setAttribute('rowspan', (minMaxIndexes.endRow - minMaxIndexes.startRow + 1).toString());
535
- }
536
- var totalWidth = 0;
537
- var unit;
538
- for (var j = rowSelectedCells.length - 1; j >= 0; j--) {
539
- if (!ej2_base_1.isNullOrUndefined(rowSelectedCells[j].style.width)
540
- && rowSelectedCells[j].style.width !== '') {
541
- if (!unit) {
542
- var match = rowSelectedCells[j].style.width.match(/^([\d.]+)([a-z%]+)$/i);
543
- unit = match ? match[2] : '%';
544
- }
545
- totalWidth = totalWidth + parseFloat(rowSelectedCells[j].style.width);
546
- }
547
- else {
548
- totalWidth = totalWidth + ((rowSelectedCells[j].offsetWidth / this.curTable.offsetWidth) * 100);
549
- unit = '%';
550
- }
551
- }
552
- firstCell.style.width = totalWidth + unit;
553
- firstCell.style.height = maxHeight + 'px';
554
- for (var i = 1; i <= selectedCells.length - 1; i++) {
555
- ej2_base_1.detach(selectedCells[i]);
556
- }
557
- for (var i = 0; i < this.curTable.rows.length; i++) {
558
- if (this.curTable.rows[i].innerHTML.trim() === '') {
559
- ej2_base_1.detach(this.curTable.rows[i]);
560
- }
561
- }
562
- util_1.removeClassWithAttr(this.curTable.querySelectorAll('table td, table th'), 'e-multi-cells-select');
563
- util_1.removeClassWithAttr(this.curTable.querySelectorAll('table td, table th'), 'e-cell-select-end');
564
- this.updateRowSpanStyle(minMaxIndexes.startRow, minMaxIndexes.endRow, this.getCorrespondingColumns());
565
- this.updateColSpanStyle(minMaxIndexes.startColumn, minMaxIndexes.endColumn, this.getCorrespondingColumns());
566
- e.item.selection.setSelectionText(this.parent.currentDocument, e.item.selection.range.startContainer, e.item.selection.range.startContainer, 0, 0);
567
- if (this.parent.nodeSelection && firstCell) {
568
- this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, firstCell, 0);
569
- }
570
- if (e.callBack) {
571
- e.callBack({
572
- requestType: e.item.subCommand,
573
- editorMode: 'HTML',
574
- event: e.event,
575
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
576
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
577
- });
578
- }
579
- };
580
- TableCommand.prototype.updateColSpanStyle = function (min, max, elements) {
581
- var colValue;
582
- var colIndex;
583
- var colMin;
584
- var index = 0;
585
- var attrValue;
586
- var count = 0;
587
- var eleArray = elements;
588
- if (min < (max = Math.min(max, eleArray[0].length - 1))) {
589
- for (colIndex = min; colIndex <= max; colIndex++) {
590
- index = Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1);
591
- if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < index &&
592
- eleArray[0][colIndex] === eleArray[0][colIndex + 1]) {
593
- for (count = index - 1, colValue = 1; colValue < eleArray.length; colValue++) {
594
- if (eleArray[colValue][colIndex] !== eleArray[colValue - 1][colIndex]) {
595
- for (colMin = colIndex; colMin < colIndex + index; colMin++) {
596
- attrValue = parseInt(eleArray[colValue][colMin].getAttribute('colspan'), 10) || 1;
597
- if (1 < attrValue &&
598
- eleArray[colValue][colMin] === eleArray[colValue][colMin + 1]) {
599
- colMin += count = Math.min(count, attrValue - 1);
600
- }
601
- else {
602
- count = Math.max(0, count - 1);
603
- if (count === 0) {
604
- break;
605
- }
606
- }
607
- }
608
- }
609
- if (!count) {
610
- break;
611
- }
612
- }
613
- }
614
- }
615
- if (count) {
616
- this.updateCellAttribute(eleArray, count, 'colspan', 0, eleArray.length - 1, min, max);
617
- }
618
- }
619
- };
620
- TableCommand.prototype.updateRowSpanStyle = function (min, max, ele) {
621
- var rowValue;
622
- var colIndex;
623
- var rowMin;
624
- var index = 0;
625
- var attrValue;
626
- var count = 0;
627
- var eleArray = ele;
628
- if (min < (max = Math.min(max, eleArray.length - 1))) {
629
- for (rowValue = min; rowValue <= max; rowValue++) {
630
- if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0])
631
- && eleArray[rowValue][0] && 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) ||
632
- 1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
633
- for (count = index - 1, colIndex = 1; colIndex < eleArray[0].length; colIndex++) {
634
- if (eleArray[rowValue][colIndex] !== eleArray[rowValue][colIndex - 1]) {
635
- for (rowMin = rowValue; rowMin < rowValue + index; rowMin++) {
636
- attrValue = parseInt(eleArray[rowMin][colIndex].getAttribute('rowspan'), 10) || 1;
637
- if (1 < attrValue && eleArray[rowMin][colIndex] ===
638
- eleArray[rowMin + 1][colIndex]) {
639
- rowMin += count = Math.min(count, attrValue - 1);
640
- }
641
- else if (!(count = Math.max(0, count - 1))) {
642
- break;
643
- }
644
- }
645
- if (!count) {
646
- break;
647
- }
648
- }
649
- }
650
- }
651
- }
652
- if (count) {
653
- this.updateCellAttribute(eleArray, count, 'rowspan', min, max, 0, eleArray[0].length - 1);
654
- }
655
- }
656
- };
657
- TableCommand.prototype.updateCellAttribute = function (elements, index, attr, min, max, firstIndex, length) {
658
- var rowIndex;
659
- var colIndex;
660
- var spanCount;
661
- for (rowIndex = min; rowIndex <= max; rowIndex++) {
662
- for (colIndex = firstIndex; colIndex <= length; colIndex++) {
663
- spanCount = parseInt(elements[rowIndex][colIndex].getAttribute(attr), 10) || 1;
664
- if (min < rowIndex && elements[rowIndex][colIndex] === elements[rowIndex - 1][colIndex] ||
665
- firstIndex < colIndex && elements[rowIndex][colIndex] ===
666
- elements[rowIndex][colIndex - 1] || 1 < (spanCount)) {
667
- if ((1 < spanCount - index)) {
668
- elements[rowIndex][colIndex].setAttribute(attr, (spanCount - index).toString());
669
- }
670
- else {
671
- elements[rowIndex][colIndex].removeAttribute(attr);
672
- }
673
- }
674
- }
675
- }
676
- };
677
- TableCommand.prototype.mergeCellContent = function () {
678
- var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
679
- var innerHtml = selectedCells[0].innerHTML === '<br>' ? '' : selectedCells[0].innerHTML;
680
- for (var i = 1; i < selectedCells.length; i++) {
681
- if ('<br>' !== selectedCells[i].innerHTML) {
682
- innerHtml = innerHtml ? innerHtml + '<br>' + selectedCells[i].innerHTML : innerHtml + selectedCells[i].innerHTML;
683
- }
684
- }
685
- selectedCells[0].innerHTML = innerHtml;
686
- };
687
- TableCommand.prototype.getSelectedMinMaxIndexes = function (correspondingCells) {
688
- var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
689
- if (0 < selectedCells.length) {
690
- var minRow = correspondingCells.length;
691
- var maxRow = 0;
692
- var minCol = correspondingCells[0].length;
693
- var maxCol = 0;
694
- for (var i = 0; i < selectedCells.length; i++) {
695
- var currentRowCol = this.getCorrespondingIndex(selectedCells[i], correspondingCells);
696
- var targetRowCol = this.FindIndex(currentRowCol[0], currentRowCol[1], correspondingCells);
697
- minRow = Math.min(currentRowCol[0], minRow);
698
- maxRow = Math.max(targetRowCol[0], maxRow);
699
- minCol = Math.min(currentRowCol[1], minCol);
700
- maxCol = Math.max(targetRowCol[1], maxCol);
701
- }
702
- return {
703
- startRow: minRow,
704
- endRow: maxRow,
705
- startColumn: minCol,
706
- endColumn: maxCol
707
- };
708
- }
709
- return null;
710
- };
711
- TableCommand.prototype.HorizontalSplit = function (e) {
712
- var selectedCell = e.item.selection.range.startContainer;
713
- this.curTable = ej2_base_1.closest(selectedCell.parentElement, 'table');
714
- if (this.curTable.querySelectorAll('.e-cell-select').length > 1) {
715
- return;
716
- }
717
- this.activeCell = this.curTable.querySelector('.e-cell-select');
718
- var newCell = this.activeCell.cloneNode(true);
719
- newCell.removeAttribute('class');
720
- newCell.innerHTML = '</br>';
721
- var activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
722
- var correspondingCells = this.getCorrespondingColumns();
723
- var activeCellRowSpan = this.activeCell.getAttribute('rowspan') ? parseInt(this.activeCell.getAttribute('rowspan'), 10) : 1;
724
- if (activeCellRowSpan > 1) {
725
- var avgCount = Math.ceil(activeCellRowSpan / 2);
726
- 1 < avgCount ? this.activeCell.setAttribute('rowspan', avgCount.toString()) :
727
- this.activeCell.removeAttribute('rowspan');
728
- 1 < (activeCellRowSpan - avgCount) ? newCell.setAttribute('rowspan', (activeCellRowSpan - avgCount).toString()) : newCell.removeAttribute('rowspan');
729
- var avgRowIndex = void 0;
730
- var colIndex = void 0;
731
- for (avgRowIndex = activeCellIndex[0] + Math.ceil(activeCellRowSpan / 2),
732
- colIndex = 0 === activeCellIndex[1] ? activeCellIndex[1]
733
- : activeCellIndex[1] - 1; 0 <= colIndex && (correspondingCells[avgRowIndex][colIndex] ===
734
- correspondingCells[avgRowIndex][colIndex - 1] || 0 < avgRowIndex && correspondingCells[avgRowIndex][colIndex]
735
- === correspondingCells[avgRowIndex - 1][colIndex]);) {
736
- colIndex--;
737
- }
738
- if (colIndex === -1) {
739
- if (this.curTable.rows[avgRowIndex].firstChild) {
740
- this.curTable.rows[avgRowIndex].prepend(newCell);
741
- }
742
- else {
743
- this.curTable.appendChild(newCell);
744
- }
745
- }
746
- else {
747
- correspondingCells[avgRowIndex][colIndex].insertAdjacentElement('afterend', newCell);
748
- }
749
- }
750
- else {
751
- var newTrEle = ej2_base_1.createElement('tr');
752
- newTrEle.appendChild(newCell);
753
- var selectedRow = correspondingCells[activeCellIndex[0]];
754
- for (var j = 0; j <= selectedRow.length - 1; j++) {
755
- if (selectedRow[j] !== selectedRow[j - 1] && selectedRow[j] !== this.activeCell) {
756
- selectedRow[j].setAttribute('rowspan', ((parseInt(selectedRow[j].getAttribute('rowspan'), 10) ?
757
- parseInt(selectedRow[j].getAttribute('rowspan'), 10) : 1) + 1).toString());
758
- }
759
- }
760
- this.activeCell.parentNode.insertAdjacentElement('afterend', newTrEle);
761
- }
762
- if (e.callBack) {
763
- e.callBack({
764
- requestType: e.item.subCommand,
765
- editorMode: 'HTML',
766
- event: e.event,
767
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
768
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
769
- });
770
- }
771
- };
772
- TableCommand.prototype.VerticalSplit = function (e) {
773
- var selectedCell = e.item.selection.range.startContainer;
774
- this.curTable = ej2_base_1.closest(selectedCell.parentElement, 'table');
775
- if (this.curTable.querySelectorAll('.e-cell-select').length > 1) {
776
- return;
777
- }
778
- this.activeCell = this.curTable.querySelector('.e-cell-select');
779
- var allRows = this.curTable.rows;
780
- var newCell = this.activeCell.cloneNode(true);
781
- newCell.removeAttribute('class');
782
- newCell.innerHTML = '</br>';
783
- var activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
784
- var correspondingColumns = this.getCorrespondingColumns();
785
- var activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10) || 1;
786
- if (activeCellcolSpan > 1) {
787
- var colSpan = Math.ceil(activeCellcolSpan / 2);
788
- var getColSizes = this.getColSizes(this.curTable);
789
- var activeCellUpdatedWidth = this.getSplitColWidth(activeCellIndex[1], activeCellIndex[1] + colSpan - 1, getColSizes);
790
- var newCellWidth = this.getSplitColWidth(activeCellIndex[1] + colSpan, activeCellIndex[1] + activeCellcolSpan - 1, getColSizes);
791
- var activeCellWidth = this.convertPixelToPercentage(this.activeCell.offsetWidth, this.curTable.offsetWidth);
792
- newCellWidth = (activeCellWidth - activeCellUpdatedWidth) < newCellWidth ?
793
- (activeCellWidth - activeCellUpdatedWidth) : newCellWidth;
794
- if (1 < colSpan) {
795
- this.activeCell.setAttribute('colspan', colSpan.toString());
796
- }
797
- else {
798
- this.activeCell.removeAttribute('colspan');
799
- }
800
- if (1 < activeCellcolSpan - colSpan) {
801
- newCell.setAttribute('colspan', (activeCellcolSpan - colSpan).toString());
802
- }
803
- else {
804
- newCell.removeAttribute('colspan');
805
- }
806
- this.activeCell.style.width = activeCellUpdatedWidth + '%';
807
- newCell.style.width = newCellWidth + '%';
808
- }
809
- else {
810
- var avgWidth = parseFloat(this.activeCell.style.width) / 2;
811
- for (var i = 0; i <= allRows.length - 1; i++) {
812
- if (0 === i || correspondingColumns[i][activeCellIndex[1]] !== correspondingColumns[i - 1][activeCellIndex[1]]) {
813
- var currentCell = correspondingColumns[i][activeCellIndex[1]];
814
- if (currentCell !== this.activeCell) {
815
- currentCell.setAttribute('colspan', ((parseInt(currentCell.getAttribute('colspan'), 10) ?
816
- parseInt(currentCell.getAttribute('colspan'), 10) : 1) + 1).toString());
817
- }
818
- }
819
- }
820
- this.activeCell.style.width = avgWidth + '%';
821
- newCell.style.width = avgWidth + '%';
822
- }
823
- this.activeCell.parentNode.insertBefore(newCell, this.activeCell.nextSibling);
824
- if (e.callBack) {
825
- e.callBack({
826
- requestType: e.item.subCommand,
827
- editorMode: 'HTML',
828
- event: e.event,
829
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
830
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
831
- });
832
- }
833
- };
834
- TableCommand.prototype.getSplitColWidth = function (startIndex, endInex, sizes) {
835
- var width = 0;
836
- for (var i = startIndex; i <= endInex; i++) {
837
- width += sizes[i];
838
- }
839
- return this.convertPixelToPercentage(width, this.curTable.offsetWidth);
840
- };
841
- TableCommand.prototype.getColSizes = function (curTable) {
842
- var cellColl = curTable.rows[0].cells;
843
- var cellCount = 0;
844
- for (var cell = 0; cell < cellColl.length; cell++) {
845
- cellCount = cellCount + cellColl[cell].colSpan;
846
- }
847
- var sizes = new Array(cellCount);
848
- var rowSpanCells = new Map();
849
- for (var i = 0; i < curTable.rows.length; i++) {
850
- var currentColIndex = 0;
851
- for (var k = 0; k < curTable.rows[i].cells.length; k++) {
852
- for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
853
- var key = "" + (i + l) + currentColIndex;
854
- rowSpanCells.set(key, curTable.rows[i].cells[k]);
855
- }
856
- var cellIndex = this.getCellIndex(rowSpanCells, i, k);
857
- if (cellIndex > currentColIndex) {
858
- currentColIndex = cellIndex;
859
- }
860
- var width = curTable.rows[i].cells[k].offsetWidth;
861
- if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
862
- sizes[currentColIndex] = width;
863
- }
864
- currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
865
- }
866
- }
867
- return sizes;
868
- };
869
- TableCommand.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
870
- var cellKey = "" + rowIndex + colIndex;
871
- var spannedCell = rowSpanCells.get(cellKey);
872
- if (spannedCell) {
873
- return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
874
- }
875
- else {
876
- return colIndex;
877
- }
878
- };
879
- TableCommand.prototype.convertPixelToPercentage = function (value, offsetValue) {
880
- return (value / offsetValue) * 100;
881
- };
882
- TableCommand.prototype.getCorrespondingColumns = function () {
883
- var elementArray = [];
884
- var _this = this;
885
- var colspan = 0;
886
- var allRows = _this.curTable.rows;
887
- for (var i = 0; i <= allRows.length - 1; i++) {
888
- var ele = allRows[i];
889
- var index = 0;
890
- for (var j = 0; j <= ele.children.length - 1; j++) {
891
- var colEle = ele.children[j];
892
- for (var ele_1 = colEle, colspan_1 = parseInt(ele_1.getAttribute('colspan'), 10) || 1, rowSpan = parseInt(ele_1.getAttribute('rowspan'), 10) || 1, rowIndex = i; rowIndex < i + rowSpan; rowIndex++) {
893
- for (var colIndex = index; colIndex < index + colspan_1; colIndex++) {
894
- if (!elementArray[rowIndex]) {
895
- elementArray[rowIndex] = [];
896
- }
897
- if (elementArray[rowIndex][colIndex]) {
898
- index++;
899
- }
900
- else {
901
- elementArray[rowIndex][colIndex] = colEle;
902
- }
903
- }
904
- }
905
- index += colspan;
906
- }
907
- }
908
- return elementArray;
909
- };
910
- TableCommand.prototype.FindIndex = function (rowIndex, columnIndex, cells) {
911
- var nextIndex;
912
- var nextCol;
913
- for (nextIndex = rowIndex + 1, nextCol = columnIndex + 1; nextIndex < cells.length;) {
914
- if (cells[nextIndex][columnIndex] !== cells[rowIndex][columnIndex]) {
915
- nextIndex--;
916
- break;
917
- }
918
- nextIndex++;
919
- }
920
- for (nextIndex === cells.length && nextIndex--; nextCol < cells[rowIndex].length;) {
921
- if (cells[rowIndex][nextCol] !== cells[rowIndex][columnIndex]) {
922
- nextCol--;
923
- break;
924
- }
925
- nextCol++;
926
- }
927
- return nextCol === cells[rowIndex].length && nextCol--,
928
- [
929
- nextIndex,
930
- nextCol
931
- ];
932
- };
933
- TableCommand.prototype.getCorrespondingIndex = function (cell, allCells) {
934
- for (var i = 0; i < allCells.length; i++) {
935
- for (var j = 0; j < allCells[i].length; j++) {
936
- if (allCells[i][j] === cell) {
937
- return [i, j];
938
- }
939
- }
940
- }
941
- return [];
942
- };
943
- TableCommand.prototype.highlightCells = function (minRow, maxRow, minCol, maxCol, eleArray) {
944
- var j;
945
- var k;
946
- var startCell;
947
- var endCell;
948
- var minRowIndex = minRow;
949
- var maxRowIndex = maxRow;
950
- var minColIndex = minCol;
951
- var maxColIndex = maxCol;
952
- var minMaxValues = new MinMax();
953
- for (j = minRowIndex; j <= maxRowIndex; j++) {
954
- startCell = this.getCorrespondingIndex(eleArray[j][minColIndex], eleArray);
955
- endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
956
- if ((1 < (parseInt(eleArray[j][minColIndex].getAttribute('rowspan'), 10) || 1) ||
957
- 1 < (parseInt(eleArray[j][minColIndex].getAttribute('colspan'), 10) || 1)) &&
958
- endCell) {
959
- minRowIndex = Math.min(startCell[0], minRowIndex);
960
- maxRowIndex = Math.max(endCell[0], maxRowIndex);
961
- minColIndex = Math.min(startCell[1], minColIndex);
962
- maxColIndex = Math.max(endCell[1], maxColIndex);
963
- }
964
- else if ((1 < (parseInt(eleArray[j][maxColIndex].getAttribute('rowspan'), 10) || 1) ||
965
- 1 < (parseInt(eleArray[j][maxColIndex].getAttribute('colspan'), 10) || 1))) {
966
- startCell = this.getCorrespondingIndex(eleArray[j][maxColIndex], eleArray);
967
- endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
968
- if (endCell) {
969
- minRowIndex = Math.min(startCell[0], minRowIndex);
970
- maxRowIndex = Math.max(endCell[0], maxRowIndex);
971
- minColIndex = Math.min(startCell[1], minColIndex);
972
- maxColIndex = Math.max(endCell[1], maxColIndex);
973
- }
974
- }
975
- for (k = minColIndex; k <= maxColIndex; k++) {
976
- startCell = this.getCorrespondingIndex(eleArray[minRowIndex][k], eleArray);
977
- endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
978
- if ((1 < (parseInt(eleArray[minRowIndex][k].getAttribute('rowspan'), 10) || 1) ||
979
- 1 < (parseInt(eleArray[minRowIndex][k].getAttribute('colspan'), 10) || 1)) &&
980
- endCell) {
981
- minRowIndex = Math.min(startCell[0], minRowIndex);
982
- maxRowIndex = Math.max(endCell[0], maxRowIndex);
983
- minColIndex = Math.min(startCell[1], minColIndex);
984
- maxColIndex = Math.max(endCell[1], maxColIndex);
985
- }
986
- else if ((1 < (parseInt(eleArray[maxRowIndex][k].getAttribute('rowspan'), 10) || 1) ||
987
- 1 < (parseInt(eleArray[maxRowIndex][k].getAttribute('colspan'), 10) || 1))) {
988
- startCell = this.getCorrespondingIndex(eleArray[maxRowIndex][k], eleArray);
989
- endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
990
- if (endCell) {
991
- minRowIndex = Math.min(startCell[0], minRowIndex);
992
- maxRowIndex = Math.max(endCell[0], maxRowIndex);
993
- minColIndex = Math.min(startCell[1], minColIndex);
994
- maxColIndex = Math.max(endCell[1], maxColIndex);
995
- }
996
- }
997
- }
998
- minMaxValues = minRowIndex === minRow && maxRowIndex === maxRow && minColIndex === minCol && maxColIndex === maxCol ? {
999
- startRow: minRow,
1000
- endRow: maxRow,
1001
- startColumn: minCol,
1002
- endColumn: maxCol
1003
- } : this.highlightCells(minRowIndex, maxRowIndex, minColIndex, maxColIndex, eleArray);
1004
- }
1005
- return minMaxValues;
1006
- };
1007
- TableCommand.prototype.restoreRange = function (target) {
1008
- if (this.parent.userAgentData.isSafari()) {
1009
- this.parent.nodeSelection.Clear(this.parent.currentDocument);
1010
- return;
1011
- }
1012
- if (this.parent.currentDocument.getSelection().rangeCount && (target.nodeName === 'TD' || target.nodeName === 'TH')) {
1013
- this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, target, 0);
1014
- }
1015
- };
1016
- TableCommand.prototype.tableStyle = function (e) {
1017
- if (e.callBack) {
1018
- e.callBack({
1019
- requestType: e.item.subCommand,
1020
- editorMode: 'HTML',
1021
- event: e.event,
1022
- range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
1023
- elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
1024
- });
1025
- }
1026
- };
1027
- TableCommand.prototype.tableMove = function (e) {
1028
- this.activeCell = e.selectNode[0];
1029
- var target = e.event.target;
1030
- var activeCellTag = this.activeCell.tagName;
1031
- var targetCellTag = target.tagName;
1032
- this.curTable = ej2_base_1.closest(target, 'table');
1033
- if ((target.tagName !== 'TD' && target.tagName !== 'TH') && activeCellTag !== targetCellTag) {
1034
- return;
1035
- }
1036
- var activeCellTable = ej2_base_1.closest(this.activeCell, 'table');
1037
- if ((ej2_base_1.isNullOrUndefined(this.curTable) || ej2_base_1.isNullOrUndefined(activeCellTable)) || activeCellTable !== this.curTable) {
1038
- return;
1039
- }
1040
- var correspondingCells = this.getCorrespondingColumns();
1041
- var activeIndexes = this.getCorrespondingIndex(this.activeCell, correspondingCells);
1042
- var targetIndexes = this.getCorrespondingIndex(target, correspondingCells);
1043
- var activeCellList = this.curTable.querySelectorAll('.e-cell-select, .e-multi-cells-select, .e-cell-select-end');
1044
- for (var i = activeCellList.length - 1; i >= 0; i--) {
1045
- if (this.activeCell !== activeCellList[i]) {
1046
- util_1.removeClassWithAttr([activeCellList[i]], ['e-cell-select']);
1047
- }
1048
- util_1.removeClassWithAttr([activeCellList[i]], ['e-multi-cells-select']);
1049
- util_1.removeClassWithAttr([activeCellList[i]], ['e-cell-select-end']);
1050
- }
1051
- if (activeIndexes[0] === targetIndexes[0] && activeIndexes[1] === targetIndexes[1]) {
1052
- if (activeCellList.length > 1) {
1053
- this.restoreRange(target);
1054
- }
1055
- return;
1056
- }
1057
- var minMaxIndexes = this.highlightCells(Math.min(activeIndexes[0], targetIndexes[0]), Math.max(activeIndexes[0], targetIndexes[0]), Math.min(activeIndexes[1], targetIndexes[1]), Math.max(activeIndexes[1], targetIndexes[1]), correspondingCells);
1058
- for (var rowIndex = minMaxIndexes.startRow; rowIndex <= minMaxIndexes.endRow; rowIndex++) {
1059
- for (var colIndex = minMaxIndexes.startColumn; colIndex <= minMaxIndexes.endColumn; colIndex++) {
1060
- correspondingCells[rowIndex][colIndex].classList.add('e-cell-select');
1061
- correspondingCells[rowIndex][colIndex].classList.add('e-multi-cells-select');
1062
- }
1063
- }
1064
- target.classList.add('e-cell-select-end');
1065
- if (e.event.type) {
1066
- e.event.preventDefault();
1067
- }
1068
- this.restoreRange(target);
1069
- };
1070
- TableCommand.prototype.destroy = function () {
1071
- this.removeEventListener();
1072
- };
1073
- TableCommand.prototype.cellStyleCleanup = function (value) {
1074
- var styles = value.split(';');
1075
- var newStyles = [];
1076
- var deniedFormats = ['background-color', 'vertical-align', 'text-align'];
1077
- for (var i = 0; i < styles.length; i++) {
1078
- var style = styles[i];
1079
- var isAllowed = true;
1080
- for (var j = 0; j < deniedFormats.length; j++) {
1081
- var deniedStyle = deniedFormats[j];
1082
- if (style.indexOf(deniedStyle) > -1) {
1083
- isAllowed = false;
1084
- }
1085
- }
1086
- if (isAllowed) {
1087
- newStyles.push(style);
1088
- }
1089
- }
1090
- return newStyles.join(';');
1091
- };
1092
- return TableCommand;
1093
- }());
1094
- exports.TableCommand = TableCommand;
1095
- var MinMax = (function () {
1096
- function MinMax() {
1097
- }
1098
- return MinMax;
1099
- }());
1100
- });