@syncfusion/ej2-richtexteditor 24.1.41 → 24.1.43-569781

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 (269) hide show
  1. package/.eslintrc.json +259 -259
  2. package/CHANGELOG.md +1927 -1775
  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 +2601 -1077
  7. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  8. package/dist/es6/ej2-richtexteditor.es5.js +2706 -1181
  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 +11 -0
  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 +3 -3
  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 -49
  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 +15 -19
  47. package/src/editor-manager/plugin/indents.d.ts +2 -2
  48. package/src/editor-manager/plugin/indents.js +2 -2
  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 +64 -7
  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 +6 -3
  61. package/src/editor-manager/plugin/lists.d.ts +2 -2
  62. package/src/editor-manager/plugin/lists.js +123 -67
  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 +213 -86
  65. package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
  66. package/src/editor-manager/plugin/nodecutter.js +8 -8
  67. package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
  68. package/src/editor-manager/plugin/selection-commands.js +127 -4
  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 +2 -3
  72. package/src/editor-manager/plugin/table.js +35 -32
  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/markdown-parser/base/interface.d.ts +10 -10
  80. package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
  81. package/src/markdown-parser/base/markdown-parser.js +3 -3
  82. package/src/markdown-parser/base/types.d.ts +1 -1
  83. package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
  84. package/src/markdown-parser/plugin/clearformat.js +2 -2
  85. package/src/markdown-parser/plugin/formats.d.ts +2 -2
  86. package/src/markdown-parser/plugin/formats.js +2 -2
  87. package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
  88. package/src/markdown-parser/plugin/insert-text.js +2 -2
  89. package/src/markdown-parser/plugin/link.d.ts +2 -2
  90. package/src/markdown-parser/plugin/link.js +2 -2
  91. package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
  92. package/src/markdown-parser/plugin/markdown-selection.js +14 -14
  93. package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
  94. package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
  95. package/src/markdown-parser/plugin/table.d.ts +3 -3
  96. package/src/markdown-parser/plugin/table.js +3 -3
  97. package/src/markdown-parser/plugin/undo.d.ts +6 -6
  98. package/src/markdown-parser/plugin/undo.js +6 -6
  99. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +12 -12
  100. package/src/rich-text-editor/actions/base-quick-toolbar.js +57 -20
  101. package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
  102. package/src/rich-text-editor/actions/base-toolbar.js +35 -37
  103. package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
  104. package/src/rich-text-editor/actions/color-picker.js +12 -2
  105. package/src/rich-text-editor/actions/count.d.ts +3 -3
  106. package/src/rich-text-editor/actions/count.js +4 -4
  107. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +2 -2
  108. package/src/rich-text-editor/actions/dropdown-buttons.js +23 -4
  109. package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
  110. package/src/rich-text-editor/actions/emoji-picker.js +4 -4
  111. package/src/rich-text-editor/actions/enter-key.js +4 -3
  112. package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
  113. package/src/rich-text-editor/actions/full-screen.js +6 -5
  114. package/src/rich-text-editor/actions/html-editor.d.ts +5 -5
  115. package/src/rich-text-editor/actions/html-editor.js +129 -45
  116. package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
  117. package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
  118. package/src/rich-text-editor/actions/keyboard.js +23 -21
  119. package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
  120. package/src/rich-text-editor/actions/markdown-editor.js +5 -3
  121. package/src/rich-text-editor/actions/paste-clean-up.d.ts +4 -1
  122. package/src/rich-text-editor/actions/paste-clean-up.js +87 -12
  123. package/src/rich-text-editor/actions/quick-toolbar.d.ts +16 -9
  124. package/src/rich-text-editor/actions/quick-toolbar.js +33 -18
  125. package/src/rich-text-editor/actions/resize.js +2 -1
  126. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  127. package/src/rich-text-editor/actions/toolbar.d.ts +15 -16
  128. package/src/rich-text-editor/actions/toolbar.js +31 -100
  129. package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
  130. package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
  131. package/src/rich-text-editor/base/classes.d.ts +121 -126
  132. package/src/rich-text-editor/base/classes.js +121 -126
  133. package/src/rich-text-editor/base/constant.d.ts +190 -150
  134. package/src/rich-text-editor/base/constant.js +359 -150
  135. package/src/rich-text-editor/base/enum.d.ts +1 -1
  136. package/src/rich-text-editor/base/enum.js +1 -1
  137. package/src/rich-text-editor/base/interface.d.ts +87 -53
  138. package/src/rich-text-editor/base/interface.js +1 -1
  139. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
  140. package/src/rich-text-editor/base/rich-text-editor.d.ts +68 -65
  141. package/src/rich-text-editor/base/rich-text-editor.js +232 -199
  142. package/src/rich-text-editor/base/util.d.ts +5 -1
  143. package/src/rich-text-editor/base/util.js +47 -4
  144. package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
  145. package/src/rich-text-editor/formatter/formatter.js +23 -12
  146. package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
  147. package/src/rich-text-editor/formatter/html-formatter.js +15 -15
  148. package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
  149. package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
  150. package/src/rich-text-editor/models/default-locale.js +30 -26
  151. package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
  152. package/src/rich-text-editor/models/iframe-settings.js +19 -19
  153. package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
  154. package/src/rich-text-editor/models/inline-mode.js +19 -19
  155. package/src/rich-text-editor/models/items.js +2 -2
  156. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
  157. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  158. package/src/rich-text-editor/models/toolbar-settings.js +20 -20
  159. package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
  160. package/src/rich-text-editor/renderer/audio-module.js +14 -1
  161. package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
  162. package/src/rich-text-editor/renderer/content-renderer.js +6 -6
  163. package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
  164. package/src/rich-text-editor/renderer/dialog-renderer.js +14 -3
  165. package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
  166. package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
  167. package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
  168. package/src/rich-text-editor/renderer/image-module.js +200 -168
  169. package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
  170. package/src/rich-text-editor/renderer/link-module.js +11 -2
  171. package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
  172. package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
  173. package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
  174. package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
  175. package/src/rich-text-editor/renderer/render.d.ts +2 -2
  176. package/src/rich-text-editor/renderer/render.js +2 -2
  177. package/src/rich-text-editor/renderer/table-module.d.ts +9 -2
  178. package/src/rich-text-editor/renderer/table-module.js +289 -137
  179. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +13 -9
  180. package/src/rich-text-editor/renderer/toolbar-renderer.js +103 -24
  181. package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
  182. package/src/rich-text-editor/renderer/video-module.js +62 -35
  183. package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
  184. package/src/rich-text-editor/renderer/view-source.js +18 -10
  185. package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
  186. package/src/rich-text-editor/services/renderer-factory.js +3 -3
  187. package/src/rich-text-editor/services/service-locator.d.ts +3 -3
  188. package/src/rich-text-editor/services/service-locator.js +3 -3
  189. package/src/selection/selection.d.ts +22 -22
  190. package/src/selection/selection.js +25 -22
  191. package/styles/_all.scss +1 -1
  192. package/styles/bootstrap-dark.css +153 -49
  193. package/styles/bootstrap.css +158 -57
  194. package/styles/bootstrap4.css +145 -45
  195. package/styles/bootstrap5-dark.css +150 -45
  196. package/styles/bootstrap5.css +150 -45
  197. package/styles/fabric-dark.css +139 -39
  198. package/styles/fabric.css +140 -40
  199. package/styles/fluent-dark.css +147 -41
  200. package/styles/fluent.css +147 -41
  201. package/styles/highcontrast-light.css +139 -39
  202. package/styles/highcontrast.css +143 -40
  203. package/styles/material-dark.css +143 -39
  204. package/styles/material.css +143 -39
  205. package/styles/material3-dark.css +155 -49
  206. package/styles/material3-dark.scss +1 -1
  207. package/styles/material3.css +155 -49
  208. package/styles/material3.scss +1 -1
  209. package/styles/rich-text-editor/_all.scss +2 -2
  210. package/styles/rich-text-editor/_bds-definition.scss +279 -0
  211. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
  212. package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
  213. package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
  214. package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
  215. package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
  216. package/styles/rich-text-editor/_fabric-definition.scss +261 -257
  217. package/styles/rich-text-editor/_fluent-definition.scss +267 -263
  218. package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
  219. package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
  220. package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
  221. package/styles/rich-text-editor/_layout.scss +2249 -2147
  222. package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
  223. package/styles/rich-text-editor/_material-definition.scss +264 -260
  224. package/styles/rich-text-editor/_material3-definition.scss +266 -262
  225. package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
  226. package/styles/rich-text-editor/_theme.scss +906 -837
  227. package/styles/rich-text-editor/bootstrap-dark.css +153 -49
  228. package/styles/rich-text-editor/bootstrap.css +158 -57
  229. package/styles/rich-text-editor/bootstrap4.css +145 -45
  230. package/styles/rich-text-editor/bootstrap5-dark.css +150 -45
  231. package/styles/rich-text-editor/bootstrap5.css +150 -45
  232. package/styles/rich-text-editor/fabric-dark.css +139 -39
  233. package/styles/rich-text-editor/fabric.css +140 -40
  234. package/styles/rich-text-editor/fluent-dark.css +147 -41
  235. package/styles/rich-text-editor/fluent.css +147 -41
  236. package/styles/rich-text-editor/highcontrast-light.css +139 -39
  237. package/styles/rich-text-editor/highcontrast.css +143 -40
  238. package/styles/rich-text-editor/icons/_bds.scss +348 -0
  239. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
  240. package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
  241. package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
  242. package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
  243. package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
  244. package/styles/rich-text-editor/icons/_fabric.scss +349 -349
  245. package/styles/rich-text-editor/icons/_fluent.scss +348 -348
  246. package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
  247. package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
  248. package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
  249. package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
  250. package/styles/rich-text-editor/icons/_material.scss +349 -349
  251. package/styles/rich-text-editor/icons/_material3.scss +348 -348
  252. package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
  253. package/styles/rich-text-editor/material-dark.css +143 -39
  254. package/styles/rich-text-editor/material.css +143 -39
  255. package/styles/rich-text-editor/material3-dark.css +155 -49
  256. package/styles/rich-text-editor/material3-dark.scss +1 -1
  257. package/styles/rich-text-editor/material3.css +155 -49
  258. package/styles/rich-text-editor/material3.scss +1 -1
  259. package/styles/rich-text-editor/tailwind-dark.css +194 -66
  260. package/styles/rich-text-editor/tailwind.css +194 -66
  261. package/styles/tailwind-dark.css +194 -66
  262. package/styles/tailwind.css +194 -66
  263. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
  264. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
  265. package/dist/ej2-richtexteditor.min.js +0 -10
  266. package/dist/global/ej2-richtexteditor.min.js +0 -11
  267. package/dist/global/ej2-richtexteditor.min.js.map +0 -1
  268. package/dist/global/index.d.ts +0 -14
  269. 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
  };
