@syncfusion/ej2-richtexteditor 19.2.57 → 19.3.43

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 (117) hide show
  1. package/.eslintrc.json +1 -1
  2. package/CHANGELOG.md +61 -9
  3. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  4. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es2015.js +1006 -312
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +1014 -310
  8. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  9. package/dist/global/ej2-richtexteditor.min.js +2 -2
  10. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +12 -12
  13. package/src/common/types.d.ts +8 -0
  14. package/src/editor-manager/base/editor-manager.d.ts +1 -1
  15. package/src/editor-manager/base/editor-manager.js +6 -6
  16. package/src/editor-manager/base/interface.d.ts +7 -1
  17. package/src/editor-manager/plugin/clearformat-exec.js +2 -2
  18. package/src/editor-manager/plugin/clearformat.d.ts +3 -1
  19. package/src/editor-manager/plugin/clearformat.js +19 -9
  20. package/src/editor-manager/plugin/dom-node.js +2 -2
  21. package/src/editor-manager/plugin/formats.d.ts +1 -0
  22. package/src/editor-manager/plugin/formats.js +87 -7
  23. package/src/editor-manager/plugin/image.js +77 -54
  24. package/src/editor-manager/plugin/inserthtml.js +20 -2
  25. package/src/editor-manager/plugin/isformatted.js +2 -1
  26. package/src/editor-manager/plugin/lists.d.ts +1 -0
  27. package/src/editor-manager/plugin/lists.js +87 -8
  28. package/src/editor-manager/plugin/nodecutter.d.ts +1 -0
  29. package/src/editor-manager/plugin/nodecutter.js +1 -0
  30. package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
  31. package/src/editor-manager/plugin/selection-commands.js +29 -12
  32. package/src/editor-manager/plugin/selection-exec.js +2 -2
  33. package/src/editor-manager/plugin/table.js +19 -9
  34. package/src/editor-manager/plugin/toolbar-status.d.ts +1 -0
  35. package/src/editor-manager/plugin/toolbar-status.js +20 -0
  36. package/src/rich-text-editor/actions/base-quick-toolbar.js +3 -4
  37. package/src/rich-text-editor/actions/enter-key.d.ts +18 -0
  38. package/src/rich-text-editor/actions/enter-key.js +290 -0
  39. package/src/rich-text-editor/actions/full-screen.js +62 -42
  40. package/src/rich-text-editor/actions/html-editor.js +30 -20
  41. package/src/rich-text-editor/actions/paste-clean-up.js +5 -5
  42. package/src/rich-text-editor/actions/resize.js +4 -4
  43. package/src/rich-text-editor/base/constant.d.ts +5 -0
  44. package/src/rich-text-editor/base/constant.js +5 -0
  45. package/src/rich-text-editor/base/interface.d.ts +15 -3
  46. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +27 -1
  47. package/src/rich-text-editor/base/rich-text-editor.d.ts +34 -5
  48. package/src/rich-text-editor/base/rich-text-editor.js +66 -57
  49. package/src/rich-text-editor/base/util.d.ts +7 -1
  50. package/src/rich-text-editor/base/util.js +45 -11
  51. package/src/rich-text-editor/formatter/formatter.js +9 -7
  52. package/src/rich-text-editor/models/items.js +3 -3
  53. package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -2
  54. package/src/rich-text-editor/renderer/image-module.d.ts +6 -0
  55. package/src/rich-text-editor/renderer/image-module.js +70 -26
  56. package/src/rich-text-editor/renderer/link-module.js +4 -3
  57. package/src/rich-text-editor/renderer/popup-renderer.js +1 -2
  58. package/src/rich-text-editor/renderer/render.js +10 -2
  59. package/src/rich-text-editor/renderer/table-module.js +25 -15
  60. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -1
  61. package/src/rich-text-editor/renderer/view-source.js +21 -3
  62. package/styles/bootstrap-dark.css +25 -12
  63. package/styles/bootstrap.css +25 -12
  64. package/styles/bootstrap4.css +21 -13
  65. package/styles/bootstrap5-dark.css +3058 -0
  66. package/styles/bootstrap5-dark.scss +1 -0
  67. package/styles/bootstrap5.css +3058 -0
  68. package/styles/bootstrap5.scss +1 -0
  69. package/styles/fabric-dark.css +20 -12
  70. package/styles/fabric.css +20 -12
  71. package/styles/highcontrast-light.css +20 -12
  72. package/styles/highcontrast.css +19 -18
  73. package/styles/material-dark.css +22 -14
  74. package/styles/material.css +19 -11
  75. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -1
  76. package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
  77. package/styles/rich-text-editor/_bootstrap4-definition.scss +2 -2
  78. package/styles/rich-text-editor/_bootstrap5-dark-definition.scss +1 -0
  79. package/styles/rich-text-editor/_bootstrap5-definition.scss +168 -0
  80. package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -1
  81. package/styles/rich-text-editor/_fabric-definition.scss +1 -1
  82. package/styles/rich-text-editor/_highcontrast-definition.scss +2 -2
  83. package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -1
  84. package/styles/rich-text-editor/_layout.scss +64 -7
  85. package/styles/rich-text-editor/_tailwind-dark-definition.scss +1 -165
  86. package/styles/rich-text-editor/_tailwind-definition.scss +74 -72
  87. package/styles/rich-text-editor/_theme.scss +103 -3
  88. package/styles/rich-text-editor/bootstrap-dark.css +25 -12
  89. package/styles/rich-text-editor/bootstrap.css +25 -12
  90. package/styles/rich-text-editor/bootstrap4.css +21 -13
  91. package/styles/rich-text-editor/bootstrap5-dark.css +3058 -0
  92. package/styles/rich-text-editor/bootstrap5-dark.scss +4 -0
  93. package/styles/rich-text-editor/bootstrap5.css +3058 -0
  94. package/styles/rich-text-editor/bootstrap5.scss +4 -0
  95. package/styles/rich-text-editor/fabric-dark.css +20 -12
  96. package/styles/rich-text-editor/fabric.css +20 -12
  97. package/styles/rich-text-editor/highcontrast-light.css +20 -12
  98. package/styles/rich-text-editor/highcontrast.css +19 -18
  99. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +1 -1
  100. package/styles/rich-text-editor/icons/_bootstrap.scss +1 -1
  101. package/styles/rich-text-editor/icons/_bootstrap4.scss +1 -1
  102. package/styles/rich-text-editor/icons/_bootstrap5-dark.scss +1 -0
  103. package/styles/rich-text-editor/icons/_bootstrap5.scss +303 -0
  104. package/styles/rich-text-editor/icons/_fabric-dark.scss +1 -1
  105. package/styles/rich-text-editor/icons/_fabric.scss +1 -1
  106. package/styles/rich-text-editor/icons/_highcontrast-light.scss +1 -1
  107. package/styles/rich-text-editor/icons/_highcontrast.scss +1 -1
  108. package/styles/rich-text-editor/icons/_material-dark.scss +1 -1
  109. package/styles/rich-text-editor/icons/_material.scss +1 -1
  110. package/styles/rich-text-editor/icons/_tailwind-dark.scss +1 -304
  111. package/styles/rich-text-editor/icons/_tailwind.scss +2 -2
  112. package/styles/rich-text-editor/material-dark.css +22 -14
  113. package/styles/rich-text-editor/material.css +19 -11
  114. package/styles/rich-text-editor/tailwind-dark.css +51 -20
  115. package/styles/rich-text-editor/tailwind.css +49 -18
  116. package/styles/tailwind-dark.css +51 -20
  117. package/styles/tailwind.css +49 -18
