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

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 (365) hide show
  1. package/.eslintrc.json +262 -260
  2. package/aceconfig.js +17 -0
  3. package/blazorGlobalSrc/common/config.d.ts +63 -0
  4. package/blazorGlobalSrc/common/config.js +123 -0
  5. package/blazorGlobalSrc/common/constant.d.ts +117 -0
  6. package/blazorGlobalSrc/common/constant.js +23 -0
  7. package/blazorGlobalSrc/common/editor-styles.d.ts +1 -0
  8. package/blazorGlobalSrc/common/editor-styles.js +5 -0
  9. package/blazorGlobalSrc/common/index.d.ts +7 -0
  10. package/blazorGlobalSrc/common/index.js +9 -0
  11. package/blazorGlobalSrc/common/interface.d.ts +119 -0
  12. package/blazorGlobalSrc/common/interface.js +4 -0
  13. package/blazorGlobalSrc/common/types.d.ts +25 -0
  14. package/blazorGlobalSrc/common/types.js +4 -0
  15. package/blazorGlobalSrc/common/user-agent.d.ts +41 -0
  16. package/blazorGlobalSrc/common/user-agent.js +71 -0
  17. package/blazorGlobalSrc/common/util.d.ts +70 -0
  18. package/blazorGlobalSrc/common/util.js +222 -0
  19. package/blazorGlobalSrc/components.d.ts +8 -0
  20. package/blazorGlobalSrc/components.js +12 -0
  21. package/blazorGlobalSrc/editor-manager/base/classes.d.ts +31 -0
  22. package/blazorGlobalSrc/editor-manager/base/classes.js +28 -0
  23. package/blazorGlobalSrc/editor-manager/base/constant.d.ts +97 -0
  24. package/blazorGlobalSrc/editor-manager/base/constant.js +41 -0
  25. package/blazorGlobalSrc/editor-manager/base/editor-manager.d.ts +95 -0
  26. package/blazorGlobalSrc/editor-manager/base/editor-manager.js +339 -0
  27. package/blazorGlobalSrc/editor-manager/base/enum.d.ts +17 -0
  28. package/blazorGlobalSrc/editor-manager/base/enum.js +4 -0
  29. package/blazorGlobalSrc/editor-manager/base/interface.d.ts +263 -0
  30. package/blazorGlobalSrc/editor-manager/base/interface.js +4 -0
  31. package/blazorGlobalSrc/editor-manager/base/types.d.ts +7 -0
  32. package/blazorGlobalSrc/editor-manager/base/types.js +4 -0
  33. package/blazorGlobalSrc/editor-manager/base.d.ts +8 -0
  34. package/blazorGlobalSrc/editor-manager/base.js +10 -0
  35. package/blazorGlobalSrc/editor-manager/index.d.ts +5 -0
  36. package/blazorGlobalSrc/editor-manager/index.js +9 -0
  37. package/blazorGlobalSrc/editor-manager/plugin/alignments.d.ts +26 -0
  38. package/blazorGlobalSrc/editor-manager/plugin/alignments.js +105 -0
  39. package/blazorGlobalSrc/editor-manager/plugin/audio.d.ts +34 -0
  40. package/blazorGlobalSrc/editor-manager/plugin/audio.js +145 -0
  41. package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.d.ts +24 -0
  42. package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.js +47 -0
  43. package/blazorGlobalSrc/editor-manager/plugin/clearformat.d.ts +29 -0
  44. package/blazorGlobalSrc/editor-manager/plugin/clearformat.js +249 -0
  45. package/blazorGlobalSrc/editor-manager/plugin/dom-node.d.ts +351 -0
  46. package/blazorGlobalSrc/editor-manager/plugin/dom-node.js +737 -0
  47. package/blazorGlobalSrc/editor-manager/plugin/dom-tree.d.ts +84 -0
  48. package/blazorGlobalSrc/editor-manager/plugin/dom-tree.js +164 -0
  49. package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.d.ts +10 -0
  50. package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.js +86 -0
  51. package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.d.ts +47 -0
  52. package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.js +622 -0
  53. package/blazorGlobalSrc/editor-manager/plugin/formats.d.ts +43 -0
  54. package/blazorGlobalSrc/editor-manager/plugin/formats.js +597 -0
  55. package/blazorGlobalSrc/editor-manager/plugin/image.d.ts +48 -0
  56. package/blazorGlobalSrc/editor-manager/plugin/image.js +399 -0
  57. package/blazorGlobalSrc/editor-manager/plugin/indents.d.ts +24 -0
  58. package/blazorGlobalSrc/editor-manager/plugin/indents.js +106 -0
  59. package/blazorGlobalSrc/editor-manager/plugin/insert-methods.d.ts +48 -0
  60. package/blazorGlobalSrc/editor-manager/plugin/insert-methods.js +37 -0
  61. package/blazorGlobalSrc/editor-manager/plugin/insert-text.d.ts +22 -0
  62. package/blazorGlobalSrc/editor-manager/plugin/insert-text.js +36 -0
  63. package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.d.ts +22 -0
  64. package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.js +49 -0
  65. package/blazorGlobalSrc/editor-manager/plugin/inserthtml.d.ts +51 -0
  66. package/blazorGlobalSrc/editor-manager/plugin/inserthtml.js +985 -0
  67. package/blazorGlobalSrc/editor-manager/plugin/isformatted.d.ts +89 -0
  68. package/blazorGlobalSrc/editor-manager/plugin/isformatted.js +199 -0
  69. package/blazorGlobalSrc/editor-manager/plugin/link.d.ts +41 -0
  70. package/blazorGlobalSrc/editor-manager/plugin/link.js +550 -0
  71. package/blazorGlobalSrc/editor-manager/plugin/lists.d.ts +74 -0
  72. package/blazorGlobalSrc/editor-manager/plugin/lists.js +1503 -0
  73. package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.d.ts +61 -0
  74. package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.js +1136 -0
  75. package/blazorGlobalSrc/editor-manager/plugin/nodecutter.d.ts +64 -0
  76. package/blazorGlobalSrc/editor-manager/plugin/nodecutter.js +167 -0
  77. package/blazorGlobalSrc/editor-manager/plugin/selection-commands.d.ts +41 -0
  78. package/blazorGlobalSrc/editor-manager/plugin/selection-commands.js +1069 -0
  79. package/blazorGlobalSrc/editor-manager/plugin/selection-exec.d.ts +24 -0
  80. package/blazorGlobalSrc/editor-manager/plugin/selection-exec.js +49 -0
  81. package/blazorGlobalSrc/editor-manager/plugin/table-selection.d.ts +26 -0
  82. package/blazorGlobalSrc/editor-manager/plugin/table-selection.js +210 -0
  83. package/blazorGlobalSrc/editor-manager/plugin/table.d.ts +56 -0
  84. package/blazorGlobalSrc/editor-manager/plugin/table.js +1100 -0
  85. package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.d.ts +39 -0
  86. package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.js +384 -0
  87. package/blazorGlobalSrc/editor-manager/plugin/undo.d.ts +85 -0
  88. package/blazorGlobalSrc/editor-manager/plugin/undo.js +216 -0
  89. package/blazorGlobalSrc/editor-manager/plugin/video.d.ts +38 -0
  90. package/blazorGlobalSrc/editor-manager/plugin/video.js +311 -0
  91. package/blazorGlobalSrc/editor-manager/plugin.d.ts +27 -0
  92. package/blazorGlobalSrc/editor-manager/plugin.js +31 -0
  93. package/blazorGlobalSrc/global.d.ts +1 -0
  94. package/blazorGlobalSrc/global.js +3 -0
  95. package/blazorGlobalSrc/index.d.ts +8 -0
  96. package/blazorGlobalSrc/index.js +12 -0
  97. package/blazorGlobalSrc/markdown-parser/base/constant.d.ts +39 -0
  98. package/blazorGlobalSrc/markdown-parser/base/constant.js +10 -0
  99. package/blazorGlobalSrc/markdown-parser/base/interface.d.ts +169 -0
  100. package/blazorGlobalSrc/markdown-parser/base/interface.js +4 -0
  101. package/blazorGlobalSrc/markdown-parser/base/markdown-parser.d.ts +69 -0
  102. package/blazorGlobalSrc/markdown-parser/base/markdown-parser.js +87 -0
  103. package/blazorGlobalSrc/markdown-parser/base/types.d.ts +7 -0
  104. package/blazorGlobalSrc/markdown-parser/base/types.js +4 -0
  105. package/blazorGlobalSrc/markdown-parser/base.d.ts +7 -0
  106. package/blazorGlobalSrc/markdown-parser/base.js +9 -0
  107. package/blazorGlobalSrc/markdown-parser/index.d.ts +5 -0
  108. package/blazorGlobalSrc/markdown-parser/index.js +9 -0
  109. package/blazorGlobalSrc/markdown-parser/plugin/clearformat.d.ts +28 -0
  110. package/blazorGlobalSrc/markdown-parser/plugin/clearformat.js +110 -0
  111. package/blazorGlobalSrc/markdown-parser/plugin/formats.d.ts +32 -0
  112. package/blazorGlobalSrc/markdown-parser/plugin/formats.js +225 -0
  113. package/blazorGlobalSrc/markdown-parser/plugin/insert-text.d.ts +24 -0
  114. package/blazorGlobalSrc/markdown-parser/plugin/insert-text.js +49 -0
  115. package/blazorGlobalSrc/markdown-parser/plugin/link.d.ts +24 -0
  116. package/blazorGlobalSrc/markdown-parser/plugin/link.js +50 -0
  117. package/blazorGlobalSrc/markdown-parser/plugin/lists.d.ts +39 -0
  118. package/blazorGlobalSrc/markdown-parser/plugin/lists.js +462 -0
  119. package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.d.ts +140 -0
  120. package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.js +104 -0
  121. package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.d.ts +31 -0
  122. package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.js +335 -0
  123. package/blazorGlobalSrc/markdown-parser/plugin/table.d.ts +52 -0
  124. package/blazorGlobalSrc/markdown-parser/plugin/table.js +216 -0
  125. package/blazorGlobalSrc/markdown-parser/plugin/undo.d.ts +83 -0
  126. package/blazorGlobalSrc/markdown-parser/plugin/undo.js +147 -0
  127. package/blazorGlobalSrc/markdown-parser/plugin.d.ts +11 -0
  128. package/blazorGlobalSrc/markdown-parser/plugin.js +15 -0
  129. package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.d.ts +114 -0
  130. package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.js +465 -0
  131. package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.d.ts +58 -0
  132. package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.js +216 -0
  133. package/blazorGlobalSrc/rich-text-editor/actions/color-picker.d.ts +52 -0
  134. package/blazorGlobalSrc/rich-text-editor/actions/color-picker.js +241 -0
  135. package/blazorGlobalSrc/rich-text-editor/actions/count.d.ts +55 -0
  136. package/blazorGlobalSrc/rich-text-editor/actions/count.js +117 -0
  137. package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.d.ts +72 -0
  138. package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.js +552 -0
  139. package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.d.ts +51 -0
  140. package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.js +853 -0
  141. package/blazorGlobalSrc/rich-text-editor/actions/enter-key.d.ts +28 -0
  142. package/blazorGlobalSrc/rich-text-editor/actions/enter-key.js +821 -0
  143. package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.d.ts +11 -0
  144. package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.js +28 -0
  145. package/blazorGlobalSrc/rich-text-editor/actions/file-manager.d.ts +45 -0
  146. package/blazorGlobalSrc/rich-text-editor/actions/file-manager.js +249 -0
  147. package/blazorGlobalSrc/rich-text-editor/actions/format-painter.d.ts +25 -0
  148. package/blazorGlobalSrc/rich-text-editor/actions/format-painter.js +156 -0
  149. package/blazorGlobalSrc/rich-text-editor/actions/full-screen.d.ts +40 -0
  150. package/blazorGlobalSrc/rich-text-editor/actions/full-screen.js +148 -0
  151. package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.d.ts +15 -0
  152. package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.js +50 -0
  153. package/blazorGlobalSrc/rich-text-editor/actions/html-editor.d.ts +120 -0
  154. package/blazorGlobalSrc/rich-text-editor/actions/html-editor.js +1244 -0
  155. package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.d.ts +14 -0
  156. package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.js +47 -0
  157. package/blazorGlobalSrc/rich-text-editor/actions/import-export.d.ts +21 -0
  158. package/blazorGlobalSrc/rich-text-editor/actions/import-export.js +117 -0
  159. package/blazorGlobalSrc/rich-text-editor/actions/keyboard-model.d.ts +30 -0
  160. package/blazorGlobalSrc/rich-text-editor/actions/keyboard.d.ts +110 -0
  161. package/blazorGlobalSrc/rich-text-editor/actions/keyboard.js +163 -0
  162. package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.d.ts +66 -0
  163. package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.js +142 -0
  164. package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.d.ts +23 -0
  165. package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.js +124 -0
  166. package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.d.ts +86 -0
  167. package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.js +1071 -0
  168. package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.d.ts +151 -0
  169. package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.js +548 -0
  170. package/blazorGlobalSrc/rich-text-editor/actions/resize.d.ts +37 -0
  171. package/blazorGlobalSrc/rich-text-editor/actions/resize.js +188 -0
  172. package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.d.ts +11 -0
  173. package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.js +168 -0
  174. package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.d.ts +18 -0
  175. package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.js +76 -0
  176. package/blazorGlobalSrc/rich-text-editor/actions/toolbar.d.ts +185 -0
  177. package/blazorGlobalSrc/rich-text-editor/actions/toolbar.js +512 -0
  178. package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.d.ts +25 -0
  179. package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.js +166 -0
  180. package/blazorGlobalSrc/rich-text-editor/actions.d.ts +26 -0
  181. package/blazorGlobalSrc/rich-text-editor/actions.js +30 -0
  182. package/blazorGlobalSrc/rich-text-editor/audio.d.ts +4 -0
  183. package/blazorGlobalSrc/rich-text-editor/audio.js +8 -0
  184. package/blazorGlobalSrc/rich-text-editor/base/classes.d.ts +628 -0
  185. package/blazorGlobalSrc/rich-text-editor/base/classes.js +129 -0
  186. package/blazorGlobalSrc/rich-text-editor/base/constant.d.ts +808 -0
  187. package/blazorGlobalSrc/rich-text-editor/base/constant.js +334 -0
  188. package/blazorGlobalSrc/rich-text-editor/base/enum.d.ts +81 -0
  189. package/blazorGlobalSrc/rich-text-editor/base/enum.js +37 -0
  190. package/blazorGlobalSrc/rich-text-editor/base/interface.d.ts +1577 -0
  191. package/blazorGlobalSrc/rich-text-editor/base/interface.js +194 -0
  192. package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor-model.d.ts +1032 -0
  193. package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.d.ts +1699 -0
  194. package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.js +2645 -0
  195. package/blazorGlobalSrc/rich-text-editor/base/util.d.ts +212 -0
  196. package/blazorGlobalSrc/rich-text-editor/base/util.js +610 -0
  197. package/blazorGlobalSrc/rich-text-editor/base.d.ts +10 -0
  198. package/blazorGlobalSrc/rich-text-editor/base.js +13 -0
  199. package/blazorGlobalSrc/rich-text-editor/formatter/formatter.d.ts +87 -0
  200. package/blazorGlobalSrc/rich-text-editor/formatter/formatter.js +223 -0
  201. package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.d.ts +34 -0
  202. package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.js +44 -0
  203. package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.d.ts +39 -0
  204. package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.js +48 -0
  205. package/blazorGlobalSrc/rich-text-editor/formatter.d.ts +6 -0
  206. package/blazorGlobalSrc/rich-text-editor/formatter.js +10 -0
  207. package/blazorGlobalSrc/rich-text-editor/html-editor.d.ts +4 -0
  208. package/blazorGlobalSrc/rich-text-editor/html-editor.js +8 -0
  209. package/blazorGlobalSrc/rich-text-editor/image.d.ts +4 -0
  210. package/blazorGlobalSrc/rich-text-editor/image.js +8 -0
  211. package/blazorGlobalSrc/rich-text-editor/index.d.ts +9 -0
  212. package/blazorGlobalSrc/rich-text-editor/index.js +12 -0
  213. package/blazorGlobalSrc/rich-text-editor/link.d.ts +4 -0
  214. package/blazorGlobalSrc/rich-text-editor/link.js +8 -0
  215. package/blazorGlobalSrc/rich-text-editor/markdown-editor.d.ts +4 -0
  216. package/blazorGlobalSrc/rich-text-editor/markdown-editor.js +8 -0
  217. package/blazorGlobalSrc/rich-text-editor/models/default-locale.d.ts +25 -0
  218. package/blazorGlobalSrc/rich-text-editor/models/default-locale.js +391 -0
  219. package/blazorGlobalSrc/rich-text-editor/models/iframe-settings-model.d.ts +68 -0
  220. package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.d.ts +61 -0
  221. package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.js +60 -0
  222. package/blazorGlobalSrc/rich-text-editor/models/inline-mode-model.d.ts +24 -0
  223. package/blazorGlobalSrc/rich-text-editor/models/inline-mode.d.ts +20 -0
  224. package/blazorGlobalSrc/rich-text-editor/models/inline-mode.js +37 -0
  225. package/blazorGlobalSrc/rich-text-editor/models/items.d.ts +36 -0
  226. package/blazorGlobalSrc/rich-text-editor/models/items.js +1011 -0
  227. package/blazorGlobalSrc/rich-text-editor/models/models.d.ts +7 -0
  228. package/blazorGlobalSrc/rich-text-editor/models/models.js +4 -0
  229. package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings-model.d.ts +40 -0
  230. package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.d.ts +50 -0
  231. package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.js +143 -0
  232. package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings-model.d.ts +1130 -0
  233. package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.d.ts +992 -0
  234. package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.js +510 -0
  235. package/blazorGlobalSrc/rich-text-editor/models.d.ts +4 -0
  236. package/blazorGlobalSrc/rich-text-editor/models.js +4 -0
  237. package/blazorGlobalSrc/rich-text-editor/quick-toolbar.d.ts +4 -0
  238. package/blazorGlobalSrc/rich-text-editor/quick-toolbar.js +8 -0
  239. package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.d.ts +82 -0
  240. package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.js +886 -0
  241. package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.d.ts +65 -0
  242. package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.js +49 -0
  243. package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.d.ts +39 -0
  244. package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.js +111 -0
  245. package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.d.ts +33 -0
  246. package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.js +101 -0
  247. package/blazorGlobalSrc/rich-text-editor/renderer/image-module.d.ts +199 -0
  248. package/blazorGlobalSrc/rich-text-editor/renderer/image-module.js +2494 -0
  249. package/blazorGlobalSrc/rich-text-editor/renderer/link-module.d.ts +63 -0
  250. package/blazorGlobalSrc/rich-text-editor/renderer/link-module.js +596 -0
  251. package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.d.ts +65 -0
  252. package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.js +38 -0
  253. package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.d.ts +54 -0
  254. package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.js +35 -0
  255. package/blazorGlobalSrc/rich-text-editor/renderer/render.d.ts +46 -0
  256. package/blazorGlobalSrc/rich-text-editor/renderer/render.js +70 -0
  257. package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.d.ts +20 -0
  258. package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.js +224 -0
  259. package/blazorGlobalSrc/rich-text-editor/renderer/table-module.d.ts +155 -0
  260. package/blazorGlobalSrc/rich-text-editor/renderer/table-module.js +2206 -0
  261. package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.d.ts +131 -0
  262. package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.js +747 -0
  263. package/blazorGlobalSrc/rich-text-editor/renderer/video-module.d.ts +120 -0
  264. package/blazorGlobalSrc/rich-text-editor/renderer/video-module.js +1507 -0
  265. package/blazorGlobalSrc/rich-text-editor/renderer/view-source.d.ts +74 -0
  266. package/blazorGlobalSrc/rich-text-editor/renderer/view-source.js +225 -0
  267. package/blazorGlobalSrc/rich-text-editor/renderer.d.ts +17 -0
  268. package/blazorGlobalSrc/rich-text-editor/renderer.js +21 -0
  269. package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.d.ts +33 -0
  270. package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.js +29 -0
  271. package/blazorGlobalSrc/rich-text-editor/services/service-locator.d.ts +29 -0
  272. package/blazorGlobalSrc/rich-text-editor/services/service-locator.js +25 -0
  273. package/blazorGlobalSrc/rich-text-editor/services.d.ts +5 -0
  274. package/blazorGlobalSrc/rich-text-editor/services.js +9 -0
  275. package/blazorGlobalSrc/rich-text-editor/toolbar.d.ts +4 -0
  276. package/blazorGlobalSrc/rich-text-editor/toolbar.js +8 -0
  277. package/blazorGlobalSrc/rich-text-editor/video.d.ts +4 -0
  278. package/blazorGlobalSrc/rich-text-editor/video.js +8 -0
  279. package/blazorGlobalSrc/rich-text-editor.d.ts +4 -0
  280. package/blazorGlobalSrc/rich-text-editor.js +8 -0
  281. package/blazorGlobalSrc/selection/index.d.ts +4 -0
  282. package/blazorGlobalSrc/selection/index.js +8 -0
  283. package/blazorGlobalSrc/selection/selection.d.ts +244 -0
  284. package/blazorGlobalSrc/selection/selection.js +309 -0
  285. package/dist/ej2-richtexteditor.umd.min.js +1 -1
  286. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  287. package/dist/es6/ej2-richtexteditor.es2015.js +6 -4
  288. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  289. package/dist/es6/ej2-richtexteditor.es5.js +6 -4
  290. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  291. package/helpers/e2e/index.d.ts +1 -0
  292. package/helpers/e2e/index.js +8 -0
  293. package/helpers/e2e/rte-helper.d.ts +79 -0
  294. package/helpers/e2e/rte-helper.js +81 -0
  295. package/package.json +1 -1
  296. package/src/editor-manager/plugin/dom-tree.js +6 -4
  297. package/src/global.d.ts +1 -0
  298. package/styles/bds-lite.css +7 -17
  299. package/styles/bds.css +11 -22
  300. package/styles/bootstrap-dark-lite.css +3 -13
  301. package/styles/bootstrap-dark.css +3 -14
  302. package/styles/bootstrap-lite.css +3 -13
  303. package/styles/bootstrap.css +3 -14
  304. package/styles/bootstrap4-lite.css +3 -13
  305. package/styles/bootstrap4.css +3 -14
  306. package/styles/bootstrap5-dark-lite.css +3 -13
  307. package/styles/bootstrap5-dark.css +3 -14
  308. package/styles/bootstrap5-lite.css +3 -13
  309. package/styles/bootstrap5.3-lite.css +3 -13
  310. package/styles/bootstrap5.3.css +3 -14
  311. package/styles/bootstrap5.css +3 -14
  312. package/styles/fabric-dark-lite.css +3 -13
  313. package/styles/fabric-dark.css +3 -14
  314. package/styles/fabric-lite.css +3 -13
  315. package/styles/fabric.css +3 -14
  316. package/styles/fluent-dark-lite.css +3 -13
  317. package/styles/fluent-dark.css +3 -14
  318. package/styles/fluent-lite.css +3 -13
  319. package/styles/fluent.css +3 -14
  320. package/styles/fluent2-lite.css +3 -13
  321. package/styles/fluent2.css +3 -14
  322. package/styles/highcontrast-light-lite.css +3 -13
  323. package/styles/highcontrast-light.css +3 -14
  324. package/styles/highcontrast-lite.css +3 -13
  325. package/styles/highcontrast.css +3 -14
  326. package/styles/material-dark-lite.css +3 -13
  327. package/styles/material-dark.css +3 -14
  328. package/styles/material-lite.css +3 -13
  329. package/styles/material.css +3 -14
  330. package/styles/material3-dark-lite.css +3 -13
  331. package/styles/material3-dark.css +3 -14
  332. package/styles/material3-lite.css +3 -13
  333. package/styles/material3.css +3 -14
  334. package/styles/rich-text-editor/_bds-definition.scss +2 -2
  335. package/styles/rich-text-editor/_bigger.scss +0 -1
  336. package/styles/rich-text-editor/_layout.scss +0 -9
  337. package/styles/rich-text-editor/_theme.scss +3 -0
  338. package/styles/rich-text-editor/bds.css +11 -22
  339. package/styles/rich-text-editor/bootstrap-dark.css +3 -14
  340. package/styles/rich-text-editor/bootstrap.css +3 -14
  341. package/styles/rich-text-editor/bootstrap4.css +3 -14
  342. package/styles/rich-text-editor/bootstrap5-dark.css +3 -14
  343. package/styles/rich-text-editor/bootstrap5.3.css +3 -14
  344. package/styles/rich-text-editor/bootstrap5.css +3 -14
  345. package/styles/rich-text-editor/fabric-dark.css +3 -14
  346. package/styles/rich-text-editor/fabric.css +3 -14
  347. package/styles/rich-text-editor/fluent-dark.css +3 -14
  348. package/styles/rich-text-editor/fluent.css +3 -14
  349. package/styles/rich-text-editor/fluent2.css +3 -14
  350. package/styles/rich-text-editor/highcontrast-light.css +3 -14
  351. package/styles/rich-text-editor/highcontrast.css +3 -14
  352. package/styles/rich-text-editor/material-dark.css +3 -14
  353. package/styles/rich-text-editor/material.css +3 -14
  354. package/styles/rich-text-editor/material3-dark.css +3 -14
  355. package/styles/rich-text-editor/material3.css +3 -14
  356. package/styles/rich-text-editor/tailwind-dark.css +3 -14
  357. package/styles/rich-text-editor/tailwind.css +3 -14
  358. package/styles/rich-text-editor/tailwind3.css +3 -14
  359. package/styles/tailwind-dark-lite.css +3 -13
  360. package/styles/tailwind-dark.css +3 -14
  361. package/styles/tailwind-lite.css +3 -13
  362. package/styles/tailwind.css +3 -14
  363. package/styles/tailwind3-lite.css +3 -13
  364. package/styles/tailwind3.css +3 -14
  365. package/tslint.json +111 -0
