@syncfusion/ej2-richtexteditor 24.2.9 → 25.1.35

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 (133) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/ej2-richtexteditor.min.js +2 -2
  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 +908 -485
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +892 -474
  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 +13 -13
  13. package/src/common/config.d.ts +7 -0
  14. package/src/common/config.js +11 -0
  15. package/src/common/interface.d.ts +12 -0
  16. package/src/common/types.d.ts +6 -0
  17. package/src/editor-manager/plugin/dom-node.d.ts +5 -1
  18. package/src/editor-manager/plugin/dom-node.js +161 -12
  19. package/src/editor-manager/plugin/formats.js +1 -1
  20. package/src/editor-manager/plugin/image.js +12 -16
  21. package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
  22. package/src/editor-manager/plugin/inserthtml.js +31 -0
  23. package/src/editor-manager/plugin/link.js +1 -1
  24. package/src/editor-manager/plugin/lists.js +24 -2
  25. package/src/editor-manager/plugin/ms-word-clean-up.js +65 -57
  26. package/src/editor-manager/plugin/selection-commands.js +52 -3
  27. package/src/editor-manager/plugin/table.js +18 -3
  28. package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
  29. package/src/editor-manager/plugin/toolbar-status.js +17 -9
  30. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -3
  31. package/src/rich-text-editor/actions/base-quick-toolbar.js +41 -10
  32. package/src/rich-text-editor/actions/base-toolbar.js +24 -30
  33. package/src/rich-text-editor/actions/dropdown-buttons.js +4 -4
  34. package/src/rich-text-editor/actions/emoji-picker.js +1 -1
  35. package/src/rich-text-editor/actions/enter-key.js +2 -1
  36. package/src/rich-text-editor/actions/full-screen.js +2 -2
  37. package/src/rich-text-editor/actions/html-editor.d.ts +0 -2
  38. package/src/rich-text-editor/actions/html-editor.js +8 -26
  39. package/src/rich-text-editor/actions/markdown-editor.js +3 -1
  40. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  41. package/src/rich-text-editor/actions/paste-clean-up.js +23 -0
  42. package/src/rich-text-editor/actions/quick-toolbar.d.ts +7 -0
  43. package/src/rich-text-editor/actions/quick-toolbar.js +23 -8
  44. package/src/rich-text-editor/actions/resize.js +2 -1
  45. package/src/rich-text-editor/actions/toolbar.d.ts +0 -2
  46. package/src/rich-text-editor/actions/toolbar.js +13 -85
  47. package/src/rich-text-editor/base/classes.d.ts +0 -5
  48. package/src/rich-text-editor/base/classes.js +0 -5
  49. package/src/rich-text-editor/base/constant.d.ts +5 -0
  50. package/src/rich-text-editor/base/constant.js +5 -0
  51. package/src/rich-text-editor/base/interface.d.ts +36 -2
  52. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +2 -2
  53. package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -3
  54. package/src/rich-text-editor/base/rich-text-editor.js +81 -58
  55. package/src/rich-text-editor/base/util.js +8 -2
  56. package/src/rich-text-editor/models/default-locale.js +15 -12
  57. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
  58. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  59. package/src/rich-text-editor/models/toolbar-settings.js +1 -1
  60. package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
  61. package/src/rich-text-editor/renderer/image-module.d.ts +8 -1
  62. package/src/rich-text-editor/renderer/image-module.js +148 -155
  63. package/src/rich-text-editor/renderer/table-module.d.ts +2 -0
  64. package/src/rich-text-editor/renderer/table-module.js +71 -8
  65. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +3 -0
  66. package/src/rich-text-editor/renderer/toolbar-renderer.js +61 -2
  67. package/src/rich-text-editor/renderer/video-module.js +7 -4
  68. package/src/rich-text-editor/renderer/view-source.js +7 -4
  69. package/styles/bootstrap-dark.css +57 -17
  70. package/styles/bootstrap.css +58 -18
  71. package/styles/bootstrap4.css +58 -18
  72. package/styles/bootstrap5-dark.css +64 -17
  73. package/styles/bootstrap5.css +64 -17
  74. package/styles/fabric-dark.css +57 -17
  75. package/styles/fabric.css +58 -18
  76. package/styles/fluent-dark.css +57 -17
  77. package/styles/fluent.css +57 -17
  78. package/styles/highcontrast-light.css +57 -17
  79. package/styles/highcontrast.css +58 -18
  80. package/styles/material-dark.css +57 -17
  81. package/styles/material.css +57 -17
  82. package/styles/material3-dark.css +59 -19
  83. package/styles/material3.css +59 -19
  84. package/styles/rich-text-editor/_bds-definition.scss +279 -0
  85. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
  86. package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
  87. package/styles/rich-text-editor/_bootstrap4-definition.scss +3 -2
  88. package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
  89. package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
  90. package/styles/rich-text-editor/_fabric-definition.scss +2 -1
  91. package/styles/rich-text-editor/_fluent-definition.scss +1 -0
  92. package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
  93. package/styles/rich-text-editor/_highcontrast-definition.scss +2 -1
  94. package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
  95. package/styles/rich-text-editor/_layout.scss +47 -13
  96. package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
  97. package/styles/rich-text-editor/_material-definition.scss +1 -0
  98. package/styles/rich-text-editor/_material3-definition.scss +1 -0
  99. package/styles/rich-text-editor/_tailwind-definition.scss +4 -3
  100. package/styles/rich-text-editor/_theme.scss +18 -5
  101. package/styles/rich-text-editor/bootstrap-dark.css +57 -17
  102. package/styles/rich-text-editor/bootstrap.css +58 -18
  103. package/styles/rich-text-editor/bootstrap4.css +58 -18
  104. package/styles/rich-text-editor/bootstrap5-dark.css +64 -17
  105. package/styles/rich-text-editor/bootstrap5.css +64 -17
  106. package/styles/rich-text-editor/fabric-dark.css +57 -17
  107. package/styles/rich-text-editor/fabric.css +58 -18
  108. package/styles/rich-text-editor/fluent-dark.css +57 -17
  109. package/styles/rich-text-editor/fluent.css +57 -17
  110. package/styles/rich-text-editor/highcontrast-light.css +57 -17
  111. package/styles/rich-text-editor/highcontrast.css +58 -18
  112. package/styles/rich-text-editor/icons/_bds.scss +351 -0
  113. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +7 -4
  114. package/styles/rich-text-editor/icons/_bootstrap.scss +7 -4
  115. package/styles/rich-text-editor/icons/_bootstrap4.scss +7 -4
  116. package/styles/rich-text-editor/icons/_bootstrap5.scss +7 -4
  117. package/styles/rich-text-editor/icons/_fabric-dark.scss +7 -4
  118. package/styles/rich-text-editor/icons/_fabric.scss +7 -4
  119. package/styles/rich-text-editor/icons/_fluent.scss +7 -4
  120. package/styles/rich-text-editor/icons/_highcontrast-light.scss +7 -4
  121. package/styles/rich-text-editor/icons/_highcontrast.scss +7 -4
  122. package/styles/rich-text-editor/icons/_material-dark.scss +7 -4
  123. package/styles/rich-text-editor/icons/_material.scss +7 -4
  124. package/styles/rich-text-editor/icons/_material3.scss +7 -4
  125. package/styles/rich-text-editor/icons/_tailwind.scss +7 -4
  126. package/styles/rich-text-editor/material-dark.css +57 -17
  127. package/styles/rich-text-editor/material.css +57 -17
  128. package/styles/rich-text-editor/material3-dark.css +59 -19
  129. package/styles/rich-text-editor/material3.css +59 -19
  130. package/styles/rich-text-editor/tailwind-dark.css +61 -21
  131. package/styles/rich-text-editor/tailwind.css +61 -21
  132. package/styles/tailwind-dark.css +61 -21
  133. package/styles/tailwind.css +61 -21
