@syncfusion/ej2-richtexteditor 23.2.7 → 24.1.41-569421

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 (272) hide show
  1. package/.eslintrc.json +259 -259
  2. package/CHANGELOG.md +1953 -1749
  3. package/README.md +76 -76
  4. package/dist/ej2-richtexteditor.umd.min.js +1 -10
  5. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es2015.js +9971 -8025
  7. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  8. package/dist/es6/ej2-richtexteditor.es5.js +8445 -6498
  9. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  10. package/helpers/e2e/index.js +3 -3
  11. package/helpers/e2e/rte-helper.js +13 -13
  12. package/license +9 -9
  13. package/package.json +74 -74
  14. package/src/common/config.d.ts +7 -0
  15. package/src/common/config.js +12 -1
  16. package/src/common/constant.d.ts +6 -0
  17. package/src/common/constant.js +6 -0
  18. package/src/common/interface.d.ts +19 -7
  19. package/src/common/types.d.ts +6 -0
  20. package/src/common/util.d.ts +6 -0
  21. package/src/common/util.js +61 -20
  22. package/src/editor-manager/base/classes.d.ts +1 -1
  23. package/src/editor-manager/base/classes.js +1 -1
  24. package/src/editor-manager/base/constant.d.ts +6 -0
  25. package/src/editor-manager/base/constant.js +6 -0
  26. package/src/editor-manager/base/editor-manager.d.ts +8 -3
  27. package/src/editor-manager/base/editor-manager.js +62 -3
  28. package/src/editor-manager/base/enum.d.ts +2 -2
  29. package/src/editor-manager/base/interface.d.ts +17 -9
  30. package/src/editor-manager/base/types.d.ts +1 -1
  31. package/src/editor-manager/plugin/alignments.d.ts +2 -2
  32. package/src/editor-manager/plugin/alignments.js +2 -2
  33. package/src/editor-manager/plugin/audio.d.ts +3 -3
  34. package/src/editor-manager/plugin/audio.js +16 -6
  35. package/src/editor-manager/plugin/clearformat-exec.d.ts +2 -2
  36. package/src/editor-manager/plugin/clearformat-exec.js +2 -2
  37. package/src/editor-manager/plugin/clearformat.d.ts +1 -1
  38. package/src/editor-manager/plugin/clearformat.js +1 -1
  39. package/src/editor-manager/plugin/dom-node.d.ts +39 -35
  40. package/src/editor-manager/plugin/dom-node.js +203 -62
  41. package/src/editor-manager/plugin/format-painter-actions.d.ts +2 -1
  42. package/src/editor-manager/plugin/format-painter-actions.js +20 -2
  43. package/src/editor-manager/plugin/formats.d.ts +3 -2
  44. package/src/editor-manager/plugin/formats.js +40 -5
  45. package/src/editor-manager/plugin/image.d.ts +3 -3
  46. package/src/editor-manager/plugin/image.js +41 -18
  47. package/src/editor-manager/plugin/indents.d.ts +2 -2
  48. package/src/editor-manager/plugin/indents.js +3 -3
  49. package/src/editor-manager/plugin/insert-methods.d.ts +4 -4
  50. package/src/editor-manager/plugin/insert-methods.js +4 -4
  51. package/src/editor-manager/plugin/insert-text.d.ts +2 -2
  52. package/src/editor-manager/plugin/insert-text.js +2 -2
  53. package/src/editor-manager/plugin/inserthtml-exec.d.ts +2 -2
  54. package/src/editor-manager/plugin/inserthtml-exec.js +2 -2
  55. package/src/editor-manager/plugin/inserthtml.d.ts +3 -2
  56. package/src/editor-manager/plugin/inserthtml.js +85 -22
  57. package/src/editor-manager/plugin/isformatted.d.ts +8 -8
  58. package/src/editor-manager/plugin/isformatted.js +8 -8
  59. package/src/editor-manager/plugin/link.d.ts +2 -2
  60. package/src/editor-manager/plugin/link.js +10 -5
  61. package/src/editor-manager/plugin/lists.d.ts +2 -2
  62. package/src/editor-manager/plugin/lists.js +161 -72
  63. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
  64. package/src/editor-manager/plugin/ms-word-clean-up.js +216 -86
  65. package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
  66. package/src/editor-manager/plugin/nodecutter.js +11 -8
  67. package/src/editor-manager/plugin/selection-commands.d.ts +3 -1
  68. package/src/editor-manager/plugin/selection-commands.js +249 -5
  69. package/src/editor-manager/plugin/selection-exec.d.ts +2 -2
  70. package/src/editor-manager/plugin/selection-exec.js +2 -2
  71. package/src/editor-manager/plugin/table.d.ts +6 -3
  72. package/src/editor-manager/plugin/table.js +97 -51
  73. package/src/editor-manager/plugin/toolbar-status.d.ts +4 -4
  74. package/src/editor-manager/plugin/toolbar-status.js +22 -12
  75. package/src/editor-manager/plugin/undo.d.ts +7 -6
  76. package/src/editor-manager/plugin/undo.js +27 -7
  77. package/src/editor-manager/plugin/video.d.ts +3 -3
  78. package/src/editor-manager/plugin/video.js +3 -3
  79. package/src/global.d.ts +1 -0
  80. package/src/markdown-parser/base/interface.d.ts +10 -10
  81. package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
  82. package/src/markdown-parser/base/markdown-parser.js +3 -3
  83. package/src/markdown-parser/base/types.d.ts +1 -1
  84. package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
  85. package/src/markdown-parser/plugin/clearformat.js +2 -2
  86. package/src/markdown-parser/plugin/formats.d.ts +2 -2
  87. package/src/markdown-parser/plugin/formats.js +2 -2
  88. package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
  89. package/src/markdown-parser/plugin/insert-text.js +2 -2
  90. package/src/markdown-parser/plugin/link.d.ts +2 -2
  91. package/src/markdown-parser/plugin/link.js +2 -2
  92. package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
  93. package/src/markdown-parser/plugin/markdown-selection.js +14 -14
  94. package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
  95. package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
  96. package/src/markdown-parser/plugin/table.d.ts +3 -3
  97. package/src/markdown-parser/plugin/table.js +3 -3
  98. package/src/markdown-parser/plugin/undo.d.ts +6 -6
  99. package/src/markdown-parser/plugin/undo.js +6 -6
  100. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +13 -12
  101. package/src/rich-text-editor/actions/base-quick-toolbar.js +70 -23
  102. package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
  103. package/src/rich-text-editor/actions/base-toolbar.js +36 -37
  104. package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
  105. package/src/rich-text-editor/actions/color-picker.js +15 -5
  106. package/src/rich-text-editor/actions/count.d.ts +3 -3
  107. package/src/rich-text-editor/actions/count.js +4 -4
  108. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +3 -2
  109. package/src/rich-text-editor/actions/dropdown-buttons.js +13 -7
  110. package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
  111. package/src/rich-text-editor/actions/emoji-picker.js +17 -8
  112. package/src/rich-text-editor/actions/enter-key.js +10 -5
  113. package/src/rich-text-editor/actions/file-manager.js +1 -1
  114. package/src/rich-text-editor/actions/format-painter.js +5 -2
  115. package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
  116. package/src/rich-text-editor/actions/full-screen.js +8 -7
  117. package/src/rich-text-editor/actions/html-editor.d.ts +5 -3
  118. package/src/rich-text-editor/actions/html-editor.js +134 -22
  119. package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
  120. package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
  121. package/src/rich-text-editor/actions/keyboard.js +23 -21
  122. package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
  123. package/src/rich-text-editor/actions/markdown-editor.js +5 -3
  124. package/src/rich-text-editor/actions/paste-clean-up.d.ts +6 -1
  125. package/src/rich-text-editor/actions/paste-clean-up.js +157 -29
  126. package/src/rich-text-editor/actions/quick-toolbar.d.ts +17 -9
  127. package/src/rich-text-editor/actions/quick-toolbar.js +68 -21
  128. package/src/rich-text-editor/actions/resize.js +2 -1
  129. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  130. package/src/rich-text-editor/actions/toolbar.d.ts +16 -16
  131. package/src/rich-text-editor/actions/toolbar.js +48 -109
  132. package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
  133. package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
  134. package/src/rich-text-editor/base/classes.d.ts +125 -125
  135. package/src/rich-text-editor/base/classes.js +125 -125
  136. package/src/rich-text-editor/base/constant.d.ts +195 -150
  137. package/src/rich-text-editor/base/constant.js +364 -150
  138. package/src/rich-text-editor/base/enum.d.ts +1 -1
  139. package/src/rich-text-editor/base/enum.js +1 -1
  140. package/src/rich-text-editor/base/interface.d.ts +96 -52
  141. package/src/rich-text-editor/base/interface.js +1 -1
  142. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
  143. package/src/rich-text-editor/base/rich-text-editor.d.ts +76 -64
  144. package/src/rich-text-editor/base/rich-text-editor.js +247 -160
  145. package/src/rich-text-editor/base/util.d.ts +1 -1
  146. package/src/rich-text-editor/base/util.js +23 -5
  147. package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
  148. package/src/rich-text-editor/formatter/formatter.js +24 -12
  149. package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
  150. package/src/rich-text-editor/formatter/html-formatter.js +15 -15
  151. package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
  152. package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
  153. package/src/rich-text-editor/models/default-locale.js +31 -25
  154. package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
  155. package/src/rich-text-editor/models/iframe-settings.js +19 -19
  156. package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
  157. package/src/rich-text-editor/models/inline-mode.js +19 -19
  158. package/src/rich-text-editor/models/items.js +3 -3
  159. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
  160. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  161. package/src/rich-text-editor/models/toolbar-settings.js +20 -20
  162. package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
  163. package/src/rich-text-editor/renderer/audio-module.js +23 -5
  164. package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
  165. package/src/rich-text-editor/renderer/content-renderer.js +6 -6
  166. package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
  167. package/src/rich-text-editor/renderer/dialog-renderer.js +24 -4
  168. package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
  169. package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
  170. package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
  171. package/src/rich-text-editor/renderer/image-module.js +265 -221
  172. package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
  173. package/src/rich-text-editor/renderer/link-module.js +54 -25
  174. package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
  175. package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
  176. package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
  177. package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
  178. package/src/rich-text-editor/renderer/render.d.ts +2 -2
  179. package/src/rich-text-editor/renderer/render.js +2 -2
  180. package/src/rich-text-editor/renderer/table-module.d.ts +11 -2
  181. package/src/rich-text-editor/renderer/table-module.js +344 -169
  182. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +12 -15
  183. package/src/rich-text-editor/renderer/toolbar-renderer.js +115 -110
  184. package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
  185. package/src/rich-text-editor/renderer/video-module.js +83 -42
  186. package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
  187. package/src/rich-text-editor/renderer/view-source.js +21 -11
  188. package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
  189. package/src/rich-text-editor/services/renderer-factory.js +3 -3
  190. package/src/rich-text-editor/services/service-locator.d.ts +3 -3
  191. package/src/rich-text-editor/services/service-locator.js +3 -3
  192. package/src/selection/selection.d.ts +22 -22
  193. package/src/selection/selection.js +25 -22
  194. package/styles/_all.scss +1 -1
  195. package/styles/bootstrap-dark.css +353 -103
  196. package/styles/bootstrap.css +357 -112
  197. package/styles/bootstrap4.css +338 -96
  198. package/styles/bootstrap5-dark.css +344 -97
  199. package/styles/bootstrap5.css +344 -97
  200. package/styles/fabric-dark.css +332 -90
  201. package/styles/fabric.css +333 -91
  202. package/styles/fluent-dark.css +360 -98
  203. package/styles/fluent.css +360 -98
  204. package/styles/highcontrast-light.css +332 -90
  205. package/styles/highcontrast.css +336 -91
  206. package/styles/material-dark.css +339 -92
  207. package/styles/material.css +339 -92
  208. package/styles/material3-dark.css +348 -100
  209. package/styles/material3-dark.scss +1 -1
  210. package/styles/material3.css +348 -100
  211. package/styles/material3.scss +1 -1
  212. package/styles/rich-text-editor/_all.scss +2 -2
  213. package/styles/rich-text-editor/_bds-definition.scss +279 -0
  214. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
  215. package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
  216. package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
  217. package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
  218. package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
  219. package/styles/rich-text-editor/_fabric-definition.scss +261 -257
  220. package/styles/rich-text-editor/_fluent-definition.scss +267 -263
  221. package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
  222. package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
  223. package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
  224. package/styles/rich-text-editor/_layout.scss +2249 -2072
  225. package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
  226. package/styles/rich-text-editor/_material-definition.scss +264 -260
  227. package/styles/rich-text-editor/_material3-definition.scss +266 -262
  228. package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
  229. package/styles/rich-text-editor/_theme.scss +926 -837
  230. package/styles/rich-text-editor/bootstrap-dark.css +353 -103
  231. package/styles/rich-text-editor/bootstrap.css +357 -112
  232. package/styles/rich-text-editor/bootstrap4.css +338 -96
  233. package/styles/rich-text-editor/bootstrap5-dark.css +344 -97
  234. package/styles/rich-text-editor/bootstrap5.css +344 -97
  235. package/styles/rich-text-editor/fabric-dark.css +332 -90
  236. package/styles/rich-text-editor/fabric.css +333 -91
  237. package/styles/rich-text-editor/fluent-dark.css +360 -98
  238. package/styles/rich-text-editor/fluent.css +360 -98
  239. package/styles/rich-text-editor/highcontrast-light.css +332 -90
  240. package/styles/rich-text-editor/highcontrast.css +336 -91
  241. package/styles/rich-text-editor/icons/_bds.scss +348 -0
  242. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
  243. package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
  244. package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
  245. package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
  246. package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
  247. package/styles/rich-text-editor/icons/_fabric.scss +349 -349
  248. package/styles/rich-text-editor/icons/_fluent.scss +348 -348
  249. package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
  250. package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
  251. package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
  252. package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
  253. package/styles/rich-text-editor/icons/_material.scss +349 -349
  254. package/styles/rich-text-editor/icons/_material3.scss +348 -348
  255. package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
  256. package/styles/rich-text-editor/material-dark.css +339 -92
  257. package/styles/rich-text-editor/material.css +339 -92
  258. package/styles/rich-text-editor/material3-dark.css +348 -100
  259. package/styles/rich-text-editor/material3-dark.scss +1 -1
  260. package/styles/rich-text-editor/material3.css +348 -100
  261. package/styles/rich-text-editor/material3.scss +1 -1
  262. package/styles/rich-text-editor/tailwind-dark.css +383 -113
  263. package/styles/rich-text-editor/tailwind.css +383 -113
  264. package/styles/tailwind-dark.css +383 -113
  265. package/styles/tailwind.css +383 -113
  266. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
  267. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
  268. package/dist/ej2-richtexteditor.min.js +0 -10
  269. package/dist/global/ej2-richtexteditor.min.js +0 -11
  270. package/dist/global/ej2-richtexteditor.min.js.map +0 -1
  271. package/dist/global/index.d.ts +0 -14
  272. package/tslint.json +0 -111