@@ -0,0 +1,1507 @@
1
+ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-buttons", "@syncfusion/ej2-inputs", "../../common/util", "../base/classes", "../base/constant", "../base/enum", "../base/util"], function (require, exports, ej2_base_1, ej2_buttons_1, ej2_inputs_1, util_1, classes, events, enum_1, util_2) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var Video = (function () {
5
+ function Video(parent, serviceLocator) {
6
+ this.isVideoUploaded = false;
7
+ this.isAllowedTypes = true;
8
+ this.pageX = null;
9
+ this.pageY = null;
10
+ this.mouseX = null;
11
+ this.deletedVid = [];
12
+ this.isResizeBind = true;
13
+ this.parent = parent;
14
+ this.rteID = parent.element.id;
15
+ this.i10n = serviceLocator.getService('rteLocale');
16
+ this.rendererFactory = serviceLocator.getService('rendererFactory');
17
+ this.dialogRenderObj = serviceLocator.getService('dialogRenderObject');
18
+ this.addEventListener();
19
+ this.isDestroyed = false;
20
+ this.docClick = this.onDocumentClick.bind(this);
21
+ }
22
+ Video.prototype.addEventListener = function () {
23
+ if (this.parent.isDestroyed) {
24
+ return;
25
+ }
26
+ this.parent.on(events.keyDown, this.onKeyDown, this);
27
+ this.parent.on(events.keyUp, this.onKeyUp, this);
28
+ this.parent.on(events.insertVideo, this.insertingVideo, this);
29
+ this.parent.on(events.initialEnd, this.afterRender, this);
30
+ this.parent.on(events.dynamicModule, this.afterRender, this);
31
+ this.parent.on(events.windowResize, this.onWindowResize, this);
32
+ this.parent.on(events.showVideoDialog, this.showDialog, this);
33
+ this.parent.on(events.closeVideoDialog, this.closeDialog, this);
34
+ this.parent.on(events.dropDownSelect, this.alignmentSelect, this);
35
+ this.parent.on(events.videoDelete, this.deleteVideo, this);
36
+ this.parent.on(events.videoToolbarAction, this.onToolbarAction, this);
37
+ this.parent.on(events.editAreaClick, this.editAreaClickHandler, this);
38
+ this.parent.on(events.iframeMouseDown, this.onIframeMouseDown, this);
39
+ this.parent.on(events.videoSize, this.videoSize, this);
40
+ this.parent.on(events.insertCompleted, this.showVideoQuickToolbar, this);
41
+ this.parent.on(events.clearDialogObj, this.clearDialogObj, this);
42
+ this.parent.on(events.destroy, this.destroy, this);
43
+ };
44
+ Video.prototype.removeEventListener = function () {
45
+ this.parent.off(events.keyDown, this.onKeyDown);
46
+ this.parent.off(events.keyUp, this.onKeyUp);
47
+ this.parent.off(events.insertVideo, this.insertingVideo);
48
+ this.parent.off(events.windowResize, this.onWindowResize);
49
+ this.parent.off(events.initialEnd, this.afterRender);
50
+ this.parent.off(events.dynamicModule, this.afterRender);
51
+ this.parent.off(events.showVideoDialog, this.showDialog);
52
+ this.parent.off(events.closeVideoDialog, this.closeDialog);
53
+ this.parent.off(events.dropDownSelect, this.alignmentSelect);
54
+ this.parent.off(events.videoDelete, this.deleteVideo);
55
+ this.parent.off(events.videoToolbarAction, this.onToolbarAction);
56
+ this.parent.off(events.editAreaClick, this.editAreaClickHandler);
57
+ this.parent.off(events.iframeMouseDown, this.onIframeMouseDown);
58
+ this.parent.off(events.videoSize, this.videoSize);
59
+ this.parent.off(events.insertCompleted, this.showVideoQuickToolbar);
60
+ this.parent.off(events.clearDialogObj, this.clearDialogObj);
61
+ this.parent.off(events.destroy, this.destroy);
62
+ if (!ej2_base_1.isNullOrUndefined(this.contentModule)) {
63
+ ej2_base_1.EventHandler.remove(this.contentModule.getEditPanel(), ej2_base_1.Browser.touchEndEvent, this.videoClick);
64
+ this.parent.formatter.editorManager.observer.off(events.checkUndo, this.undoStack);
65
+ if (this.parent.insertVideoSettings.resize) {
66
+ ej2_base_1.EventHandler.remove(this.parent.contentModule.getEditPanel(), ej2_base_1.Browser.touchStartEvent, this.resizeStart);
67
+ this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick);
68
+ this.docClick = null;
69
+ ej2_base_1.EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
70
+ ej2_base_1.EventHandler.remove(this.contentModule.getDocument(), ej2_base_1.Browser.touchMoveEvent, this.resizing);
71
+ }
72
+ }
73
+ };
74
+ Video.prototype.afterRender = function () {
75
+ this.contentModule = this.rendererFactory.getRenderer(enum_1.RenderType.Content);
76
+ ej2_base_1.EventHandler.add(this.contentModule.getEditPanel(), ej2_base_1.Browser.touchEndEvent, this.videoClick, this);
77
+ if (this.parent.insertVideoSettings.resize) {
78
+ ej2_base_1.EventHandler.add(this.parent.contentModule.getEditPanel(), ej2_base_1.Browser.touchStartEvent, this.resizeStart, this);
79
+ this.parent.element.ownerDocument.addEventListener('mousedown', this.docClick);
80
+ ej2_base_1.EventHandler.add(this.contentModule.getEditPanel(), 'cut', this.onCutHandler, this);
81
+ }
82
+ };
83
+ Video.prototype.clearDialogObj = function () {
84
+ if (this.uploadObj && !this.uploadObj.isDestroyed) {
85
+ this.uploadObj.destroy();
86
+ ej2_base_1.detach(this.uploadObj.element);
87
+ this.uploadObj = null;
88
+ }
89
+ if (this.webUrlBtn && !this.webUrlBtn.isDestroyed) {
90
+ this.webUrlBtn.destroy();
91
+ ej2_base_1.detach(this.webUrlBtn.element);
92
+ this.webUrlBtn = null;
93
+ }
94
+ if (this.embedUrlBtn && !this.embedUrlBtn.isDestroyed) {
95
+ this.embedUrlBtn.destroy();
96
+ ej2_base_1.detach(this.embedUrlBtn.element);
97
+ this.embedUrlBtn = null;
98
+ }
99
+ if (this.widthNum && !this.widthNum.isDestroyed) {
100
+ this.widthNum.destroy();
101
+ ej2_base_1.detach(this.widthNum.element);
102
+ this.widthNum = null;
103
+ }
104
+ if (this.heightNum && !this.heightNum.isDestroyed) {
105
+ this.heightNum.destroy();
106
+ ej2_base_1.detach(this.heightNum.element);
107
+ this.heightNum = null;
108
+ }
109
+ if (this.button && !this.button.isDestroyed) {
110
+ this.button.destroy();
111
+ ej2_base_1.detach(this.button.element);
112
+ this.heightNum = null;
113
+ }
114
+ if (this.dialogObj && this.dialogObj.element) {
115
+ this.dialogObj.destroy();
116
+ ej2_base_1.detach(this.dialogObj.element);
117
+ this.dialogObj = null;
118
+ }
119
+ };
120
+ Video.prototype.onKeyUp = function (event) {
121
+ if (!ej2_base_1.isNullOrUndefined(this.deletedVid) && this.deletedVid.length > 0) {
122
+ for (var i = 0; i < this.deletedVid.length; i++) {
123
+ var args = {
124
+ element: this.deletedVid[i],
125
+ src: this.deletedVid[i].tagName !== 'IFRAME' ? this.deletedVid[i].querySelector('source').getAttribute('src') :
126
+ this.deletedVid[i].src
127
+ };
128
+ this.parent.trigger(events.afterMediaDelete, args);
129
+ }
130
+ }
131
+ };
132
+ Video.prototype.undoStack = function (args) {
133
+ if ((args.subCommand.toLowerCase() === 'undo' || args.subCommand.toLowerCase() === 'redo') && this.parent.editorMode === 'HTML') {
134
+ for (var i = 0; i < this.parent.formatter.getUndoRedoStack().length; i++) {
135
+ var temp = this.parent.createElement('div');
136
+ var contentElem = this.parent.formatter.getUndoRedoStack()[i].text;
137
+ temp.appendChild(contentElem.cloneNode(true));
138
+ var vid = temp.querySelectorAll('video');
139
+ if (temp.querySelector('.e-vid-resize') && vid.length > 0) {
140
+ for (var j = 0; j < vid.length; j++) {
141
+ vid[j].style.outline = '';
142
+ }
143
+ ej2_base_1.detach(temp.querySelector('.e-vid-resize'));
144
+ var clonedElement = temp.cloneNode(true);
145
+ var fragment = document.createDocumentFragment();
146
+ while (clonedElement.firstChild) {
147
+ fragment.appendChild(clonedElement.firstChild);
148
+ }
149
+ this.parent.formatter.getUndoRedoStack()[i].text = fragment;
150
+ }
151
+ }
152
+ }
153
+ };
154
+ Video.prototype.onIframeMouseDown = function (e) {
155
+ var target = e.target;
156
+ if (this.dialogObj) {
157
+ this.dialogObj.hide({ returnValue: true });
158
+ }
159
+ if (!(!ej2_base_1.isNullOrUndefined(this.parent.currentTarget) && this.parent.currentTarget.nodeName === 'VIDEO') && (this.videoEle && this.vidResizeDiv && this.contentModule.getEditPanel().contains(this.vidResizeDiv))) {
160
+ this.cancelResizeAction();
161
+ }
162
+ if (this.contentModule.getEditPanel().querySelector('.e-vid-resize') && (this.parent.currentTarget.nodeName === 'VIDEO')) {
163
+ if (!ej2_base_1.isNullOrUndefined(this.prevSelectedVidEle) &&
164
+ this.prevSelectedVidEle !== ((target.tagName === 'IFRAME' || target.tagName === 'VIDEO') ? target : target.querySelector('iframe'))) {
165
+ this.prevSelectedVidEle.style.outline = '';
166
+ }
167
+ }
168
+ };
169
+ Video.prototype.videoSize = function (e) {
170
+ var _this = this;
171
+ if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
172
+ return;
173
+ }
174
+ this.insertVideo(e);
175
+ if (!ej2_base_1.isNullOrUndefined(this.dialogObj)) {
176
+ var vidSizeHeader = this.i10n.getConstant('videoSizeHeader');
177
+ var linkUpdate = this.i10n.getConstant('dialogUpdate');
178
+ var dialogContent = this.vidsizeInput(e);
179
+ var selectObj_1 = { args: e.args, selfVideo: this, selection: e.selection, selectNode: e.selectNode };
180
+ this.dialogObj.setProperties({
181
+ width: '290px', header: vidSizeHeader, content: dialogContent,
182
+ buttons: [{
183
+ click: function (e) {
184
+ _this.insertSize(selectObj_1);
185
+ },
186
+ buttonModel: {
187
+ content: linkUpdate, cssClass: 'e-flat e-update-size', isPrimary: true
188
+ }
189
+ }]
190
+ });
191
+ this.dialogObj.element.style.maxHeight = 'inherit';
192
+ this.dialogObj.content.querySelector('input').focus();
193
+ }
194
+ };
195
+ Video.prototype.vidsizeInput = function (e) {
196
+ var _this = this;
197
+ var selectNode = e.selectNode[0];
198
+ var vidHeight = this.i10n.getConstant('videoHeight');
199
+ var vidWidth = this.i10n.getConstant('videoWidth');
200
+ var vidSizeWrap = this.parent.createElement('div', { className: 'e-video-sizewrap' });
201
+ var widthVal = ej2_base_1.isNullOrUndefined(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
202
+ selectNode.style.width !== '') ? selectNode.style.width : !ej2_base_1.isNullOrUndefined(this.changedWidthValue) ?
203
+ this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
204
+ var heightVal = ej2_base_1.isNullOrUndefined(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
205
+ selectNode.style.height !== '') ? selectNode.style.height : !ej2_base_1.isNullOrUndefined(this.changedHeightValue) ?
206
+ this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString(), 10)).toString();
207
+ if (selectNode.style.width === '' && ej2_base_1.isNullOrUndefined(this.changedWidthValue)) {
208
+ widthVal = 'auto';
209
+ }
210
+ if (selectNode.style.height === '' && ej2_base_1.isNullOrUndefined(this.changedHeightValue)) {
211
+ heightVal = 'auto';
212
+ }
213
+ this.changedWidthValue = null;
214
+ this.changedHeightValue = null;
215
+ var content = '<div class="e-rte-label"><label>' + vidWidth +
216
+ '</label></div><div class="e-rte-field"><input type="text" id="vidwidth" class="e-vid-width" value=' +
217
+ widthVal
218
+ + ' /></div>' +
219
+ '<div class="e-rte-label">' + '<label>' + vidHeight + '</label></div><div class="e-rte-field"> ' +
220
+ '<input type="text" id="vidheight" class="e-vid-height" value=' +
221
+ heightVal
222
+ + ' /></div>';
223
+ var contentElem = util_2.parseHtml(content);
224
+ vidSizeWrap.appendChild(contentElem);
225
+ this.widthNum = new ej2_inputs_1.TextBox({
226
+ value: ej2_base_1.formatUnit(widthVal),
227
+ enableRtl: this.parent.enableRtl,
228
+ input: function (e) {
229
+ _this.inputWidthValue = ej2_base_1.formatUnit((e.value));
230
+ }
231
+ });
232
+ this.widthNum.createElement = this.parent.createElement;
233
+ this.widthNum.appendTo(vidSizeWrap.querySelector('#vidwidth'));
234
+ this.heightNum = new ej2_inputs_1.TextBox({
235
+ value: ej2_base_1.formatUnit(heightVal),
236
+ enableRtl: this.parent.enableRtl,
237
+ input: function (e) {
238
+ _this.inputHeightValue = ej2_base_1.formatUnit((e.value));
239
+ }
240
+ });
241
+ this.heightNum.createElement = this.parent.createElement;
242
+ this.heightNum.appendTo(vidSizeWrap.querySelector('#vidheight'));
243
+ return vidSizeWrap;
244
+ };
245
+ Video.prototype.insertSize = function (e) {
246
+ e.selection.restore();
247
+ var proxy = e.selfVideo;
248
+ if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
249
+ proxy.parent.formatter.saveData();
250
+ }
251
+ var dialogEle = proxy.dialogObj.element;
252
+ this.changedWidthValue = this.inputWidthValue === 'px' ? null : this.inputWidthValue;
253
+ this.changedHeightValue = this.inputHeightValue === 'px' ? null : this.inputHeightValue;
254
+ var width = dialogEle.querySelector('.e-vid-width').value;
255
+ var height = dialogEle.parentElement.querySelector('.e-vid-height').value;
256
+ proxy.parent.formatter.process(this.parent, e.args, e.args, {
257
+ width: width, height: height, selectNode: e.selectNode,
258
+ subCommand: e.args.item.subCommand
259
+ });
260
+ if (this.vidResizeDiv) {
261
+ e.selectNode[0] = (e.selectNode[0].tagName === 'VIDEO' || e.selectNode[0].tagName === 'IFRAME') ?
262
+ e.selectNode[0] : e.selectNode[0].querySelector('iframe');
263
+ proxy.vidResizePos(e.selectNode[0], this.vidResizeDiv);
264
+ }
265
+ proxy.dialogObj.hide({ returnValue: true });
266
+ };
267
+ Video.prototype.resizeEnd = function (e) {
268
+ this.resizeBtnInit();
269
+ this.videoEle.parentElement.style.cursor = 'auto';
270
+ if (ej2_base_1.Browser.isDevice) {
271
+ ej2_base_1.removeClass([e.target.parentElement], 'e-mob-span');
272
+ }
273
+ var args = { event: e, requestType: 'videos' };
274
+ this.parent.trigger(events.resizeStop, args);
275
+ var pageX = this.getPointX(e);
276
+ var pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
277
+ this.parent.element.getBoundingClientRect().top + e.clientY : e.pageY;
278
+ this.parent.formatter.editorManager.observer.on(events.checkUndo, this.undoStack, this);
279
+ this.parent.formatter.saveData();
280
+ };
281
+ Video.prototype.resizeStart = function (e, ele) {
282
+ var _this = this;
283
+ if (this.parent.readonly) {
284
+ return;
285
+ }
286
+ var target = ele ? ele : !this.isEmbedVidElem(e.target) ? e.target : e.target.querySelector('iframe');
287
+ if (ej2_base_1.isNullOrUndefined(target)) {
288
+ return;
289
+ }
290
+ this.prevSelectedVidEle = this.videoEle;
291
+ if (target.tagName === 'VIDEO' || target.tagName === 'IFRAME') {
292
+ this.parent.preventDefaultResize(e);
293
+ var videoElem = target;
294
+ if (this.vidResizeDiv && this.contentModule.getEditPanel().contains(this.vidResizeDiv)) {
295
+ ej2_base_1.detach(this.vidResizeDiv);
296
+ }
297
+ this.videoResize(videoElem);
298
+ }
299
+ if (target.classList.contains('e-rte-videoboxmark')) {
300
+ if (this.parent.formatter.getUndoRedoStack().length === 0) {
301
+ this.parent.formatter.saveData();
302
+ }
303
+ this.pageX = this.getPointX(e);
304
+ this.pageY = this.getPointY(e);
305
+ e.preventDefault();
306
+ e.stopImmediatePropagation();
307
+ this.resizeBtnInit();
308
+ if (this.quickToolObj) {
309
+ this.quickToolObj.videoQTBar.hidePopup();
310
+ }
311
+ if (target.classList.contains('e-rte-topLeft')) {
312
+ this.resizeBtnStat.topLeft = true;
313
+ }
314
+ if (target.classList.contains('e-rte-topRight')) {
315
+ this.resizeBtnStat.topRight = true;
316
+ }
317
+ if (target.classList.contains('e-rte-botLeft')) {
318
+ this.resizeBtnStat.botLeft = true;
319
+ }
320
+ if (target.classList.contains('e-rte-botRight')) {
321
+ this.resizeBtnStat.botRight = true;
322
+ }
323
+ if (ej2_base_1.Browser.isDevice && this.contentModule.getEditPanel().contains(this.vidResizeDiv) &&
324
+ !this.vidResizeDiv.classList.contains('e-mob-span')) {
325
+ ej2_base_1.addClass([this.vidResizeDiv], 'e-mob-span');
326
+ }
327
+ else {
328
+ var args = { event: e, requestType: 'videos' };
329
+ this.parent.trigger(events.resizeStart, args, function (resizeStartArgs) {
330
+ if (resizeStartArgs.cancel) {
331
+ _this.cancelResizeAction();
332
+ }
333
+ });
334
+ }
335
+ if (this.isResizeBind) {
336
+ ej2_base_1.EventHandler.add(this.contentModule.getDocument(), ej2_base_1.Browser.touchMoveEvent, this.resizing, this);
337
+ ej2_base_1.EventHandler.add(this.contentModule.getDocument(), ej2_base_1.Browser.touchEndEvent, this.resizeEnd, this);
338
+ this.isResizeBind = false;
339
+ }
340
+ }
341
+ };
342
+ Video.prototype.videoClick = function (e) {
343
+ if (ej2_base_1.Browser.isDevice) {
344
+ if ((e.target.tagName === 'VIDEO' || this.isEmbedVidElem(e.target))) {
345
+ this.contentModule.getEditPanel().setAttribute('contenteditable', 'false');
346
+ e.target.focus();
347
+ }
348
+ else {
349
+ if (!this.parent.readonly) {
350
+ this.contentModule.getEditPanel().setAttribute('contenteditable', 'true');
351
+ }
352
+ }
353
+ }
354
+ if (e.target.tagName === 'VIDEO' || this.isEmbedVidElem(e.target) && !this.parent.userAgentData.isSafari()) {
355
+ e.preventDefault();
356
+ }
357
+ };
358
+ Video.prototype.onCutHandler = function () {
359
+ if (this.vidResizeDiv && this.contentModule.getEditPanel().contains(this.vidResizeDiv)) {
360
+ this.cancelResizeAction();
361
+ }
362
+ };
363
+ Video.prototype.videoResize = function (e) {
364
+ this.resizeBtnInit();
365
+ this.videoEle = e;
366
+ ej2_base_1.addClass([this.videoEle], 'e-resize');
367
+ this.vidResizeDiv = this.parent.createElement('span', { className: 'e-vid-resize', id: this.rteID + '_vidResize' });
368
+ this.vidResizeDiv.appendChild(this.parent.createElement('span', {
369
+ className: 'e-rte-videoboxmark e-rte-topLeft', styles: 'cursor: nwse-resize'
370
+ }));
371
+ this.vidResizeDiv.appendChild(this.parent.createElement('span', {
372
+ className: 'e-rte-videoboxmark e-rte-topRight', styles: 'cursor: nesw-resize'
373
+ }));
374
+ this.vidResizeDiv.appendChild(this.parent.createElement('span', {
375
+ className: 'e-rte-videoboxmark e-rte-botLeft', styles: 'cursor: nesw-resize'
376
+ }));
377
+ this.vidResizeDiv.appendChild(this.parent.createElement('span', {
378
+ className: 'e-rte-videoboxmark e-rte-botRight', styles: 'cursor: nwse-resize'
379
+ }));
380
+ if (ej2_base_1.Browser.isDevice) {
381
+ ej2_base_1.addClass([this.vidResizeDiv], 'e-mob-rte');
382
+ }
383
+ e.style.outline = '2px solid #4a90e2';
384
+ this.vidResizePos(e, this.vidResizeDiv);
385
+ this.resizeVidDupPos(e);
386
+ this.contentModule.getEditPanel().appendChild(this.vidResizeDiv);
387
+ if (this.parent.element.style.height === 'auto') {
388
+ this.vidResizePos(e, this.vidResizeDiv);
389
+ }
390
+ };
391
+ Video.prototype.getPointX = function (e) {
392
+ if (e.touches && e.touches.length) {
393
+ return e.touches[0].pageX;
394
+ }
395
+ else {
396
+ return e.pageX;
397
+ }
398
+ };
399
+ Video.prototype.getPointY = function (e) {
400
+ if (e.touches && e.touches.length) {
401
+ return e.touches[0].pageY;
402
+ }
403
+ else {
404
+ return e.pageY;
405
+ }
406
+ };
407
+ Video.prototype.vidResizePos = function (e, vidResizeDiv) {
408
+ if (ej2_base_1.isNullOrUndefined(vidResizeDiv)) {
409
+ return;
410
+ }
411
+ var pos = this.calcPos(e);
412
+ var top = pos.top;
413
+ var left = pos.left;
414
+ var vidWid = e.width !== 0 && e.width !== 'auto' && e.width !== 'NaN' ? e.width : e.getBoundingClientRect().width;
415
+ var vidHgt = e.height !== 0 && e.height !== 'auto' && e.height !== 'NaN' ? e.height : e.getBoundingClientRect().height;
416
+ var borWid = (ej2_base_1.Browser.isDevice) ? (4 * parseInt((e.style.outline.slice(-3)), 10)) + 2 :
417
+ (2 * parseInt((e.style.outline.slice(-3)), 10)) + 2;
418
+ var devWid = ((ej2_base_1.Browser.isDevice) ? 0 : 2);
419
+ vidResizeDiv.querySelector('.e-rte-botLeft').style.left = (left - borWid) + 'px';
420
+ vidResizeDiv.querySelector('.e-rte-botLeft').style.top = ((parseInt(vidHgt.toString(), 10) - borWid) + top) + 'px';
421
+ vidResizeDiv.querySelector('.e-rte-botRight').style.left = ((parseInt(vidWid.toString(), 10) - (borWid - devWid)) + left) + 'px';
422
+ vidResizeDiv.querySelector('.e-rte-botRight').style.top = ((parseInt(vidHgt.toString(), 10) - borWid) + top) + 'px';
423
+ vidResizeDiv.querySelector('.e-rte-topRight').style.left = ((parseInt(vidWid.toString(), 10) - (borWid - devWid)) + left) + 'px';
424
+ vidResizeDiv.querySelector('.e-rte-topRight').style.top = (top - (borWid)) + 'px';
425
+ vidResizeDiv.querySelector('.e-rte-topLeft').style.left = (left - borWid) + 'px';
426
+ vidResizeDiv.querySelector('.e-rte-topLeft').style.top = (top - borWid) + 'px';
427
+ };
428
+ Video.prototype.calcPos = function (elem) {
429
+ var ignoreOffset = ['TD', 'TH', 'TABLE', 'A'];
430
+ var parentOffset = { top: 0, left: 0 };
431
+ var elementOffset;
432
+ var doc = elem.ownerDocument;
433
+ var offsetParent = ((elem.offsetParent && (elem.offsetParent.classList.contains('e-video-clickelem') ||
434
+ ignoreOffset.indexOf(elem.offsetParent.tagName) > -1)) ? ej2_base_1.closest(elem, '#' + this.parent.getID() + '_rte-edit-view') : elem.offsetParent) || doc.documentElement;
435
+ while (offsetParent &&
436
+ (offsetParent === doc.body || offsetParent === doc.documentElement) &&
437
+ offsetParent.style.position === 'static') {
438
+ offsetParent = offsetParent.parentNode;
439
+ }
440
+ if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
441
+ parentOffset = offsetParent.getBoundingClientRect();
442
+ }
443
+ if (elem && elem.nodeType === 1 && elem.tagName === 'IFRAME') {
444
+ elementOffset = elem.getBoundingClientRect();
445
+ return {
446
+ top: elementOffset.top - parentOffset.top,
447
+ left: elementOffset.left - parentOffset.left
448
+ };
449
+ }
450
+ else {
451
+ return {
452
+ top: elem.offsetTop,
453
+ left: elem.offsetLeft
454
+ };
455
+ }
456
+ };
457
+ Video.prototype.setAspectRatio = function (vid, expectedX, expectedY, e) {
458
+ var vidEleStyle = getComputedStyle(vid);
459
+ if (ej2_base_1.isNullOrUndefined(vidEleStyle)) {
460
+ return;
461
+ }
462
+ var regExp = RegExp;
463
+ var width = vidEleStyle.width !== '' ? vidEleStyle.width.match(new regExp('^\\d+(\\.\\d*)?%$', 'g')) ? parseFloat(vidEleStyle.width) :
464
+ parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
465
+ var height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
466
+ width = width.toString().match(new regExp('\\b\\d+(\\.\\d*)?(%|$)\\b', 'g')) ? parseFloat(width.toString()) : parseInt(width.toString(), 10);
467
+ height = height.toString().match(new regExp('\\b\\d+(\\.\\d*)?(%|$)\\b', 'g')) ? parseFloat(height.toString()) : parseInt(height.toString(), 10);
468
+ if (width > height) {
469
+ vid.style.minWidth = this.parent.insertVideoSettings.minWidth === 0 ? '200px' : ej2_base_1.formatUnit(this.parent.insertVideoSettings.minWidth);
470
+ vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '90px' : ej2_base_1.formatUnit(this.parent.insertVideoSettings.minHeight);
471
+ if (this.parent.insertVideoSettings.resizeByPercent) {
472
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
473
+ }
474
+ else if ((vid.style.width === '' && vid.style.height !== '') || (vidEleStyle.width === '' && vidEleStyle.height !== '')) {
475
+ vid.style.height = expectedY + 'px';
476
+ }
477
+ else if ((vid.style.width !== '' && vid.style.height === '') || (vidEleStyle.width !== '' && vidEleStyle.height === '')) {
478
+ var currentWidth = ((width / height * expectedY) +
479
+ width / height) <
480
+ (this.parent.inputElement.getBoundingClientRect().right - 32) ?
481
+ ((width / height * expectedY) +
482
+ width / height) :
483
+ (this.parent.inputElement.getBoundingClientRect().right - 32);
484
+ vid.style.width = currentWidth.toString() + 'px';
485
+ }
486
+ else if (vid.style.width !== '' || vidEleStyle.width !== '') {
487
+ var currentWidth = (width / height * expectedY) <
488
+ (this.parent.inputElement.getBoundingClientRect().right - 32) ?
489
+ (width / height * expectedY) :
490
+ (this.parent.inputElement.getBoundingClientRect().right - 32);
491
+ vid.style.width = currentWidth + 'px';
492
+ vid.style.height = expectedY + 'px';
493
+ }
494
+ else {
495
+ vid.setAttribute('width', (parseInt(((width / height * expectedY) + width / height).toString(), 10)).toString());
496
+ }
497
+ }
498
+ else if (height > width) {
499
+ if (this.parent.insertVideoSettings.resizeByPercent) {
500
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
501
+ }
502
+ else if (vidEleStyle.width !== '' || vid.style.width !== '') {
503
+ vid.style.width = expectedX + 'px';
504
+ vid.style.height = (height / width * expectedX) + 'px';
505
+ }
506
+ else {
507
+ vid.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - vid.getBoundingClientRect().left).toString() : expectedX.toString());
508
+ }
509
+ }
510
+ else {
511
+ if (this.parent.insertVideoSettings.resizeByPercent) {
512
+ vid.style.width = this.pixToPerc(expectedX, (vid.previousElementSibling || vid.parentElement)) + '%';
513
+ vid.style.height = null;
514
+ vid.removeAttribute('height');
515
+ }
516
+ else {
517
+ vid.style.width = expectedX + 'px';
518
+ vid.style.height = expectedX + 'px';
519
+ }
520
+ }
521
+ };
522
+ Video.prototype.updateVidEleWidth = function (vid, width, height, expectedX, expectedY) {
523
+ if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
524
+ var original = vid.offsetWidth + this.mouseX;
525
+ var finalWidthByPerc = (original / vid.offsetWidth) * (parseFloat(vid.style.width).toString() === 'NaN' ? (vid.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(vid.style.width));
526
+ vid.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
527
+ }
528
+ else {
529
+ if (width > height) {
530
+ vid.style.width = this.pixToPerc(width / height * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
531
+ }
532
+ else {
533
+ vid.style.width = this.pixToPerc((expectedX / height * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
534
+ }
535
+ }
536
+ vid.style.height = null;
537
+ vid.removeAttribute('height');
538
+ };
539
+ Video.prototype.pixToPerc = function (expected, parentEle) {
540
+ return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
541
+ };
542
+ Video.prototype.vidDupMouseMove = function (width, height, e) {
543
+ var _this = this;
544
+ var args = { event: e, requestType: 'videos' };
545
+ this.parent.trigger(events.onResize, args, function (resizingArgs) {
546
+ if (resizingArgs.cancel) {
547
+ _this.cancelResizeAction();
548
+ }
549
+ else {
550
+ if ((parseInt(_this.parent.insertVideoSettings.minWidth, 10) >= parseInt(width, 10) ||
551
+ (parseInt(_this.parent.getInsertVidMaxWidth(), 10) <= parseInt(width, 10) &&
552
+ ej2_base_1.isNullOrUndefined(_this.videoEle.style.width)))) {
553
+ return;
554
+ }
555
+ if (!_this.parent.insertVideoSettings.resizeByPercent &&
556
+ (parseInt(_this.parent.insertVideoSettings.minHeight, 10) >= parseInt(height, 10) ||
557
+ parseInt(_this.parent.insertVideoSettings.maxHeight, 10) <= parseInt(height, 10))) {
558
+ return;
559
+ }
560
+ _this.videoEle.parentElement.style.cursor = 'pointer';
561
+ _this.setAspectRatio(_this.videoEle, parseInt(width, 10), parseInt(height, 10), args);
562
+ _this.resizeVidDupPos(_this.videoEle);
563
+ _this.vidResizePos(_this.videoEle, _this.vidResizeDiv);
564
+ }
565
+ });
566
+ };
567
+ Video.prototype.resizing = function (e) {
568
+ if (this.videoEle.offsetWidth >= this.parent.getInsertVidMaxWidth()) {
569
+ this.videoEle.style.maxHeight = this.videoEle.offsetHeight + 'px';
570
+ }
571
+ var pageX = this.getPointX(e);
572
+ var pageY = this.getPointY(e);
573
+ var mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
574
+ var mouseY = (this.resizeBtnStat.topLeft || this.resizeBtnStat.topRight) ? -(pageY - this.pageY) : (pageY - this.pageY);
575
+ var width = parseInt(this.vidDupPos.width, 10) + mouseX;
576
+ var height = parseInt(this.vidDupPos.height, 10) + mouseY;
577
+ this.pageX = pageX;
578
+ this.pageY = pageY;
579
+ this.mouseX = mouseX;
580
+ if (this.resizeBtnStat.botRight) {
581
+ this.vidDupMouseMove(width + 'px', height + 'px', e);
582
+ }
583
+ else if (this.resizeBtnStat.botLeft) {
584
+ this.vidDupMouseMove(width + 'px', height + 'px', e);
585
+ }
586
+ else if (this.resizeBtnStat.topRight) {
587
+ this.vidDupMouseMove(width + 'px', height + 'px', e);
588
+ }
589
+ else if (this.resizeBtnStat.topLeft) {
590
+ this.vidDupMouseMove(width + 'px', height + 'px', e);
591
+ }
592
+ };
593
+ Video.prototype.cancelResizeAction = function () {
594
+ this.isResizeBind = true;
595
+ ej2_base_1.EventHandler.remove(this.contentModule.getDocument(), ej2_base_1.Browser.touchMoveEvent, this.resizing);
596
+ ej2_base_1.EventHandler.remove(this.contentModule.getDocument(), ej2_base_1.Browser.touchEndEvent, this.resizeEnd);
597
+ if (this.videoEle && this.vidResizeDiv && this.contentModule.getEditPanel().contains(this.vidResizeDiv)) {
598
+ ej2_base_1.detach(this.vidResizeDiv);
599
+ this.videoEle.style.outline = '';
600
+ this.vidResizeDiv = null;
601
+ this.pageX = null;
602
+ this.pageY = null;
603
+ }
604
+ };
605
+ Video.prototype.resizeVidDupPos = function (e) {
606
+ this.vidDupPos = {
607
+ width: (e.style.width !== '' && (this.parent.insertVideoSettings &&
608
+ !this.parent.insertVideoSettings.resizeByPercent)) ? this.videoEle.style.width : e.width !== 'auto' && e.width !== 0 && e.width !== 'NaN' ? e.width + 'px' : parseInt(getComputedStyle(e).width, 10) + 'px',
609
+ height: (e.style.height !== '') ? this.videoEle.style.height : e.height !== 'auto' && e.height !== 0 && e.height !== 'NaN' ? e.height + 'px' : parseInt(getComputedStyle(e).height, 10) + 'px'
610
+ };
611
+ };
612
+ Video.prototype.resizeBtnInit = function () {
613
+ return this.resizeBtnStat = { botLeft: false, botRight: false, topRight: false, topLeft: false };
614
+ };
615
+ Video.prototype.onToolbarAction = function (args) {
616
+ if (util_1.isIDevice()) {
617
+ this.parent.notify(events.selectionRestore, {});
618
+ }
619
+ var item = args.args.item;
620
+ switch (item.subCommand) {
621
+ case 'VideoReplace':
622
+ this.parent.notify(events.insertVideo, args);
623
+ break;
624
+ case 'VideoRemove':
625
+ this.parent.notify(events.videoDelete, args);
626
+ break;
627
+ case 'VideoDimension':
628
+ this.parent.notify(events.videoSize, args);
629
+ }
630
+ };
631
+ Video.prototype.onKeyDown = function (event) {
632
+ var originalEvent = event.args;
633
+ var range;
634
+ var save;
635
+ var selectNodeEle;
636
+ var selectParentEle;
637
+ this.deletedVid = [];
638
+ var isCursor;
639
+ var keyCodeValues = [27, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
640
+ 44, 45, 9, 16, 17, 18, 19, 20, 33, 34, 35, 36, 37, 38, 39, 40, 91, 92, 93, 144, 145, 182, 183];
641
+ if (this.parent.editorMode === 'HTML') {
642
+ range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
643
+ isCursor = range.startContainer === range.endContainer && range.startOffset === range.endOffset;
644
+ }
645
+ if (!isCursor && this.parent.editorMode === 'HTML' && keyCodeValues.indexOf(originalEvent.which) < 0) {
646
+ var nodes = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
647
+ for (var i = 0; i < nodes.length; i++) {
648
+ if (nodes[i].nodeName === 'VIDEO' || nodes[i].nodeName === 'IFRAME') {
649
+ this.deletedVid.push(nodes[i]);
650
+ }
651
+ }
652
+ }
653
+ if (this.parent.editorMode === 'HTML' && ((originalEvent.which === 8 && originalEvent.code === 'Backspace') ||
654
+ (originalEvent.which === 46 && originalEvent.code === 'Delete'))) {
655
+ var isCursor_1 = range.startContainer === range.endContainer && range.startOffset === range.endOffset;
656
+ if ((originalEvent.which === 8 && originalEvent.code === 'Backspace' && isCursor_1)) {
657
+ this.checkVideoBack(range);
658
+ }
659
+ else if ((originalEvent.which === 46 && originalEvent.code === 'Delete' && isCursor_1)) {
660
+ this.checkVideoDel(range);
661
+ }
662
+ }
663
+ if (!ej2_base_1.isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) &&
664
+ originalEvent.code !== 'KeyK') {
665
+ range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
666
+ selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
667
+ selectParentEle = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
668
+ if (!originalEvent.ctrlKey && originalEvent.key && (originalEvent.key.length === 1 || originalEvent.action === 'enter') &&
669
+ ((!ej2_base_1.isNullOrUndefined(selectParentEle[0]) && selectParentEle[0].tagName === 'VIDEO' || this.isEmbedVidElem(selectParentEle[0]))) &&
670
+ selectParentEle[0].parentElement) {
671
+ var prev = selectParentEle[0].parentElement;
672
+ if (this.contentModule.getEditPanel().querySelector('.e-vid-resize')) {
673
+ this.removeResizeEle();
674
+ }
675
+ ej2_base_1.removeClass([selectParentEle[0]], classes.CLS_VID_FOCUS);
676
+ if (this.quickToolObj && this.quickToolObj.videoQTBar) {
677
+ this.quickToolObj.videoQTBar.hidePopup();
678
+ }
679
+ }
680
+ }
681
+ if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
682
+ this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
683
+ }
684
+ if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
685
+ if (selectNodeEle && selectNodeEle[0] &&
686
+ ((selectNodeEle[0].nodeName === 'VIDEO' || this.isEmbedVidElem(selectNodeEle[0])) ||
687
+ (originalEvent.keyCode === 46 && selectNodeEle[0].nextSibling &&
688
+ (selectNodeEle[0].nextSibling.className === 'e-video-wrap' || this.isEmbedVidElem(selectNodeEle[0].nextSibling))) ||
689
+ (originalEvent.keyCode === 8 && selectNodeEle[0].previousSibling &&
690
+ (selectNodeEle[0].previousSibling.className === 'e-video-wrap' || this.isEmbedVidElem(selectNodeEle[0].previousSibling)))) &&
691
+ selectNodeEle.length <= 2) {
692
+ if (!ej2_base_1.isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
693
+ save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
694
+ }
695
+ originalEvent.preventDefault();
696
+ var event_1 = {
697
+ selectNode: selectNodeEle, selection: save, selectParent: selectParentEle,
698
+ args: {
699
+ item: { command: 'Videos', subCommand: 'VideoRemove' },
700
+ originalEvent: originalEvent
701
+ }
702
+ };
703
+ this.deleteVideo(event_1, originalEvent.keyCode);
704
+ }
705
+ if (this.parent.contentModule.getEditPanel().querySelector('.e-vid-resize')) {
706
+ this.removeResizeEle();
707
+ }
708
+ }
709
+ if (originalEvent.code === 'Backspace') {
710
+ originalEvent.action = 'backspace';
711
+ }
712
+ switch (originalEvent.action) {
713
+ case 'escape':
714
+ if (!ej2_base_1.isNullOrUndefined(this.dialogObj)) {
715
+ this.dialogObj.close();
716
+ }
717
+ break;
718
+ case 'backspace':
719
+ case 'delete':
720
+ for (var i = 0; i < this.deletedVid.length; i++) {
721
+ var src = this.deletedVid[i].src;
722
+ this.videoRemovePost(src);
723
+ }
724
+ if (this.parent.editorMode !== 'Markdown') {
725
+ if (range.startContainer.nodeType === 3) {
726
+ if (originalEvent.code === 'Backspace') {
727
+ if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
728
+ range.startContainer.previousElementSibling.classList.contains(classes.CLS_VIDEOWRAP)) {
729
+ ej2_base_1.detach(range.startContainer.previousElementSibling);
730
+ }
731
+ }
732
+ else {
733
+ if (range.startContainer.nextElementSibling &&
734
+ range.endContainer.textContent.length === range.endOffset &&
735
+ range.startContainer.nextElementSibling.classList.contains(classes.CLS_VIDEOWRAP)) {
736
+ ej2_base_1.detach(range.startContainer.nextElementSibling);
737
+ }
738
+ }
739
+ }
740
+ else if (range.startContainer.nodeType === 1 && (range.startContainer.classList &&
741
+ range.startContainer.classList.contains(classes.CLS_VIDEOWRAP))) {
742
+ ej2_base_1.detach(range.startContainer);
743
+ }
744
+ else if (range.startContainer.nodeType === 1 &&
745
+ !ej2_base_1.isNullOrUndefined(range.startContainer.querySelector('.e-video-wrap')) && originalEvent.code === 'Delete') {
746
+ ej2_base_1.detach(range.startContainer.querySelector('.e-video-wrap'));
747
+ }
748
+ }
749
+ break;
750
+ case 'insert-video':
751
+ if (!ej2_base_1.isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
752
+ save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
753
+ }
754
+ this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
755
+ originalEvent.preventDefault();
756
+ break;
757
+ }
758
+ if (originalEvent.ctrlKey && originalEvent.key === 'a') {
759
+ this.handleSelectAll();
760
+ }
761
+ };
762
+ Video.prototype.handleSelectAll = function () {
763
+ this.cancelResizeAction();
764
+ var videoFocusNodes = this.parent.inputElement.querySelectorAll('.' + classes.CLS_VID_FOCUS);
765
+ ej2_base_1.removeClass(videoFocusNodes, classes.CLS_VID_FOCUS);
766
+ };
767
+ Video.prototype.openDialog = function (isInternal, event, selection, ele, parentEle) {
768
+ var range;
769
+ var save;
770
+ var selectNodeEle;
771
+ var selectParentEle;
772
+ if (!isInternal && !ej2_base_1.isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
773
+ range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
774
+ save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
775
+ selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
776
+ selectParentEle = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
777
+ }
778
+ else {
779
+ save = selection;
780
+ selectNodeEle = ele;
781
+ selectParentEle = parentEle;
782
+ }
783
+ if (this.parent.editorMode === 'HTML') {
784
+ this.insertVideo({
785
+ args: {
786
+ item: { command: 'Videos', subCommand: 'Video' },
787
+ originalEvent: event,
788
+ name: !isInternal ? 'showDialog' : null
789
+ },
790
+ selectNode: selectNodeEle,
791
+ selection: save,
792
+ selectParent: selectParentEle
793
+ });
794
+ }
795
+ };
796
+ Video.prototype.showDialog = function (args) {
797
+ if (!ej2_base_1.isNullOrUndefined(args.originalEvent)) {
798
+ this.openDialog(false, args.originalEvent);
799
+ }
800
+ else {
801
+ this.openDialog(false);
802
+ }
803
+ };
804
+ Video.prototype.closeDialog = function () {
805
+ if (this.dialogObj) {
806
+ this.dialogObj.hide({ returnValue: true });
807
+ }
808
+ };
809
+ Video.prototype.checkVideoBack = function (range) {
810
+ if (range.startContainer.nodeName === '#text' && range.startOffset === 0 &&
811
+ !ej2_base_1.isNullOrUndefined(range.startContainer.previousSibling) && (range.startContainer.previousSibling.nodeName === 'VIDEO' ||
812
+ this.isEmbedVidElem(range.startContainer.previousSibling))) {
813
+ this.deletedVid.push(range.startContainer.previousSibling);
814
+ }
815
+ else if (range.startContainer.nodeName !== '#text' && !ej2_base_1.isNullOrUndefined(range.startContainer.childNodes[range.startOffset - 1]) &&
816
+ (range.startContainer.childNodes[range.startOffset - 1].nodeName === 'VIDEO' ||
817
+ this.isEmbedVidElem(range.startContainer.childNodes[range.startOffset - 1]))) {
818
+ this.deletedVid.push(range.startContainer.childNodes[range.startOffset - 1]);
819
+ }
820
+ };
821
+ Video.prototype.checkVideoDel = function (range) {
822
+ if (range.startContainer.nodeName === '#text' && range.startOffset === range.startContainer.textContent.length &&
823
+ !ej2_base_1.isNullOrUndefined(range.startContainer.nextSibling) && (range.startContainer.nextSibling.nodeName === 'VIDEO' ||
824
+ this.isEmbedVidElem(range.startContainer.nextSibling))) {
825
+ this.deletedVid.push(range.startContainer.nextSibling);
826
+ }
827
+ else if (range.startContainer.nodeName !== '#text' && !ej2_base_1.isNullOrUndefined(range.startContainer.childNodes[range.startOffset]) &&
828
+ (range.startContainer.childNodes[range.startOffset].nodeName === 'VIDEO' ||
829
+ this.isEmbedVidElem(range.startContainer.childNodes[range.startOffset]))) {
830
+ this.deletedVid.push(range.startContainer.childNodes[range.startOffset]);
831
+ }
832
+ };
833
+ Video.prototype.alignmentSelect = function (e) {
834
+ var item = e.item;
835
+ if (!document.body.contains(document.body.querySelector('.e-rte-quick-toolbar')) || item.command !== 'Videos') {
836
+ return;
837
+ }
838
+ var range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
839
+ var selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
840
+ selectNodeEle = (selectNodeEle[0].nodeName === 'VIDEO') ? selectNodeEle : [this.videoEle];
841
+ var args = { args: e, selectNode: selectNodeEle };
842
+ if (this.parent.formatter.getUndoRedoStack().length === 0) {
843
+ this.parent.formatter.saveData();
844
+ }
845
+ switch (item.subCommand) {
846
+ case 'JustifyLeft':
847
+ case 'JustifyCenter':
848
+ case 'JustifyRight':
849
+ this.alignVideo(args, item.subCommand);
850
+ break;
851
+ case 'Inline':
852
+ this.inline(args);
853
+ break;
854
+ case 'Break':
855
+ this.break(args);
856
+ break;
857
+ }
858
+ if (this.quickToolObj && document.body.contains(this.quickToolObj.videoQTBar.element)) {
859
+ this.quickToolObj.videoQTBar.hidePopup();
860
+ ej2_base_1.removeClass([selectNodeEle[0]], classes.CLS_VID_FOCUS);
861
+ }
862
+ this.cancelResizeAction();
863
+ };
864
+ Video.prototype.deleteVideo = function (e, keyCode) {
865
+ if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
866
+ return;
867
+ }
868
+ if (this.isEmbedVidElem(e.selectNode[0])) {
869
+ e.selectNode[0] = e.selectNode[0].classList.contains(classes.CLS_VID_CLICK_ELEM) ? e.selectNode[0] :
870
+ e.selectNode[0].parentElement;
871
+ }
872
+ var args = {
873
+ element: !this.isEmbedVidElem(e.selectNode[0]) ? e.selectNode[0].querySelector('iframe') :
874
+ e.selectNode[0],
875
+ src: !this.isEmbedVidElem(e.selectNode[0]) ? e.selectNode[0].querySelector('source').getAttribute('src') :
876
+ e.selectNode[0].querySelector('iframe').getAttribute('src')
877
+ };
878
+ if (this.parent.formatter.getUndoRedoStack().length === 0) {
879
+ this.parent.formatter.saveData();
880
+ }
881
+ e.selection.restore();
882
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
883
+ selectNode: e.selectNode,
884
+ subCommand: e.args.item.subCommand
885
+ });
886
+ this.videoRemovePost(args.src);
887
+ if (this.quickToolObj && document.body.contains(this.quickToolObj.videoQTBar.element)) {
888
+ this.quickToolObj.videoQTBar.hidePopup();
889
+ }
890
+ this.cancelResizeAction();
891
+ if (ej2_base_1.isNullOrUndefined(keyCode)) {
892
+ this.parent.trigger(events.afterMediaDelete, args);
893
+ }
894
+ };
895
+ Video.prototype.videoRemovePost = function (src) {
896
+ var proxy = this;
897
+ var absoluteUrl = '';
898
+ if (ej2_base_1.isNullOrUndefined(this.parent.insertVideoSettings.removeUrl) || this.parent.insertVideoSettings.removeUrl === '') {
899
+ return;
900
+ }
901
+ if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
902
+ absoluteUrl = src;
903
+ }
904
+ else {
905
+ absoluteUrl = new URL(src, document.baseURI).href;
906
+ }
907
+ this.removingVideoName = absoluteUrl.replace(/^.*[\\\/]/, '');
908
+ var xhr = new XMLHttpRequest();
909
+ xhr.addEventListener('readystatechange', function () {
910
+ if (this.readyState === 4 && this.status === 200) {
911
+ proxy.triggerPost(this.response);
912
+ }
913
+ });
914
+ xhr.open('GET', absoluteUrl);
915
+ xhr.responseType = 'blob';
916
+ xhr.send();
917
+ };
918
+ Video.prototype.triggerPost = function (response) {
919
+ var removeUrl = this.parent.insertVideoSettings.removeUrl;
920
+ if (ej2_base_1.isNullOrUndefined(removeUrl) || removeUrl === '') {
921
+ return;
922
+ }
923
+ var file = new File([response], this.removingVideoName);
924
+ var ajax = new ej2_base_1.Ajax(removeUrl, 'POST', true, null);
925
+ var formData = new FormData();
926
+ formData.append('UploadFiles', file);
927
+ ajax.send(formData);
928
+ };
929
+ Video.prototype.onDocumentClick = function (e) {
930
+ var target = e.target;
931
+ if (ej2_base_1.isNullOrUndefined(this.contentModule.getEditPanel())) {
932
+ return;
933
+ }
934
+ if (target.nodeName === 'VIDEO' || this.isEmbedVidElem(target)) {
935
+ this.videoEle = !this.isEmbedVidElem(target) ? target : target.querySelector('iframe');
936
+ }
937
+ if (!ej2_base_1.isNullOrUndefined(this.dialogObj) && ((!ej2_base_1.closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
938
+ !this.parent.getToolbarElement().contains(e.target)) ||
939
+ (this.parent.getToolbarElement() && this.parent.getToolbarElement().contains(e.target) &&
940
+ !ej2_base_1.closest(target, '#' + this.parent.getID() + '_toolbar_Video') &&
941
+ !target.querySelector('#' + this.parent.getID() + '_toolbar_Video')))) {
942
+ if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
943
+ }
944
+ else {
945
+ this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
946
+ this.dialogObj.hide({ returnValue: true });
947
+ this.parent.isBlur = true;
948
+ util_2.dispatchEvent(this.parent.element, 'focusout');
949
+ }
950
+ }
951
+ if (this.contentModule.getEditPanel().querySelector('.e-vid-resize')) {
952
+ if (target.tagName !== 'VIDEO' && !this.isEmbedVidElem(target)) {
953
+ this.removeResizeEle();
954
+ }
955
+ if ((target.tagName !== 'VIDEO' && !this.isEmbedVidElem(target)) && !ej2_base_1.isNullOrUndefined(this.videoEle)) {
956
+ this.videoEle.style.outline = '';
957
+ }
958
+ else if (!ej2_base_1.isNullOrUndefined(this.prevSelectedVidEle) &&
959
+ this.prevSelectedVidEle !== ((target.tagName === 'IFRAME' || target.tagName === 'VIDEO') ? target : target.querySelector('iframe'))) {
960
+ this.prevSelectedVidEle.style.outline = '';
961
+ }
962
+ }
963
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !ej2_base_1.closest(target, '#' + this.dialogObj.element.id)) {
964
+ this.dialogObj.hide();
965
+ }
966
+ };
967
+ Video.prototype.removeResizeEle = function () {
968
+ this.isResizeBind = true;
969
+ ej2_base_1.EventHandler.remove(this.contentModule.getDocument(), ej2_base_1.Browser.touchMoveEvent, this.resizing);
970
+ ej2_base_1.EventHandler.remove(this.contentModule.getDocument(), ej2_base_1.Browser.touchEndEvent, this.resizeEnd);
971
+ ej2_base_1.detach(this.contentModule.getEditPanel().querySelector('.e-vid-resize'));
972
+ };
973
+ Video.prototype.onWindowResize = function () {
974
+ if (!ej2_base_1.isNullOrUndefined(this.contentModule) && !ej2_base_1.isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.e-vid-resize'))) {
975
+ this.cancelResizeAction();
976
+ }
977
+ };
978
+ Video.prototype.break = function (e) {
979
+ if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
980
+ return;
981
+ }
982
+ var subCommand = (e.args.item) ?
983
+ e.args.item.subCommand : 'Break';
984
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
985
+ };
986
+ Video.prototype.inline = function (e) {
987
+ if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
988
+ return;
989
+ }
990
+ var subCommand = (e.args.item) ?
991
+ e.args.item.subCommand : 'Inline';
992
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
993
+ };
994
+ Video.prototype.alignVideo = function (e, type) {
995
+ var subCommand = (e.args.item) ?
996
+ e.args.item.subCommand : type;
997
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
998
+ };
999
+ Video.prototype.editAreaClickHandler = function (e) {
1000
+ if (this.parent.readonly) {
1001
+ this.hideVideoQuickToolbar();
1002
+ return;
1003
+ }
1004
+ var args = e.args;
1005
+ var showOnRightClick = this.parent.quickToolbarSettings.showOnRightClick;
1006
+ if (args.which === 2 || (showOnRightClick && args.which === 1) || (!showOnRightClick && args.which === 3)) {
1007
+ if ((showOnRightClick && args.which === 1) && !ej2_base_1.isNullOrUndefined(args.target) &&
1008
+ (args.target.tagName === 'VIDEO' || this.isEmbedVidElem(args.target))) {
1009
+ this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
1010
+ this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), args.target);
1011
+ }
1012
+ return;
1013
+ }
1014
+ if (this.parent.editorMode === 'HTML' && this.parent.quickToolbarModule && this.parent.quickToolbarModule.videoQTBar) {
1015
+ this.quickToolObj = this.parent.quickToolbarModule;
1016
+ var target = args.target;
1017
+ this.contentModule = this.rendererFactory.getRenderer(enum_1.RenderType.Content);
1018
+ var isPopupOpen = this.quickToolObj.videoQTBar.element.classList.contains('e-rte-pop');
1019
+ if ((target.nodeName === 'VIDEO' || this.isEmbedVidElem(target)) && this.parent.quickToolbarModule) {
1020
+ if (isPopupOpen) {
1021
+ return;
1022
+ }
1023
+ this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
1024
+ this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), target);
1025
+ if (util_1.isIDevice()) {
1026
+ this.parent.notify(events.selectionSave, e);
1027
+ }
1028
+ ej2_base_1.addClass([!this.isEmbedVidElem(target) ? target : target.querySelector('iframe')], classes.CLS_VID_FOCUS);
1029
+ this.showVideoQuickToolbar({ args: args, type: 'Videos', elements: [args.target] });
1030
+ }
1031
+ else {
1032
+ this.hideVideoQuickToolbar();
1033
+ }
1034
+ }
1035
+ };
1036
+ Video.prototype.showVideoQuickToolbar = function (e) {
1037
+ var _this = this;
1038
+ if (e.type !== 'Videos' || (!ej2_base_1.isNullOrUndefined(e.args) && e.args.detail === 2) || ej2_base_1.isNullOrUndefined(this.parent.quickToolbarModule)
1039
+ || ej2_base_1.isNullOrUndefined(this.parent.quickToolbarModule.videoQTBar) || ej2_base_1.isNullOrUndefined(e.args)) {
1040
+ return;
1041
+ }
1042
+ this.quickToolObj = this.parent.quickToolbarModule;
1043
+ var args = e.args;
1044
+ var target = e.elements;
1045
+ [].forEach.call(e.elements, function (element, index) {
1046
+ if (index === 0) {
1047
+ target = element;
1048
+ }
1049
+ });
1050
+ if (target.tagName === 'VIDEO' || this.isEmbedVidElem(target)) {
1051
+ ej2_base_1.addClass([(!this.isEmbedVidElem(target) || target.tagName === 'IFRAME') ? target : target.querySelector('iframe')], [classes.CLS_VID_FOCUS]);
1052
+ }
1053
+ var pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
1054
+ this.parent.element.getBoundingClientRect().top + args.clientY : args.pageY;
1055
+ if (this.parent.quickToolbarModule.videoQTBar) {
1056
+ if (e.isNotify) {
1057
+ this.showPopupTime = setTimeout(function () {
1058
+ _this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
1059
+ _this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
1060
+ _this.quickToolObj.videoQTBar.showPopup(args.pageX - 50, pageY + (target.getBoundingClientRect().height / 2) - target.offsetTop, target);
1061
+ if (_this.parent.insertVideoSettings.resize === true) {
1062
+ _this.resizeStart(e.args, target);
1063
+ }
1064
+ }, 400);
1065
+ }
1066
+ else {
1067
+ this.quickToolObj.videoQTBar.showPopup(args.pageX - 50, pageY + (target.getBoundingClientRect().height / 2) - target.offsetTop, target);
1068
+ }
1069
+ }
1070
+ };
1071
+ Video.prototype.hideVideoQuickToolbar = function () {
1072
+ if (!ej2_base_1.isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.' + classes.CLS_VID_FOCUS))) {
1073
+ ej2_base_1.removeClass([this.contentModule.getEditPanel().querySelector('.' + classes.CLS_VID_FOCUS)], classes.CLS_VID_FOCUS);
1074
+ if (!ej2_base_1.isNullOrUndefined(this.videoEle)) {
1075
+ this.videoEle.style.outline = '';
1076
+ }
1077
+ if (!ej2_base_1.isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.e-vid-resize'))) {
1078
+ ej2_base_1.detach(this.contentModule.getEditPanel().querySelector('.e-vid-resize'));
1079
+ }
1080
+ if (this.quickToolObj && this.quickToolObj.videoQTBar && document.body.contains(this.quickToolObj.videoQTBar.element)) {
1081
+ this.quickToolObj.videoQTBar.hidePopup();
1082
+ }
1083
+ }
1084
+ };
1085
+ Video.prototype.isEmbedVidElem = function (target) {
1086
+ if ((target && target.nodeType !== 3 && target.nodeName !== 'BR' && (target.classList && (target.classList.contains(classes.CLS_VIDEOWRAP) || target.classList.contains(classes.CLS_VID_CLICK_ELEM) ||
1087
+ target.classList.contains('e-embed-video-wrap')))) || (target && target.nodeName === 'IFRAME')) {
1088
+ return true;
1089
+ }
1090
+ else {
1091
+ return false;
1092
+ }
1093
+ };
1094
+ Video.prototype.insertingVideo = function (e) {
1095
+ this.insertVideo(e);
1096
+ if (!ej2_base_1.isNullOrUndefined(this.dialogObj)) {
1097
+ this.dialogObj.element.style.maxHeight = 'inherit';
1098
+ var dialogContent = this.dialogObj.element.querySelector('.e-video-content');
1099
+ if (!ej2_base_1.isNullOrUndefined(this.parent.insertVideoSettings.path) || this.parent.editorMode === 'HTML') {
1100
+ document.getElementById(this.rteID + '_insertVideo').focus();
1101
+ }
1102
+ else {
1103
+ dialogContent.querySelector('.e-video-url').focus();
1104
+ }
1105
+ }
1106
+ };
1107
+ Video.prototype.insertVideo = function (e) {
1108
+ var _this = this;
1109
+ if (this.dialogObj) {
1110
+ this.dialogObj.hide({ returnValue: true });
1111
+ return;
1112
+ }
1113
+ var videoDialog = this.parent.createElement('div', { className: 'e-rte-video-dialog', id: this.rteID + '_video' });
1114
+ this.parent.rootContainer.appendChild(videoDialog);
1115
+ var videoInsert = this.i10n.getConstant('dialogInsert');
1116
+ var videolinkCancel = this.i10n.getConstant('dialogCancel');
1117
+ var videoHeader = this.i10n.getConstant('videoHeader');
1118
+ var selection = e.selection;
1119
+ var selectObj = { selfVideo: this, selection: e.selection, args: e.args, selectParent: e.selectParent };
1120
+ var dialogModel = {
1121
+ header: videoHeader,
1122
+ cssClass: classes.CLS_RTE_ELEMENTS,
1123
+ enableRtl: this.parent.enableRtl,
1124
+ locale: this.parent.locale,
1125
+ showCloseIcon: true, closeOnEscape: true, width: (ej2_base_1.Browser.isDevice) ? '290px' : '340px',
1126
+ isModal: ej2_base_1.Browser.isDevice,
1127
+ buttons: [{
1128
+ click: this.insertVideoUrl.bind(selectObj),
1129
+ buttonModel: { content: videoInsert, cssClass: 'e-flat e-insertVideo', isPrimary: true, disabled: true }
1130
+ },
1131
+ {
1132
+ click: function (e) {
1133
+ _this.cancelDialog(e);
1134
+ },
1135
+ buttonModel: { cssClass: 'e-flat e-cancel', content: videolinkCancel }
1136
+ }],
1137
+ target: (ej2_base_1.Browser.isDevice) ? document.body : this.parent.element,
1138
+ animationSettings: { effect: 'None' },
1139
+ close: function (event) {
1140
+ if (_this.isVideoUploaded) {
1141
+ if (_this.dialogObj.element.querySelector('.e-file-abort-btn')) {
1142
+ _this.dialogObj.element.querySelector('.e-file-abort-btn').click();
1143
+ }
1144
+ else {
1145
+ _this.uploadObj.remove();
1146
+ }
1147
+ }
1148
+ _this.parent.isBlur = false;
1149
+ if (event && !ej2_base_1.isNullOrUndefined(event.event) && event.event.returnValue) {
1150
+ if (_this.parent.editorMode === 'HTML') {
1151
+ selection.restore();
1152
+ }
1153
+ }
1154
+ _this.clearDialogObj();
1155
+ _this.dialogRenderObj.close(event);
1156
+ }
1157
+ };
1158
+ var dialogContent = this.parent.createElement('div', { className: 'e-video-content' });
1159
+ if (!ej2_base_1.isNullOrUndefined(this.parent.insertVideoSettings.path) || this.parent.editorMode === 'HTML') {
1160
+ dialogContent.appendChild(this.videoUpload(e));
1161
+ }
1162
+ var linkHeader = this.parent.createElement('div', { className: 'e-videoheader' });
1163
+ var embedLinkHeader = this.parent.createElement('div', { className: 'e-embed-videoheader' });
1164
+ var linkHeaderText = this.i10n.getConstant('videoLinkHeader');
1165
+ var embedLinkHeaderText = this.i10n.getConstant('embedVideoLinkHeader');
1166
+ if (this.parent.editorMode === 'HTML') {
1167
+ linkHeader.innerHTML = linkHeaderText;
1168
+ embedLinkHeader.innerHTML = embedLinkHeaderText;
1169
+ }
1170
+ dialogContent.appendChild(this.urlPopup(e));
1171
+ if (e.selectNode && e.selectNode[0].nodeType === 1 && (e.selectNode[0].tagName === 'VIDEO' || this.isEmbedVidElem(e.selectNode[0]))) {
1172
+ dialogModel.header = this.parent.localeObj.getConstant('editVideoHeader');
1173
+ dialogModel.content = dialogContent;
1174
+ }
1175
+ else {
1176
+ dialogModel.content = dialogContent;
1177
+ }
1178
+ this.dialogObj = this.dialogRenderObj.render(dialogModel);
1179
+ this.dialogObj.createElement = this.parent.createElement;
1180
+ this.dialogObj.appendTo(videoDialog);
1181
+ if (e.selectNode && e.selectNode[0].nodeType === 1 && (e.selectNode[0].tagName === 'VIDEO' || this.isEmbedVidElem(e.selectNode[0]))
1182
+ && (e.name === 'insertVideo')) {
1183
+ this.dialogObj.element.querySelector('.e-insertVideo').textContent = this.parent.localeObj.getConstant('dialogUpdate');
1184
+ }
1185
+ videoDialog.style.maxHeight = 'inherit';
1186
+ if (this.quickToolObj) {
1187
+ if (this.quickToolObj.videoQTBar && document.body.contains(this.quickToolObj.videoQTBar.element)) {
1188
+ this.quickToolObj.videoQTBar.hidePopup();
1189
+ if (!ej2_base_1.isNullOrUndefined(e.selectParent)) {
1190
+ ej2_base_1.removeClass([e.selectParent[0]], classes.CLS_VID_FOCUS);
1191
+ }
1192
+ }
1193
+ if (this.quickToolObj.inlineQTBar && document.body.contains(this.quickToolObj.inlineQTBar.element)) {
1194
+ this.quickToolObj.inlineQTBar.hidePopup();
1195
+ }
1196
+ if (this.quickToolObj.textQTBar && this.parent.element.ownerDocument.body.contains(this.quickToolObj.textQTBar.element)) {
1197
+ this.quickToolObj.textQTBar.hidePopup();
1198
+ }
1199
+ }
1200
+ };
1201
+ Video.prototype.urlPopup = function (e) {
1202
+ var _this = this;
1203
+ var videoUrl = this.parent.createElement('div', { className: 'e-video-url-wrap' });
1204
+ var urlContent = this.parent.createElement('div', { id: 'urlcontent' });
1205
+ var placeUrl = this.i10n.getConstant('videoUrl');
1206
+ var content = '<input id="embedURL" type="radio">' + '<input id="webURL" type="radio" >';
1207
+ var contentElem = util_2.parseHtml(content);
1208
+ videoUrl.appendChild(contentElem);
1209
+ videoUrl.appendChild(urlContent);
1210
+ this.embedInputUrl = this.parent.createElement('textarea', {
1211
+ className: 'e-input e-embed-video-url',
1212
+ attrs: { placeholder: this.i10n.getConstant('pasteEmbeddedCodeHere'), type: 'text', tabindex: '-1', 'aria-label': this.i10n.getConstant('embedVideoLinkHeader') }
1213
+ });
1214
+ this.embedInputUrl.addEventListener('input', function () {
1215
+ if (!ej2_base_1.isNullOrUndefined(_this.embedInputUrl)) {
1216
+ if (_this.embedInputUrl.value.length === 0) {
1217
+ _this.dialogObj.getButtons(0).element.disabled = true;
1218
+ }
1219
+ else {
1220
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1221
+ }
1222
+ }
1223
+ });
1224
+ this.inputUrl = this.parent.createElement('input', {
1225
+ className: 'e-input e-video-url',
1226
+ attrs: { placeholder: placeUrl, spellcheck: 'false' }
1227
+ });
1228
+ this.inputUrl.addEventListener('input', function () {
1229
+ if (!ej2_base_1.isNullOrUndefined(_this.inputUrl)) {
1230
+ if (_this.inputUrl.value.length === 0) {
1231
+ _this.dialogObj.getButtons(0).element.disabled = true;
1232
+ }
1233
+ else {
1234
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1235
+ }
1236
+ }
1237
+ });
1238
+ if (e.selectNode && e.selectNode[0] && (e.selectNode[0].nodeName === 'VIDEO' || this.isEmbedVidElem(e.selectNode[0]))) {
1239
+ if (e.selectNode[0].nodeName === 'VIDEO' || e.selectNode[0].classList.contains('e-video-wrap')) {
1240
+ var regex = new RegExp(/([^\S]|^)(((https?:\/\/)|(www\.))(\S+))/gi);
1241
+ var sourceElement = e.selectNode[0].querySelector('source');
1242
+ this.inputUrl.value = sourceElement && sourceElement.src && sourceElement.src.match(regex) ? sourceElement.src : '';
1243
+ }
1244
+ else {
1245
+ this.embedInputUrl.value = e.selectNode[0].nodeName === 'IFRAME' ? e.selectNode[0].outerHTML
1246
+ : e.selectNode[0].querySelector('iframe').outerHTML;
1247
+ }
1248
+ }
1249
+ var isWebUrl = this.inputUrl.value ? true : false;
1250
+ this.embedUrlBtn = new ej2_buttons_1.RadioButton({
1251
+ label: this.i10n.getConstant('embeddedCode'),
1252
+ checked: !isWebUrl,
1253
+ name: 'URL',
1254
+ created: function () {
1255
+ if (!isWebUrl) {
1256
+ urlContent.appendChild(_this.embedInputUrl);
1257
+ }
1258
+ },
1259
+ change: function () {
1260
+ urlContent.innerHTML = '';
1261
+ urlContent.appendChild(_this.embedInputUrl);
1262
+ }
1263
+ });
1264
+ this.embedUrlBtn.appendTo(videoUrl.querySelector('#embedURL'));
1265
+ this.webUrlBtn = new ej2_buttons_1.RadioButton({
1266
+ label: this.i10n.getConstant('webUrl'),
1267
+ checked: isWebUrl,
1268
+ name: 'URL',
1269
+ created: function () {
1270
+ if (isWebUrl) {
1271
+ urlContent.appendChild(_this.inputUrl);
1272
+ }
1273
+ },
1274
+ change: function () {
1275
+ urlContent.innerHTML = '';
1276
+ urlContent.appendChild(_this.inputUrl);
1277
+ }
1278
+ });
1279
+ this.webUrlBtn.appendTo(videoUrl.querySelector('#webURL'));
1280
+ return videoUrl;
1281
+ };
1282
+ Video.prototype.videoUpload = function (e) {
1283
+ var _this = this;
1284
+ var save;
1285
+ var selectParent;
1286
+ var proxy = this;
1287
+ var iframe = proxy.parent.iframeSettings.enable;
1288
+ if (proxy.parent.editorMode === 'HTML' && (!iframe && ej2_base_1.isNullOrUndefined(ej2_base_1.closest(e.selection.range.startContainer.parentNode, '[id='
1289
+ + "'" + this.parent.contentModule.getPanel().id + "'" + ']'))
1290
+ || (iframe && !util_2.hasClass(e.selection.range.startContainer.parentNode.ownerDocument.querySelector('body'), 'e-lib')))) {
1291
+ this.contentModule.getEditPanel().focus();
1292
+ var range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
1293
+ save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
1294
+ selectParent = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
1295
+ }
1296
+ else {
1297
+ save = e.selection;
1298
+ selectParent = e.selectParent;
1299
+ }
1300
+ var uploadParentEle = this.parent.createElement('div', { className: 'e-vid-uploadwrap e-droparea' });
1301
+ var deviceVideoUpMsg = this.i10n.getConstant('videoDeviceUploadMessage');
1302
+ var videoUpMsg = this.i10n.getConstant('videoUploadMessage');
1303
+ var span = this.parent.createElement('span', { className: 'e-droptext' });
1304
+ var spanMsg = this.parent.createElement('span', {
1305
+ className: 'e-rte-upload-text', innerHTML: ((ej2_base_1.Browser.isDevice) ? deviceVideoUpMsg : videoUpMsg)
1306
+ });
1307
+ span.appendChild(spanMsg);
1308
+ var btnEle = this.parent.createElement('button', {
1309
+ className: 'e-browsebtn', id: this.rteID + '_insertVideo', attrs: { autofocus: 'true', type: 'button' }
1310
+ });
1311
+ span.appendChild(btnEle);
1312
+ uploadParentEle.appendChild(span);
1313
+ var browserMsg = this.i10n.getConstant('browse');
1314
+ this.button = new ej2_buttons_1.Button({ content: browserMsg, enableRtl: this.parent.enableRtl });
1315
+ this.button.isStringTemplate = true;
1316
+ this.button.createElement = this.parent.createElement;
1317
+ this.button.appendTo(btnEle);
1318
+ var btnClick = (ej2_base_1.Browser.isDevice) ? span : btnEle;
1319
+ ej2_base_1.EventHandler.add(btnClick, 'click', this.fileSelect, this);
1320
+ var uploadEle = this.parent.createElement('input', {
1321
+ id: this.rteID + '_upload', attrs: { type: 'File', name: 'UploadFiles' }
1322
+ });
1323
+ uploadParentEle.appendChild(uploadEle);
1324
+ var fileName;
1325
+ var selectArgs;
1326
+ var filesData;
1327
+ this.uploadObj = new ej2_inputs_1.Uploader({
1328
+ asyncSettings: { saveUrl: this.parent.insertVideoSettings.saveUrl, removeUrl: this.parent.insertVideoSettings.removeUrl },
1329
+ dropArea: span, multiple: false, enableRtl: this.parent.enableRtl,
1330
+ allowedExtensions: this.parent.insertVideoSettings.allowedTypes.toString(),
1331
+ selected: function (e) {
1332
+ proxy.isVideoUploaded = true;
1333
+ selectArgs = e;
1334
+ filesData = e.filesData;
1335
+ _this.parent.trigger(events.fileSelected, selectArgs, function (selectArgs) {
1336
+ if (!selectArgs.cancel) {
1337
+ if (ej2_base_1.isNullOrUndefined(selectArgs.filesData[0])) {
1338
+ return;
1339
+ }
1340
+ _this.checkExtension(selectArgs.filesData[0]);
1341
+ fileName = selectArgs.filesData[0].name;
1342
+ if (_this.parent.editorMode === 'HTML' && ej2_base_1.isNullOrUndefined(_this.parent.insertVideoSettings.path)) {
1343
+ var reader_1 = new FileReader();
1344
+ reader_1.addEventListener('load', function (e) {
1345
+ var url = _this.parent.insertVideoSettings.saveFormat === 'Base64' ? reader_1.result :
1346
+ URL.createObjectURL(util_2.convertToBlob(reader_1.result));
1347
+ proxy.uploadUrl = {
1348
+ url: url, selection: save, fileName: fileName,
1349
+ selectParent: selectParent
1350
+ };
1351
+ proxy.inputUrl.setAttribute('disabled', 'true');
1352
+ proxy.embedInputUrl.setAttribute('disabled', 'true');
1353
+ if (ej2_base_1.isNullOrUndefined(proxy.parent.insertVideoSettings.saveUrl) && _this.isAllowedTypes
1354
+ && !ej2_base_1.isNullOrUndefined(_this.dialogObj)) {
1355
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1356
+ }
1357
+ });
1358
+ reader_1.readAsDataURL(selectArgs.filesData[0].rawFile);
1359
+ }
1360
+ }
1361
+ });
1362
+ },
1363
+ beforeUpload: function (args) {
1364
+ _this.parent.trigger(events.beforeFileUpload, args);
1365
+ },
1366
+ uploading: function (e) {
1367
+ if (!_this.parent.isServerRendered) {
1368
+ _this.parent.trigger(events.fileUploading, e);
1369
+ }
1370
+ },
1371
+ success: function (e) {
1372
+ _this.parent.trigger(events.fileUploadSuccess, e, function (e) {
1373
+ if (!ej2_base_1.isNullOrUndefined(_this.parent.insertVideoSettings.path)) {
1374
+ var url = _this.parent.insertVideoSettings.path + e.file.name;
1375
+ var value = { url: url, selection: save };
1376
+ proxy.uploadUrl = {
1377
+ url: url, selection: save, fileName: fileName, selectParent: selectParent,
1378
+ width: {
1379
+ width: proxy.parent.insertVideoSettings.width, minWidth: proxy.parent.insertVideoSettings.minWidth,
1380
+ maxWidth: proxy.parent.getInsertImgMaxWidth()
1381
+ },
1382
+ height: {
1383
+ height: proxy.parent.insertVideoSettings.height, minHeight: proxy.parent.insertVideoSettings.minHeight,
1384
+ maxHeight: proxy.parent.insertVideoSettings.maxHeight
1385
+ }
1386
+ };
1387
+ proxy.embedInputUrl.setAttribute('disabled', 'true');
1388
+ }
1389
+ if (e.operation === 'upload' && !ej2_base_1.isNullOrUndefined(_this.dialogObj)) {
1390
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1391
+ }
1392
+ });
1393
+ },
1394
+ failure: function (e) {
1395
+ _this.parent.trigger(events.fileUploadFailed, e);
1396
+ },
1397
+ removing: function () {
1398
+ _this.parent.trigger(events.fileRemoving, e, function (e) {
1399
+ proxy.isVideoUploaded = false;
1400
+ _this.dialogObj.getButtons(0).element.disabled = true;
1401
+ if (proxy.inputUrl.getAttribute('disabled')) {
1402
+ proxy.inputUrl.removeAttribute('disabled');
1403
+ }
1404
+ if (proxy.embedInputUrl.getAttribute('disabled')) {
1405
+ proxy.embedInputUrl.removeAttribute('disabled');
1406
+ }
1407
+ if (proxy.uploadUrl) {
1408
+ proxy.uploadUrl.url = '';
1409
+ }
1410
+ });
1411
+ }
1412
+ });
1413
+ this.uploadObj.isStringTemplate = true;
1414
+ this.uploadObj.createElement = this.parent.createElement;
1415
+ this.uploadObj.appendTo(uploadEle);
1416
+ return uploadParentEle;
1417
+ };
1418
+ Video.prototype.checkExtension = function (e) {
1419
+ if (this.uploadObj.allowedExtensions) {
1420
+ if (this.uploadObj.allowedExtensions.toLocaleLowerCase().indexOf(('.' + e.type).toLocaleLowerCase()) === -1) {
1421
+ this.dialogObj.getButtons(0).element.setAttribute('disabled', 'disabled');
1422
+ this.isAllowedTypes = false;
1423
+ }
1424
+ else {
1425
+ this.isAllowedTypes = true;
1426
+ }
1427
+ }
1428
+ };
1429
+ Video.prototype.fileSelect = function () {
1430
+ this.dialogObj.element.getElementsByClassName('e-file-select-wrap')[0].querySelector('button').click();
1431
+ return false;
1432
+ };
1433
+ Video.prototype.cancelDialog = function (e) {
1434
+ this.parent.isBlur = false;
1435
+ this.dialogObj.hide({ returnValue: true });
1436
+ if (this.isVideoUploaded) {
1437
+ this.uploadObj.removing();
1438
+ }
1439
+ };
1440
+ Video.prototype.insertVideoUrl = function (e) {
1441
+ var proxy = this.selfVideo;
1442
+ proxy.isVideoUploaded = false;
1443
+ var url = proxy.inputUrl.value;
1444
+ var embedUrl = proxy.embedInputUrl.value;
1445
+ if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
1446
+ proxy.parent.formatter.saveData();
1447
+ }
1448
+ if (!ej2_base_1.isNullOrUndefined(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
1449
+ proxy.uploadUrl.cssClass = (proxy.parent.insertVideoSettings.layoutOption === 'Inline' ?
1450
+ classes.CLS_VIDEOINLINE : classes.CLS_VIDEOBREAK);
1451
+ proxy.uploadUrl.width = {
1452
+ width: proxy.parent.insertVideoSettings.width, minWidth: proxy.parent.insertVideoSettings.minWidth,
1453
+ maxWidth: proxy.parent.getInsertImgMaxWidth()
1454
+ };
1455
+ proxy.uploadUrl.height = {
1456
+ height: proxy.parent.insertVideoSettings.height, minHeight: proxy.parent.insertVideoSettings.minHeight,
1457
+ maxHeight: proxy.parent.insertVideoSettings.maxHeight
1458
+ };
1459
+ proxy.dialogObj.hide({ returnValue: false });
1460
+ if (proxy.dialogObj !== null) {
1461
+ return;
1462
+ }
1463
+ proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, proxy.uploadUrl);
1464
+ proxy.uploadUrl.url = '';
1465
+ }
1466
+ else if (proxy.parent.editorMode === 'HTML' && (url !== '' || embedUrl !== '')) {
1467
+ var webUrlBtn = document.getElementById('webURL');
1468
+ var name_1 = webUrlBtn.checked ? url.split('/')[url.split('/').length - 1] : embedUrl;
1469
+ var value = {
1470
+ cssClass: (proxy.parent.insertVideoSettings.layoutOption === 'Inline' ? classes.CLS_VIDEOINLINE : classes.CLS_VIDEOBREAK),
1471
+ url: url, selection: this.selection, fileName: name_1, isEmbedUrl: !webUrlBtn.checked,
1472
+ selectParent: this.selectParent, width: {
1473
+ width: proxy.parent.insertVideoSettings.width, minWidth: proxy.parent.insertVideoSettings.minWidth,
1474
+ maxWidth: proxy.parent.getInsertImgMaxWidth()
1475
+ },
1476
+ height: {
1477
+ height: proxy.parent.insertVideoSettings.height, minHeight: proxy.parent.insertVideoSettings.minHeight,
1478
+ maxHeight: proxy.parent.insertVideoSettings.maxHeight
1479
+ }
1480
+ };
1481
+ proxy.dialogObj.hide({ returnValue: false });
1482
+ if (proxy.dialogObj !== null) {
1483
+ return;
1484
+ }
1485
+ proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, value);
1486
+ }
1487
+ };
1488
+ Video.prototype.destroy = function () {
1489
+ if (this.isDestroyed) {
1490
+ return;
1491
+ }
1492
+ this.prevSelectedVidEle = undefined;
1493
+ this.removeEventListener();
1494
+ if (this.showPopupTime) {
1495
+ clearTimeout(this.showPopupTime);
1496
+ this.showPopupTime = null;
1497
+ }
1498
+ this.clearDialogObj();
1499
+ this.isDestroyed = true;
1500
+ };
1501
+ Video.prototype.getModuleName = function () {
1502
+ return 'video';
1503
+ };
1504
+ return Video;
1505
+ }());
1506
+ exports.Video = Video;
1507
+ });