@@ -472,72 +472,80 @@ var MsWordPaste = /** @class */ (function () {
472
472
  };
473
473
  MsWordPaste.prototype.styleCorrection = function (elm, wordPasteStyleConfig) {
474
474
  var styleElement = elm.querySelectorAll('style');
475
+ var styles = [];
475
476
  if (styleElement.length > 0) {
476
- var styles = styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
477
+ if (!isNOU(styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi))) {
478
+ styles = styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
479
+ }
480
+ else if (styleElement.length > 1) {
481
+ styles = styleElement[1].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
482
+ }
477
483
  var styleClassObject_1 = !isNOU(styles) ? this.findStyleObject(styles) : null;
478
- var keys = Object.keys(styleClassObject_1);
479
- var values = keys.map(function (key) {
480
- return styleClassObject_1["" + key];
481
- });
482
- values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
483
- this.filterStyles(elm, wordPasteStyleConfig);
484
- var resultElem = void 0;
485
- var fromClass = false;
486
- for (var i = 0; i < keys.length; i++) {
487
- if (keys[i].split('.')[0] === '') {
488
- resultElem = elm.getElementsByClassName(keys[i].split('.')[1]);
489
- fromClass = true;
490
- }
491
- else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') >= 0) {
492
- continue;
493
- }
494
- else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') < 0) {
495
- resultElem = elm.getElementsByTagName(keys[i]);
496
- }
497
- else {
498
- resultElem = elm.querySelectorAll(keys[i]);
499
- }
500
- for (var j = 0; j < resultElem.length; j++) {
501
- if (resultElem[j].closest('li') && keys[i] === 'p') {
484
+ if (!isNOU(styleClassObject_1)) {
485
+ var keys = Object.keys(styleClassObject_1);
486
+ var values = keys.map(function (key) {
487
+ return styleClassObject_1["" + key];
488
+ });
489
+ values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
490
+ this.filterStyles(elm, wordPasteStyleConfig);
491
+ var resultElem = void 0;
492
+ var fromClass = false;
493
+ for (var i = 0; i < keys.length; i++) {
494
+ if (keys[i].split('.')[0] === '') {
495
+ resultElem = elm.getElementsByClassName(keys[i].split('.')[1]);
496
+ fromClass = true;
497
+ }
498
+ else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') >= 0) {
502
499
  continue;
503
500
  }
504
- var styleProperty = resultElem[j].getAttribute('style');
505
- if (!isNOU(styleProperty) && styleProperty.trim() !== '') {
506
- var valueSplit = values[i].split(';');
507
- if (!fromClass) {
508
- for (var k = 0; k < valueSplit.length; k++) {
509
- if (styleProperty.indexOf(valueSplit[k].split(':')[0]) >= 0) {
510
- valueSplit.splice(k, 1);
511
- k--;
501
+ else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') < 0) {
502
+ resultElem = elm.getElementsByTagName(keys[i]);
503
+ }
504
+ else {
505
+ resultElem = elm.querySelectorAll(keys[i]);
506
+ }
507
+ for (var j = 0; j < resultElem.length; j++) {
508
+ if (resultElem[j].closest('li') && keys[i] === 'p') {
509
+ continue;
510
+ }
511
+ var styleProperty = resultElem[j].getAttribute('style');
512
+ if (!isNOU(styleProperty) && styleProperty.trim() !== '') {
513
+ var valueSplit = values[i].split(';');
514
+ if (!fromClass) {
515
+ for (var k = 0; k < valueSplit.length; k++) {
516
+ if (styleProperty.indexOf(valueSplit[k].split(':')[0]) >= 0) {
517
+ valueSplit.splice(k, 1);
518
+ k--;
519
+ }
512
520
  }
513
521
  }
522
+ var changedValue = styleProperty + valueSplit.join(';') + ';';
523
+ resultElem[j].setAttribute('style', changedValue);
524
+ }
525
+ else {
526
+ values[i] = values[i].replace(/text-indent:-(.*?)(?=;|$)/gm, '');
527
+ resultElem[j].setAttribute('style', values[i]);
514
528
  }
515
- var changedValue = styleProperty + valueSplit.join(';') + ';';
516
- resultElem[j].setAttribute('style', changedValue);
517
- }
518
- else {
519
- values[i] = values[i].replace(/text-indent:-(.*?)(?=;|$)/gm, '');
520
- resultElem[j].setAttribute('style', values[i]);
521
529
  }
530
+ fromClass = false;
522
531
  }
523
- fromClass = false;
524
- }
525
- var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
526
- for (var i = 0; i < listClass.length; i++) {
527
- if (keys.indexOf('li.' + listClass[i]) > -1) {
528
- var olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
529
- for (var j = 0; j < olULElems.length; j++) {
530
- var styleProperty = olULElems[j].getAttribute('style');
531
- if (!isNOU(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
532
- var valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
533
- for (var k = 0; k < valueSplit.length; k++) {
534
- if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
535
- if (!isNOU(valueSplit[k].split(':')[1]) &&
536
- valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
537
- olULElems[j].style.marginLeft.indexOf('in') >= 0) {
538
- var classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
539
- var inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
540
- olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
532
+ var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
533
+ for (var i = 0; i < listClass.length; i++) {
534
+ if (keys.indexOf('li.' + listClass[i]) > -1) {
535
+ var olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
536
+ for (var j = 0; j < olULElems.length; j++) {
537
+ var styleProperty = olULElems[j].getAttribute('style');
538
+ if (!isNOU(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
539
+ var valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
540
+ for (var k = 0; k < valueSplit.length; k++) {
541
+ if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
542
+ if (!isNOU(valueSplit[k].split(':')[1]) &&
543
+ valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
544
+ olULElems[j].style.marginLeft.indexOf('in') >= 0) {
545
+ var classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
546
+ var inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
547
+ olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
548
+ }
541
549
  }
542
550
  }
543
551
  }
@@ -331,6 +331,30 @@ var SelectionCommands = /** @class */ (function () {
331
331
  formatNode.style.textDecoration = 'none';
332
332
  child = [formatNode];
333
333
  }
334
+ else if (IsFormatted.inlineTags.indexOf(formatNodeTagName.toLowerCase()) !== -1 && isFontStyle && formatNodeTagName.toLocaleLowerCase() !== 'span') {
335
+ var fontNodeStyle = formatNode.style;
336
+ if (fontNodeStyle.color && format === 'fontcolor') {
337
+ if (formatNode.nodeName === 'A') {
338
+ fontNodeStyle.color = value;
339
+ }
340
+ else {
341
+ fontNodeStyle.color = '';
342
+ }
343
+ }
344
+ else if (fontNodeStyle.backgroundColor && format === 'backgroundcolor') {
345
+ fontNodeStyle.backgroundColor = '';
346
+ }
347
+ else if (fontNodeStyle.fontSize && format === 'fontsize') {
348
+ fontNodeStyle.fontSize = '';
349
+ }
350
+ else if (fontNodeStyle.fontFamily && format === 'fontname') {
351
+ fontNodeStyle.fontFamily = '';
352
+ }
353
+ if (formatNode.getAttribute("style") === '') {
354
+ formatNode.removeAttribute("style");
355
+ }
356
+ child = [formatNode];
357
+ }
334
358
  else {
335
359
  child = InsertMethods.unwrap(formatNode);
336
360
  var liElement = nodes[index].parentElement;
@@ -511,19 +535,44 @@ var SelectionCommands = /** @class */ (function () {
511
535
  parentElement = parentElement.parentElement;
512
536
  liElement = parentElement;
513
537
  }
514
- if (format === 'fontcolor') {
538
+ if (format === 'fontcolor' || format === 'fontname') {
515
539
  var parentElem = nodes[index].parentElement;
516
540
  if (!isNOU(parentElem) && parentElem.childNodes) {
517
541
  for (var i = 0; i < parentElem.childNodes.length; i++) {
518
542
  if (this.concatenateTextExcludingList(nodes, index) === nodes[index].textContent) {
543
+ var liElement_1 = void 0;
519
544
  if (parentElem.tagName === 'LI') {
520
- parentElem.style.color = value;
545
+ liElement_1 = parentElem;
546
+ }
547
+ else if (parentElem.closest('li')) {
548
+ liElement_1 = parentElem.closest('li');
549
+ }
550
+ if (!isNOU(liElement_1)) {
551
+ switch (format) {
552
+ case 'fontcolor':
553
+ liElement_1.style.color = value;
554
+ break;
555
+ case 'fontname':
556
+ liElement_1.style.fontFamily = value;
557
+ break;
558
+ default:
559
+ break;
560
+ }
521
561
  }
522
562
  }
523
563
  // eslint-disable-next-line
524
564
  var childElement = parentElem.childNodes[i];
525
565
  if (childElement.tagName === 'OL' || childElement.tagName === 'UL') {
526
- childElement.style.color = 'initial';
566
+ switch (format) {
567
+ case 'fontcolor':
568
+ childElement.style.color = 'initial';
569
+ break;
570
+ case 'fontname':
571
+ childElement.style.fontFamily = 'initial';
572
+ break;
573
+ default:
574
+ break;
575
+ }
527
576
  }
528
577
  }
529
578
  }
@@ -61,7 +61,7 @@ var TableCommand = /** @class */ (function () {
61
61
  e.item.selection.restore();
62
62
  InsertHtml.Insert(this.parent.currentDocument, table, this.parent.editableElement);
63
63
  e.item.selection.setSelectionText(this.parent.currentDocument, table.querySelector('td'), table.querySelector('td'), 0, 0);
64
- if (table.nextElementSibling === null) {
64
+ if (table.nextElementSibling === null && !table.classList.contains('ignore-table')) {
65
65
  var insertElem = void 0;
66
66
  if (e.enterAction === 'DIV') {
67
67
  insertElem = createElement('div');
@@ -76,6 +76,9 @@ var TableCommand = /** @class */ (function () {
76
76
  }
77
77
  this.insertAfter(insertElem, table);
78
78
  }
79
+ if (table.classList.contains('ignore-table')) {
80
+ table.classList.remove('ignore-table');
81
+ }
79
82
  table.querySelector('td').classList.add('e-cell-select');
80
83
  if (e.callBack) {
81
84
  e.callBack({
@@ -498,10 +501,22 @@ var TableCommand = /** @class */ (function () {
498
501
  firstCell.setAttribute('rowspan', (minMaxIndexes.endRow - minMaxIndexes.startRow + 1).toString());
499
502
  }
500
503
  var totalWidth = 0;
504
+ var unit;
501
505
  for (var j = rowSelectedCells.length - 1; j >= 0; j--) {
502
- totalWidth = totalWidth + parseFloat(rowSelectedCells[j].style.width);
506
+ if (!isNOU(rowSelectedCells[j].style.width)
507
+ && rowSelectedCells[j].style.width !== '') {
508
+ if (!unit) {
509
+ var match = rowSelectedCells[j].style.width.match(/^([\d.]+)([a-z%]+)$/i);
510
+ unit = match ? match[2] : '%';
511
+ }
512
+ totalWidth = totalWidth + parseFloat(rowSelectedCells[j].style.width);
513
+ }
514
+ else {
515
+ totalWidth = totalWidth + ((rowSelectedCells[j].offsetWidth / this.curTable.offsetWidth) * 100);
516
+ unit = '%';
517
+ }
503
518
  }
504
- firstCell.style.width = totalWidth + '%';
519
+ firstCell.style.width = totalWidth + unit;
505
520
  for (var i = 1; i <= selectedCells.length - 1; i++) {
506
521
  detach(selectedCells[i]);
507
522
  }
@@ -11,7 +11,7 @@ export declare class ToolbarStatus {
11
11
  * get method
12
12
  *
13
13
  * @param {Document} docElement - specifies the document element
14
- * @param {Node} targetNode - specifies the target node
14
+ * @param {Node} rootNode - specifies the content editable element
15
15
  * @param {string[]} formatNode - specifies the format node
16
16
  * @param {string[]} fontSize - specifies the font size
17
17
  * @param {string[]} fontName - specifies the font name.
@@ -20,7 +20,7 @@ export declare class ToolbarStatus {
20
20
  * @hidden
21
21
 
22
22
  */
23
- static get(docElement: Document, targetNode: Node, formatNode?: string[], fontSize?: string[], fontName?: string[], documentNode?: Node): IToolbarStatus;
23
+ static get(docElement: Document, rootNode: Node, formatNode?: string[], fontSize?: string[], fontName?: string[], documentNode?: Node): IToolbarStatus;
24
24
  private static getImmediateBlockNode;
25
25
  private static getFormatParent;
26
26
  private static isFormattedNode;
@@ -17,7 +17,7 @@ var ToolbarStatus = /** @class */ (function () {
17
17
  * get method
18
18
  *
19
19
  * @param {Document} docElement - specifies the document element
20
- * @param {Node} targetNode - specifies the target node
20
+ * @param {Node} rootNode - specifies the content editable element
21
21
  * @param {string[]} formatNode - specifies the format node
22
22
  * @param {string[]} fontSize - specifies the font size
23
23
  * @param {string[]} fontName - specifies the font name.
@@ -26,7 +26,7 @@ var ToolbarStatus = /** @class */ (function () {
26
26
  * @hidden
27
27
 
28
28
  */
29
- ToolbarStatus.get = function (docElement, targetNode, formatNode, fontSize, fontName, documentNode) {
29
+ ToolbarStatus.get = function (docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
30
30
  var formatCollection = JSON.parse(JSON.stringify(statusCollection));
31
31
  var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
32
32
  var nodeSelection = new NodeSelection();
@@ -56,7 +56,7 @@ var ToolbarStatus = /** @class */ (function () {
56
56
  }
57
57
  for (var index = 0; index < nodes.length; index++) {
58
58
  // eslint-disable-next-line max-len
59
- formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
59
+ formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], rootNode, formatNode, fontSize, fontName);
60
60
  if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
61
61
  nodeCollection.bold = formatCollection.bold;
62
62
  }
@@ -131,16 +131,24 @@ var ToolbarStatus = /** @class */ (function () {
131
131
  return node;
132
132
  };
133
133
  ToolbarStatus.getFormatParent = function (docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
134
+ var isListUpdated = false;
135
+ var isComplexListUpdated = false;
134
136
  if (targetNode.contains(node) ||
135
137
  (node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
136
138
  do {
137
- formatCollection = this.isFormattedNode(docElement, formatCollection, node, formatNode, fontSize, fontName);
139
+ formatCollection = this.isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName);
140
+ if (formatCollection.orderedlist || formatCollection.unorderedlist) {
141
+ isListUpdated = true;
142
+ }
143
+ if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
144
+ isComplexListUpdated = true;
145
+ }
138
146
  node = node.parentNode;
139
147
  } while (node && (node !== targetNode));
140
148
  }
141
149
  return formatCollection;
142
150
  };
143
- ToolbarStatus.isFormattedNode = function (docElement, formatCollection, node, formatNode, fontSize, fontName) {
151
+ ToolbarStatus.isFormattedNode = function (docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName) {
144
152
  if (!formatCollection.bold) {
145
153
  formatCollection.bold = IsFormatted.isBold(node);
146
154
  }
@@ -171,10 +179,10 @@ var ToolbarStatus = /** @class */ (function () {
171
179
  if (!formatCollection.backgroundcolor) {
172
180
  formatCollection.backgroundcolor = this.isBackgroundColor(node);
173
181
  }
174
- if (!formatCollection.orderedlist) {
182
+ if (!formatCollection.orderedlist && !isListUpdated) {
175
183
  formatCollection.orderedlist = this.isOrderedList(node);
176
184
  }
177
- if (!formatCollection.unorderedlist) {
185
+ if (!formatCollection.unorderedlist && !isListUpdated) {
178
186
  formatCollection.unorderedlist = this.isUnorderedList(node);
179
187
  }
180
188
  if (!formatCollection.alignments) {
@@ -189,10 +197,10 @@ var ToolbarStatus = /** @class */ (function () {
189
197
  if (!formatCollection.createlink) {
190
198
  formatCollection.createlink = this.isLink(node);
191
199
  }
192
- if (!formatCollection.numberFormatList) {
200
+ if (!formatCollection.numberFormatList && !isComplexListUpdated) {
193
201
  formatCollection.numberFormatList = this.isNumberFormatList(node);
194
202
  }
195
- if (!formatCollection.bulletFormatList) {
203
+ if (!formatCollection.bulletFormatList && !isComplexListUpdated) {
196
204
  formatCollection.bulletFormatList = this.isBulletFormatList(node);
197
205
  }
198
206
  return formatCollection;
@@ -1,5 +1,5 @@
1
1
  import { Popup } from '@syncfusion/ej2-popups';
2
- import { IRichTextEditor } from '../base/interface';
2
+ import { IRichTextEditor, IBaseQuickToolbar } from '../base/interface';
3
3
  import { IToolbarItems, IQuickToolbarOptions } from '../base/interface';
4
4
  import { ServiceLocator } from '../services/service-locator';
5
5
  import { BaseToolbar } from './base-toolbar';
@@ -7,10 +7,10 @@ import { RichTextEditorModel } from '../base/rich-text-editor-model';
7
7
  /**
8
8
  * `Quick toolbar` module is used to handle Quick toolbar actions.
9
9
  */
10
- export declare class BaseQuickToolbar {
10
+ export declare class BaseQuickToolbar implements IBaseQuickToolbar {
11
11
  popupObj: Popup;
12
12
  element: HTMLElement;
13
- private isDOMElement;
13
+ isRendered: boolean;
14
14
  quickTBarObj: BaseToolbar;
15
15
  private stringItems;
16
16
  private dropDownButtons;
@@ -15,7 +15,7 @@ var BaseQuickToolbar = /** @class */ (function () {
15
15
  function BaseQuickToolbar(parent, locator) {
16
16
  this.parent = parent;
17
17
  this.locator = locator;
18
- this.isDOMElement = false;
18
+ this.isRendered = false;
19
19
  this.renderFactory = this.locator.getService('rendererFactory');
20
20
  this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
21
21
  this.popupRenderer = this.renderFactory.getRenderer(RenderType.Popup);
@@ -79,7 +79,18 @@ var BaseQuickToolbar = /** @class */ (function () {
79
79
  e.target.classList.contains('e-imgbreak')) ? false : true;
80
80
  var target = !isNOU(imgWrapper) ? imgWrapper : e.target;
81
81
  addClass([this.toolbarElement], [classes.CLS_RM_WHITE_SPACE]);
82
- var targetOffsetTop = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetTop : target.offsetTop;
82
+ var targetOffsetTop;
83
+ if (!isNOU(closest(target, 'table'))) {
84
+ targetOffsetTop = target.offsetTop;
85
+ var parentTable = closest(target, 'table');
86
+ while (!isNOU(parentTable)) {
87
+ targetOffsetTop += parentTable.offsetTop;
88
+ parentTable = closest(parentTable.parentElement, 'table');
89
+ }
90
+ }
91
+ else {
92
+ targetOffsetTop = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetTop : target.offsetTop;
93
+ }
83
94
  var parentOffsetTop = window.pageYOffset + e.parentData.top;
84
95
  if ((targetOffsetTop - e.editTop) > e.popHeight) {
85
96
  y = parentOffsetTop + e.tBarElementHeight + (targetOffsetTop - e.editTop) - e.popHeight - 5;
@@ -91,11 +102,30 @@ var BaseQuickToolbar = /** @class */ (function () {
91
102
  y = e.y;
92
103
  }
93
104
  target = isAligned ? e.target : target;
94
- if (target.offsetWidth > e.popWidth) {
95
- x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + ((target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft);
105
+ var targetOffsetLeft;
106
+ var currentOffsetWidth;
107
+ if (!isNOU(closest(target, 'table'))) {
108
+ targetOffsetLeft = target.offsetLeft;
109
+ var parentTable = closest(target, 'table');
110
+ var checkOffSetParentWidth = false;
111
+ if (!isNOU(closest(parentTable, 'TD'))) {
112
+ checkOffSetParentWidth = true;
113
+ }
114
+ while (!isNOU(parentTable)) {
115
+ targetOffsetLeft += parentTable.offsetLeft;
116
+ currentOffsetWidth = checkOffSetParentWidth ? parentTable.offsetWidth : target.offsetWidth;
117
+ parentTable = closest(parentTable.parentElement, 'table');
118
+ }
119
+ }
120
+ else {
121
+ currentOffsetWidth = target.offsetWidth;
122
+ targetOffsetLeft = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft;
123
+ }
124
+ if (currentOffsetWidth > e.popWidth) {
125
+ x = (currentOffsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + targetOffsetLeft;
96
126
  }
97
127
  else {
98
- x = e.parentData.left + target.offsetLeft;
128
+ x = e.parentData.left + targetOffsetLeft;
99
129
  }
100
130
  this.popupObj.position.X = ((x + e.popWidth) > e.parentData.right) ? e.parentData.right - e.popWidth : x;
101
131
  this.popupObj.position.Y = (y >= 0) ? y : e.y + 5;
@@ -233,7 +263,8 @@ var BaseQuickToolbar = /** @class */ (function () {
233
263
  openDelay: 400,
234
264
  showTipPointer: true,
235
265
  windowCollision: true,
236
- position: 'BottomCenter'
266
+ position: 'BottomCenter',
267
+ cssClass: _this.parent.getCssClass()
237
268
  });
238
269
  _this.tooltip.appendTo(_this.element);
239
270
  }
@@ -267,7 +298,7 @@ var BaseQuickToolbar = /** @class */ (function () {
267
298
  parentData: parent_1.getBoundingClientRect(),
268
299
  tBarElementHeight: tBarHeight
269
300
  };
270
- if ((target.tagName === 'IMG' || target.tagName === 'AUDIO' || target.tagName === 'VIDEO' || target.tagName === 'IFRAME' || (target.classList &&
301
+ if ((closest(target, 'TABLE') || target.tagName === 'IMG' || target.tagName === 'AUDIO' || target.tagName === 'VIDEO' || target.tagName === 'IFRAME' || (target.classList &&
271
302
  (target.classList.contains(classes.CLS_AUDIOWRAP) || target.classList.contains(classes.CLS_CLICKELEM) ||
272
303
  target.classList.contains(classes.CLS_VID_CLICK_ELEM)))) && (x == beforeQuickToolbarArgs.positionX || y == beforeQuickToolbarArgs.positionY)) {
273
304
  _this.setPosition(showPopupData);
@@ -287,7 +318,7 @@ var BaseQuickToolbar = /** @class */ (function () {
287
318
  maxWidth: window.outerWidth + 'px'
288
319
  });
289
320
  addClass([_this.element], [classes.CLS_POP]);
290
- _this.isDOMElement = true;
321
+ _this.isRendered = true;
291
322
  }
292
323
  });
293
324
  };
@@ -327,7 +358,7 @@ var BaseQuickToolbar = /** @class */ (function () {
327
358
  this.parent.notify(events.destroyTooltip, { args: event });
328
359
  }
329
360
  this.removeEleFromDOM();
330
- this.isDOMElement = false;
361
+ this.isRendered = false;
331
362
  };
332
363
  /**
333
364
  * @param {string} item - specifies the string value
@@ -350,7 +381,7 @@ var BaseQuickToolbar = /** @class */ (function () {
350
381
  };
351
382
  BaseQuickToolbar.prototype.removeEleFromDOM = function () {
352
383
  var element = this.popupObj.element;
353
- if (this.isDOMElement) {
384
+ if (this.isRendered) {
354
385
  this.dropDownButtons.destroyDropDowns();
355
386
  this.colorPickerObj.destroyColorPicker();
356
387
  removeClass([this.element], [classes.CLS_POP]);
@@ -1,9 +1,9 @@
1
1
  import { RenderType } from '../base/enum';
2
2
  import { CLS_HR_SEPARATOR } from '../base/classes';
3
3
  import * as events from '../base/constant';
4
- import { getTooltipText, isIDevice, toObjectLowerCase } from '../base/util';
4
+ import { getTooltipText, toObjectLowerCase } from '../base/util';
5
5
  import { tools, templateItems, windowKeys } from '../models/items';
6
- import { isNullOrUndefined, extend, Browser } from '@syncfusion/ej2-base';
6
+ import { isNullOrUndefined, extend } from '@syncfusion/ej2-base';
7
7
  /**
8
8
  * `Toolbar` module is used to handle Toolbar actions.
9
9
  */
@@ -107,23 +107,13 @@ var BaseToolbar = /** @class */ (function () {
107
107
  case '-':
108
108
  return { type: 'Separator', cssClass: CLS_HR_SEPARATOR };
109
109
  default:
110
- if (this.parent.showTooltip) {
111
- return {
112
- id: this.parent.getID() + '_' + container + '_' + this.tools[itemStr.toLocaleLowerCase()].id,
113
- prefixIcon: this.tools[itemStr.toLocaleLowerCase()].icon,
114
- tooltipText: getTooltipText(itemStr, this.locator),
115
- command: this.tools[itemStr.toLocaleLowerCase()].command,
116
- subCommand: this.tools[itemStr.toLocaleLowerCase()].subCommand
117
- };
118
- }
119
- else {
120
- return {
121
- id: this.parent.getID() + '_' + container + '_' + this.tools[itemStr.toLocaleLowerCase()].id,
122
- prefixIcon: this.tools[itemStr.toLocaleLowerCase()].icon,
123
- command: this.tools[itemStr.toLocaleLowerCase()].command,
124
- subCommand: this.tools[itemStr.toLocaleLowerCase()].subCommand
125
- };
126
- }
110
+ return {
111
+ id: this.parent.getID() + '_' + container + '_' + this.tools[itemStr.toLocaleLowerCase()].id,
112
+ prefixIcon: this.tools[itemStr.toLocaleLowerCase()].icon,
113
+ tooltipText: getTooltipText(itemStr, this.locator),
114
+ command: this.tools[itemStr.toLocaleLowerCase()].command,
115
+ subCommand: this.tools[itemStr.toLocaleLowerCase()].subCommand
116
+ };
127
117
  }
128
118
  }
129
119
  };
@@ -176,17 +166,21 @@ var BaseToolbar = /** @class */ (function () {
176
166
  var item = tbItems_1[_i];
177
167
  _loop_1(item);
178
168
  }
179
- for (var num = 0; num < items.length; num++) {
180
- var tooltipText = items[num].tooltipText;
181
- var shortCutKey = void 0;
182
- if (windowKeys["" + tooltipText]) {
183
- shortCutKey = Browser.isDevice && isIDevice() ? windowKeys["" + tooltipText].replace('Ctrl', 'Cmd') : windowKeys["" + tooltipText];
184
- }
185
- else {
186
- shortCutKey = tooltipText;
187
- }
188
- if (shortCutKey) {
189
- items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
169
+ if (this.parent.showTooltip) {
170
+ for (var num = 0; num < items.length; num++) {
171
+ var tooltipText = items[num].tooltipText;
172
+ var shortCutKey = void 0;
173
+ if (windowKeys["" + tooltipText]) {
174
+ shortCutKey = window.navigator.platform.toLocaleLowerCase().includes('mac') ? windowKeys["" + tooltipText].replace('Ctrl', 'Cmd') : windowKeys["" + tooltipText];
175
+ }
176
+ else {
177
+ shortCutKey = tooltipText;
178
+ }
179
+ if (shortCutKey) {
180
+ if (!(items[num].command === "Images" && items[num].subCommand === "InsertLink")) {
181
+ items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
182
+ }
183
+ }
190
184
  }
191
185
  }
192
186
  return items;
@@ -26,7 +26,7 @@ var DropDownButtons = /** @class */ (function () {
26
26
  addClass([args.element], item.cssClass);
27
27
  }
28
28
  if (item.command === 'Images' || item.command === 'Videos' || item.command === 'Audios' || item.command === 'Table') {
29
- args.element.setAttribute('title', getQuickToolbarTooltipText(item.text));
29
+ args.element.setAttribute('title', getQuickToolbarTooltipText(item.text) !== '' ? getQuickToolbarTooltipText(item.text) : item.text);
30
30
  }
31
31
  if (item.command === 'Alignments' || item.subCommand === 'JustifyLeft'
32
32
  || item.subCommand === 'JustifyRight' || item.subCommand === 'JustifyCenter') {
@@ -36,13 +36,13 @@ var DropDownButtons = /** @class */ (function () {
36
36
  args.element.setAttribute('title', getTooltipTextDropdownItems(item.subCommand.toLocaleLowerCase(), this.locator, formatsLocale));
37
37
  }
38
38
  if (item.command === 'Font') {
39
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.value.toLocaleLowerCase(), this.locator, fontNameLocale));
39
+ args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) : item.text);
40
40
  }
41
41
  if (item.subCommand === 'BulletFormatList') {
42
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.value.toLocaleLowerCase(), this.locator, bulletFormatListLocale));
42
+ args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) : item.text);
43
43
  }
44
44
  if (item.subCommand === 'NumberFormatList') {
45
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.replace(/\s/g, '').toLocaleLowerCase(), this.locator, numberFormatListLocale));
45
+ args.element.setAttribute('title', (getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale)) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale) : item.text);
46
46
  }
47
47
  if (item.subCommand === 'FontSize') {
48
48
  args.element.setAttribute('title', getTooltipTextDropdownItems(item.value.toLocaleLowerCase(), null, null, this.parent));
@@ -61,7 +61,7 @@ var EmojiPicker = /** @class */ (function () {
61
61
  }
62
62
  this.popDiv = this.parent.createElement('div', { className: 'e-rte-emojipicker-popup', id: this.parent.getID() + '_emojiPicker' });
63
63
  if (!isNOU(this.parent.getToolbar()) && !this.parent.inlineMode.enable) {
64
- this.parent.getToolbar().appendChild(this.popDiv);
64
+ this.parent.getToolbar().parentElement.appendChild(this.popDiv);
65
65
  }
66
66
  else if (this.parent.inlineMode.enable) {
67
67
  this.parent.element.appendChild(this.popDiv);
@@ -50,7 +50,8 @@ var EnterKeyAction = /** @class */ (function () {
50
50
  isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
51
51
  }
52
52
  if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
53
- if (isNOU(this.startNode.closest('LI, UL, OL')) && isNOU(this.endNode.closest('LI, UL, OL')) && isTableEnter &&
53
+ if (isNOU(this.startNode.closest('LI, UL, OL')) && isNOU(this.endNode.closest('LI, UL, OL')) &&
54
+ isNOU(this.startNode.closest('.e-img-inner')) && isTableEnter &&
54
55
  isNOU(this.startNode.closest('PRE')) && isNOU(this.endNode.closest('PRE'))) {
55
56
  var shiftKey_1 = e.args.shiftKey;
56
57
  var actionBeginArgs = {