@@ -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 >= 15) ? expectedX : 15) + 'px';
433
- img.style.height = ((expectedX >= 15) ? expectedX : 15) + '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,7 +440,7 @@ 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
446
  }
@@ -467,35 +451,37 @@ var Image = /** @class */ (function () {
467
451
  this.cancelResizeAction();
468
452
  return;
469
453
  }
470
- if (this.imgEle.offsetWidth >= this.parent.getInsertImgMaxWidth()) {
471
- this.imgEle.style.maxHeight = this.imgEle.offsetHeight + 'px';
472
- }
473
- else if (isNOU(this.parent.insertImageSettings.maxHeight)) {
474
- this.imgEle.style.maxHeight = '';
475
- }
476
- this.imgEle.style.maxWidth = (closest(this.imgEle, 'ol,ul') != null ? this.parent.getInsertImgMaxWidth() - parseInt((getComputedStyle(closest(this.imgEle, 'ol,ul')).paddingLeft), 0) : this.parent.getInsertImgMaxWidth()) + 'px';
477
- var pageX = this.getPointX(e);
478
- var pageY = this.getPointY(e);
479
- var mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
480
- var mouseY = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageY - this.pageY) : (pageY - this.pageY);
481
- var width = parseInt(this.imgDupPos.width, 10) + mouseX;
482
- var height = parseInt(this.imgDupPos.height, 10) + mouseY;
483
- this.mouseX = mouseX;
484
- this.pageX = pageX;
485
- this.pageY = pageY;
486
- if (this.resizeBtnStat.botRight) {
487
- this.imgDupMouseMove(width + 'px', height + 'px', e);
488
- }
489
- else if (this.resizeBtnStat.botLeft) {
490
- this.imgDupMouseMove(width + 'px', height + 'px', e);
491
- }
492
- else if (this.resizeBtnStat.topRight) {
493
- this.imgDupMouseMove(width + 'px', height + 'px', e);
494
- }
495
- 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;
496
476
  this.imgDupMouseMove(width + 'px', height + 'px', e);