@@ -1,4 +1,4 @@
1
- import { addClass, detach, EventHandler, isNullOrUndefined, select, Ajax, formatUnit } from '@syncfusion/ej2-base';
1
+ import { addClass, detach, EventHandler, select, Ajax, formatUnit } from '@syncfusion/ej2-base';
2
2
  import { Browser, closest, removeClass, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
3
3
  import * as events from '../base/constant';
4
4
  import * as classes from '../base/classes';
@@ -8,6 +8,7 @@ import { Button, CheckBox } from '@syncfusion/ej2-buttons';
8
8
  import { RenderType } from '../base/enum';
9
9
  import { dispatchEvent, parseHtml, hasClass, convertToBlob } from '../base/util';
10
10
  import { isIDevice } from '../../common/util';
11
+ import { imageResizeFactor } from '../../common/config';
11
12
  /**
12
13
  * `Image` module is used to handle image actions.
13
14
  */
@@ -17,7 +18,6 @@ var Image = /** @class */ (function () {
17
18
  this.isAllowedTypes = true;
18
19
  this.pageX = null;
19
20
  this.pageY = null;
20
- this.mouseX = null;
21
21
  this.deletedImg = [];
22
22
  this.parent = parent;
23
23
  this.rteID = parent.element.id;
@@ -87,7 +87,7 @@ var Image = /** @class */ (function () {
87
87
  dropElement.removeEventListener('dragstart', this.dragStart.bind(this), true);
88
88
  dropElement.removeEventListener('dragenter', this.dragEnter.bind(this), true);
89
89
  dropElement.removeEventListener('dragover', this.dragOver.bind(this), true);
90
- if (!isNullOrUndefined(this.contentModule)) {
90
+ if (!isNOU(this.contentModule)) {
91
91
  EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.imageClick);
92
92
  this.parent.formatter.editorManager.observer.off(events.checkUndo, this.undoStack);
93
93
  if (this.parent.insertImageSettings.resize) {
@@ -100,7 +100,7 @@ var Image = /** @class */ (function () {
100
100
  };
101
101
  Image.prototype.updateCss = function (currentObj, e) {
102
102
  if (currentObj && e.cssClass) {
103
- if (isNullOrUndefined(e.oldCssClass)) {
103
+ if (isNOU(e.oldCssClass)) {
104
104
  currentObj.setProperties({ cssClass: (currentObj.cssClass + ' ' + e.cssClass).trim() });
105
105
  }
106
106
  else {
@@ -111,7 +111,7 @@ var Image = /** @class */ (function () {
111
111
  // eslint-disable-next-line @typescript-eslint/tslint/config
112
112
  Image.prototype.setCssClass = function (e) {
113
113
  if (this.popupObj && e.cssClass) {
114
- if (isNullOrUndefined(e.oldCssClass)) {
114
+ if (isNOU(e.oldCssClass)) {
115
115
  addClass([this.popupObj.element], e.cssClass);
116
116
  }
117
117
  else {
@@ -175,11 +175,6 @@ var Image = /** @class */ (function () {
175
175
  }
176
176
  var args = { event: e, requestType: 'images' };
177
177
  this.parent.trigger(events.resizeStop, args);
178
- /* eslint-disable */
179
- var pageX = this.getPointX(e);
180
- var pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
181
- this.parent.element.getBoundingClientRect().top + e.clientY : e.pageY;
182
- /* eslint-enable */
183
178
  this.parent.formatter.editorManager.observer.on(events.checkUndo, this.undoStack, this);
184
179
  this.parent.formatter.saveData();
185
180
  };
@@ -210,17 +205,15 @@ var Image = /** @class */ (function () {
210
205
  if (this.quickToolObj) {
211
206
  this.quickToolObj.imageQTBar.hidePopup();
212
207
  }
213
- if (target.classList.contains('e-rte-topLeft')) {
214
- this.resizeBtnStat.topLeft = true;
215
- }
216
- if (target.classList.contains('e-rte-topRight')) {
217
- this.resizeBtnStat.topRight = true;
218
- }
219
- if (target.classList.contains('e-rte-botLeft')) {
220
- this.resizeBtnStat.botLeft = true;
221
- }
222
- if (target.classList.contains('e-rte-botRight')) {
223
- this.resizeBtnStat.botRight = true;
208
+ var handlers = ['topLeft', 'topRight', 'botLeft', 'botRight'];
209
+ for (var i = 0; i < handlers.length; i++) {
210
+ var handler = handlers[i];
211
+ if (target.classList.contains('e-rte-' + handler)) {
212
+ this.resizeBtnStat[handler] = true;
213
+ this.currentResizeHandler = handler;
214
+ this.aspectRatio = this.findAspectRatio(this.imgEle);
215
+ break; // Exit the loop once a match is found
216
+ }
224
217
  }
225
218
  if (Browser.isDevice && this.contentModule.getEditPanel().contains(this.imgResizeDiv) &&
226
219
  !this.imgResizeDiv.classList.contains('e-mob-span')) {
@@ -234,6 +227,7 @@ var Image = /** @class */ (function () {
234
227
  }
235
228
  });
236
229
  }
230
+ EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
237
231
  EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
238
232
  }
239
233
  };
@@ -265,18 +259,18 @@ var Image = /** @class */ (function () {
265
259
  this.resizeBtnInit();
266
260
  this.imgEle = e;
267
261
  addClass([this.imgEle], 'e-resize');
268
- this.imgResizeDiv = this.parent.createElement('span', { className: 'e-img-resize' + ' ' + this.parent.cssClass, id: this.rteID + '_imgResize' });
262
+ this.imgResizeDiv = this.parent.createElement('span', { className: 'e-img-resize' + this.parent.getCssClass(true), id: this.rteID + '_imgResize' });
269
263
  this.imgResizeDiv.appendChild(this.parent.createElement('span', {
270
- className: 'e-rte-imageboxmark e-rte-topLeft' + ' ' + this.parent.cssClass, styles: 'cursor: nwse-resize'
264
+ className: 'e-rte-imageboxmark e-rte-topLeft' + this.parent.getCssClass(true), styles: 'cursor: nwse-resize'
271
265
  }));
272
266
  this.imgResizeDiv.appendChild(this.parent.createElement('span', {
273
- className: 'e-rte-imageboxmark e-rte-topRight' + ' ' + this.parent.cssClass, styles: 'cursor: nesw-resize'
267
+ className: 'e-rte-imageboxmark e-rte-topRight' + this.parent.getCssClass(true), styles: 'cursor: nesw-resize'
274
268
  }));
275
269
  this.imgResizeDiv.appendChild(this.parent.createElement('span', {
276
- className: 'e-rte-imageboxmark e-rte-botLeft' + ' ' + this.parent.cssClass, styles: 'cursor: nesw-resize'
270
+ className: 'e-rte-imageboxmark e-rte-botLeft' + this.parent.getCssClass(true), styles: 'cursor: nesw-resize'
277
271
  }));
278
272
  this.imgResizeDiv.appendChild(this.parent.createElement('span', {
279
- className: 'e-rte-imageboxmark e-rte-botRight' + ' ' + this.parent.cssClass, styles: 'cursor: nwse-resize'
273
+ className: 'e-rte-imageboxmark e-rte-botRight' + this.parent.getCssClass(true), styles: 'cursor: nwse-resize'
280
274
  }));
281
275
  if (Browser.isDevice) {
282
276
  addClass([this.imgResizeDiv], 'e-mob-rte');
@@ -285,7 +279,6 @@ var Image = /** @class */ (function () {
285
279
  this.imgResizePos(e, this.imgResizeDiv);
286
280
  this.resizeImgDupPos(e);
287
281
  this.contentModule.getEditPanel().appendChild(this.imgResizeDiv);
288
- EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
289
282
  };
290
283
  Image.prototype.getPointX = function (e) {
291
284
  if (e.touches && e.touches.length) {
@@ -351,89 +344,80 @@ var Image = /** @class */ (function () {
351
344
  };
352
345
  }
353
346
  };
354
- Image.prototype.setAspectRatio = function (img, expectedX, expectedY, e) {
355
- if (isNullOrUndefined(img.width)) {
347
+ Image.prototype.setAspectRatio = function (img, expectedX, expectedY) {
348
+ if (isNOU(img.width)) {
356
349
  return;
357
350
  }
358
- // eslint-disable-next-line security/detect-unsafe-regex
359
- var width = img.style.width !== '' ? img.style.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(img.style.width) :
360
- parseInt(img.style.width, 10) : img.width;
361
- var height = img.style.height !== '' ? parseInt(img.style.height, 10) : img.height;
362
- if (width > height) {
363
- img.style.minWidth = this.parent.insertImageSettings.minWidth === 0 ? '20px' : formatUnit(this.parent.insertImageSettings.minWidth);
364
- if (this.parent.insertImageSettings.resizeByPercent) {
365
- if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
366
- var original = img.offsetWidth + this.mouseX;
367
- var finalWidthByPerc = (original / img.offsetWidth) * (parseFloat(img.style.width).toString() === 'NaN' ? (img.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(img.style.width));
368
- img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
351
+ var width = img.width;
352
+ var height = img.height;
353
+ var sameHeightWidth = (width === height);
354
+ var factor = this.parent.insertImageSettings.resizeByPercent ? '%' : 'px';
355
+ var emptyStyleDimension = (img.style.width === '' && img.style.height === '');
356
+ if (!sameHeightWidth && !emptyStyleDimension) {
357
+ if (img.style.width !== '' && img.style.height !== '') {
358
+ if (this.parent.insertImageSettings.resizeByPercent) {
359
+ this.setImageWidth(img, expectedX, factor);
360
+ this.removeImageHeight(img);
369
361
  }
370
362
  else {
371
- img.style.width = this.pixToPerc((width / height * expectedY), (img.previousElementSibling || img.parentElement)) + '%';
363
+ this.setImageWidth(img, expectedX, factor);
364
+ this.setImageHeight(img, expectedY, factor);
372
365
  }
373
- img.style.height = null;
374
- img.removeAttribute('height');
375
- }
376
- else if (img.style.width === '' && img.style.height !== '') {
377
- img.style.height = expectedY + 'px';
378
- }
379
- else if (img.style.width !== '' && img.style.height === '') {
380
- var currentWidth = ((width / height * expectedY) + width / height) <
381
- (this.parent.inputElement.getBoundingClientRect().right - 32) ?
382
- ((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
383
- img.style.width = currentWidth.toString() + 'px';
384
- img.style.height = expectedY + 'px';
385
366
  }
386
367
  else if (img.style.width !== '') {
387
- var currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
388
- (width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
389
- img.style.width = currentWidth + 'px';
390
- img.style.height = expectedY + 'px';
391
- }
392
- else {
393
- if (this.parent.iframeSettings.enable) {
394
- img.setAttribute('width', (img.width + this.mouseX).toString());
368
+ if (this.parent.insertImageSettings.resizeByPercent) {
369
+ this.setImageWidth(img, expectedX, factor);
370
+ this.removeImageHeight(img);
395
371
  }
396
372
  else {
397
- var currentWidth = img.offsetWidth === 0 ? img.width + this.mouseX + parseInt(img.style.outlineWidth.split('p')[0], 10) : img.offsetWidth + this.mouseX;
398
- img.setAttribute('width', (currentWidth).toString());
373
+ this.setImageWidth(img, expectedX, factor);
399
374
  }
400
375
  }
401
- }
402
- else if (height > width) {
403
- if (this.parent.insertImageSettings.resizeByPercent) {
404
- if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
405
- var original = img.offsetWidth + this.mouseX;
406
- var finalWidthByPerc = (original / img.offsetWidth) * (parseFloat(img.style.width).toString() === 'NaN' ?
407
- (img.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) :
408
- parseFloat(img.style.width));
409
- img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
376
+ else if (img.style.height !== '') {
377
+ if (this.parent.insertImageSettings.resizeByPercent) {
378
+ this.setImageWidth(img, expectedX, factor);
379
+ this.removeImageHeight(img);
410
380
  }
411
381
  else {
412
- img.style.width = this.pixToPerc((expectedX / height * expectedY), (img.previousElementSibling || img.parentElement)) + '%';
382
+ this.setImageHeight(img, expectedY, factor);
413
383
  }
414
- img.style.height = null;
415
- img.removeAttribute('height');
416
- }
417
- else if (img.style.width !== '') {
418
- img.style.width = expectedX + 'px';
419
- img.style.height = (height / width * expectedX) + 'px';
420
- }
421
- else {
422
- img.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - img.getBoundingClientRect().left).toString() : expectedX.toString());
423
384
  }
424
385
  }
425
386
  else {
387
+ this.setImageWidth(img, expectedX, factor);
426
388
  if (this.parent.insertImageSettings.resizeByPercent) {
427
- img.style.width = this.pixToPerc(expectedX, (img.previousElementSibling || img.parentElement)) + '%';
428
- img.style.height = null;
429
- img.removeAttribute('height');
389
+ this.removeImageHeight(img);
430
390
  }
431
391
  else {
432
- img.style.width = expectedX + 'px';
433
- img.style.height = expectedX + 'px';
392
+ this.setImageHeight(img, expectedY, factor);
434
393
  }
435
394
  }
436
395
  };
396
+ Image.prototype.setImageWidth = function (img, value, suffix) {
397
+ img.style.width = this.getImageDimension(value, img) + suffix;
398
+ if (!this.parent.insertImageSettings.resizeByPercent) {
399
+ img.setAttribute('width', value.toString());
400
+ }
401
+ };
402
+ Image.prototype.setImageHeight = function (img, value, suffix) {
403
+ img.style.height = this.getImageDimension(value, img) + suffix;
404
+ if (!this.parent.insertImageSettings.resizeByPercent) {
405
+ img.setAttribute('height', value.toString());
406
+ }
407
+ };
408
+ Image.prototype.removeImageHeight = function (img) {
409
+ img.style.height = '';
410
+ img.removeAttribute('height');
411
+ };
412
+ Image.prototype.getImageDimension = function (value, img) {
413
+ if (this.parent.insertImageSettings.resizeByPercent) {
414
+ var rootElem = img.parentElement || img.previousElementSibling;
415
+ return this.pixToPerc(value, rootElem);
416
+ }
417
+ else {
418
+ return value;
419
+ }
420
+ };
437
421
  Image.prototype.pixToPerc = function (expected, parentEle) {
438
422
  return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
439
423
  };
@@ -456,10 +440,9 @@ var Image = /** @class */ (function () {
456
440
  return;
457
441
  }
458
442
  _this.imgEle.parentElement.style.cursor = 'pointer';
459
- _this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10), args);
443
+ _this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10));
460
444
  _this.resizeImgDupPos(_this.imgEle);
461
445
  _this.imgResizePos(_this.imgEle, _this.imgResizeDiv);
462
- _this.parent.setContentHeight('', false);
463
446
  }
464
447
  });
465
448
  };
@@ -468,35 +451,37 @@ var Image = /** @class */ (function () {
468
451
  this.cancelResizeAction();
469
452
  return;
470
453
  }
471
- if (this.imgEle.offsetWidth >= this.parent.getInsertImgMaxWidth()) {
472
- this.imgEle.style.maxHeight = this.imgEle.offsetHeight + 'px';
473
- }
474
- else if (isNOU(this.parent.insertImageSettings.maxHeight)) {
475
- this.imgEle.style.maxHeight = '';
476
- }
477
- this.imgEle.style.maxWidth = this.parent.getInsertImgMaxWidth() + 'px';
478
- var pageX = this.getPointX(e);
479
- var pageY = this.getPointY(e);
480
- var mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
481
- var mouseY = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageY - this.pageY) : (pageY - this.pageY);
482
- var width = parseInt(this.imgDupPos.width, 10) + mouseX;
483
- var height = parseInt(this.imgDupPos.height, 10) + mouseY;
484
- this.mouseX = mouseX;
485
- this.pageX = pageX;
486
- this.pageY = pageY;
487
- if (this.resizeBtnStat.botRight) {
488
- this.imgDupMouseMove(width + 'px', height + 'px', e);
489
- }
490
- else if (this.resizeBtnStat.botLeft) {
491
- this.imgDupMouseMove(width + 'px', height + 'px', e);
492
- }
493
- else if (this.resizeBtnStat.topRight) {
494
- this.imgDupMouseMove(width + 'px', height + 'px', e);
495
- }
496
- else if (this.resizeBtnStat.topLeft) {
454
+ if (this.resizeBtnStat.botRight || this.resizeBtnStat.botLeft || this.resizeBtnStat.topRight || this.resizeBtnStat.topLeft) {
455
+ var pageX = this.getPointX(e);
456
+ var pageY = this.getPointY(e);
457
+ var resizeFactor = this.getResizeFactor(this.currentResizeHandler);
458
+ var diffX = (pageX - this.pageX);
459
+ var diffY = (pageY - this.pageY);
460
+ var currentWidth = this.imgEle.clientWidth;
461
+ var currentHeight = this.imgEle.clientHeight;
462
+ var width = diffX * resizeFactor[0] + currentWidth;
463
+ var height = diffY * resizeFactor[1] + currentHeight;
464
+ width = (width < 16) ? 16 : width;
465
+ height = (height < 16) ? 16 : height;
466
+ if (Math.abs(diffX) > Math.abs(diffY)) {
467
+ height = Math.round(width / this.aspectRatio);
468
+ width = Math.round(height * this.aspectRatio);
469
+ }
470
+ else {
471
+ width = Math.round(height * this.aspectRatio);
472
+ height = Math.round(width / this.aspectRatio);
473
+ }
474
+ this.pageX = pageX;
475
+ this.pageY = pageY;
497
476
  this.imgDupMouseMove(width + 'px', height + 'px', e);
498
477
  }
499
478
  };
479
+ Image.prototype.getResizeFactor = function (value) {
480
+ return imageResizeFactor[value];
481
+ };
482
+ Image.prototype.findAspectRatio = function (image) {
483
+ return image.clientWidth / image.clientHeight;
484
+ };
500
485
  Image.prototype.cancelResizeAction = function () {
501
486
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
502
487
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd);
@@ -506,6 +491,8 @@ var Image = /** @class */ (function () {
506
491
  this.imgResizeDiv = null;
507
492
  this.pageX = null;
508
493
  this.pageY = null;
494
+ this.currentResizeHandler = null;
495
+ this.aspectRatio = null;
509
496
  }
510
497
  };
511
498
  Image.prototype.resizeImgDupPos = function (e) {
@@ -516,6 +503,8 @@ var Image = /** @class */ (function () {
516
503
  };
517
504
  };
518
505
  Image.prototype.resizeBtnInit = function () {
506
+ this.aspectRatio = null;
507
+ this.currentResizeHandler = null;
519
508
  return this.resizeBtnStat = { botLeft: false, botRight: false, topRight: false, topLeft: false };
520
509
  };
521
510
  Image.prototype.onToolbarAction = function (args) {
@@ -588,7 +577,7 @@ var Image = /** @class */ (function () {
588
577
  });
589
578
  if (this.quickToolObj && document.body.contains(this.quickToolObj.imageQTBar.element)) {
590
579
  this.quickToolObj.imageQTBar.hidePopup();
591
- if (!isNullOrUndefined(e.selectParent)) {
580
+ if (!isNOU(e.selectParent)) {
592
581
  removeClass([e.selectParent[0]], 'e-img-focus');
593
582
  }
594
583
  }
@@ -628,7 +617,7 @@ var Image = /** @class */ (function () {
628
617
  this.checkImageDel(range);
629
618
  }
630
619
  }
631
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) &&
620
+ if (!isNOU(this.parent.formatter.editorManager.nodeSelection) &&
632
621
  originalEvent.code !== 'KeyK') {
633
622
  range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
634
623
  selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
@@ -645,11 +634,13 @@ var Image = /** @class */ (function () {
645
634
  }
646
635
  }
647
636
  if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
648
- this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
637
+ if (this.parent.editorMode !== 'Markdown') {
638
+ this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
639
+ }
649
640
  }
650
641
  if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
651
642
  if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
652
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
643
+ if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
653
644
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
654
645
  }
655
646
  originalEvent.preventDefault();
@@ -671,7 +662,7 @@ var Image = /** @class */ (function () {
671
662
  }
672
663
  switch (originalEvent.action) {
673
664
  case 'escape':
674
- if (!isNullOrUndefined(this.dialogObj)) {
665
+ if (!isNOU(this.dialogObj)) {
675
666
  this.dialogObj.close();
676
667
  }
677
668
  break;
@@ -699,24 +690,41 @@ var Image = /** @class */ (function () {
699
690
  }
700
691
  }
701
692
  }
702
- else if ((range.startContainer.nodeType === 1 &&
703
- range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE))) {
704
- detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE));
705
- }
706
- else if (range.startContainer.nodeType === 1 &&
707
- range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_IMGBREAK)) {
708
- detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_IMGBREAK));
693
+ else if (range.startContainer.nodeType === 1) {
694
+ if (range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE)) {
695
+ detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE));
696
+ }
697
+ else if (range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_IMGBREAK)) {
698
+ detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_IMGBREAK));
699
+ }
700
+ else if (range.startContainer.classList.contains('e-img-wrap') && closest(range.startContainer, '.' + classes.CLS_CAPTION)) {
701
+ var parentElem = range.startContainer.parentElement.parentElement;
702
+ detach(closest(range.startContainer, '.' + classes.CLS_CAPTION));
703
+ if (parentElem && parentElem.textContent.trim() === '') {
704
+ var brElem = this.parent.createElement('br');
705
+ brElem.classList.add('e-rte-image-remove-focus');
706
+ parentElem.appendChild(brElem);
707
+ }
708
+ }
709
709
  }
710
710
  }
711
711
  break;
712
712
  case 'insert-image':
713
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
713
+ if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
714
714
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
715
715
  }
716
716
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
717
717
  originalEvent.preventDefault();
718
718
  break;
719
719
  }
720
+ if (originalEvent.ctrlKey && originalEvent.key === 'a') {
721
+ this.handleSelectAll();
722
+ }
723
+ };
724
+ Image.prototype.handleSelectAll = function () {
725
+ this.cancelResizeAction();
726
+ var imgFocusNodes = this.parent.inputElement.querySelectorAll('.' + classes.CLS_IMG_FOCUS);
727
+ removeClass(imgFocusNodes, classes.CLS_IMG_FOCUS);
720
728
  };
721
729
  Image.prototype.openDialog = function (isInternal, event, selection, ele, parentEle) {
722
730
  var range;
@@ -762,7 +770,7 @@ var Image = /** @class */ (function () {
762
770
  };
763
771
  Image.prototype.showDialog = function () {
764
772
  this.openDialog(false);
765
- this.setCssClass({ cssClass: this.parent.cssClass });
773
+ this.setCssClass({ cssClass: this.parent.getCssClass() });
766
774
  };
767
775
  Image.prototype.closeDialog = function () {
768
776
  if (this.dialogObj) {
@@ -860,8 +868,8 @@ var Image = /** @class */ (function () {
860
868
  };
861
869
  Image.prototype.showImageQuickToolbar = function (e) {
862
870
  var _this = this;
863
- if (e.type !== 'Images' || isNullOrUndefined(this.parent.quickToolbarModule)
864
- || isNullOrUndefined(this.parent.quickToolbarModule.imageQTBar) || isNullOrUndefined(e.args)) {
871
+ if (e.type !== 'Images' || isNOU(this.parent.quickToolbarModule)
872
+ || isNOU(this.parent.quickToolbarModule.imageQTBar) || isNOU(e.args)) {
865
873
  return;
866
874
  }
867
875
  this.quickToolObj = this.parent.quickToolbarModule;
@@ -886,15 +894,17 @@ var Image = /** @class */ (function () {
886
894
  _this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
887
895
  _this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
888
896
  _this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
897
+ _this.resizeStart(e.args, target);
889
898
  }, 400);
890
899
  }
891
900
  else {
892
- this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
901
+ var coordinates = target.getBoundingClientRect();
902
+ this.quickToolObj.imageQTBar.showPopup(coordinates.left, coordinates.top, target, 'Image');
893
903
  }
894
904
  }
895
905
  };
896
906
  Image.prototype.hideImageQuickToolbar = function () {
897
- if (!isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
907
+ if (!isNOU(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
898
908
  removeClass([this.contentModule.getEditPanel().querySelector('.e-img-focus')], 'e-img-focus');
899
909
  if (this.quickToolObj && this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
900
910
  this.quickToolObj.imageQTBar.hidePopup();
@@ -909,7 +919,7 @@ var Image = /** @class */ (function () {
909
919
  var args = e.args;
910
920
  var showOnRightClick = this.parent.quickToolbarSettings.showOnRightClick;
911
921
  if (args.which === 2 || (showOnRightClick && args.which === 1) || (!showOnRightClick && args.which === 3)) {
912
- if ((showOnRightClick && args.which === 1) && !isNullOrUndefined(args.target) &&
922
+ if ((showOnRightClick && args.which === 1) && !isNOU(args.target) &&
913
923
  args.target.tagName === 'IMG') {
914
924
  this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
915
925
  this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), args.target);
@@ -969,20 +979,20 @@ var Image = /** @class */ (function () {
969
979
  return;
970
980
  }
971
981
  this.imagDialog(e);
972
- if (!isNullOrUndefined(this.dialogObj)) {
973
- var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' + ' ' + this.parent.cssClass });
982
+ if (!isNOU(this.dialogObj)) {
983
+ var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' + this.parent.getCssClass(true) });
974
984
  var linkUrl = this.i10n.getConstant('linkurl');
975
- var content = '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
976
- '<input type="text" data-role ="none" class="e-input e-img-link' + ' ' + this.parent.cssClass + '" spellcheck="false" placeholder="' + linkUrl + '"/></div>' +
985
+ var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
986
+ '<input type="text" data-role ="none" class="e-input e-img-link' + this.parent.getCssClass(true) + '" spellcheck="false" placeholder="' + linkUrl + '"/></div>' +
977
987
  '<div class="e-rte-label"></div>' + '<div class="e-rte-field">' +
978
- '<input type="checkbox" class="e-rte-linkTarget' + ' ' + this.parent.cssClass + '" data-role ="none"></div>';
988
+ '<input type="checkbox" class="e-rte-linkTarget' + this.parent.getCssClass(true) + '" data-role ="none"></div>';
979
989
  var contentElem = parseHtml(content);
980
990
  linkWrap.appendChild(contentElem);
981
991
  var linkTarget = linkWrap.querySelector('.e-rte-linkTarget');
982
992
  var inputLink = linkWrap.querySelector('.e-img-link');
983
993
  var linkOpenLabel = this.i10n.getConstant('linkOpenInNewWindow');
984
994
  this.checkBoxObj = new CheckBox({
985
- label: linkOpenLabel, checked: true, enableRtl: this.parent.enableRtl, cssClass: this.parent.cssClass,
995
+ label: linkOpenLabel, checked: true, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
986
996
  change: function (e) {
987
997
  if (e.checked) {
988
998
  target_1 = '_blank';
@@ -996,14 +1006,14 @@ var Image = /** @class */ (function () {
996
1006
  this.checkBoxObj.createElement = this.parent.createElement;
997
1007
  this.checkBoxObj.appendTo(linkTarget);
998
1008
  var target_1 = this.checkBoxObj.checked ? '_blank' : null;
1009
+ var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
999
1010
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
1000
1011
  var linkargs_1 = {
1001
1012
  args: e.args,
1002
1013
  selfImage: this, selection: e.selection,
1003
- selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1
1014
+ selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1, ariaLabel: imageLabel
1004
1015
  };
1005
1016
  this.dialogObj.setProperties({
1006
- height: 'inherit',
1007
1017
  width: '290px',
1008
1018
  header: this.parent.localeObj.getConstant('imageInsertLinkHeader'),
1009
1019
  content: linkWrap,
@@ -1013,7 +1023,7 @@ var Image = /** @class */ (function () {
1013
1023
  _this.insertlink(linkargs_1);
1014
1024
  },
1015
1025
  buttonModel: {
1016
- content: linkUpdate, cssClass: 'e-flat e-update-link' + ' ' + this.parent.cssClass, isPrimary: true
1026
+ content: linkUpdate, cssClass: 'e-flat e-update-link' + this.parent.getCssClass(true), isPrimary: true
1017
1027
  }
1018
1028
  }],
1019
1029
  cssClass: this.dialogObj.cssClass + ' e-rte-img-link-dialog'
@@ -1021,7 +1031,7 @@ var Image = /** @class */ (function () {
1021
1031
  if (!isNOU(this.parent.cssClass)) {
1022
1032
  this.dialogObj.setProperties({ cssClass: this.parent.cssClass });
1023
1033
  }
1024
- if (!isNullOrUndefined(inputDetails)) {
1034
+ if (!isNOU(inputDetails)) {
1025
1035
  inputLink.value = inputDetails.url;
1026
1036
  // eslint-disable-next-line
1027
1037
  (inputDetails.target) ? this.checkBoxObj.checked = true : this.checkBoxObj.checked = false;
@@ -1038,14 +1048,14 @@ var Image = /** @class */ (function () {
1038
1048
  }
1039
1049
  this.imagDialog(e);
1040
1050
  var altText = this.i10n.getConstant('altText');
1041
- if (!isNullOrUndefined(this.dialogObj)) {
1042
- var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' + ' ' + this.parent.cssClass });
1051
+ if (!isNOU(this.dialogObj)) {
1052
+ var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' + this.parent.getCssClass(true) });
1043
1053
  var altHeader = this.i10n.getConstant('alternateHeader');
1044
1054
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
1045
1055
  var getAlt = (e.selectNode[0].getAttribute('alt') === null) ? '' :
1046
1056
  e.selectNode[0].getAttribute('alt');
1047
- var content = '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
1048
- '<input type="text" spellcheck="false" class="e-input e-img-alt' + ' ' + this.parent.cssClass + '" placeholder="' + altText + '"/>' +
1057
+ var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
1058
+ '<input type="text" spellcheck="false" class="e-input e-img-alt' + this.parent.getCssClass(true) + '" placeholder="' + altText + '"/>' +
1049
1059
  '</div>';
1050
1060
  var contentElem = parseHtml(content);
1051
1061
  contentElem.querySelector('input').setAttribute('value', getAlt);
@@ -1056,14 +1066,14 @@ var Image = /** @class */ (function () {
1056
1066
  alt: inputAlt
1057
1067
  };
1058
1068
  this.dialogObj.setProperties({
1059
- height: 'inherit', width: '290px', header: altHeader, content: altWrap,
1069
+ width: '290px', header: altHeader, content: altWrap,
1060
1070
  buttons: [{
1061
1071
  // eslint-disable-next-line
1062
1072
  click: function (e) {
1063
1073
  _this.insertAlt(altArgs_1);
1064
1074
  },
1065
1075
  buttonModel: {
1066
- content: linkUpdate, cssClass: 'e-flat e-update-alt' + ' ' + this.parent.cssClass, isPrimary: true
1076
+ content: linkUpdate, cssClass: 'e-flat e-update-alt' + this.parent.getCssClass(true), isPrimary: true
1067
1077
  }
1068
1078
  }],
1069
1079
  cssClass: this.dialogObj.cssClass + ' e-rte-img-alt-dialog'
@@ -1076,7 +1086,7 @@ var Image = /** @class */ (function () {
1076
1086
  }
1077
1087
  };
1078
1088
  Image.prototype.insertAlt = function (e) {
1079
- if (!isNullOrUndefined(e.alt)) {
1089
+ if (!isNOU(e.alt)) {
1080
1090
  e.selection.restore();
1081
1091
  if (this.parent.formatter.getUndoRedoStack().length === 0) {
1082
1092
  this.parent.formatter.saveData();
@@ -1115,14 +1125,14 @@ var Image = /** @class */ (function () {
1115
1125
  }
1116
1126
  if (e.selectNode[0].parentElement.nodeName === 'A') {
1117
1127
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
1118
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, selectNode: e.selectNode,
1128
+ url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
1119
1129
  subCommand: e.args.item.subCommand
1120
1130
  });
1121
1131
  proxy.dialogObj.hide({ returnValue: true });
1122
1132
  return;
1123
1133
  }
1124
1134
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
1125
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, selectNode: e.selectNode,
1135
+ url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
1126
1136
  subCommand: e.args.item.subCommand, selection: e.selection
1127
1137
  });
1128
1138
  var captionEle = closest(e.selectNode[0], '.e-img-caption');
@@ -1150,7 +1160,29 @@ var Image = /** @class */ (function () {
1150
1160
  if (this.parent.formatter.getUndoRedoStack().length === 0) {
1151
1161
  this.parent.formatter.saveData();
1152
1162
  }
1153
- e.selection.restore();
1163
+ var restoreStartElement = e.selection.range.startContainer;
1164
+ if (e.selection.range.startContainer.nodeName === 'SPAN' &&
1165
+ restoreStartElement.classList.contains('e-img-wrap') &&
1166
+ restoreStartElement.parentElement.classList.contains('e-img-caption')) {
1167
+ restoreStartElement = restoreStartElement.parentElement;
1168
+ if (!isNOU(restoreStartElement.previousSibling)) {
1169
+ var lastNode = restoreStartElement.previousSibling;
1170
+ while (lastNode.nodeName !== '#text' && lastNode.nodeName !== 'BR') {
1171
+ lastNode = lastNode.lastChild;
1172
+ }
1173
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), lastNode, lastNode.nodeName !== 'BR' ? lastNode.textContent.length : 0);
1174
+ }
1175
+ else if (!isNOU(restoreStartElement.nextSibling)) {
1176
+ var firstNode = restoreStartElement.nextSibling;
1177
+ while (firstNode.nodeName !== '#text' && firstNode.nodeName !== 'BR') {
1178
+ firstNode = firstNode.firstChild;
1179
+ }
1180
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), firstNode, 0);
1181
+ }
1182
+ }
1183
+ else {
1184
+ e.selection.restore();
1185
+ }
1154
1186
  if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
1155
1187
  this.removeResizeEle();
1156
1188
  }
@@ -1164,7 +1196,7 @@ var Image = /** @class */ (function () {
1164
1196
  this.quickToolObj.imageQTBar.hidePopup();
1165
1197
  }
1166
1198
  this.cancelResizeAction();
1167
- if (isNullOrUndefined(keyCode)) {
1199
+ if (isNOU(keyCode)) {
1168
1200
  this.parent.trigger(events.afterImageDelete, args);
1169
1201
  }
1170
1202
  };
@@ -1218,7 +1250,7 @@ var Image = /** @class */ (function () {
1218
1250
  addClass([selectNode], 'e-rte-image');
1219
1251
  var subCommand = (e.args.item) ?
1220
1252
  e.args.item.subCommand : 'Caption';
1221
- if (!isNullOrUndefined(closest(selectNode, '.' + classes.CLS_CAPTION))) {
1253
+ if (!isNOU(closest(selectNode, '.' + classes.CLS_CAPTION))) {
1222
1254
  detach(closest(selectNode, '.' + classes.CLS_CAPTION));
1223
1255
  if (Browser.isIE) {
1224
1256
  this.contentModule.getEditPanel().focus();
@@ -1233,11 +1265,11 @@ var Image = /** @class */ (function () {
1233
1265
  }
1234
1266
  else {
1235
1267
  this.captionEle = this.parent.createElement('span', {
1236
- className: classes.CLS_CAPTION + ' ' + classes.CLS_RTE_CAPTION + ' ' + this.parent.cssClass,
1268
+ className: classes.CLS_CAPTION + ' ' + classes.CLS_RTE_CAPTION + this.parent.getCssClass(true),
1237
1269
  attrs: { contenteditable: 'false', draggable: 'false', style: 'width:' + this.parent.insertImageSettings.width }
1238
1270
  });
1239
- var imgWrap = this.parent.createElement('span', { className: 'e-img-wrap' + ' ' + this.parent.cssClass });
1240
- var imgInner = this.parent.createElement('span', { className: 'e-img-inner' + ' ' + this.parent.cssClass,
1271
+ var imgWrap = this.parent.createElement('span', { className: 'e-img-wrap' + this.parent.getCssClass(true) });
1272
+ var imgInner = this.parent.createElement('span', { className: 'e-img-inner' + this.parent.getCssClass(true),
1241
1273
  attrs: { contenteditable: 'true' } });
1242
1274
  var parent_1 = e.selectNode[0].parentElement;
1243
1275
  if (parent_1.tagName === 'A') {
@@ -1277,20 +1309,20 @@ var Image = /** @class */ (function () {
1277
1309
  return;
1278
1310
  }
1279
1311
  this.imagDialog(e);
1280
- if (!isNullOrUndefined(this.dialogObj)) {
1312
+ if (!isNOU(this.dialogObj)) {
1281
1313
  var imgSizeHeader = this.i10n.getConstant('imageSizeHeader');
1282
1314
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
1283
1315
  var dialogContent = this.imgsizeInput(e);
1284
1316
  var selectObj_1 = { args: e.args, selfImage: this, selection: e.selection, selectNode: e.selectNode };
1285
1317
  this.dialogObj.setProperties({
1286
- height: (Browser.isDevice) ? '300px' : 'inherit', width: '290px', header: imgSizeHeader, content: dialogContent,
1318
+ width: '290px', header: imgSizeHeader, content: dialogContent,
1287
1319
  buttons: [{
1288
1320
  // eslint-disable-next-line
1289
1321
  click: function (e) {
1290
1322
  _this.insertSize(selectObj_1);
1291
1323
  },
1292
1324
  buttonModel: {
1293
- content: linkUpdate, cssClass: 'e-flat e-update-size' + ' ' + this.parent.cssClass, isPrimary: true
1325
+ content: linkUpdate, cssClass: 'e-flat e-update-size' + this.parent.getCssClass(true), isPrimary: true
1294
1326
  }
1295
1327
  }],
1296
1328
  cssClass: this.dialogObj.cssClass + ' e-rte-img-size-dialog'
@@ -1336,7 +1368,7 @@ var Image = /** @class */ (function () {
1336
1368
  this.dialogObj.hide({ returnValue: true });
1337
1369
  return;
1338
1370
  }
1339
- var imgDialog = this.parent.createElement('div', { className: 'e-rte-img-dialog' + ' ' + this.parent.cssClass, id: this.rteID + '_image' });
1371
+ var imgDialog = this.parent.createElement('div', { className: 'e-rte-img-dialog' + this.parent.getCssClass(true), id: this.rteID + '_image' });
1340
1372
  this.parent.element.appendChild(imgDialog);
1341
1373
  var imgInsert = this.i10n.getConstant('dialogInsert');
1342
1374
  var imglinkCancel = this.i10n.getConstant('dialogCancel');
@@ -1345,29 +1377,29 @@ var Image = /** @class */ (function () {
1345
1377
  var selectObj = { selfImage: this, selection: e.selection, args: e.args, selectParent: e.selectParent };
1346
1378
  var dialogModel = {
1347
1379
  header: imgHeader,
1348
- cssClass: classes.CLS_RTE_ELEMENTS + ' ' + this.parent.cssClass,
1380
+ cssClass: classes.CLS_RTE_ELEMENTS + this.parent.getCssClass(true),
1349
1381
  enableRtl: this.parent.enableRtl,
1350
1382
  locale: this.parent.locale,
1351
1383
  showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
1352
1384
  isModal: Browser.isDevice,
1353
1385
  buttons: [{
1354
1386
  click: this.insertImageUrl.bind(selectObj),
1355
- buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' + ' ' + this.parent.cssClass, isPrimary: true, disabled: true }
1387
+ buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' + this.parent.getCssClass(true), isPrimary: true, disabled: this.parent.editorMode === 'Markdown' ? false : true }
1356
1388
  },
1357
1389
  {
1358
1390
  click: function (e) {
1359
1391
  _this.cancelDialog(e);
1360
1392
  },
1361
- buttonModel: { cssClass: 'e-flat e-cancel' + ' ' + this.parent.cssClass, content: imglinkCancel }
1393
+ buttonModel: { cssClass: 'e-flat e-cancel' + this.parent.getCssClass(true), content: imglinkCancel }
1362
1394
  }],
1363
1395
  target: (Browser.isDevice) ? document.body : this.parent.element,
1364
1396
  animationSettings: { effect: 'None' },
1365
1397
  close: function (event) {
1366
1398
  if (_this.isImgUploaded) {
1367
- _this.uploadObj.removing();
1399
+ _this.uploadObj.remove();
1368
1400
  }
1369
1401
  _this.parent.isBlur = false;
1370
- if (event && event.event.returnValue) {
1402
+ if (event && !isNOU(event.event) && event.event.returnValue) {
1371
1403
  if (_this.parent.editorMode === 'HTML') {
1372
1404
  selection.restore();
1373
1405
  }
@@ -1381,12 +1413,12 @@ var Image = /** @class */ (function () {
1381
1413
  _this.dialogObj = null;
1382
1414
  }
1383
1415
  };
1384
- var dialogContent = this.parent.createElement('div', { className: 'e-img-content' + ' ' + this.parent.cssClass });
1385
- if ((!isNullOrUndefined(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1416
+ var dialogContent = this.parent.createElement('div', { className: 'e-img-content' + this.parent.getCssClass(true) });
1417
+ if ((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1386
1418
  || this.parent.editorMode === 'HTML') {
1387
1419
  dialogContent.appendChild(this.imgUpload(e));
1388
1420
  }
1389
- var linkHeader = this.parent.createElement('div', { className: 'e-linkheader' + ' ' + this.parent.cssClass });
1421
+ var linkHeader = this.parent.createElement('div', { className: 'e-linkheader' + this.parent.getCssClass(true) });
1390
1422
  var linkHeaderText = this.i10n.getConstant('imageLinkHeader');
1391
1423
  if (this.parent.editorMode === 'HTML') {
1392
1424
  linkHeader.innerHTML = linkHeaderText;
@@ -1406,7 +1438,7 @@ var Image = /** @class */ (function () {
1406
1438
  this.dialogObj = this.dialogRenderObj.render(dialogModel);
1407
1439
  this.dialogObj.createElement = this.parent.createElement;
1408
1440
  this.dialogObj.appendTo(imgDialog);
1409
- if (isNullOrUndefined(this.dialogObj)) {
1441
+ if (isNOU(this.dialogObj)) {
1410
1442
  return;
1411
1443
  }
1412
1444
  if (e.selectNode && e.selectNode[0].nodeName === 'IMG' && (e.name === 'insertImage')) {
@@ -1416,7 +1448,7 @@ var Image = /** @class */ (function () {
1416
1448
  if (this.quickToolObj) {
1417
1449
  if (this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
1418
1450
  this.quickToolObj.imageQTBar.hidePopup();
1419
- if (!isNullOrUndefined(e.selectParent)) {
1451
+ if (!isNOU(e.selectParent)) {
1420
1452
  removeClass([e.selectParent[0]], 'e-img-focus');
1421
1453
  }
1422
1454
  }
@@ -1432,9 +1464,6 @@ var Image = /** @class */ (function () {
1432
1464
  Image.prototype.cancelDialog = function (e) {
1433
1465
  this.parent.isBlur = false;
1434
1466
  this.dialogObj.hide({ returnValue: true });
1435
- if (this.isImgUploaded) {
1436
- this.uploadObj.removing();
1437
- }
1438
1467
  };
1439
1468
  Image.prototype.onDocumentClick = function (e) {
1440
1469
  var target = e.target;
@@ -1447,7 +1476,7 @@ var Image = /** @class */ (function () {
1447
1476
  if (target.nodeName !== '#document') {
1448
1477
  this.parent.currentTarget = e.target;
1449
1478
  }
1450
- if (!isNullOrUndefined(this.dialogObj) && ((
1479
+ if (!isNOU(this.dialogObj) && ((
1451
1480
  // eslint-disable-next-line
1452
1481
  !closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
1453
1482
  !this.parent.getToolbarElement().contains(e.target)) ||
@@ -1458,6 +1487,7 @@ var Image = /** @class */ (function () {
1458
1487
  if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
1459
1488
  }
1460
1489
  else {
1490
+ this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
1461
1491
  this.dialogObj.hide({ returnValue: true });
1462
1492
  this.parent.isBlur = true;
1463
1493
  dispatchEvent(this.parent.element, 'focusout');
@@ -1486,9 +1516,11 @@ var Image = /** @class */ (function () {
1486
1516
  for (var i = 0; i < items.length; i++) {
1487
1517
  removeClass([items[i]], 'e-img-focus');
1488
1518
  removeClass([items[i]], 'e-resize');
1489
- items[i].style.maxWidth = '';
1490
1519
  }
1491
1520
  }
1521
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
1522
+ this.dialogObj.hide();
1523
+ }
1492
1524
  };
1493
1525
  Image.prototype.removeResizeEle = function () {
1494
1526
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
@@ -1500,13 +1532,12 @@ var Image = /** @class */ (function () {
1500
1532
  this.cancelResizeAction();
1501
1533
  }
1502
1534
  };
1503
- // eslint-disable-next-line
1504
1535
  Image.prototype.imageUrlPopup = function (e) {
1505
1536
  var _this = this;
1506
- var imgUrl = this.parent.createElement('div', { className: 'imgUrl' + ' ' + this.parent.cssClass });
1537
+ var imgUrl = this.parent.createElement('div', { className: 'imgUrl' + this.parent.getCssClass(true) });
1507
1538
  var placeUrl = this.i10n.getConstant('imageUrl');
1508
1539
  this.inputUrl = this.parent.createElement('input', {
1509
- className: 'e-input e-img-url' + ' ' + this.parent.cssClass,
1540
+ className: 'e-input e-img-url' + this.parent.getCssClass(true),
1510
1541
  attrs: { placeholder: placeUrl, spellcheck: 'false', 'aria-label': this.i10n.getConstant('imageLinkHeader') }
1511
1542
  });
1512
1543
  this.inputUrl.addEventListener('input', function () {
@@ -1519,6 +1550,10 @@ var Image = /** @class */ (function () {
1519
1550
  }
1520
1551
  }
1521
1552
  });
1553
+ if (e.selectNode && e.selectNode[0].nodeName === 'IMG') {
1554
+ var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
1555
+ this.inputUrl.value = e.selectNode[0].src.match(regex) ? e.selectNode[0].src : '';
1556
+ }
1522
1557
  imgUrl.appendChild(this.inputUrl);
1523
1558
  return imgUrl;
1524
1559
  };
@@ -1527,10 +1562,13 @@ var Image = /** @class */ (function () {
1527
1562
  var proxy = this.selfImage;
1528
1563
  proxy.isImgUploaded = false;
1529
1564
  var url = proxy.inputUrl.value;
1565
+ if (proxy.parent.editorMode === 'Markdown' && url === '') {
1566
+ url = 'http://';
1567
+ }
1530
1568
  if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
1531
1569
  proxy.parent.formatter.saveData();
1532
1570
  }
1533
- if (!isNullOrUndefined(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
1571
+ if (!isNOU(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
1534
1572
  proxy.uploadUrl.cssClass = (proxy.parent.insertImageSettings.display === 'inline' ?
1535
1573
  classes.CLS_IMGINLINE : classes.CLS_IMGBREAK);
1536
1574
  proxy.dialogObj.hide({ returnValue: false });
@@ -1542,7 +1580,7 @@ var Image = /** @class */ (function () {
1542
1580
  }
1543
1581
  }
1544
1582
  else if (url !== '') {
1545
- if (proxy.parent.editorMode === 'HTML' && isNullOrUndefined(closest(
1583
+ if (proxy.parent.editorMode === 'HTML' && isNOU(closest(
1546
1584
  // eslint-disable-next-line
1547
1585
  this.selection.range.startContainer.parentNode, '[id=' + "'" + proxy.contentModule.getPanel().id + "'" + ']'))) {
1548
1586
  proxy.contentModule.getEditPanel().focus();
@@ -1551,7 +1589,7 @@ var Image = /** @class */ (function () {
1551
1589
  this.selectParent = proxy.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
1552
1590
  }
1553
1591
  var regex = /[\w-]+.(jpg|png|jpeg|gif)/g;
1554
- var matchUrl = (!isNullOrUndefined(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
1592
+ var matchUrl = (!isNOU(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
1555
1593
  var value = {
1556
1594
  cssClass: (proxy.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
1557
1595
  url: url, selection: this.selection, altText: matchUrl,
@@ -1573,19 +1611,25 @@ var Image = /** @class */ (function () {
1573
1611
  var selectNode = e.selectNode[0];
1574
1612
  var imgHeight = this.i10n.getConstant('imageHeight');
1575
1613
  var imgWidth = this.i10n.getConstant('imageWidth');
1576
- var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' + ' ' + this.parent.cssClass });
1577
- var widthVal = isNullOrUndefined(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
1578
- selectNode.style.width !== '') ? selectNode.style.width : !isNullOrUndefined(this.changedWidthValue) ?
1614
+ var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' + this.parent.getCssClass(true) });
1615
+ var widthVal = isNOU(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
1616
+ selectNode.style.width !== '') ? selectNode.style.width : !isNOU(this.changedWidthValue) ?
1579
1617
  this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
1580
- var heightVal = isNullOrUndefined(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
1581
- selectNode.style.height !== '') ? selectNode.style.height : !isNullOrUndefined(this.changedHeightValue) ?
1618
+ var heightVal = isNOU(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
1619
+ selectNode.style.height !== '') ? selectNode.style.height : !isNOU(this.changedHeightValue) ?
1582
1620
  this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString(), 10)).toString();
1621
+ if (selectNode.style.width === '') {
1622
+ widthVal = 'auto';
1623
+ }
1624
+ if (selectNode.style.height === '') {
1625
+ heightVal = 'auto';
1626
+ }
1583
1627
  this.changedWidthValue = null;
1584
1628
  this.changedHeightValue = null;
1585
- var content = '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"><label>' + imgWidth +
1586
- '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '/></div>' +
1587
- '<div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"> ' +
1588
- '<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '"/></div>';
1629
+ var content = '<div class="e-rte-label' + this.parent.getCssClass(true) + '"><label>' + imgWidth +
1630
+ '</label></div><div class="e-rte-field' + this.parent.getCssClass(true) + '"><input type="text" id="imgwidth" class="e-img-width' + this.parent.getCssClass(true) + '"/></div>' +
1631
+ '<div class="e-rte-label' + this.parent.getCssClass(true) + '">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field' + this.parent.getCssClass(true) + '"> ' +
1632
+ '<input type="text" id="imgheight" class="e-img-height' + this.parent.getCssClass(true) + '"/></div>';
1589
1633
  var contentElem = parseHtml(content);
1590
1634
  contentElem.getElementById('imgwidth').setAttribute('value', widthVal);
1591
1635
  contentElem.getElementById('imgheight').setAttribute('value', heightVal);
@@ -1593,7 +1637,7 @@ var Image = /** @class */ (function () {
1593
1637
  this.widthNum = new TextBox({
1594
1638
  value: formatUnit(widthVal),
1595
1639
  enableRtl: this.parent.enableRtl,
1596
- cssClass: this.parent.cssClass,
1640
+ cssClass: this.parent.getCssClass(),
1597
1641
  input: function (e) {
1598
1642
  _this.inputWidthValue = formatUnit(_this.inputValue(e.value));
1599
1643
  }
@@ -1603,7 +1647,7 @@ var Image = /** @class */ (function () {
1603
1647
  this.heightNum = new TextBox({
1604
1648
  value: formatUnit(heightVal),
1605
1649
  enableRtl: this.parent.enableRtl,
1606
- cssClass: this.parent.cssClass,
1650
+ cssClass: this.parent.getCssClass(),
1607
1651
  input: function (e) {
1608
1652
  _this.inputHeightValue = formatUnit(_this.inputValue(e.value));
1609
1653
  }
@@ -1643,10 +1687,10 @@ var Image = /** @class */ (function () {
1643
1687
  };
1644
1688
  Image.prototype.insertImage = function (e) {
1645
1689
  this.imagDialog(e);
1646
- if (!isNullOrUndefined(this.dialogObj)) {
1690
+ if (!isNOU(this.dialogObj)) {
1647
1691
  this.dialogObj.element.style.maxHeight = 'inherit';
1648
1692
  var dialogContent = this.dialogObj.element.querySelector('.e-img-content');
1649
- if (((!isNullOrUndefined(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1693
+ if (((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1650
1694
  || this.parent.editorMode === 'HTML')) {
1651
1695
  document.getElementById(this.rteID + '_insertImage').focus();
1652
1696
  }
@@ -1662,7 +1706,7 @@ var Image = /** @class */ (function () {
1662
1706
  // eslint-disable-next-line
1663
1707
  var proxy = this;
1664
1708
  var iframe = proxy.parent.iframeSettings.enable;
1665
- if (proxy.parent.editorMode === 'HTML' && (!iframe && isNullOrUndefined(closest(e.selection.range.startContainer.parentNode, '[id='
1709
+ if (proxy.parent.editorMode === 'HTML' && (!iframe && isNOU(closest(e.selection.range.startContainer.parentNode, '[id='
1666
1710
  // eslint-disable-next-line
1667
1711
  + "'" + this.parent.contentModule.getPanel().id + "'" + ']'))
1668
1712
  || (iframe && !hasClass(e.selection.range.startContainer.parentNode.ownerDocument.querySelector('body'), 'e-lib')))) {
@@ -1675,16 +1719,16 @@ var Image = /** @class */ (function () {
1675
1719
  save = e.selection;
1676
1720
  selectParent = e.selectParent;
1677
1721
  }
1678
- var uploadParentEle = this.parent.createElement('div', { className: 'e-img-uploadwrap e-droparea' + ' ' + this.parent.cssClass });
1722
+ var uploadParentEle = this.parent.createElement('div', { className: 'e-img-uploadwrap e-droparea' + this.parent.getCssClass(true) });
1679
1723
  var deviceImgUpMsg = this.i10n.getConstant('imageDeviceUploadMessage');
1680
1724
  var imgUpMsg = this.i10n.getConstant('imageUploadMessage');
1681
- var span = this.parent.createElement('span', { className: 'e-droptext' + ' ' + this.parent.cssClass });
1725
+ var span = this.parent.createElement('span', { className: 'e-droptext' + this.parent.getCssClass(true) });
1682
1726
  var spanMsg = this.parent.createElement('span', {
1683
- className: 'e-rte-upload-text' + ' ' + this.parent.cssClass, innerHTML: ((Browser.isDevice) ? deviceImgUpMsg : imgUpMsg)
1727
+ className: 'e-rte-upload-text' + this.parent.getCssClass(true), innerHTML: ((Browser.isDevice) ? deviceImgUpMsg : imgUpMsg)
1684
1728
  });
1685
1729
  span.appendChild(spanMsg);
1686
1730
  var btnEle = this.parent.createElement('button', {
1687
- className: 'e-browsebtn' + ' ' + this.parent.cssClass, id: this.rteID + '_insertImage', attrs: { autofocus: 'true', type: 'button' }
1731
+ className: 'e-browsebtn' + this.parent.getCssClass(true), id: this.rteID + '_insertImage', attrs: { autofocus: 'true', type: 'button' }
1688
1732
  });
1689
1733
  span.appendChild(btnEle);
1690
1734
  uploadParentEle.appendChild(span);
@@ -1696,7 +1740,7 @@ var Image = /** @class */ (function () {
1696
1740
  var btnClick = (Browser.isDevice) ? span : btnEle;
1697
1741
  EventHandler.add(btnClick, 'click', this.fileSelect, this);
1698
1742
  var uploadEle = this.parent.createElement('input', {
1699
- id: this.rteID + '_upload', attrs: { type: 'File', name: 'UploadFiles' }, className: this.parent.cssClass
1743
+ id: this.rteID + '_upload', attrs: { type: 'File', name: 'UploadFiles' }, className: this.parent.getCssClass()
1700
1744
  });
1701
1745
  uploadParentEle.appendChild(uploadEle);
1702
1746
  var altText;
@@ -1704,7 +1748,7 @@ var Image = /** @class */ (function () {
1704
1748
  var filesData;
1705
1749
  this.uploadObj = new Uploader({
1706
1750
  asyncSettings: { saveUrl: this.parent.insertImageSettings.saveUrl, removeUrl: this.parent.insertImageSettings.removeUrl },
1707
- dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.cssClass,
1751
+ dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
1708
1752
  allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
1709
1753
  selected: function (e) {
1710
1754
  proxy.isImgUploaded = true;
@@ -1714,8 +1758,8 @@ var Image = /** @class */ (function () {
1714
1758
  _this.parent.trigger(events.imageSelected, selectArgs, function (selectArgs) {
1715
1759
  if (!selectArgs.cancel) {
1716
1760
  _this.checkExtension(selectArgs.filesData[0]);
1717
- altText = selectArgs.filesData[0].name;
1718
- if (_this.parent.editorMode === 'HTML' && isNullOrUndefined(_this.parent.insertImageSettings.path)) {
1761
+ altText = selectArgs.filesData[0].name.replace(/\.[a-zA-Z0-9]+$/, '');
1762
+ if (_this.parent.editorMode === 'HTML' && isNOU(_this.parent.insertImageSettings.path)) {
1719
1763
  var reader_1 = new FileReader();
1720
1764
  // eslint-disable-next-line
1721
1765
  reader_1.addEventListener('load', function (e) {
@@ -1734,8 +1778,8 @@ var Image = /** @class */ (function () {
1734
1778
  }
1735
1779
  };
1736
1780
  proxy.inputUrl.setAttribute('disabled', 'true');
1737
- if (isNullOrUndefined(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
1738
- && !isNullOrUndefined(_this.dialogObj)) {
1781
+ if (isNOU(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
1782
+ && !isNOU(_this.dialogObj)) {
1739
1783
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1740
1784
  }
1741
1785
  });
@@ -1754,7 +1798,7 @@ var Image = /** @class */ (function () {
1754
1798
  },
1755
1799
  success: function (e) {
1756
1800
  _this.parent.trigger(events.imageUploadSuccess, e, function (e) {
1757
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
1801
+ if (!isNOU(_this.parent.insertImageSettings.path)) {
1758
1802
  var url = _this.parent.insertImageSettings.path + e.file.name;
1759
1803
  // eslint-disable-next-line
1760
1804
  var value = { url: url, selection: save };
@@ -1770,7 +1814,7 @@ var Image = /** @class */ (function () {
1770
1814
  };
1771
1815
  proxy.inputUrl.setAttribute('disabled', 'true');
1772
1816
  }
1773
- if (e.operation === 'upload' && !isNullOrUndefined(_this.dialogObj)) {
1817
+ if (e.operation === 'upload' && !isNOU(_this.dialogObj)) {
1774
1818
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1775
1819
  }
1776
1820
  });
@@ -1778,9 +1822,9 @@ var Image = /** @class */ (function () {
1778
1822
  failure: function (e) {
1779
1823
  _this.parent.trigger(events.imageUploadFailed, e);
1780
1824
  },
1781
- removing: function () {
1825
+ removing: function (removeEventArgs) {
1782
1826
  // eslint-disable-next-line
1783
- _this.parent.trigger(events.imageRemoving, e, function (e) {
1827
+ _this.parent.trigger(events.imageRemoving, removeEventArgs, function (e) {
1784
1828
  proxy.isImgUploaded = false;
1785
1829
  _this.dialogObj.getButtons(0).element.disabled = true;
1786
1830
  proxy.inputUrl.removeAttribute('disabled');
@@ -2069,7 +2113,7 @@ var Image = /** @class */ (function () {
2069
2113
  saveUrl: this.parent.insertImageSettings.saveUrl,
2070
2114
  removeUrl: this.parent.insertImageSettings.removeUrl
2071
2115
  },
2072
- cssClass: classes.CLS_RTE_DIALOG_UPLOAD + ' ' + this.parent.cssClass,
2116
+ cssClass: classes.CLS_RTE_DIALOG_UPLOAD + this.parent.getCssClass(true),
2073
2117
  dropArea: this.parent.element,
2074
2118
  allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
2075
2119
  removing: function () {
@@ -2099,10 +2143,10 @@ var Image = /** @class */ (function () {
2099
2143
  isUploading = true;
2100
2144
  _this.parent.trigger(events.imageUploading, e, function (imageUploadingArgs) {
2101
2145
  if (imageUploadingArgs.cancel) {
2102
- if (!isNullOrUndefined(imageElement)) {
2146
+ if (!isNOU(imageElement)) {
2103
2147
  detach(imageElement);
2104
2148
  }
2105
- if (!isNullOrUndefined(_this.popupObj.element)) {
2149
+ if (!isNOU(_this.popupObj.element)) {
2106
2150
  detach(_this.popupObj.element);
2107
2151
  }
2108
2152
  }
@@ -2199,7 +2243,7 @@ var Image = /** @class */ (function () {
2199
2243
  imageElement.classList.add(classes.CLS_IMG_FOCUS);
2200
2244
  e.element = imageElement;
2201
2245
  this.parent.trigger(events.imageUploadSuccess, e, function (e) {
2202
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
2246
+ if (!isNOU(_this.parent.insertImageSettings.path)) {
2203
2247
  var url = _this.parent.insertImageSettings.path + e.file.name;
2204
2248
  imageElement.src = url;
2205
2249
  imageElement.setAttribute('alt', e.file.name);
@@ -2214,7 +2258,7 @@ var Image = /** @class */ (function () {
2214
2258
  };
2215
2259
  Image.prototype.imagePaste = function (args) {
2216
2260
  var _this = this;
2217
- if (args.text.length === 0 && !isNullOrUndefined(args.file)) {
2261
+ if (args.text.length === 0 && !isNOU(args.file)) {
2218
2262
  // eslint-disable-next-line
2219
2263
  var proxy_1 = this;
2220
2264
  var reader_2 = new FileReader();
@@ -2223,7 +2267,7 @@ var Image = /** @class */ (function () {
2223
2267
  reader_2.addEventListener('load', function (e) {
2224
2268
  var url = {
2225
2269
  cssClass: (proxy_1.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
2226
- url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNullOrUndefined(args.callBack) ?
2270
+ url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNOU(args.callBack) ?
2227
2271
  reader_2.result : URL.createObjectURL(convertToBlob(reader_2.result)),
2228
2272
  width: {
2229
2273
  width: proxy_1.parent.insertImageSettings.width, minWidth: proxy_1.parent.insertImageSettings.minWidth,
@@ -2234,7 +2278,7 @@ var Image = /** @class */ (function () {
2234
2278
  maxHeight: proxy_1.parent.insertImageSettings.maxHeight
2235
2279
  }
2236
2280
  };
2237
- if (!isNullOrUndefined(args.callBack)) {
2281
+ if (!isNOU(args.callBack)) {
2238
2282
  args.callBack(url);
2239
2283
  return;
2240
2284
  }
@@ -2271,14 +2315,14 @@ var Image = /** @class */ (function () {
2271
2315
  * @method destroy
2272
2316
  * @returns {void}
2273
2317
  * @hidden
2274
-
2318
+ * @deprecated
2275
2319
  */
2276
2320
  /* eslint-enable */
2277
2321
  Image.prototype.destroy = function () {
2278
- this.prevSelectedImgEle = undefined;
2279
2322
  if (isNOU(this.parent)) {
2280
2323
  return;
2281
2324
  }
2325
+ this.prevSelectedImgEle = undefined;
2282
2326
  this.removeEventListener();
2283
2327
  };
2284
2328
  Image.prototype.moduleDestroy = function () {