@@ -149,14 +149,14 @@ export var tools = {
149
149
  'numberformatlist': {
150
150
  'id': 'NumberFormatList',
151
151
  'icon': 'e-order-list',
152
- 'tooltip': 'NumberFormatList',
152
+ 'tooltip': 'Number Format List',
153
153
  'command': 'NumberFormatList',
154
154
  'subCommand': 'NumberFormatList'
155
155
  },
156
156
  'bulletformatlist': {
157
157
  'id': 'BulletFormatList',
158
158
  'icon': 'e-unorder-list',
159
- 'tooltip': 'BulletFormatList',
159
+ 'tooltip': 'Bullet Format List',
160
160
  'command': 'BulletFormatList',
161
161
  'subCommand': 'BulletFormatList'
162
162
  },
@@ -330,7 +330,7 @@ export var tools = {
330
330
  },
331
331
  'dimension': {
332
332
  'id': 'Dimension',
333
- 'icon': 'e-dimension',
333
+ 'icon': 'e-img-dimension',
334
334
  'tooltip': 'Change Size',
335
335
  'command': 'Images',
336
336
  'subCommand': 'Dimension'
@@ -39,10 +39,10 @@ var IframeContentRender = /** @class */ (function (_super) {
39
39
  rteContent + '</body></html>';
40
40
  var iFrameContent = IFRAMEHEADER + iFrameBodyContent;
41
41
  var iframe = this.parent.createElement('iframe', {
42
- innerHTML: iFrameContent,
43
42
  id: this.parent.getID() + '_rte-view',
44
43
  className: 'e-rte-content',
45
- styles: 'display:block;'
44
+ styles: 'display:block;',
45
+ attrs: { 'srcdoc': iFrameContent }
46
46
  });
47
47
  this.setPanel(iframe);
48
48
  rteObj.element.appendChild(iframe);
@@ -24,10 +24,15 @@ export declare class Image {
24
24
  private imgEle;
25
25
  private prevSelectedImgEle;
26
26
  private isImgUploaded;
27
+ private isAllowedTypes;
27
28
  private pageX;
28
29
  private pageY;
29
30
  private dialogRenderObj;
30
31
  private deletedImg;
32
+ private changedWidthValue;
33
+ private changedHeightValue;
34
+ private inputWidthValue;
35
+ private inputHeightValue;
31
36
  private constructor();
32
37
  protected addEventListener(): void;
33
38
  protected removeEventListener(): void;
@@ -87,6 +92,7 @@ export declare class Image {
87
92
  private imageUrlPopup;
88
93
  private insertImageUrl;
89
94
  private imgsizeInput;
95
+ private inputValue;
90
96
  private insertSize;
91
97
  private insertImage;
92
98
  private imgUpload;
@@ -1,8 +1,8 @@
1
- import { addClass, detach, EventHandler, isNullOrUndefined, select, isBlazor, Ajax } from '@syncfusion/ej2-base';
1
+ import { addClass, detach, EventHandler, isNullOrUndefined, 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';
5
- import { Uploader, NumericTextBox } from '@syncfusion/ej2-inputs';
5
+ import { Uploader, TextBox } from '@syncfusion/ej2-inputs';
6
6
  import { Popup } from '@syncfusion/ej2-popups';
7
7
  import { Button, CheckBox } from '@syncfusion/ej2-buttons';
8
8
  import { RenderType } from '../base/enum';
@@ -14,6 +14,7 @@ import { isIDevice } from '../../common/util';
14
14
  var Image = /** @class */ (function () {
15
15
  function Image(parent, serviceLocator) {
16
16
  this.isImgUploaded = false;
17
+ this.isAllowedTypes = true;
17
18
  this.pageX = null;
18
19
  this.pageY = null;
19
20
  this.deletedImg = [];
@@ -134,7 +135,7 @@ var Image = /** @class */ (function () {
134
135
  if (Browser.isDevice) {
135
136
  removeClass([e.target.parentElement], 'e-mob-span');
136
137
  }
137
- var args = isBlazor() ? { requestType: 'images' } : { event: e, requestType: 'images' };
138
+ var args = { event: e, requestType: 'images' };
138
139
  this.parent.trigger(events.resizeStop, args);
139
140
  /* eslint-disable */
140
141
  var pageX = this.getPointX(e);
@@ -188,7 +189,7 @@ var Image = /** @class */ (function () {
188
189
  addClass([this.imgResizeDiv], 'e-mob-span');
189
190
  }
190
191
  else {
191
- var args = isBlazor() ? { requestType: 'images' } : { event: e, requestType: 'images' };
192
+ var args = { event: e, requestType: 'images' };
192
193
  this.parent.trigger(events.resizeStart, args, function (resizeStartArgs) {
193
194
  if (resizeStartArgs.cancel) {
194
195
  _this.cancelResizeAction();
@@ -323,6 +324,12 @@ var Image = /** @class */ (function () {
323
324
  img.style.height = null;
324
325
  img.removeAttribute('height');
325
326
  }
327
+ else if (img.style.width === '' && img.style.height !== '') {
328
+ img.style.height = expectedY + 'px';
329
+ }
330
+ else if (img.style.width !== '' && img.style.height === '') {
331
+ img.style.width = ((width / height * expectedY) + width / height).toString() + 'px';
332
+ }
326
333
  else if (img.style.width !== '') {
327
334
  img.style.width = (width / height * expectedY) + 'px';
328
335
  img.style.height = expectedY + 'px';
@@ -371,7 +378,7 @@ var Image = /** @class */ (function () {
371
378
  };
372
379
  Image.prototype.imgDupMouseMove = function (width, height, e) {
373
380
  var _this = this;
374
- var args = isBlazor() ? { requestType: 'images' } : { event: e, requestType: 'images' };
381
+ var args = { event: e, requestType: 'images' };
375
382
  this.parent.trigger(events.onResize, args, function (resizingArgs) {
376
383
  if (resizingArgs.cancel) {
377
384
  _this.cancelResizeAction();
@@ -1198,7 +1205,7 @@ var Image = /** @class */ (function () {
1198
1205
  isModal: Browser.isDevice,
1199
1206
  buttons: [{
1200
1207
  click: this.insertImageUrl.bind(selectObj),
1201
- buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage', isPrimary: true }
1208
+ buttonModel: { content: imgInsert, cssClass: 'e-flat e-insertImage', isPrimary: true, disabled: true }
1202
1209
  },
1203
1210
  {
1204
1211
  click: function (e) {
@@ -1324,12 +1331,23 @@ var Image = /** @class */ (function () {
1324
1331
  };
1325
1332
  // eslint-disable-next-line
1326
1333
  Image.prototype.imageUrlPopup = function (e) {
1334
+ var _this = this;
1327
1335
  var imgUrl = this.parent.createElement('div', { className: 'imgUrl' });
1328
1336
  var placeUrl = this.i10n.getConstant('imageUrl');
1329
1337
  this.inputUrl = this.parent.createElement('input', {
1330
1338
  className: 'e-input e-img-url',
1331
1339
  attrs: { placeholder: placeUrl, spellcheck: 'false' }
1332
1340
  });
1341
+ this.inputUrl.addEventListener('input', function () {
1342
+ if (!isNOU(_this.inputUrl)) {
1343
+ if (_this.inputUrl.value.length === 0) {
1344
+ _this.dialogObj.getButtons(0).element.disabled = true;
1345
+ }
1346
+ else {
1347
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1348
+ }
1349
+ }
1350
+ });
1333
1351
  imgUrl.appendChild(this.inputUrl);
1334
1352
  return imgUrl;
1335
1353
  };
@@ -1380,42 +1398,58 @@ var Image = /** @class */ (function () {
1380
1398
  }
1381
1399
  };
1382
1400
  Image.prototype.imgsizeInput = function (e) {
1401
+ var _this = this;
1383
1402
  var selectNode = e.selectNode[0];
1384
1403
  var imgHeight = this.i10n.getConstant('imageHeight');
1385
1404
  var imgWidth = this.i10n.getConstant('imageWidth');
1386
1405
  var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' });
1387
- var widthVal = (selectNode.getAttribute('width') === 'auto' ||
1388
- isNullOrUndefined(selectNode.getAttribute('width'))) ? selectNode.width : selectNode.getClientRects()[0].width;
1389
- var heightVal = (selectNode.getAttribute('height') === 'auto' ||
1390
- isNullOrUndefined(selectNode.getAttribute('height'))) ? selectNode.height : selectNode.getClientRects()[0].height;
1406
+ var widthVal = isNullOrUndefined(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
1407
+ selectNode.style.width !== "") ? selectNode.style.width : !isNullOrUndefined(this.changedWidthValue) ?
1408
+ this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString())).toString();
1409
+ var heightVal = isNullOrUndefined(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
1410
+ selectNode.style.height !== "") ? selectNode.style.height : !isNullOrUndefined(this.changedHeightValue) ?
1411
+ this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString())).toString();
1412
+ this.changedWidthValue = null;
1413
+ this.changedHeightValue = null;
1391
1414
  var content = '<div class="e-rte-label"><label>' + imgWidth +
1392
- '</label></div><div class="e-rte-field"><input type="text" data-role ="none" id="imgwidth" class="e-img-width" value=' +
1415
+ '</label></div><div class="e-rte-field"><input type="text" id="imgwidth" class="e-img-width" value=' +
1393
1416
  widthVal
1394
1417
  + ' /></div>' +
1395
1418
  '<div class="e-rte-label">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field"> ' +
1396
- '<input type="text" data-role ="none" id="imgheight" class="e-img-height" value=' +
1419
+ '<input type="text" id="imgheight" class="e-img-height" value=' +
1397
1420
  heightVal
1398
1421
  + ' /></div>';
1399
1422
  var contentElem = parseHtml(content);
1400
1423
  imgSizeWrap.appendChild(contentElem);
1401
- var widthNum = new NumericTextBox({
1402
- format: '###.### px', min: this.parent.insertImageSettings.minWidth,
1403
- max: this.parent.getInsertImgMaxWidth(),
1404
- enableRtl: this.parent.enableRtl, locale: this.parent.locale
1424
+ var widthNum = new TextBox({
1425
+ value: formatUnit(widthVal),
1426
+ enableRtl: this.parent.enableRtl,
1427
+ input: function (e) {
1428
+ _this.inputWidthValue = formatUnit(_this.inputValue(e.value));
1429
+ }
1405
1430
  });
1406
- widthNum.isStringTemplate = true;
1407
1431
  widthNum.createElement = this.parent.createElement;
1408
1432
  widthNum.appendTo(imgSizeWrap.querySelector('#imgwidth'));
1409
- var heightNum = new NumericTextBox({
1410
- format: '###.### px', min: this.parent.insertImageSettings.minHeight,
1411
- max: this.parent.insertImageSettings.maxHeight,
1412
- enableRtl: this.parent.enableRtl, locale: this.parent.locale
1433
+ var heightNum = new TextBox({
1434
+ value: formatUnit(heightVal),
1435
+ enableRtl: this.parent.enableRtl,
1436
+ input: function (e) {
1437
+ _this.inputHeightValue = formatUnit(_this.inputValue(e.value));
1438
+ }
1413
1439
  });
1414
- heightNum.isStringTemplate = true;
1415
1440
  heightNum.createElement = this.parent.createElement;
1416
1441
  heightNum.appendTo(imgSizeWrap.querySelector('#imgheight'));
1417
1442
  return imgSizeWrap;
1418
1443
  };
1444
+ Image.prototype.inputValue = function (value) {
1445
+ if (value === 'auto' || value.indexOf('%') !== -1 || value.indexOf('px') !== -1
1446
+ || value.match(/(\d+)/)) {
1447
+ return value;
1448
+ }
1449
+ else {
1450
+ return "auto";
1451
+ }
1452
+ };
1419
1453
  Image.prototype.insertSize = function (e) {
1420
1454
  e.selection.restore();
1421
1455
  var proxy = e.selfImage;
@@ -1423,8 +1457,10 @@ var Image = /** @class */ (function () {
1423
1457
  proxy.parent.formatter.saveData();
1424
1458
  }
1425
1459
  var dialogEle = proxy.dialogObj.element;
1426
- var width = parseFloat(dialogEle.querySelector('.e-img-width').value);
1427
- var height = parseFloat(dialogEle.parentElement.querySelector('.e-img-height').value);
1460
+ this.changedWidthValue = this.inputWidthValue;
1461
+ this.changedHeightValue = this.inputHeightValue;
1462
+ var width = dialogEle.querySelector('.e-img-width').value;
1463
+ var height = dialogEle.parentElement.querySelector('.e-img-height').value;
1428
1464
  proxy.parent.formatter.process(this.parent, e.args, e.args, {
1429
1465
  width: width, height: height, selectNode: e.selectNode,
1430
1466
  subCommand: e.args.item.subCommand
@@ -1534,6 +1570,10 @@ var Image = /** @class */ (function () {
1534
1570
  }
1535
1571
  };
1536
1572
  proxy.inputUrl.setAttribute('disabled', 'true');
1573
+ if (isNullOrUndefined(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
1574
+ && !isNullOrUndefined(_this.dialogObj)) {
1575
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1576
+ }
1537
1577
  });
1538
1578
  reader_1.readAsDataURL(selectArgs.filesData[0].rawFile);
1539
1579
  }
@@ -1590,6 +1630,9 @@ var Image = /** @class */ (function () {
1590
1630
  };
1591
1631
  proxy.inputUrl.setAttribute('disabled', 'true');
1592
1632
  }
1633
+ if (e.operation === 'upload' && !isNullOrUndefined(_this.dialogObj)) {
1634
+ _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1635
+ }
1593
1636
  });
1594
1637
  },
1595
1638
  failure: function (e) {
@@ -1599,11 +1642,11 @@ var Image = /** @class */ (function () {
1599
1642
  // eslint-disable-next-line
1600
1643
  _this.parent.trigger(events.imageRemoving, e, function (e) {
1601
1644
  proxy.isImgUploaded = false;
1645
+ _this.dialogObj.getButtons(0).element.disabled = true;
1602
1646
  proxy.inputUrl.removeAttribute('disabled');
1603
1647
  if (proxy.uploadUrl) {
1604
1648
  proxy.uploadUrl.url = '';
1605
1649
  }
1606
- _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1607
1650
  });
1608
1651
  }
1609
1652
  });
@@ -1616,9 +1659,10 @@ var Image = /** @class */ (function () {
1616
1659
  if (this.uploadObj.allowedExtensions) {
1617
1660
  if (this.uploadObj.allowedExtensions.toLocaleLowerCase().indexOf(('.' + e.type).toLocaleLowerCase()) === -1) {
1618
1661
  this.dialogObj.getButtons(0).element.setAttribute('disabled', 'disabled');
1662
+ this.isAllowedTypes = false;
1619
1663
  }
1620
1664
  else {
1621
- this.dialogObj.getButtons(0).element.removeAttribute('disabled');
1665
+ this.isAllowedTypes = true;
1622
1666
  }
1623
1667
  }
1624
1668
  };
@@ -1,4 +1,4 @@
1
- import { EventHandler, detach, isNullOrUndefined, select, isBlazor, extend } from '@syncfusion/ej2-base';
1
+ import { EventHandler, detach, isNullOrUndefined, select, extend } from '@syncfusion/ej2-base';
2
2
  import { closest, addClass, removeClass, Browser } from '@syncfusion/ej2-base';
3
3
  import * as events from '../base/constant';
4
4
  import { CLS_RTE_ELEMENTS } from '../base/classes';
@@ -293,7 +293,7 @@ var Link = /** @class */ (function () {
293
293
  }
294
294
  _this.dialogObj.destroy();
295
295
  detach(_this.dialogObj.element);
296
- var args = isBlazor() ? null : _this.dialogObj;
296
+ var args = _this.dialogObj;
297
297
  _this.dialogRenderObj.close(args);
298
298
  _this.dialogObj = null;
299
299
  }
@@ -385,7 +385,8 @@ var Link = /** @class */ (function () {
385
385
  proxy.parent.formatter.saveData();
386
386
  }
387
387
  var argsValue;
388
- if (this.args.code === 'KeyK') {
388
+ if (!isNullOrUndefined(this.args) &&
389
+ this.args.code === 'KeyK') {
389
390
  var originalEvent = this.args;
390
391
  extend(this.args, { item: { command: 'Links', subCommand: 'CreateLink' }, originalEvent: originalEvent }, true);
391
392
  var argsVal = {
@@ -1,6 +1,5 @@
1
1
  import { Popup } from '@syncfusion/ej2-popups';
2
2
  import { CLS_QUICK_POP } from '../base/classes';
3
- import { isBlazor } from '@syncfusion/ej2-base';
4
3
  import * as events from '../base/constant';
5
4
  /**
6
5
  * `Popup renderer` module is used to render popup in RichTextEditor.
@@ -18,7 +17,7 @@ var PopupRenderer = /** @class */ (function () {
18
17
  this.parent = parent;
19
18
  }
20
19
  PopupRenderer.prototype.quickToolbarOpen = function () {
21
- var args = isBlazor() ? { element: this.popupObj.element } : this.popupObj;
20
+ var args = this.popupObj;
22
21
  this.parent.trigger(events.quickToolbarOpen, args);
23
22
  };
24
23
  /**
@@ -74,9 +74,17 @@ var Render = /** @class */ (function () {
74
74
  var childNodes = this.parent.contentModule.getEditPanel().childNodes;
75
75
  if ((childNodes.length === 0) ||
76
76
  (childNodes.length === 1 && childNodes[0].childNodes.length === 0 && ((childNodes[0].tagName === 'BR') ||
77
- (childNodes[0].tagName === 'P' && childNodes[0].textContent === '')))) {
77
+ ((childNodes[0].tagName === 'P' || childNodes[0].tagName === 'DIV') && childNodes[0].textContent === '')))) {
78
78
  var node = this.parent.contentModule.getEditPanel();
79
- node.innerHTML = '<p><br/></p>';
79
+ if (this.parent.enterKey === 'DIV') {
80
+ node.innerHTML = '<div><br/></div>';
81
+ }
82
+ else if (this.parent.enterKey === 'BR') {
83
+ node.innerHTML = '<br/>';
84
+ }
85
+ else {
86
+ node.innerHTML = '<p><br/></p>';
87
+ }
80
88
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), node.childNodes[0], 0);
81
89
  }
82
90
  break;
@@ -1,4 +1,4 @@
1
- import { detach, closest, Browser, isNullOrUndefined as isNOU, isBlazor } from '@syncfusion/ej2-base';
1
+ import { detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
2
2
  import { isNullOrUndefined, EventHandler, addClass, removeClass } from '@syncfusion/ej2-base';
3
3
  import { Popup } from '@syncfusion/ej2-popups';
4
4
  import { Button } from '@syncfusion/ej2-buttons';
@@ -68,14 +68,16 @@ var Table = /** @class */ (function () {
68
68
  }
69
69
  };
70
70
  Table.prototype.afterRender = function () {
71
- this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
72
- this.parent.on(events.tableColorPickerChanged, this.setBGColor, this);
73
- this.parent.on(events.mouseDown, this.cellSelect, this);
74
- if (this.parent.tableSettings.resize) {
75
- EventHandler.add(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart, this);
76
- }
77
- if (!Browser.isDevice && this.parent.tableSettings.resize) {
78
- EventHandler.add(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper, this);
71
+ if (isNullOrUndefined(this.contentModule)) {
72
+ this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
73
+ this.parent.on(events.tableColorPickerChanged, this.setBGColor, this);
74
+ this.parent.on(events.mouseDown, this.cellSelect, this);
75
+ if (this.parent.tableSettings.resize) {
76
+ EventHandler.add(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart, this);
77
+ }
78
+ if (!Browser.isDevice && this.parent.tableSettings.resize) {
79
+ EventHandler.add(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper, this);
80
+ }
79
81
  }
80
82
  };
81
83
  Table.prototype.dropdownSelect = function (e) {
@@ -109,6 +111,7 @@ var Table = /** @class */ (function () {
109
111
  break;
110
112
  case 'Dashed':
111
113
  case 'Alternate':
114
+ case 'Custom':
112
115
  this.tableStyles(args, item.subCommand);
113
116
  break;
114
117
  case 'Merge':
@@ -232,6 +235,13 @@ var Table = /** @class */ (function () {
232
235
  table.classList.add(classes.CLS_TB_ALT_BOR);
233
236
  /* eslint-enable */
234
237
  }
238
+ if (args.args && args.args.item.cssClass) {
239
+ var classList = args.args.item.cssClass.split(' ');
240
+ for (var i = 0; i < classList.length; i++) {
241
+ (table.classList.contains(classList[i])) ? table.classList.remove(classList[i]) :
242
+ table.classList.add(classList[i]);
243
+ }
244
+ }
235
245
  this.parent.formatter.saveData();
236
246
  this.parent.formatter.editorManager.nodeSelection.restore();
237
247
  };
@@ -448,7 +458,7 @@ var Table = /** @class */ (function () {
448
458
  selectionObj.selection = proxy.parent.formatter.editorManager.nodeSelection.save(range, proxy.contentModule.getDocument());
449
459
  }
450
460
  var value = {
451
- row: row, columns: col, width: {
461
+ rows: row, columns: col, width: {
452
462
  minWidth: proxy.parent.tableSettings.minWidth,
453
463
  maxWidth: proxy.parent.tableSettings.maxWidth,
454
464
  width: proxy.parent.tableSettings.width
@@ -586,8 +596,8 @@ var Table = /** @class */ (function () {
586
596
  parentOffset = offsetParent.getBoundingClientRect();
587
597
  }
588
598
  return {
589
- top: offset.top - parentOffset.top,
590
- left: offset.left - parentOffset.left
599
+ top: elem.offsetTop,
600
+ left: elem.offsetLeft
591
601
  };
592
602
  };
593
603
  Table.prototype.getPointX = function (e) {
@@ -647,7 +657,7 @@ var Table = /** @class */ (function () {
647
657
  EventHandler.add(this.helper, Browser.touchStartEvent, this.resizeStart, this);
648
658
  }
649
659
  else {
650
- var args = isBlazor() ? { requestType: 'Table' } : { event: e, requestType: 'Table' };
660
+ var args = { event: e, requestType: 'Table' };
651
661
  this.parent.trigger(events.resizeStart, args, function (resizeStartArgs) {
652
662
  if (resizeStartArgs.cancel) {
653
663
  _this.cancelResizeAction();
@@ -724,7 +734,7 @@ var Table = /** @class */ (function () {
724
734
  var mouseY = (this.parent.enableRtl) ? -(pageY - this.pageY) : (pageY - this.pageY);
725
735
  this.pageX = pageX;
726
736
  this.pageY = pageY;
727
- var args = isBlazor() ? { requestType: 'table' } : { event: e, requestType: 'table' };
737
+ var args = { event: e, requestType: 'table' };
728
738
  this.parent.trigger(events.onResize, args, function (resizingArgs) {
729
739
  if (resizingArgs.cancel) {
730
740
  _this.cancelResizeAction();
@@ -811,7 +821,7 @@ var Table = /** @class */ (function () {
811
821
  this.pageY = null;
812
822
  this.moveEle = null;
813
823
  }
814
- var args = isBlazor() ? { requestType: 'table' } : { event: e, requestType: 'table' };
824
+ var args = { event: e, requestType: 'table' };
815
825
  this.parent.trigger(events.resizeStop, args);
816
826
  this.parent.formatter.saveData();
817
827
  };
@@ -46,7 +46,7 @@ var ToolbarRenderer = /** @class */ (function () {
46
46
  if (!this.parent.enabled) {
47
47
  return;
48
48
  }
49
- if (!this.parent.readonly) {
49
+ if (!this.parent.readonly || isNullOrUndefined(args.item)) {
50
50
  this.parent.notify(events.toolbarClick, args);
51
51
  }
52
52
  this.parent.trigger('toolbarClick', args);
@@ -178,7 +178,21 @@ var ViewSource = /** @class */ (function () {
178
178
  baseToolbar: this.parent.getBaseToolbarObject()
179
179
  });
180
180
  var serializeValue = this.parent.serializeValue(editHTML.value);
181
- var value = (serializeValue === null || serializeValue === '') ? '<p><br/></p>' : serializeValue;
181
+ var value;
182
+ if (serializeValue === null || serializeValue === '') {
183
+ if (this.parent.enterKey === 'DIV') {
184
+ value = '<div><br/></div>';
185
+ }
186
+ else if (this.parent.enterKey === 'BR') {
187
+ value = '<br/>';
188
+ }
189
+ else {
190
+ value = '<p><br/></p>';
191
+ }
192
+ }
193
+ else {
194
+ value = serializeValue;
195
+ }
182
196
  if (this.parent.iframeSettings.enable) {
183
197
  editHTML.parentElement.style.display = 'none';
184
198
  editHTML.style.display = 'none';
@@ -210,9 +224,13 @@ var ViewSource = /** @class */ (function () {
210
224
  };
211
225
  ViewSource.prototype.getTextAreaValue = function () {
212
226
  return (this.contentModule.getEditPanel().innerHTML === '<p><br></p>') ||
227
+ (this.contentModule.getEditPanel().innerHTML === '<div><br></div>') ||
228
+ (this.contentModule.getEditPanel().innerHTML === '<br>') ||
213
229
  (this.contentModule.getEditPanel().childNodes.length === 1 &&
214
- this.contentModule.getEditPanel().childNodes[0].tagName === 'P' &&
215
- this.contentModule.getEditPanel().innerHTML.length === 7) ? '' : this.parent.value;
230
+ (this.contentModule.getEditPanel().childNodes[0].tagName === 'P' &&
231
+ this.contentModule.getEditPanel().innerHTML.length === 7) ||
232
+ (this.contentModule.getEditPanel().childNodes[0].tagName === 'DIV' &&
233
+ this.contentModule.getEditPanel().innerHTML.length === 11)) ? '' : this.parent.value;
216
234
  };
217
235
  /**
218
236
  * getPanel method
@@ -196,8 +196,8 @@
196
196
  content: '\e33c';
197
197
  }
198
198
 
199
- .e-rte-toolbar .e-dimension::before,
200
- .e-rte-dropdown-popup .e-dimension::before {
199
+ .e-rte-toolbar .e-img-dimension::before,
200
+ .e-rte-dropdown-popup .e-img-dimension::before {
201
201
  content: '\e336';
202
202
  }
203
203
 
@@ -663,15 +663,15 @@
663
663
  font-size: 13px;
664
664
  }
665
665
 
666
- .e-richtexteditor .e-rte-toolbar .e-toolbar-items .e-toolbar-item .e-rte-numberformatlist-dropdown .e-order-list.e-icons::before,
667
- .e-richtexteditor .e-rte-toolbar .e-toolbar-items .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-unorder-list.e-icons::before,
668
- .e-richtexteditor .e-rte-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-numberformatlist-dropdown .e-order-list.e-icons::before,
669
- .e-richtexteditor .e-rte-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-unorder-list.e-icons::before,
670
- .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-items .e-toolbar-item .e-rte-numberformatlist-dropdown .e-order-list.e-icons::before,
671
- .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-items .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-unorder-list.e-icons::before,
672
- .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-numberformatlist-dropdown .e-order-list.e-icons::before,
673
- .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-unorder-list.e-icons::before {
674
- font-size: 14px;
666
+ .e-richtexteditor .e-rte-toolbar .e-toolbar-items .e-toolbar-item .e-rte-numberformatlist-dropdown .e-rte-list-primary-content,
667
+ .e-richtexteditor .e-rte-toolbar .e-toolbar-items .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-rte-list-primary-content,
668
+ .e-richtexteditor .e-rte-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-numberformatlist-dropdown .e-rte-list-primary-content,
669
+ .e-richtexteditor .e-rte-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-rte-list-primary-content,
670
+ .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-items .e-toolbar-item .e-rte-numberformatlist-dropdown .e-rte-list-primary-content,
671
+ .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-items .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-rte-list-primary-content,
672
+ .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-numberformatlist-dropdown .e-rte-list-primary-content,
673
+ .e-richtexteditor .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown .e-rte-list-primary-content {
674
+ line-height: 1;
675
675
  }
676
676
 
677
677
  .e-richtexteditor .e-rte-toolbar .e-toolbar-items .e-toolbar-item .e-background-color.e-icons::before,
@@ -1884,7 +1884,7 @@
1884
1884
  .e-rte-toolbar.e-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control.e-active .e-rte-list-primary-content .e-order-list,
1885
1885
  .e-rte-toolbar.e-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control .e-rte-list-primary-content .e-unorder-list,
1886
1886
  .e-rte-toolbar.e-toolbar .e-toolbar-extended .e-toolbar-item .e-rte-bulletformatlist-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control.e-active .e-rte-list-primary-content .e-unorder-list {
1887
- line-height: 25px;
1887
+ line-height: 30px;
1888
1888
  }
1889
1889
 
1890
1890
  .e-rte-toolbar.e-toolbar.e-extended-toolbar .e-toolbar-items .e-toolbar-item .e-rte-fontcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control .e-rte-color-content::after,
@@ -2384,6 +2384,11 @@
2384
2384
  padding: 0;
2385
2385
  }
2386
2386
 
2387
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control {
2388
+ padding-left: 0;
2389
+ padding-right: 0;
2390
+ }
2391
+
2387
2392
  .e-richtexteditor .e-rte-table-popup.e-popup-open.e-dialog .e-rte-tablecell {
2388
2393
  margin: 1px;
2389
2394
  }
@@ -2394,6 +2399,10 @@
2394
2399
  border-bottom: 0;
2395
2400
  }
2396
2401
 
2402
+ .e-richtexteditor .e-rte-toolbar .e-toolbar-item.e-overlay .e-tbar-btn .e-icons {
2403
+ color: #f0f0f0;
2404
+ }
2405
+
2397
2406
  .e-richtexteditor .e-rte-toolbar .e-toolbar-item.e-active .e-tbar-btn,
2398
2407
  .e-richtexteditor .e-rte-toolbar .e-toolbar-item.e-active .e-tbar-btn:focus {
2399
2408
  background: rgba(26, 26, 26, 0.12);
@@ -2658,6 +2667,10 @@
2658
2667
  border-bottom: 0;
2659
2668
  }
2660
2669
 
2670
+ .e-richtexteditor.e-rte-tb-expand .e-rte-toolbar .e-toolbar-extended.e-popup-open {
2671
+ border-bottom: 0;
2672
+ }
2673
+
2661
2674
  .e-richtexteditor.e-rte-tb-expand .e-rte-toolbar.e-expand-open + .e-rte-content {
2662
2675
  border-top: 0;
2663
2676
  }