497
477
  }
498
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
+ };
499
485
  Image.prototype.cancelResizeAction = function () {
500
486
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
501
487
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd);
@@ -505,6 +491,8 @@ var Image = /** @class */ (function () {
505
491
  this.imgResizeDiv = null;
506
492
  this.pageX = null;
507
493
  this.pageY = null;
494
+ this.currentResizeHandler = null;
495
+ this.aspectRatio = null;
508
496
  }
509
497
  };
510
498
  Image.prototype.resizeImgDupPos = function (e) {
@@ -515,6 +503,8 @@ var Image = /** @class */ (function () {
515
503
  };
516
504
  };
517
505
  Image.prototype.resizeBtnInit = function () {
506
+ this.aspectRatio = null;
507
+ this.currentResizeHandler = null;
518
508
  return this.resizeBtnStat = { botLeft: false, botRight: false, topRight: false, topLeft: false };
519
509
  };
520
510
  Image.prototype.onToolbarAction = function (args) {
@@ -587,7 +577,7 @@ var Image = /** @class */ (function () {
587
577
  });
588
578
  if (this.quickToolObj && document.body.contains(this.quickToolObj.imageQTBar.element)) {
589
579
  this.quickToolObj.imageQTBar.hidePopup();
590
- if (!isNullOrUndefined(e.selectParent)) {
580
+ if (!isNOU(e.selectParent)) {
591
581
  removeClass([e.selectParent[0]], 'e-img-focus');
592
582
  }
593
583
  }
@@ -627,7 +617,7 @@ var Image = /** @class */ (function () {
627
617
  this.checkImageDel(range);
628
618
  }
629
619
  }
630
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) &&
620
+ if (!isNOU(this.parent.formatter.editorManager.nodeSelection) &&
631
621
  originalEvent.code !== 'KeyK') {
632
622
  range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
633
623
  selectNodeEle = this.parent.formatter.editorManager.nodeSelection.getNodeCollection(range);
@@ -644,11 +634,13 @@ var Image = /** @class */ (function () {
644
634
  }
645
635
  }
646
636
  if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
647
- this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
637
+ if (this.parent.editorMode !== 'Markdown') {
638
+ this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
639
+ }
648
640
  }
649
641
  if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
650
642
  if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
651
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
643
+ if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
652
644
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
653
645
  }
654
646
  originalEvent.preventDefault();
@@ -670,7 +662,7 @@ var Image = /** @class */ (function () {
670
662
  }
671
663
  switch (originalEvent.action) {
672
664
  case 'escape':
673
- if (!isNullOrUndefined(this.dialogObj)) {
665
+ if (!isNOU(this.dialogObj)) {
674
666
  this.dialogObj.close();
675
667
  }
676
668
  break;
@@ -718,13 +710,21 @@ var Image = /** @class */ (function () {
718
710
  }
719
711
  break;
720
712
  case 'insert-image':
721
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
713
+ if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
722
714
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
723
715
  }
724
716
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
725
717
  originalEvent.preventDefault();
726
718
  break;
727
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);
728
728
  };
729
729
  Image.prototype.openDialog = function (isInternal, event, selection, ele, parentEle) {
730
730
  var range;
@@ -868,8 +868,8 @@ var Image = /** @class */ (function () {
868
868
  };
869
869
  Image.prototype.showImageQuickToolbar = function (e) {
870
870
  var _this = this;
871
- if (e.type !== 'Images' || isNullOrUndefined(this.parent.quickToolbarModule)
872
- || 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)) {
873
873
  return;
874
874
  }
875
875
  this.quickToolObj = this.parent.quickToolbarModule;
@@ -894,15 +894,17 @@ var Image = /** @class */ (function () {
894
894
  _this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
895
895
  _this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
896
896
  _this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
897
+ _this.resizeStart(e.args, target);
897
898
  }, 400);
898
899
  }
899
900
  else {
900
- this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
901
+ var coordinates = target.getBoundingClientRect();
902
+ this.quickToolObj.imageQTBar.showPopup(coordinates.left, coordinates.top, target, 'Image');
901
903
  }
902
904
  }
903
905
  };
904
906
  Image.prototype.hideImageQuickToolbar = function () {
905
- if (!isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
907
+ if (!isNOU(this.contentModule.getEditPanel().querySelector('.e-img-focus'))) {
906
908
  removeClass([this.contentModule.getEditPanel().querySelector('.e-img-focus')], 'e-img-focus');
907
909
  if (this.quickToolObj && this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
908
910
  this.quickToolObj.imageQTBar.hidePopup();
@@ -917,7 +919,7 @@ var Image = /** @class */ (function () {
917
919
  var args = e.args;
918
920
  var showOnRightClick = this.parent.quickToolbarSettings.showOnRightClick;
919
921
  if (args.which === 2 || (showOnRightClick && args.which === 1) || (!showOnRightClick && args.which === 3)) {
920
- if ((showOnRightClick && args.which === 1) && !isNullOrUndefined(args.target) &&
922
+ if ((showOnRightClick && args.which === 1) && !isNOU(args.target) &&
921
923
  args.target.tagName === 'IMG') {
922
924
  this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
923
925
  this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), args.target);
@@ -977,7 +979,7 @@ var Image = /** @class */ (function () {
977
979
  return;
978
980
  }
979
981
  this.imagDialog(e);
980
- if (!isNullOrUndefined(this.dialogObj)) {
982
+ if (!isNOU(this.dialogObj)) {
981
983
  var linkWrap = this.parent.createElement('div', { className: 'e-img-linkwrap' + this.parent.getCssClass(true) });
982
984
  var linkUrl = this.i10n.getConstant('linkurl');
983
985
  var content = '<div class="e-rte-field' + this.parent.getCssClass(true) + '">' +
@@ -1004,7 +1006,7 @@ var Image = /** @class */ (function () {
1004
1006
  this.checkBoxObj.createElement = this.parent.createElement;
1005
1007
  this.checkBoxObj.appendTo(linkTarget);
1006
1008
  var target_1 = this.checkBoxObj.checked ? '_blank' : null;
1007
- var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null;
1009
+ var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
1008
1010
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
1009
1011
  var linkargs_1 = {
1010
1012
  args: e.args,
@@ -1012,7 +1014,6 @@ var Image = /** @class */ (function () {
1012
1014
  selectNode: e.selectNode, selectParent: e.selectParent, link: inputLink, target: target_1, ariaLabel: imageLabel
1013
1015
  };
1014
1016
  this.dialogObj.setProperties({
1015
- height: 'inherit',
1016
1017
  width: '290px',
1017
1018
  header: this.parent.localeObj.getConstant('imageInsertLinkHeader'),
1018
1019
  content: linkWrap,
@@ -1030,7 +1031,7 @@ var Image = /** @class */ (function () {
1030
1031
  if (!isNOU(this.parent.cssClass)) {
1031
1032
  this.dialogObj.setProperties({ cssClass: this.parent.cssClass });
1032
1033
  }
1033
- if (!isNullOrUndefined(inputDetails)) {
1034
+ if (!isNOU(inputDetails)) {
1034
1035
  inputLink.value = inputDetails.url;
1035
1036
  // eslint-disable-next-line
1036
1037
  (inputDetails.target) ? this.checkBoxObj.checked = true : this.checkBoxObj.checked = false;
@@ -1047,7 +1048,7 @@ var Image = /** @class */ (function () {
1047
1048
  }
1048
1049
  this.imagDialog(e);
1049
1050
  var altText = this.i10n.getConstant('altText');
1050
- if (!isNullOrUndefined(this.dialogObj)) {
1051
+ if (!isNOU(this.dialogObj)) {
1051
1052
  var altWrap = this.parent.createElement('div', { className: 'e-img-altwrap' + this.parent.getCssClass(true) });
1052
1053
  var altHeader = this.i10n.getConstant('alternateHeader');
1053
1054
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
@@ -1065,7 +1066,7 @@ var Image = /** @class */ (function () {
1065
1066
  alt: inputAlt
1066
1067
  };
1067
1068
  this.dialogObj.setProperties({
1068
- height: 'inherit', width: '290px', header: altHeader, content: altWrap,
1069
+ width: '290px', header: altHeader, content: altWrap,
1069
1070
  buttons: [{
1070
1071
  // eslint-disable-next-line
1071
1072
  click: function (e) {
@@ -1085,7 +1086,7 @@ var Image = /** @class */ (function () {
1085
1086
  }
1086
1087
  };
1087
1088
  Image.prototype.insertAlt = function (e) {
1088
- if (!isNullOrUndefined(e.alt)) {
1089
+ if (!isNOU(e.alt)) {
1089
1090
  e.selection.restore();
1090
1091
  if (this.parent.formatter.getUndoRedoStack().length === 0) {
1091
1092
  this.parent.formatter.saveData();
@@ -1124,14 +1125,14 @@ var Image = /** @class */ (function () {
1124
1125
  }
1125
1126
  if (e.selectNode[0].parentElement.nodeName === 'A') {
1126
1127
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
1127
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : 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,
1128
1129
  subCommand: e.args.item.subCommand
1129
1130
  });
1130
1131
  proxy.dialogObj.hide({ returnValue: true });
1131
1132
  return;
1132
1133
  }
1133
1134
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
1134
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : 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,
1135
1136
  subCommand: e.args.item.subCommand, selection: e.selection
1136
1137
  });
1137
1138
  var captionEle = closest(e.selectNode[0], '.e-img-caption');
@@ -1159,7 +1160,29 @@ var Image = /** @class */ (function () {
1159
1160
  if (this.parent.formatter.getUndoRedoStack().length === 0) {
1160
1161
  this.parent.formatter.saveData();
1161
1162
  }
1162
- 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
+ }
1163
1186
  if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
1164
1187
  this.removeResizeEle();
1165
1188
  }
@@ -1173,7 +1196,7 @@ var Image = /** @class */ (function () {
1173
1196
  this.quickToolObj.imageQTBar.hidePopup();
1174
1197
  }
1175
1198
  this.cancelResizeAction();
1176
- if (isNullOrUndefined(keyCode)) {
1199
+ if (isNOU(keyCode)) {
1177
1200
  this.parent.trigger(events.afterImageDelete, args);
1178
1201
  }
1179
1202
  };
@@ -1227,7 +1250,7 @@ var Image = /** @class */ (function () {
1227
1250
  addClass([selectNode], 'e-rte-image');
1228
1251
  var subCommand = (e.args.item) ?
1229
1252
  e.args.item.subCommand : 'Caption';
1230
- if (!isNullOrUndefined(closest(selectNode, '.' + classes.CLS_CAPTION))) {
1253
+ if (!isNOU(closest(selectNode, '.' + classes.CLS_CAPTION))) {
1231
1254
  detach(closest(selectNode, '.' + classes.CLS_CAPTION));
1232
1255
  if (Browser.isIE) {
1233
1256
  this.contentModule.getEditPanel().focus();
@@ -1286,13 +1309,13 @@ var Image = /** @class */ (function () {
1286
1309
  return;
1287
1310
  }
1288
1311
  this.imagDialog(e);
1289
- if (!isNullOrUndefined(this.dialogObj)) {
1312
+ if (!isNOU(this.dialogObj)) {
1290
1313
  var imgSizeHeader = this.i10n.getConstant('imageSizeHeader');
1291
1314
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
1292
1315
  var dialogContent = this.imgsizeInput(e);
1293
1316
  var selectObj_1 = { args: e.args, selfImage: this, selection: e.selection, selectNode: e.selectNode };
1294
1317
  this.dialogObj.setProperties({
1295
- height: (Browser.isDevice) ? '300px' : 'inherit', width: '290px', header: imgSizeHeader, content: dialogContent,
1318
+ width: '290px', header: imgSizeHeader, content: dialogContent,
1296
1319
  buttons: [{
1297
1320
  // eslint-disable-next-line
1298
1321
  click: function (e) {
@@ -1361,7 +1384,7 @@ var Image = /** @class */ (function () {
1361
1384
  isModal: Browser.isDevice,
1362
1385
  buttons: [{
1363
1386
  click: this.insertImageUrl.bind(selectObj),
1364
- buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage' + this.parent.getCssClass(true), 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 }
1365
1388
  },
1366
1389
  {
1367
1390
  click: function (e) {
@@ -1373,7 +1396,7 @@ var Image = /** @class */ (function () {
1373
1396
  animationSettings: { effect: 'None' },
1374
1397
  close: function (event) {
1375
1398
  if (_this.isImgUploaded) {
1376
- _this.uploadObj.removing();
1399
+ _this.uploadObj.remove();
1377
1400
  }
1378
1401
  _this.parent.isBlur = false;
1379
1402
  if (event && event.event.returnValue) {
@@ -1391,7 +1414,7 @@ var Image = /** @class */ (function () {
1391
1414
  }
1392
1415
  };
1393
1416
  var dialogContent = this.parent.createElement('div', { className: 'e-img-content' + this.parent.getCssClass(true) });
1394
- if ((!isNullOrUndefined(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1417
+ if ((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1395
1418
  || this.parent.editorMode === 'HTML') {
1396
1419
  dialogContent.appendChild(this.imgUpload(e));
1397
1420
  }
@@ -1415,7 +1438,7 @@ var Image = /** @class */ (function () {
1415
1438
  this.dialogObj = this.dialogRenderObj.render(dialogModel);
1416
1439
  this.dialogObj.createElement = this.parent.createElement;
1417
1440
  this.dialogObj.appendTo(imgDialog);
1418
- if (isNullOrUndefined(this.dialogObj)) {
1441
+ if (isNOU(this.dialogObj)) {
1419
1442
  return;
1420
1443
  }
1421
1444
  if (e.selectNode && e.selectNode[0].nodeName === 'IMG' && (e.name === 'insertImage')) {
@@ -1425,7 +1448,7 @@ var Image = /** @class */ (function () {
1425
1448
  if (this.quickToolObj) {
1426
1449
  if (this.quickToolObj.imageQTBar && document.body.contains(this.quickToolObj.imageQTBar.element)) {
1427
1450
  this.quickToolObj.imageQTBar.hidePopup();
1428
- if (!isNullOrUndefined(e.selectParent)) {
1451
+ if (!isNOU(e.selectParent)) {
1429
1452
  removeClass([e.selectParent[0]], 'e-img-focus');
1430
1453
  }
1431
1454
  }
@@ -1441,9 +1464,6 @@ var Image = /** @class */ (function () {
1441
1464
  Image.prototype.cancelDialog = function (e) {
1442
1465
  this.parent.isBlur = false;
1443
1466
  this.dialogObj.hide({ returnValue: true });
1444
- if (this.isImgUploaded) {
1445
- this.uploadObj.removing();
1446
- }
1447
1467
  };
1448
1468
  Image.prototype.onDocumentClick = function (e) {
1449
1469
  var target = e.target;
@@ -1456,7 +1476,7 @@ var Image = /** @class */ (function () {
1456
1476
  if (target.nodeName !== '#document') {
1457
1477
  this.parent.currentTarget = e.target;
1458
1478
  }
1459
- if (!isNullOrUndefined(this.dialogObj) && ((
1479
+ if (!isNOU(this.dialogObj) && ((
1460
1480
  // eslint-disable-next-line
1461
1481
  !closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']') && this.parent.toolbarSettings.enable && this.parent.getToolbarElement() &&
1462
1482
  !this.parent.getToolbarElement().contains(e.target)) ||
@@ -1467,6 +1487,7 @@ var Image = /** @class */ (function () {
1467
1487
  if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
1468
1488
  }
1469
1489
  else {
1490
+ this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
1470
1491
  this.dialogObj.hide({ returnValue: true });
1471
1492
  this.parent.isBlur = true;
1472
1493
  dispatchEvent(this.parent.element, 'focusout');
@@ -1495,7 +1516,6 @@ var Image = /** @class */ (function () {
1495
1516
  for (var i = 0; i < items.length; i++) {
1496
1517
  removeClass([items[i]], 'e-img-focus');
1497
1518
  removeClass([items[i]], 'e-resize');
1498
- items[i].style.maxWidth = '';
1499
1519
  }
1500
1520
  }
1501
1521
  };
@@ -1509,7 +1529,6 @@ var Image = /** @class */ (function () {
1509
1529
  this.cancelResizeAction();
1510
1530
  }
1511
1531
  };
1512
- // eslint-disable-next-line
1513
1532
  Image.prototype.imageUrlPopup = function (e) {
1514
1533
  var _this = this;
1515
1534
  var imgUrl = this.parent.createElement('div', { className: 'imgUrl' + this.parent.getCssClass(true) });
@@ -1528,6 +1547,10 @@ var Image = /** @class */ (function () {
1528
1547
  }
1529
1548
  }
1530
1549
  });
1550
+ if (e.selectNode && e.selectNode[0].nodeName === 'IMG') {
1551
+ var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
1552
+ this.inputUrl.value = e.selectNode[0].src.match(regex) ? e.selectNode[0].src : '';
1553
+ }
1531
1554
  imgUrl.appendChild(this.inputUrl);
1532
1555
  return imgUrl;
1533
1556
  };
@@ -1536,10 +1559,13 @@ var Image = /** @class */ (function () {
1536
1559
  var proxy = this.selfImage;
1537
1560
  proxy.isImgUploaded = false;
1538
1561
  var url = proxy.inputUrl.value;
1562
+ if (proxy.parent.editorMode === 'Markdown' && url === '') {
1563
+ url = 'http://';
1564
+ }
1539
1565
  if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
1540
1566
  proxy.parent.formatter.saveData();
1541
1567
  }
1542
- if (!isNullOrUndefined(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
1568
+ if (!isNOU(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
1543
1569
  proxy.uploadUrl.cssClass = (proxy.parent.insertImageSettings.display === 'inline' ?
1544
1570
  classes.CLS_IMGINLINE : classes.CLS_IMGBREAK);
1545
1571
  proxy.dialogObj.hide({ returnValue: false });
@@ -1551,7 +1577,7 @@ var Image = /** @class */ (function () {
1551
1577
  }
1552
1578
  }
1553
1579
  else if (url !== '') {
1554
- if (proxy.parent.editorMode === 'HTML' && isNullOrUndefined(closest(
1580
+ if (proxy.parent.editorMode === 'HTML' && isNOU(closest(
1555
1581
  // eslint-disable-next-line
1556
1582
  this.selection.range.startContainer.parentNode, '[id=' + "'" + proxy.contentModule.getPanel().id + "'" + ']'))) {
1557
1583
  proxy.contentModule.getEditPanel().focus();
@@ -1560,7 +1586,7 @@ var Image = /** @class */ (function () {
1560
1586
  this.selectParent = proxy.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
1561
1587
  }
1562
1588
  var regex = /[\w-]+.(jpg|png|jpeg|gif)/g;
1563
- var matchUrl = (!isNullOrUndefined(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
1589
+ var matchUrl = (!isNOU(url.match(regex)) && proxy.parent.editorMode === 'HTML') ? url.match(regex)[0] : '';
1564
1590
  var value = {
1565
1591
  cssClass: (proxy.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
1566
1592
  url: url, selection: this.selection, altText: matchUrl,
@@ -1583,12 +1609,18 @@ var Image = /** @class */ (function () {
1583
1609
  var imgHeight = this.i10n.getConstant('imageHeight');
1584
1610
  var imgWidth = this.i10n.getConstant('imageWidth');
1585
1611
  var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' + this.parent.getCssClass(true) });
1586
- var widthVal = isNullOrUndefined(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
1587
- selectNode.style.width !== '') ? selectNode.style.width : !isNullOrUndefined(this.changedWidthValue) ?
1612
+ var widthVal = isNOU(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
1613
+ selectNode.style.width !== '') ? selectNode.style.width : !isNOU(this.changedWidthValue) ?
1588
1614
  this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
1589
- var heightVal = isNullOrUndefined(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
1590
- selectNode.style.height !== '') ? selectNode.style.height : !isNullOrUndefined(this.changedHeightValue) ?
1615
+ var heightVal = isNOU(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
1616
+ selectNode.style.height !== '') ? selectNode.style.height : !isNOU(this.changedHeightValue) ?
1591
1617
  this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString(), 10)).toString();
1618
+ if (selectNode.style.width === '') {
1619
+ widthVal = 'auto';
1620
+ }
1621
+ if (selectNode.style.height === '') {
1622
+ heightVal = 'auto';
1623
+ }
1592
1624
  this.changedWidthValue = null;
1593
1625
  this.changedHeightValue = null;
1594
1626
  var content = '<div class="e-rte-label' + this.parent.getCssClass(true) + '"><label>' + imgWidth +
@@ -1652,10 +1684,10 @@ var Image = /** @class */ (function () {
1652
1684
  };
1653
1685
  Image.prototype.insertImage = function (e) {
1654
1686
  this.imagDialog(e);
1655
- if (!isNullOrUndefined(this.dialogObj)) {
1687
+ if (!isNOU(this.dialogObj)) {
1656
1688
  this.dialogObj.element.style.maxHeight = 'inherit';
1657
1689
  var dialogContent = this.dialogObj.element.querySelector('.e-img-content');
1658
- if (((!isNullOrUndefined(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1690
+ if (((!isNOU(this.parent.insertImageSettings.path) && this.parent.editorMode === 'Markdown')
1659
1691
  || this.parent.editorMode === 'HTML')) {
1660
1692
  document.getElementById(this.rteID + '_insertImage').focus();
1661
1693
  }
@@ -1671,7 +1703,7 @@ var Image = /** @class */ (function () {
1671
1703
  // eslint-disable-next-line
1672
1704
  var proxy = this;
1673
1705
  var iframe = proxy.parent.iframeSettings.enable;
1674
- if (proxy.parent.editorMode === 'HTML' && (!iframe && isNullOrUndefined(closest(e.selection.range.startContainer.parentNode, '[id='
1706
+ if (proxy.parent.editorMode === 'HTML' && (!iframe && isNOU(closest(e.selection.range.startContainer.parentNode, '[id='
1675
1707
  // eslint-disable-next-line
1676
1708
  + "'" + this.parent.contentModule.getPanel().id + "'" + ']'))
1677
1709
  || (iframe && !hasClass(e.selection.range.startContainer.parentNode.ownerDocument.querySelector('body'), 'e-lib')))) {
@@ -1723,8 +1755,8 @@ var Image = /** @class */ (function () {
1723
1755
  _this.parent.trigger(events.imageSelected, selectArgs, function (selectArgs) {
1724
1756
  if (!selectArgs.cancel) {
1725
1757
  _this.checkExtension(selectArgs.filesData[0]);
1726
- altText = selectArgs.filesData[0].name;
1727
- if (_this.parent.editorMode === 'HTML' && isNullOrUndefined(_this.parent.insertImageSettings.path)) {
1758
+ altText = selectArgs.filesData[0].name.replace(/\.[a-zA-Z0-9]+$/, '');
1759
+ if (_this.parent.editorMode === 'HTML' && isNOU(_this.parent.insertImageSettings.path)) {
1728
1760
  var reader_1 = new FileReader();
1729
1761
  // eslint-disable-next-line
1730
1762
  reader_1.addEventListener('load', function (e) {
@@ -1743,8 +1775,8 @@ var Image = /** @class */ (function () {
1743
1775
  }
1744
1776
  };
1745
1777
  proxy.inputUrl.setAttribute('disabled', 'true');
1746
- if (isNullOrUndefined(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
1747
- && !isNullOrUndefined(_this.dialogObj)) {
1778
+ if (isNOU(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
1779
+ && !isNOU(_this.dialogObj)) {
1748
1780
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1749
1781
  }
1750
1782
  });
@@ -1763,7 +1795,7 @@ var Image = /** @class */ (function () {
1763
1795
  },
1764
1796
  success: function (e) {
1765
1797
  _this.parent.trigger(events.imageUploadSuccess, e, function (e) {
1766
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
1798
+ if (!isNOU(_this.parent.insertImageSettings.path)) {
1767
1799
  var url = _this.parent.insertImageSettings.path + e.file.name;
1768
1800
  // eslint-disable-next-line
1769
1801
  var value = { url: url, selection: save };
@@ -1779,7 +1811,7 @@ var Image = /** @class */ (function () {
1779
1811
  };
1780
1812
  proxy.inputUrl.setAttribute('disabled', 'true');
1781
1813
  }
1782
- if (e.operation === 'upload' && !isNullOrUndefined(_this.dialogObj)) {
1814
+ if (e.operation === 'upload' && !isNOU(_this.dialogObj)) {
1783
1815
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1784
1816
  }
1785
1817
  });
@@ -2108,10 +2140,10 @@ var Image = /** @class */ (function () {
2108
2140
  isUploading = true;
2109
2141
  _this.parent.trigger(events.imageUploading, e, function (imageUploadingArgs) {
2110
2142
  if (imageUploadingArgs.cancel) {
2111
- if (!isNullOrUndefined(imageElement)) {
2143
+ if (!isNOU(imageElement)) {
2112
2144
  detach(imageElement);
2113
2145
  }
2114
- if (!isNullOrUndefined(_this.popupObj.element)) {
2146
+ if (!isNOU(_this.popupObj.element)) {
2115
2147
  detach(_this.popupObj.element);
2116
2148
  }
2117
2149
  }
@@ -2208,7 +2240,7 @@ var Image = /** @class */ (function () {
2208
2240
  imageElement.classList.add(classes.CLS_IMG_FOCUS);
2209
2241
  e.element = imageElement;
2210
2242
  this.parent.trigger(events.imageUploadSuccess, e, function (e) {
2211
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
2243
+ if (!isNOU(_this.parent.insertImageSettings.path)) {
2212
2244
  var url = _this.parent.insertImageSettings.path + e.file.name;
2213
2245
  imageElement.src = url;
2214
2246
  imageElement.setAttribute('alt', e.file.name);
@@ -2223,7 +2255,7 @@ var Image = /** @class */ (function () {
2223
2255
  };
2224
2256
  Image.prototype.imagePaste = function (args) {
2225
2257
  var _this = this;
2226
- if (args.text.length === 0 && !isNullOrUndefined(args.file)) {
2258
+ if (args.text.length === 0 && !isNOU(args.file)) {
2227
2259
  // eslint-disable-next-line
2228
2260
  var proxy_1 = this;
2229
2261
  var reader_2 = new FileReader();
@@ -2232,7 +2264,7 @@ var Image = /** @class */ (function () {
2232
2264
  reader_2.addEventListener('load', function (e) {
2233
2265
  var url = {
2234
2266
  cssClass: (proxy_1.parent.insertImageSettings.display === 'inline' ? classes.CLS_IMGINLINE : classes.CLS_IMGBREAK),
2235
- url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNullOrUndefined(args.callBack) ?
2267
+ url: _this.parent.insertImageSettings.saveFormat === 'Base64' || !isNOU(args.callBack) ?
2236
2268
  reader_2.result : URL.createObjectURL(convertToBlob(reader_2.result)),
2237
2269
  width: {
2238
2270
  width: proxy_1.parent.insertImageSettings.width, minWidth: proxy_1.parent.insertImageSettings.minWidth,
@@ -2243,7 +2275,7 @@ var Image = /** @class */ (function () {
2243
2275
  maxHeight: proxy_1.parent.insertImageSettings.maxHeight
2244
2276
  }
2245
2277
  };
2246
- if (!isNullOrUndefined(args.callBack)) {
2278
+ if (!isNOU(args.callBack)) {
2247
2279
  args.callBack(url);
2248
2280
  return;
2249
2281
  }
@@ -2280,7 +2312,7 @@ var Image = /** @class */ (function () {
2280
2312
  * @method destroy
2281
2313
  * @returns {void}
2282
2314
  * @hidden
2283
-
2315
+ * @deprecated
2284
2316
  */
2285
2317
  /* eslint-enable */
2286
2318
  Image.prototype.destroy = function () {