@syncfusion/ej2-richtexteditor 25.1.38 → 25.1.40

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 (102) hide show
  1. package/CHANGELOG.md +34 -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 +1996 -1801
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +2058 -1863
  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 +10 -10
  13. package/src/editor-manager/plugin/audio.js +1 -1
  14. package/src/editor-manager/plugin/formats.js +6 -0
  15. package/src/editor-manager/plugin/indents.js +1 -1
  16. package/src/editor-manager/plugin/inserthtml.js +9 -3
  17. package/src/editor-manager/plugin/link.js +4 -2
  18. package/src/editor-manager/plugin/lists.js +38 -14
  19. package/src/editor-manager/plugin/nodecutter.js +3 -0
  20. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  21. package/src/editor-manager/plugin/selection-commands.js +84 -2
  22. package/src/editor-manager/plugin/table.d.ts +4 -0
  23. package/src/editor-manager/plugin/table.js +62 -19
  24. package/src/editor-manager/plugin/video.js +1 -1
  25. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +1 -0
  26. package/src/rich-text-editor/actions/base-quick-toolbar.js +9 -13
  27. package/src/rich-text-editor/actions/base-toolbar.js +3 -2
  28. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +1 -0
  29. package/src/rich-text-editor/actions/dropdown-buttons.js +8 -23
  30. package/src/rich-text-editor/actions/emoji-picker.js +1 -1
  31. package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
  32. package/src/rich-text-editor/actions/enter-key.js +50 -1
  33. package/src/rich-text-editor/actions/format-painter.js +4 -1
  34. package/src/rich-text-editor/actions/html-editor.js +9 -4
  35. package/src/rich-text-editor/actions/paste-clean-up.d.ts +0 -1
  36. package/src/rich-text-editor/actions/paste-clean-up.js +2 -26
  37. package/src/rich-text-editor/actions/quick-toolbar.d.ts +2 -0
  38. package/src/rich-text-editor/actions/quick-toolbar.js +14 -4
  39. package/src/rich-text-editor/base/enum.d.ts +11 -0
  40. package/src/rich-text-editor/base/enum.js +12 -0
  41. package/src/rich-text-editor/base/interface.d.ts +9 -1
  42. package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -2
  43. package/src/rich-text-editor/base/rich-text-editor.js +4 -18
  44. package/src/rich-text-editor/base/util.d.ts +0 -4
  45. package/src/rich-text-editor/base/util.js +1 -35
  46. package/src/rich-text-editor/formatter/formatter.js +4 -2
  47. package/src/rich-text-editor/renderer/audio-module.js +9 -4
  48. package/src/rich-text-editor/renderer/image-module.js +7 -2
  49. package/src/rich-text-editor/renderer/table-module.js +15 -5
  50. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -1
  51. package/src/rich-text-editor/renderer/toolbar-renderer.js +27 -23
  52. package/src/rich-text-editor/renderer/video-module.js +29 -15
  53. package/styles/bootstrap-dark.css +11 -0
  54. package/styles/bootstrap.css +11 -0
  55. package/styles/bootstrap4.css +11 -0
  56. package/styles/bootstrap5-dark.css +11 -0
  57. package/styles/bootstrap5.css +11 -0
  58. package/styles/fabric-dark.css +11 -0
  59. package/styles/fabric.css +11 -0
  60. package/styles/fluent-dark.css +11 -0
  61. package/styles/fluent.css +11 -0
  62. package/styles/highcontrast-light.css +11 -0
  63. package/styles/highcontrast.css +11 -0
  64. package/styles/material-dark.css +11 -0
  65. package/styles/material.css +11 -0
  66. package/styles/material3-dark.css +11 -0
  67. package/styles/material3.css +11 -0
  68. package/styles/rich-text-editor/_bds-definition.scss +6 -0
  69. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +6 -0
  70. package/styles/rich-text-editor/_bootstrap-definition.scss +6 -0
  71. package/styles/rich-text-editor/_bootstrap4-definition.scss +6 -0
  72. package/styles/rich-text-editor/_bootstrap5-definition.scss +6 -0
  73. package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -0
  74. package/styles/rich-text-editor/_fabric-definition.scss +6 -0
  75. package/styles/rich-text-editor/_fluent-definition.scss +6 -0
  76. package/styles/rich-text-editor/_fusionnew-definition.scss +6 -0
  77. package/styles/rich-text-editor/_highcontrast-definition.scss +6 -0
  78. package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -0
  79. package/styles/rich-text-editor/_layout.scss +10 -0
  80. package/styles/rich-text-editor/_material-dark-definition.scss +6 -0
  81. package/styles/rich-text-editor/_material-definition.scss +6 -0
  82. package/styles/rich-text-editor/_material3-definition.scss +6 -0
  83. package/styles/rich-text-editor/_tailwind-definition.scss +6 -0
  84. package/styles/rich-text-editor/bootstrap-dark.css +11 -0
  85. package/styles/rich-text-editor/bootstrap.css +11 -0
  86. package/styles/rich-text-editor/bootstrap4.css +11 -0
  87. package/styles/rich-text-editor/bootstrap5-dark.css +11 -0
  88. package/styles/rich-text-editor/bootstrap5.css +11 -0
  89. package/styles/rich-text-editor/fabric-dark.css +11 -0
  90. package/styles/rich-text-editor/fabric.css +11 -0
  91. package/styles/rich-text-editor/fluent-dark.css +11 -0
  92. package/styles/rich-text-editor/fluent.css +11 -0
  93. package/styles/rich-text-editor/highcontrast-light.css +11 -0
  94. package/styles/rich-text-editor/highcontrast.css +11 -0
  95. package/styles/rich-text-editor/material-dark.css +11 -0
  96. package/styles/rich-text-editor/material.css +11 -0
  97. package/styles/rich-text-editor/material3-dark.css +11 -0
  98. package/styles/rich-text-editor/material3.css +11 -0
  99. package/styles/rich-text-editor/tailwind-dark.css +11 -0
  100. package/styles/rich-text-editor/tailwind.css +11 -0
  101. package/styles/tailwind-dark.css +11 -0
  102. package/styles/tailwind.css +11 -0
@@ -1641,6 +1641,18 @@ var DialogType;
1641
1641
  DialogType["InsertTable"] = "InsertTable";
1642
1642
  /* eslint-enable */
1643
1643
  })(DialogType || (DialogType = {}));
1644
+ /**
1645
+ * Defines types to be used as inserted image.
1646
+ */
1647
+ var UploadRequest;
1648
+ (function (UploadRequest) {
1649
+ /** Defines UploadRequest as Uploaded */
1650
+ UploadRequest["Uploaded"] = "Uploaded";
1651
+ /** Defines UploadRequest as Dropped */
1652
+ UploadRequest["Dropped"] = "Dropped";
1653
+ /** Defines UploadRequest as Pasted */
1654
+ UploadRequest["Pasted"] = "Pasted";
1655
+ })(UploadRequest || (UploadRequest = {}));
1644
1656
 
1645
1657
  /* eslint-disable */
1646
1658
  /**
@@ -3082,40 +3094,6 @@ function getTooltipText(item, serviceLocator) {
3082
3094
  var tooltipText = i10n.getConstant(itemLocale);
3083
3095
  return tooltipText;
3084
3096
  }
3085
- function getTooltipTextDropdownItems(item, serviceLocator, localeItems, rteObj) {
3086
- if (localeItems) {
3087
- var i10n = serviceLocator.getService('rteLocale');
3088
- for (var i = 0; i < localeItems.length; i++) {
3089
- var itemLocale = localeItems[i].value.toLocaleLowerCase();
3090
- var numberValue = localeItems[i].locale;
3091
- var numberLocale = defaultLocale["" + numberValue].toLocaleLowerCase();
3092
- if (item === itemLocale || item === numberLocale) {
3093
- var tooltipText = localeItems[i].locale;
3094
- return i10n.getConstant(tooltipText);
3095
- }
3096
- }
3097
- }
3098
- else {
3099
- var fontsize = rteObj.fontSize.items;
3100
- for (var i = 0; i < fontsize.length; i++) {
3101
- if (item === rteObj.fontSize.items[i].value) {
3102
- var fontSize$$1 = rteObj.fontSize.items[i].text;
3103
- return fontSize$$1;
3104
- }
3105
- }
3106
- }
3107
- return '';
3108
- }
3109
- function getQuickToolbarTooltipText(item) {
3110
- var keys = Object.keys(defaultLocale);
3111
- for (var i = 0; i < keys.length; i++) {
3112
- var tooltipText = defaultLocale["" + keys[i]];
3113
- if (item === tooltipText) {
3114
- return tooltipText;
3115
- }
3116
- }
3117
- return '';
3118
- }
3119
3097
  /**
3120
3098
  * @param {ISetToolbarStatusArgs} e - specifies the e element
3121
3099
  * @param {boolean} isPopToolbar - specifies the boolean value
@@ -3587,86 +3565,1476 @@ function updateDropDownFontFormatLocale(self) {
3587
3565
  }
3588
3566
 
3589
3567
  /**
3590
- * `Toolbar renderer` module is used to render toolbar in RichTextEditor.
3568
+ * Is formatted or not.
3591
3569
  *
3592
3570
  * @hidden
3593
3571
  * @deprecated
3594
3572
  */
3595
- var ToolbarRenderer = /** @__PURE__ @class */ (function () {
3573
+ var IsFormatted = /** @__PURE__ @class */ (function () {
3574
+ function IsFormatted() {
3575
+ }
3596
3576
  /**
3597
- * Constructor for toolbar renderer module
3577
+ * getFormattedNode method
3598
3578
  *
3599
- * @param {IRichTextEditor} parent - specifies the parent element.
3600
- * @param {ServiceLocator} serviceLocator - specifies the serviceLocator
3579
+ * @param {Node} node - specifies the node.
3580
+ * @param {string} format - specifies the string value.
3581
+ * @param {Node} endNode - specifies the end node
3582
+ * @returns {Node} - returns the node
3583
+ * @hidden
3584
+ * @deprecated
3601
3585
  */
3602
- function ToolbarRenderer(parent, serviceLocator) {
3603
- this.parent = parent;
3604
- if (serviceLocator) {
3605
- this.l10n = serviceLocator.getService('rteLocale');
3586
+ IsFormatted.prototype.getFormattedNode = function (node, format, endNode) {
3587
+ var parentNode = this.getFormatParent(node, format, endNode);
3588
+ if (parentNode !== null && parentNode !== endNode) {
3589
+ return parentNode;
3606
3590
  }
3607
- this.wireEvent();
3608
- }
3609
- ToolbarRenderer.prototype.wireEvent = function () {
3610
- this.parent.on(destroy, this.unWireEvent, this);
3611
- this.parent.on(destroyTooltip, this.destroyTooltip, this);
3612
- this.parent.on(closeTooltip, this.closeTooltip, this);
3591
+ return null;
3613
3592
  };
3614
- ToolbarRenderer.prototype.destroyTooltip = function () {
3615
- var currentDocument = this.parent.iframeSettings.enable ? this.parent.contentModule.getPanel().ownerDocument :
3616
- this.parent.contentModule.getDocument();
3617
- if (!isNullOrUndefined(currentDocument.querySelector('.e-tooltip-wrap')) && !isNullOrUndefined(currentDocument.querySelector('[data-tooltip-id]'))) {
3618
- var tooltipTargetEle = currentDocument.querySelector('[data-tooltip-id]');
3619
- var event_1 = new MouseEvent('mouseleave', { bubbles: true, cancelable: true });
3620
- tooltipTargetEle.dispatchEvent(event_1);
3593
+ IsFormatted.prototype.getFormatParent = function (node, format, endNode) {
3594
+ do {
3595
+ node = node.parentNode;
3596
+ } while (node && (node !== endNode) && !this.isFormattedNode(node, format));
3597
+ return node;
3598
+ };
3599
+ IsFormatted.prototype.isFormattedNode = function (node, format) {
3600
+ switch (format) {
3601
+ case 'bold':
3602
+ return IsFormatted.isBold(node);
3603
+ case 'italic':
3604
+ return IsFormatted.isItalic(node);
3605
+ case 'underline':
3606
+ return IsFormatted.isUnderline(node);
3607
+ case 'strikethrough':
3608
+ return IsFormatted.isStrikethrough(node);
3609
+ case 'superscript':
3610
+ return IsFormatted.isSuperscript(node);
3611
+ case 'subscript':
3612
+ return IsFormatted.isSubscript(node);
3613
+ case 'fontcolor':
3614
+ return this.isFontColor(node);
3615
+ case 'fontname':
3616
+ return this.isFontName(node);
3617
+ case 'fontsize':
3618
+ return this.isFontSize(node);
3619
+ case 'backgroundcolor':
3620
+ return this.isBackgroundColor(node);
3621
+ default:
3622
+ return false;
3621
3623
  }
3622
3624
  };
3623
- ToolbarRenderer.prototype.unWireEvent = function () {
3624
- this.parent.off(destroy, this.unWireEvent);
3625
- this.parent.off(destroyTooltip, this.destroyTooltip);
3626
- this.parent.off(closeTooltip, this.closeTooltip);
3625
+ /**
3626
+ * isBold method
3627
+ *
3628
+ * @param {Node} node - specifies the node value
3629
+ * @returns {boolean} - returns the boolean value
3630
+ * @hidden
3631
+ * @deprecated
3632
+ */
3633
+ IsFormatted.isBold = function (node) {
3634
+ var validTags = ['strong', 'b'];
3635
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3636
+ return true;
3637
+ }
3638
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3639
+ node.style && node.style.fontWeight === 'bold') {
3640
+ return true;
3641
+ }
3642
+ else {
3643
+ return false;
3644
+ }
3627
3645
  };
3628
- ToolbarRenderer.prototype.toolbarBeforeCreate = function (e) {
3629
- if (this.mode === 'Extended') {
3630
- e.enableCollision = false;
3646
+ /**
3647
+ * isItalic method
3648
+ *
3649
+ * @param {Node} node - specifies the node value
3650
+ * @returns {boolean} - returns the boolean value
3651
+ * @hidden
3652
+ * @deprecated
3653
+ */
3654
+ IsFormatted.isItalic = function (node) {
3655
+ var validTags = ['em', 'i'];
3656
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3657
+ return true;
3658
+ }
3659
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3660
+ node.style && node.style.fontStyle === 'italic') {
3661
+ return true;
3662
+ }
3663
+ else {
3664
+ return false;
3631
3665
  }
3632
3666
  };
3633
- ToolbarRenderer.prototype.toolbarCreated = function () {
3634
- this.parent.notify(toolbarCreated, this);
3667
+ /**
3668
+ * isUnderline method
3669
+ *
3670
+ * @param {Node} node - specifies the node value
3671
+ * @returns {boolean} - returns the boolean value
3672
+ * @hidden
3673
+ * @deprecated
3674
+ */
3675
+ IsFormatted.isUnderline = function (node) {
3676
+ var validTags = ['u'];
3677
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3678
+ return true;
3679
+ /* eslint-disable */
3680
+ }
3681
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3682
+ node.style && (node.style.textDecoration === 'underline' ||
3683
+ node.style.textDecorationLine === 'underline')) {
3684
+ /* eslint-enable */
3685
+ return true;
3686
+ }
3687
+ else {
3688
+ return false;
3689
+ }
3635
3690
  };
3636
- ToolbarRenderer.prototype.toolbarClicked = function (args) {
3637
- if (!this.parent.enabled) {
3638
- return;
3691
+ /**
3692
+ * isStrikethrough method
3693
+ *
3694
+ * @param {Node} node - specifies the node value
3695
+ * @returns {boolean} - returns the boolean value
3696
+ * @hidden
3697
+ * @deprecated
3698
+ */
3699
+ IsFormatted.isStrikethrough = function (node) {
3700
+ var validTags = ['del', 'strike'];
3701
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3702
+ return true;
3703
+ /* eslint-disable */
3639
3704
  }
3640
- this.parent.trigger('toolbarClick', args);
3641
- if (!this.parent.readonly || isNullOrUndefined(args.item)) {
3642
- this.parent.notify(toolbarClick, args);
3705
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3706
+ node.style && (node.style.textDecoration === 'line-through' ||
3707
+ node.style.textDecorationLine === 'line-through')) {
3708
+ /* eslint-enable */
3709
+ return true;
3710
+ }
3711
+ else {
3712
+ return false;
3643
3713
  }
3644
3714
  };
3645
- ToolbarRenderer.prototype.dropDownSelected = function (args) {
3646
- this.parent.notify(dropDownSelect, args);
3647
- this.destroyTooltip();
3715
+ /**
3716
+ * isSuperscript method
3717
+ *
3718
+ * @param {Node} node - specifies the node value
3719
+ * @returns {boolean} - returns the boolean value
3720
+ * @hidden
3721
+ * @deprecated
3722
+ */
3723
+ IsFormatted.isSuperscript = function (node) {
3724
+ var validTags = ['sup'];
3725
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3726
+ return true;
3727
+ }
3728
+ else {
3729
+ return false;
3730
+ }
3648
3731
  };
3649
- ToolbarRenderer.prototype.beforeDropDownItemRender = function (args) {
3650
- if (this.parent.readonly || !this.parent.enabled) {
3651
- return;
3732
+ /**
3733
+ * isSubscript method
3734
+ *
3735
+ * @param {Node} node - specifies the node value
3736
+ * @returns {boolean} - returns the boolean value
3737
+ * @hidden
3738
+ * @deprecated
3739
+ */
3740
+ IsFormatted.isSubscript = function (node) {
3741
+ var validTags = ['sub'];
3742
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3743
+ return true;
3744
+ }
3745
+ else {
3746
+ return false;
3652
3747
  }
3653
- this.parent.notify(beforeDropDownItemRender, args);
3654
3748
  };
3655
- ToolbarRenderer.prototype.tooltipBeforeRender = function (args) {
3656
- if (!isNullOrUndefined(args.target.getAttribute('title'))) {
3657
- var tooltipTarget = args.target.getAttribute('title');
3658
- var tooltipText = void 0;
3659
- switch (tooltipTarget) {
3660
- case 'Minimize':
3661
- tooltipText = this.l10n.getConstant('minimize');
3662
- args.target.setAttribute('title', tooltipText + ' (Esc)');
3663
- break;
3664
- case 'Maximize':
3665
- tooltipText = this.l10n.getConstant('maximize');
3666
- args.target.setAttribute('title', tooltipText + ' (Ctrl+Shift+F)');
3667
- break;
3749
+ IsFormatted.prototype.isFontColor = function (node) {
3750
+ var color = node.style && node.style.color;
3751
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3752
+ color !== null && color !== '' && color !== undefined) {
3753
+ return true;
3754
+ }
3755
+ else {
3756
+ return false;
3757
+ }
3758
+ };
3759
+ IsFormatted.prototype.isBackgroundColor = function (node) {
3760
+ var backColor = node.style && node.style.backgroundColor;
3761
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3762
+ backColor !== null && backColor !== '' && backColor !== undefined) {
3763
+ return true;
3764
+ }
3765
+ else {
3766
+ return false;
3767
+ }
3768
+ };
3769
+ IsFormatted.prototype.isFontSize = function (node) {
3770
+ var size = node.style && node.style.fontSize;
3771
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3772
+ size !== null && size !== '' && size !== undefined) {
3773
+ return true;
3774
+ }
3775
+ else {
3776
+ return false;
3777
+ }
3778
+ };
3779
+ IsFormatted.prototype.isFontName = function (node) {
3780
+ var name = node.style && node.style.fontFamily;
3781
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3782
+ name !== null && name !== '' && name !== undefined) {
3783
+ return true;
3784
+ }
3785
+ else {
3786
+ return false;
3787
+ }
3788
+ };
3789
+ // Get Formatted Node
3790
+ IsFormatted.inlineTags = [
3791
+ 'a',
3792
+ 'abbr',
3793
+ 'acronym',
3794
+ 'b',
3795
+ 'bdo',
3796
+ 'big',
3797
+ 'cite',
3798
+ 'code',
3799
+ 'dfn',
3800
+ 'em',
3801
+ 'font',
3802
+ 'i',
3803
+ 'kbd',
3804
+ 'label',
3805
+ 'q',
3806
+ 'samp',
3807
+ 'small',
3808
+ 'span',
3809
+ 'strong',
3810
+ 'sub',
3811
+ 'sup',
3812
+ 'tt',
3813
+ 'u',
3814
+ 'var',
3815
+ 'del'
3816
+ ];
3817
+ return IsFormatted;
3818
+ }());
3819
+
3820
+ /**
3821
+ * Constant values for EditorManager
3822
+ */
3823
+ /**
3824
+ * Image plugin events
3825
+ *
3826
+ * @hidden
3827
+ */
3828
+ var IMAGE = 'INSERT-IMAGE';
3829
+ var AUDIO = 'INSERT-AUDIO';
3830
+ var VIDEO = 'INSERT-VIDEO';
3831
+ var TABLE = 'INSERT-TABLE';
3832
+ var LINK = 'INSERT-LINK';
3833
+ var INSERT_ROW = 'INSERT-ROW';
3834
+ var INSERT_COLUMN = 'INSERT-COLUMN';
3835
+ var DELETEROW = 'DELETE-ROW';
3836
+ var DELETECOLUMN = 'DELETE-COLUMN';
3837
+ var REMOVETABLE = 'REMOVE-TABLE';
3838
+ var TABLEHEADER = 'TABLE-HEADER';
3839
+ var TABLE_VERTICAL_ALIGN = 'TABLE_VERTICAL_ALIGN';
3840
+ var TABLE_MERGE = 'TABLE_MERGE';
3841
+ var TABLE_VERTICAL_SPLIT = 'TABLE_VERTICAL_SPLIT';
3842
+ var TABLE_HORIZONTAL_SPLIT = 'TABLE_HORIZONTAL_SPLIT';
3843
+ var TABLE_MOVE = 'TABLE_MOVE';
3844
+ /**
3845
+ * Alignments plugin events
3846
+ *
3847
+ * @hidden
3848
+ */
3849
+ var ALIGNMENT_TYPE = 'alignment-type';
3850
+ /**
3851
+ * Indents plugin events
3852
+ *
3853
+ * @hidden
3854
+ */
3855
+ var INDENT_TYPE = 'indent-type';
3856
+ /**
3857
+ * Constant tag names
3858
+ *
3859
+ * @hidden
3860
+ */
3861
+ var DEFAULT_TAG = 'p';
3862
+ /**
3863
+ * @hidden
3864
+ */
3865
+ var BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote',
3866
+ 'canvas', 'details', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer',
3867
+ 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav',
3868
+ 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tbody', 'td', 'tfoot', 'th',
3869
+ 'thead', 'tr', 'ul', 'video', 'body'];
3870
+ /**
3871
+ * @hidden
3872
+ */
3873
+ var IGNORE_BLOCK_TAGS = ['td', 'th'];
3874
+ /**
3875
+ * @hidden
3876
+ */
3877
+ var TABLE_BLOCK_TAGS = ['table', 'tbody', 'td', 'tfoot', 'th',
3878
+ 'thead', 'tr'];
3879
+ /**
3880
+ * Selection plugin events
3881
+ *
3882
+ * @hidden
3883
+ */
3884
+ var SELECTION_TYPE = 'selection-type';
3885
+ /**
3886
+ * Insert HTML plugin events
3887
+ *
3888
+ * @hidden
3889
+ */
3890
+ var INSERTHTML_TYPE = 'inserthtml-type';
3891
+ /**
3892
+ * Insert Text plugin events
3893
+ *
3894
+ * @hidden
3895
+ */
3896
+ var INSERT_TEXT_TYPE = 'insert-text-type';
3897
+ /**
3898
+ * Clear Format HTML plugin events
3899
+ *
3900
+ * @hidden
3901
+ */
3902
+ var CLEAR_TYPE = 'clear-type';
3903
+ /**
3904
+ * Self closing tags
3905
+ *
3906
+ * @hidden
3907
+ */
3908
+ var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
3909
+ /**
3910
+ * Source
3911
+ *
3912
+ * @hidden
3913
+ */
3914
+ var PASTE_SOURCE = ['word', 'excel', 'onenote'];
3915
+
3916
+ /**
3917
+ * `Selection` module is used to handle RTE Selections.
3918
+ */
3919
+ var NodeSelection = /** @__PURE__ @class */ (function () {
3920
+ function NodeSelection() {
3921
+ this.startNodeName = [];
3922
+ this.endNodeName = [];
3923
+ }
3924
+ NodeSelection.prototype.saveInstance = function (range, body) {
3925
+ this.range = range.cloneRange();
3926
+ this.rootNode = this.documentFromRange(range);
3927
+ this.body = body;
3928
+ this.startContainer = this.getNodeArray(range.startContainer, true);
3929
+ this.endContainer = this.getNodeArray(range.endContainer, false);
3930
+ this.startOffset = range.startOffset;
3931
+ this.endOffset = range.endOffset;
3932
+ this.html = this.body.innerHTML;
3933
+ return this;
3934
+ };
3935
+ NodeSelection.prototype.documentFromRange = function (range) {
3936
+ return (9 === range.startContainer.nodeType) ? range.startContainer : range.startContainer.ownerDocument;
3937
+ };
3938
+ NodeSelection.prototype.getRange = function (docElement) {
3939
+ var select$$1 = this.get(docElement);
3940
+ var range = select$$1 && select$$1.rangeCount > 0 ? select$$1.getRangeAt(select$$1.rangeCount - 1) : docElement.createRange();
3941
+ return (range.startContainer !== docElement || range.endContainer !== docElement
3942
+ || range.startOffset || range.endOffset || (range.setStart(docElement.body, 0), range.collapse(!0)), range);
3943
+ };
3944
+ /**
3945
+ * get method
3946
+ *
3947
+ * @param {Document} docElement - specifies the get function
3948
+ * @returns {void}
3949
+ * @hidden
3950
+ * @deprecated
3951
+ */
3952
+ NodeSelection.prototype.get = function (docElement) {
3953
+ return docElement.defaultView.getSelection();
3954
+ };
3955
+ /**
3956
+ * save method
3957
+ *
3958
+ * @param {Range} range - range value.
3959
+ * @param {Document} docElement - specifies the document.
3960
+ * @returns {void}
3961
+ * @hidden
3962
+ * @deprecated
3963
+ */
3964
+ NodeSelection.prototype.save = function (range, docElement) {
3965
+ range = (range) ? range.cloneRange() : this.getRange(docElement);
3966
+ return this.saveInstance(range, docElement.body);
3967
+ };
3968
+ /**
3969
+ * getIndex method
3970
+ *
3971
+ * @param {Node} node - specifies the node value.
3972
+ * @returns {void}
3973
+ * @hidden
3974
+ * @deprecated
3975
+ */
3976
+ NodeSelection.prototype.getIndex = function (node) {
3977
+ var index;
3978
+ var num = 0;
3979
+ node = !node.previousSibling && node.tagName === 'BR' ? node : node.previousSibling;
3980
+ if (node) {
3981
+ for (var type = node.nodeType; node; null) {
3982
+ index = node.nodeType;
3983
+ num++;
3984
+ //eslint-disable-next-line
3985
+ type = index;
3986
+ node = node.previousSibling;
3987
+ }
3988
+ }
3989
+ return num;
3990
+ };
3991
+ NodeSelection.prototype.isChildNode = function (nodeCollection, parentNode) {
3992
+ for (var index = 0; index < parentNode.childNodes.length; index++) {
3993
+ if (nodeCollection.indexOf(parentNode.childNodes[index]) > -1) {
3994
+ return true;
3668
3995
  }
3669
3996
  }
3997
+ return false;
3998
+ };
3999
+ NodeSelection.prototype.getNode = function (startNode, endNode, nodeCollection) {
4000
+ if (endNode === startNode &&
4001
+ (startNode.nodeType === 3 || !startNode.firstChild || nodeCollection.indexOf(startNode.firstChild) !== -1
4002
+ || this.isChildNode(nodeCollection, startNode))) {
4003
+ return null;
4004
+ }
4005
+ if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
4006
+ return null;
4007
+ }
4008
+ if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
4009
+ return startNode.firstChild;
4010
+ }
4011
+ if (startNode.nextSibling) {
4012
+ return startNode.nextSibling;
4013
+ }
4014
+ if (!startNode.parentNode) {
4015
+ return null;
4016
+ }
4017
+ else {
4018
+ return startNode.parentNode;
4019
+ }
4020
+ };
4021
+ /**
4022
+ * getNodeCollection method
4023
+ *
4024
+ * @param {Range} range -specifies the range.
4025
+ * @returns {void}
4026
+ * @hidden
4027
+ * @deprecated
4028
+ */
4029
+ NodeSelection.prototype.getNodeCollection = function (range) {
4030
+ var startNode = range.startContainer.childNodes[range.startOffset]
4031
+ || range.startContainer;
4032
+ var endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
4033
+ || range.endContainer;
4034
+ if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
4035
+ startNode.childNodes.length === 0) {
4036
+ return [startNode];
4037
+ }
4038
+ if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
4039
+ return [startNode.nodeName === 'BR' || startNode.nodeName === '#text' ? startNode : startNode.childNodes[0]];
4040
+ }
4041
+ var nodeCollection = [];
4042
+ do {
4043
+ if (nodeCollection.indexOf(startNode) === -1) {
4044
+ nodeCollection.push(startNode);
4045
+ }
4046
+ startNode = this.getNode(startNode, endNode, nodeCollection);
4047
+ } while (startNode);
4048
+ return nodeCollection;
4049
+ };
4050
+ /**
4051
+ * getParentNodeCollection method
4052
+ *
4053
+ * @param {Range} range - specifies the range value.
4054
+ * @returns {void}
4055
+ * @hidden
4056
+ * @deprecated
4057
+ */
4058
+ NodeSelection.prototype.getParentNodeCollection = function (range) {
4059
+ return this.getParentNodes(this.getNodeCollection(range), range);
4060
+ };
4061
+ /**
4062
+ * getParentNodes method
4063
+ *
4064
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4065
+ * @param {Range} range - specifies the range values.
4066
+ * @returns {void}
4067
+ * @hidden
4068
+ * @deprecated
4069
+ */
4070
+ NodeSelection.prototype.getParentNodes = function (nodeCollection, range) {
4071
+ nodeCollection = nodeCollection.reverse();
4072
+ for (var index = 0; index < nodeCollection.length; index++) {
4073
+ if ((nodeCollection.indexOf(nodeCollection[index].parentNode) !== -1)
4074
+ || (nodeCollection[index].nodeType === 3 &&
4075
+ range.startContainer !== range.endContainer &&
4076
+ range.startContainer.parentNode !== range.endContainer.parentNode)) {
4077
+ nodeCollection.splice(index, 1);
4078
+ index--;
4079
+ }
4080
+ else if (nodeCollection[index].nodeType === 3) {
4081
+ nodeCollection[index] = nodeCollection[index].parentNode;
4082
+ }
4083
+ }
4084
+ return nodeCollection;
4085
+ };
4086
+ /**
4087
+ * getSelectionNodeCollection method
4088
+ *
4089
+ * @param {Range} range - specifies the range value.
4090
+ * @returns {void}
4091
+ * @hidden
4092
+ * @deprecated
4093
+ */
4094
+ NodeSelection.prototype.getSelectionNodeCollection = function (range) {
4095
+ return this.getSelectionNodes(this.getNodeCollection(range));
4096
+ };
4097
+ /**
4098
+ * getSelectionNodeCollection along with BR node method
4099
+ *
4100
+ * @param {Range} range - specifies the range value.
4101
+ * @returns {void}
4102
+ * @hidden
4103
+ * @deprecated
4104
+ */
4105
+ NodeSelection.prototype.getSelectionNodeCollectionBr = function (range) {
4106
+ return this.getSelectionNodesBr(this.getNodeCollection(range));
4107
+ };
4108
+ /**
4109
+ * getParentNodes method
4110
+ *
4111
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4112
+ * @returns {void}
4113
+ * @hidden
4114
+ * @deprecated
4115
+ */
4116
+ NodeSelection.prototype.getSelectionNodes = function (nodeCollection) {
4117
+ nodeCollection = nodeCollection.reverse();
4118
+ // eslint-disable-next-line
4119
+ var regEx = new RegExp(String.fromCharCode(8203), 'g');
4120
+ for (var index = 0; index < nodeCollection.length; index++) {
4121
+ if (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
4122
+ (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx)))) {
4123
+ nodeCollection.splice(index, 1);
4124
+ index--;
4125
+ }
4126
+ }
4127
+ return nodeCollection.reverse();
4128
+ };
4129
+ /**
4130
+ * Get selection text nodes with br method.
4131
+ *
4132
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4133
+ * @returns {void}
4134
+ * @hidden
4135
+ * @deprecated
4136
+ */
4137
+ NodeSelection.prototype.getSelectionNodesBr = function (nodeCollection) {
4138
+ nodeCollection = nodeCollection.reverse();
4139
+ // eslint-disable-next-line
4140
+ var regEx = new RegExp(String.fromCharCode(8203), 'g');
4141
+ for (var index = 0; index < nodeCollection.length; index++) {
4142
+ if (nodeCollection[index].nodeName !== 'BR' &&
4143
+ (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
4144
+ (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx))))) {
4145
+ nodeCollection.splice(index, 1);
4146
+ index--;
4147
+ }
4148
+ }
4149
+ return nodeCollection.reverse();
4150
+ };
4151
+ /**
4152
+ * getInsertNodeCollection method
4153
+ *
4154
+ * @param {Range} range - specifies the range value.
4155
+ * @returns {void}
4156
+ * @hidden
4157
+ * @deprecated
4158
+ */
4159
+ NodeSelection.prototype.getInsertNodeCollection = function (range) {
4160
+ return this.getInsertNodes(this.getNodeCollection(range));
4161
+ };
4162
+ /**
4163
+ * getInsertNodes method
4164
+ *
4165
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4166
+ * @returns {void}
4167
+ * @hidden
4168
+ * @deprecated
4169
+ */
4170
+ NodeSelection.prototype.getInsertNodes = function (nodeCollection) {
4171
+ nodeCollection = nodeCollection.reverse();
4172
+ for (var index = 0; index < nodeCollection.length; index++) {
4173
+ if ((nodeCollection[index].childNodes.length !== 0 &&
4174
+ nodeCollection[index].nodeType !== 3) ||
4175
+ (nodeCollection[index].nodeType === 3 &&
4176
+ nodeCollection[index].textContent === '')) {
4177
+ nodeCollection.splice(index, 1);
4178
+ index--;
4179
+ }
4180
+ }
4181
+ return nodeCollection.reverse();
4182
+ };
4183
+ /**
4184
+ * getNodeArray method
4185
+ *
4186
+ * @param {Node} node - specifies the node content.
4187
+ * @param {boolean} isStart - specifies the boolean value.
4188
+ * @param {Document} root - specifies the root document.
4189
+ * @returns {void}
4190
+ * @hidden
4191
+ * @deprecated
4192
+ */
4193
+ NodeSelection.prototype.getNodeArray = function (node, isStart, root) {
4194
+ var array = [];
4195
+ // eslint-disable-next-line
4196
+ ((isStart) ? (this.startNodeName = []) : (this.endNodeName = []));
4197
+ for (; node !== (root ? root : this.rootNode); null) {
4198
+ if (isNullOrUndefined(node)) {
4199
+ break;
4200
+ }
4201
+ // eslint-disable-next-line
4202
+ (isStart) ? this.startNodeName.push(node.nodeName.toLowerCase()) : this.endNodeName.push(node.nodeName.toLowerCase());
4203
+ array.push(this.getIndex(node));
4204
+ node = node.parentNode;
4205
+ }
4206
+ return array;
4207
+ };
4208
+ NodeSelection.prototype.setRangePoint = function (range, isvalid, num, size) {
4209
+ var node = this.rootNode;
4210
+ var index = num.length;
4211
+ var constant = size;
4212
+ for (; index--; null) {
4213
+ node = node && node.childNodes[num[index]];
4214
+ }
4215
+ if (node && constant >= 0 && node.nodeName !== 'html') {
4216
+ if (node.nodeType === 3 && node.nodeValue.replace(/\u00a0/g, '&nbsp;') === '&nbsp;') {
4217
+ constant = node.textContent.length;
4218
+ }
4219
+ range[isvalid ? 'setStart' : 'setEnd'](node, constant);
4220
+ }
4221
+ return range;
4222
+ };
4223
+ /**
4224
+ * restore method
4225
+ *
4226
+ * @returns {void}
4227
+ * @hidden
4228
+ * @deprecated
4229
+ */
4230
+ NodeSelection.prototype.restore = function () {
4231
+ var range = this.range.cloneRange();
4232
+ range = this.setRangePoint(range, true, this.startContainer, this.startOffset);
4233
+ range = this.setRangePoint(range, false, this.endContainer, this.endOffset);
4234
+ this.selectRange(this.rootNode, range);
4235
+ return range;
4236
+ };
4237
+ NodeSelection.prototype.selectRange = function (docElement, range) {
4238
+ this.setRange(docElement, range);
4239
+ this.save(range, docElement);
4240
+ };
4241
+ /**
4242
+ * setRange method
4243
+ *
4244
+ * @param {Document} docElement - specifies the document.
4245
+ * @param {Range} range - specifies the range.
4246
+ * @returns {void}
4247
+ * @hidden
4248
+ * @deprecated
4249
+ */
4250
+ NodeSelection.prototype.setRange = function (docElement, range) {
4251
+ var selection = this.get(docElement);
4252
+ selection.removeAllRanges();
4253
+ selection.addRange(range);
4254
+ };
4255
+ /**
4256
+ * setSelectionText method
4257
+ *
4258
+ * @param {Document} docElement - specifies the documrent
4259
+ * @param {Node} startNode - specifies the starting node.
4260
+ * @param {Node} endNode - specifies the the end node.
4261
+ * @param {number} startIndex - specifies the starting index.
4262
+ * @param {number} endIndex - specifies the end index.
4263
+ * @returns {void}
4264
+ * @hidden
4265
+ * @deprecated
4266
+ */
4267
+ NodeSelection.prototype.setSelectionText = function (docElement, startNode, endNode, startIndex, endIndex) {
4268
+ var range = docElement.createRange();
4269
+ range.setStart(startNode, startIndex);
4270
+ range.setEnd(endNode, endIndex);
4271
+ this.setRange(docElement, range);
4272
+ };
4273
+ /**
4274
+ * setSelectionContents method
4275
+ *
4276
+ * @param {Document} docElement - specifies the document.
4277
+ * @param {Node} element - specifies the node.
4278
+ * @returns {void}
4279
+ * @hidden
4280
+ * @deprecated
4281
+ */
4282
+ NodeSelection.prototype.setSelectionContents = function (docElement, element) {
4283
+ var range = docElement.createRange();
4284
+ range.selectNode(element);
4285
+ this.setRange(docElement, range);
4286
+ };
4287
+ /**
4288
+ * setSelectionNode method
4289
+ *
4290
+ * @param {Document} docElement - specifies the document.
4291
+ * @param {Node} element - specifies the node.
4292
+ * @returns {void}
4293
+ * @hidden
4294
+ * @deprecated
4295
+ */
4296
+ NodeSelection.prototype.setSelectionNode = function (docElement, element) {
4297
+ var range = docElement.createRange();
4298
+ range.selectNodeContents(element);
4299
+ this.setRange(docElement, range);
4300
+ };
4301
+ /**
4302
+ * getSelectedNodes method
4303
+ *
4304
+ * @param {Document} docElement - specifies the document.
4305
+ * @returns {void}
4306
+ * @hidden
4307
+ * @deprecated
4308
+ */
4309
+ NodeSelection.prototype.getSelectedNodes = function (docElement) {
4310
+ return this.getNodeCollection(this.getRange(docElement));
4311
+ };
4312
+ /**
4313
+ * Clear method
4314
+ *
4315
+ * @param {Document} docElement - specifies the document.
4316
+ * @returns {void}
4317
+ * @hidden
4318
+ * @deprecated
4319
+ */
4320
+ NodeSelection.prototype.Clear = function (docElement) {
4321
+ this.get(docElement).removeAllRanges();
4322
+ };
4323
+ /**
4324
+ * insertParentNode method
4325
+ *
4326
+ * @param {Document} docElement - specifies the document.
4327
+ * @param {Node} newNode - specicfies the new node.
4328
+ * @param {Range} range - specifies the range.
4329
+ * @returns {void}
4330
+ * @hidden
4331
+ * @deprecated
4332
+ */
4333
+ NodeSelection.prototype.insertParentNode = function (docElement, newNode, range) {
4334
+ range.surroundContents(newNode);
4335
+ this.selectRange(docElement, range);
4336
+ };
4337
+ /**
4338
+ * setCursorPoint method
4339
+ *
4340
+ * @param {Document} docElement - specifies the document.
4341
+ * @param {Element} element - specifies the element.
4342
+ * @param {number} point - specifies the point.
4343
+ * @returns {void}
4344
+ * @hidden
4345
+ * @deprecated
4346
+ */
4347
+ NodeSelection.prototype.setCursorPoint = function (docElement, element, point) {
4348
+ var range = docElement.createRange();
4349
+ var selection = docElement.defaultView.getSelection();
4350
+ range.setStart(element, point);
4351
+ range.collapse(true);
4352
+ selection.removeAllRanges();
4353
+ selection.addRange(range);
4354
+ };
4355
+ return NodeSelection;
4356
+ }());
4357
+
4358
+ /**
4359
+ * `Selection` module is used to handle RTE Selections.
4360
+ */
4361
+
4362
+ /**
4363
+ * Defines common util methods used by Rich Text Editor.
4364
+ */
4365
+ var inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
4366
+ 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
4367
+ 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
4368
+ 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
4369
+ 'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
4370
+ /**
4371
+ * @returns {void}
4372
+ * @hidden
4373
+ */
4374
+ function isIDevice$1() {
4375
+ var result = false;
4376
+ if (Browser.isDevice && Browser.isIos) {
4377
+ result = true;
4378
+ }
4379
+ return result;
4380
+ }
4381
+ /**
4382
+ * @param {Element} editableElement - specifies the editable element.
4383
+ * @param {string} selector - specifies the string values.
4384
+ * @returns {void}
4385
+ * @hidden
4386
+ */
4387
+ function setEditFrameFocus(editableElement, selector) {
4388
+ if (editableElement.nodeName === 'BODY' && !isNullOrUndefined(selector)) {
4389
+ var iframe = top.window.document.querySelector(selector);
4390
+ if (!isNullOrUndefined(iframe)) {
4391
+ iframe.contentWindow.focus();
4392
+ }
4393
+ }
4394
+ }
4395
+ /**
4396
+ * @param {string} value - specifies the string value
4397
+ * @param {string} enterAction - specifies the enter key action API
4398
+ * @returns {void}
4399
+ * @hidden
4400
+ */
4401
+ function updateTextNode$1(value, enterAction) {
4402
+ var tempNode = document.createElement('div');
4403
+ tempNode.innerHTML = value;
4404
+ tempNode.setAttribute('class', 'tempDiv');
4405
+ var resultElm = document.createElement('div');
4406
+ var childNodes = tempNode.childNodes;
4407
+ if (childNodes.length > 0) {
4408
+ var isPreviousInlineElem = void 0;
4409
+ var previousParent = void 0;
4410
+ var paraElm = void 0;
4411
+ while (tempNode.firstChild) {
4412
+ if ((tempNode.firstChild.nodeName === '#text' &&
4413
+ (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
4414
+ inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
4415
+ if (!isPreviousInlineElem) {
4416
+ if (enterAction === 'BR') {
4417
+ resultElm.appendChild(tempNode.firstChild);
4418
+ previousParent = resultElm;
4419
+ }
4420
+ else {
4421
+ paraElm = createElement('p');
4422
+ resultElm.appendChild(paraElm);
4423
+ paraElm.appendChild(tempNode.firstChild);
4424
+ previousParent = paraElm;
4425
+ isPreviousInlineElem = true;
4426
+ }
4427
+ }
4428
+ else {
4429
+ previousParent.appendChild(tempNode.firstChild);
4430
+ previousParent = paraElm;
4431
+ isPreviousInlineElem = true;
4432
+ }
4433
+ }
4434
+ else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
4435
+ (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
4436
+ detach(tempNode.firstChild);
4437
+ }
4438
+ else {
4439
+ resultElm.appendChild(tempNode.firstChild);
4440
+ isPreviousInlineElem = false;
4441
+ }
4442
+ }
4443
+ var tableElm = resultElm.querySelectorAll('table');
4444
+ for (var i = 0; i < tableElm.length; i++) {
4445
+ if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table')) {
4446
+ tableElm[i].classList.add('e-rte-paste-table');
4447
+ if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
4448
+ tableElm[i].classList.remove('e-rte-paste-word-table');
4449
+ continue; // Skiping the removal of the border if the source is from word.
4450
+ }
4451
+ else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
4452
+ tableElm[i].classList.remove('e-rte-paste-excel-table');
4453
+ if (tableElm[i].getAttribute('border') === '0') {
4454
+ tableElm[i].removeAttribute('border');
4455
+ }
4456
+ var tdElm = tableElm[i].querySelectorAll('td');
4457
+ for (var j = 0; j < tdElm.length; j++) {
4458
+ if (tdElm[j].style.borderLeft === 'none') {
4459
+ tdElm[j].style.removeProperty('border-left');
4460
+ }
4461
+ if (tdElm[j].style.borderRight === 'none') {
4462
+ tdElm[j].style.removeProperty('border-right');
4463
+ }
4464
+ if (tdElm[j].style.borderBottom === 'none') {
4465
+ tdElm[j].style.removeProperty('border-bottom');
4466
+ }
4467
+ if (tdElm[j].style.borderTop === 'none') {
4468
+ tdElm[j].style.removeProperty('border-top');
4469
+ }
4470
+ if (tdElm[j].style.border === 'none') {
4471
+ tdElm[j].style.removeProperty('border');
4472
+ }
4473
+ }
4474
+ }
4475
+ else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
4476
+ tableElm[i].classList.remove('e-rte-paste-onenote-table');
4477
+ continue;
4478
+ }
4479
+ }
4480
+ }
4481
+ var imageElm = resultElm.querySelectorAll('img');
4482
+ for (var i = 0; i < imageElm.length; i++) {
4483
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
4484
+ continue; // Should not add the class if the image is Broken.
4485
+ }
4486
+ if (!imageElm[i].classList.contains('e-rte-image')) {
4487
+ imageElm[i].classList.add('e-rte-image');
4488
+ }
4489
+ if (!(imageElm[i].classList.contains('e-imginline') ||
4490
+ imageElm[i].classList.contains('e-imgbreak'))) {
4491
+ imageElm[i].classList.add('e-imginline');
4492
+ }
4493
+ }
4494
+ }
4495
+ return resultElm.innerHTML;
4496
+ }
4497
+ /**
4498
+ * @param {Node} startChildNodes - specifies the node
4499
+ * @returns {void}
4500
+ * @hidden
4501
+ */
4502
+ function getLastTextNode(startChildNodes) {
4503
+ var finalNode = startChildNodes;
4504
+ do {
4505
+ if (finalNode.childNodes.length > 0) {
4506
+ finalNode = finalNode.childNodes[0];
4507
+ }
4508
+ } while (finalNode.childNodes.length > 0);
4509
+ return finalNode;
4510
+ }
4511
+ /**
4512
+ * @returns {void}
4513
+ * @hidden
4514
+ */
4515
+ function getDefaultHtmlTbStatus() {
4516
+ return {
4517
+ bold: false,
4518
+ italic: false,
4519
+ subscript: false,
4520
+ superscript: false,
4521
+ strikethrough: false,
4522
+ orderedlist: false,
4523
+ unorderedlist: false,
4524
+ numberFormatList: false,
4525
+ bulletFormatList: false,
4526
+ underline: false,
4527
+ alignments: null,
4528
+ backgroundcolor: null,
4529
+ fontcolor: null,
4530
+ fontname: null,
4531
+ fontsize: null,
4532
+ formats: null,
4533
+ createlink: false,
4534
+ insertcode: false
4535
+ };
4536
+ }
4537
+ /**
4538
+ * @returns {void}
4539
+ * @hidden
4540
+ */
4541
+ function getDefaultMDTbStatus() {
4542
+ return {
4543
+ bold: false,
4544
+ italic: false,
4545
+ subscript: false,
4546
+ superscript: false,
4547
+ strikethrough: false,
4548
+ orderedlist: false,
4549
+ uppercase: false,
4550
+ lowercase: false,
4551
+ inlinecode: false,
4552
+ unorderedlist: false,
4553
+ formats: null
4554
+ };
4555
+ }
4556
+ /**
4557
+ * @param {Range} range - specifies the range
4558
+ * @returns {void}
4559
+ * @hidden
4560
+ */
4561
+ function nestedListCleanUp(range) {
4562
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
4563
+ range.extractContents();
4564
+ while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
4565
+ (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
4566
+ var emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
4567
+ if (emptyLI.length > 0) {
4568
+ emptyLI.forEach(function (item) {
4569
+ item.remove();
4570
+ });
4571
+ }
4572
+ }
4573
+ var liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
4574
+ if (liElem.length > 0) {
4575
+ liElem.forEach(function (item) {
4576
+ if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
4577
+ item.style.listStyleType = "none";
4578
+ }
4579
+ });
4580
+ }
4581
+ }
4582
+ }
4583
+
4584
+ /**
4585
+ * Update Toolbar Status
4586
+ *
4587
+ * @hidden
4588
+ * @deprecated
4589
+ */
4590
+ var statusCollection = getDefaultHtmlTbStatus();
4591
+ var ToolbarStatus = /** @__PURE__ @class */ (function () {
4592
+ function ToolbarStatus() {
4593
+ }
4594
+ /**
4595
+ * get method
4596
+ *
4597
+ * @param {Document} docElement - specifies the document element
4598
+ * @param {Node} rootNode - specifies the content editable element
4599
+ * @param {string[]} formatNode - specifies the format node
4600
+ * @param {string[]} fontSize - specifies the font size
4601
+ * @param {string[]} fontName - specifies the font name.
4602
+ * @param {Node} documentNode - specifies the document node.
4603
+ * @returns {IToolbarStatus} - returns the toolbar status
4604
+ * @hidden
4605
+ * @deprecated
4606
+ */
4607
+ ToolbarStatus.get = function (docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
4608
+ var formatCollection = JSON.parse(JSON.stringify(statusCollection));
4609
+ var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
4610
+ var nodeSelection = new NodeSelection();
4611
+ var range = nodeSelection.getRange(docElement);
4612
+ var nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
4613
+ nodeSelection.getSelectionNodeCollectionBr(range);
4614
+ var nodesLength = nodes.length;
4615
+ var isNodeChanged = false;
4616
+ for (var index = 0; index < nodes.length; index++) {
4617
+ while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
4618
+ nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
4619
+ (this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
4620
+ range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
4621
+ nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
4622
+ nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
4623
+ isNodeChanged = true;
4624
+ }
4625
+ if (isNodeChanged && nodes[index]) {
4626
+ nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
4627
+ isNodeChanged = false;
4628
+ }
4629
+ if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
4630
+ (nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
4631
+ nodes.splice(index, 1);
4632
+ index--;
4633
+ }
4634
+ }
4635
+ for (var index = 0; index < nodes.length; index++) {
4636
+ // eslint-disable-next-line max-len
4637
+ formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], rootNode, formatNode, fontSize, fontName);
4638
+ if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
4639
+ nodeCollection.bold = formatCollection.bold;
4640
+ }
4641
+ if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
4642
+ nodeCollection.insertcode = formatCollection.insertcode;
4643
+ }
4644
+ if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
4645
+ nodeCollection.italic = formatCollection.italic;
4646
+ }
4647
+ if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
4648
+ nodeCollection.underline = formatCollection.underline;
4649
+ }
4650
+ if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
4651
+ nodeCollection.strikethrough = formatCollection.strikethrough;
4652
+ }
4653
+ if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
4654
+ nodeCollection.superscript = formatCollection.superscript;
4655
+ }
4656
+ if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
4657
+ nodeCollection.subscript = formatCollection.subscript;
4658
+ }
4659
+ if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
4660
+ nodeCollection.fontcolor = formatCollection.fontcolor;
4661
+ }
4662
+ if (index === 0 && formatCollection.fontname) {
4663
+ nodeCollection.fontname = formatCollection.fontname;
4664
+ }
4665
+ else {
4666
+ nodeCollection.fontname = formatCollection.fontname === nodeCollection.fontname ? formatCollection.fontname : 'empty';
4667
+ }
4668
+ if (index === 0 && formatCollection.fontsize) {
4669
+ nodeCollection.fontsize = formatCollection.fontsize;
4670
+ }
4671
+ else {
4672
+ nodeCollection.fontsize = formatCollection.fontsize === nodeCollection.fontsize ? formatCollection.fontsize : 'empty';
4673
+ }
4674
+ if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
4675
+ nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
4676
+ }
4677
+ if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
4678
+ nodeCollection.orderedlist = formatCollection.orderedlist;
4679
+ }
4680
+ if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
4681
+ nodeCollection.unorderedlist = formatCollection.unorderedlist;
4682
+ }
4683
+ if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
4684
+ nodeCollection.alignments = formatCollection.alignments;
4685
+ }
4686
+ if (index === 0 && formatCollection.formats) {
4687
+ nodeCollection.formats = formatCollection.formats;
4688
+ }
4689
+ else {
4690
+ nodeCollection.formats = formatCollection.formats === nodeCollection.formats ? formatCollection.formats : 'empty';
4691
+ }
4692
+ if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
4693
+ nodeCollection.createlink = formatCollection.createlink;
4694
+ }
4695
+ if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
4696
+ nodeCollection.numberFormatList = formatCollection.numberFormatList;
4697
+ }
4698
+ if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
4699
+ nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
4700
+ }
4701
+ formatCollection = JSON.parse(JSON.stringify(statusCollection));
4702
+ }
4703
+ return nodeCollection;
4704
+ };
4705
+ ToolbarStatus.getImmediateBlockNode = function (node) {
4706
+ do {
4707
+ node = node.parentNode;
4708
+ } while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
4709
+ return node;
4710
+ };
4711
+ ToolbarStatus.getFormatParent = function (docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
4712
+ var isListUpdated = false;
4713
+ var isComplexListUpdated = false;
4714
+ if (targetNode.contains(node) ||
4715
+ (node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
4716
+ do {
4717
+ formatCollection = this.isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName);
4718
+ if (formatCollection.orderedlist || formatCollection.unorderedlist) {
4719
+ isListUpdated = true;
4720
+ }
4721
+ if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
4722
+ isComplexListUpdated = true;
4723
+ }
4724
+ node = node.parentNode;
4725
+ } while (node && (node !== targetNode));
4726
+ }
4727
+ return formatCollection;
4728
+ };
4729
+ ToolbarStatus.isFormattedNode = function (docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName) {
4730
+ if (!formatCollection.bold) {
4731
+ formatCollection.bold = IsFormatted.isBold(node);
4732
+ }
4733
+ if (!formatCollection.italic) {
4734
+ formatCollection.italic = IsFormatted.isItalic(node);
4735
+ }
4736
+ if (!formatCollection.underline) {
4737
+ formatCollection.underline = IsFormatted.isUnderline(node);
4738
+ }
4739
+ if (!formatCollection.strikethrough) {
4740
+ formatCollection.strikethrough = IsFormatted.isStrikethrough(node);
4741
+ }
4742
+ if (!formatCollection.superscript) {
4743
+ formatCollection.superscript = IsFormatted.isSuperscript(node);
4744
+ }
4745
+ if (!formatCollection.subscript) {
4746
+ formatCollection.subscript = IsFormatted.isSubscript(node);
4747
+ }
4748
+ if (!formatCollection.fontcolor) {
4749
+ formatCollection.fontcolor = this.isFontColor(docElement, node);
4750
+ }
4751
+ if (!formatCollection.fontname) {
4752
+ formatCollection.fontname = this.isFontName(docElement, node, fontName);
4753
+ }
4754
+ if (!formatCollection.fontsize) {
4755
+ formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
4756
+ }
4757
+ if (!formatCollection.backgroundcolor) {
4758
+ formatCollection.backgroundcolor = this.isBackgroundColor(node);
4759
+ }
4760
+ if (!formatCollection.orderedlist && !isListUpdated) {
4761
+ formatCollection.orderedlist = this.isOrderedList(node);
4762
+ }
4763
+ if (!formatCollection.unorderedlist && !isListUpdated) {
4764
+ formatCollection.unorderedlist = this.isUnorderedList(node);
4765
+ }
4766
+ if (!formatCollection.alignments) {
4767
+ formatCollection.alignments = this.isAlignment(node);
4768
+ }
4769
+ if (!formatCollection.formats) {
4770
+ formatCollection.formats = this.isFormats(node, formatNode);
4771
+ if (formatCollection.formats === 'pre') {
4772
+ formatCollection.insertcode = true;
4773
+ }
4774
+ }
4775
+ if (!formatCollection.createlink) {
4776
+ formatCollection.createlink = this.isLink(node);
4777
+ }
4778
+ if (!formatCollection.numberFormatList && !isComplexListUpdated) {
4779
+ formatCollection.numberFormatList = this.isNumberFormatList(node);
4780
+ }
4781
+ if (!formatCollection.bulletFormatList && !isComplexListUpdated) {
4782
+ formatCollection.bulletFormatList = this.isBulletFormatList(node);
4783
+ }
4784
+ return formatCollection;
4785
+ };
4786
+ ToolbarStatus.isFontColor = function (docElement, node) {
4787
+ var color = node.style && node.style.color;
4788
+ if ((color === null || color === undefined || color === '') && node.nodeType !== 3) {
4789
+ color = this.getComputedStyle(docElement, node, 'color');
4790
+ }
4791
+ if (color !== null && color !== '' && color !== undefined) {
4792
+ return color;
4793
+ }
4794
+ else {
4795
+ return null;
4796
+ }
4797
+ };
4798
+ ToolbarStatus.isLink = function (node) {
4799
+ if (node.nodeName.toLocaleLowerCase() === 'a') {
4800
+ return true;
4801
+ }
4802
+ else {
4803
+ return false;
4804
+ }
4805
+ };
4806
+ ToolbarStatus.isBackgroundColor = function (node) {
4807
+ var backColor = node.style && node.style.backgroundColor;
4808
+ if (backColor !== null && backColor !== '' && backColor !== undefined) {
4809
+ return backColor;
4810
+ }
4811
+ else {
4812
+ return null;
4813
+ }
4814
+ };
4815
+ ToolbarStatus.isFontSize = function (docElement, node, fontSize) {
4816
+ var size = node.style && node.style.fontSize;
4817
+ if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
4818
+ node.parentElement.classList.contains('e-content')) {
4819
+ size = this.getComputedStyle(docElement, node, 'font-size');
4820
+ }
4821
+ if ((size !== null && size !== '' && size !== undefined)
4822
+ && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
4823
+ return size;
4824
+ }
4825
+ else {
4826
+ return null;
4827
+ }
4828
+ };
4829
+ ToolbarStatus.isFontName = function (docElement, node, fontName) {
4830
+ var name = node.style && node.style.fontFamily;
4831
+ if ((name === null || name === undefined || name === '') && node.nodeType !== 3) {
4832
+ name = this.getComputedStyle(docElement, node, 'font-family');
4833
+ }
4834
+ var index = null;
4835
+ if ((name !== null && name !== '' && name !== undefined)
4836
+ && (fontName === null || fontName === undefined || (fontName.filter(function (value, pos) {
4837
+ // eslint-disable-next-line
4838
+ var pattern = new RegExp(name, 'i');
4839
+ if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
4840
+ (value.split(',')[0] && !isNullOrUndefined(value.split(',')[0].trim().match(pattern)) &&
4841
+ value.split(',')[0].trim() === value.split(',')[0].trim().match(pattern)[0])) {
4842
+ index = pos;
4843
+ }
4844
+ }) && (index !== null)))) {
4845
+ // eslint-disable-next-line
4846
+ return (index !== null) ? fontName[index] : name.replace(/"/g, '');
4847
+ }
4848
+ else {
4849
+ return null;
4850
+ }
4851
+ };
4852
+ ToolbarStatus.isOrderedList = function (node) {
4853
+ if (node.nodeName.toLocaleLowerCase() === 'ol') {
4854
+ return true;
4855
+ }
4856
+ else {
4857
+ return false;
4858
+ }
4859
+ };
4860
+ ToolbarStatus.isUnorderedList = function (node) {
4861
+ if (node.nodeName.toLocaleLowerCase() === 'ul') {
4862
+ return true;
4863
+ }
4864
+ else {
4865
+ return false;
4866
+ }
4867
+ };
4868
+ ToolbarStatus.isAlignment = function (node) {
4869
+ var align = node.style && node.style.textAlign;
4870
+ if (align === 'left') {
4871
+ return 'justifyleft';
4872
+ }
4873
+ else if (align === 'center') {
4874
+ return 'justifycenter';
4875
+ }
4876
+ else if (align === 'right') {
4877
+ return 'justifyright';
4878
+ }
4879
+ else if (align === 'justify') {
4880
+ return 'justifyfull';
4881
+ }
4882
+ else {
4883
+ return null;
4884
+ }
4885
+ };
4886
+ ToolbarStatus.isFormats = function (node, formatNode) {
4887
+ if (((formatNode === undefined || formatNode === null)
4888
+ && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) > -1)
4889
+ || (formatNode !== null && formatNode !== undefined
4890
+ && formatNode.indexOf(node.nodeName.toLocaleLowerCase()) > -1)) {
4891
+ return node.nodeName.toLocaleLowerCase();
4892
+ }
4893
+ else {
4894
+ return null;
4895
+ }
4896
+ };
4897
+ ToolbarStatus.getComputedStyle = function (docElement, node, prop) {
4898
+ return docElement.defaultView.getComputedStyle(node, null).getPropertyValue(prop);
4899
+ };
4900
+ ToolbarStatus.isNumberFormatList = function (node) {
4901
+ var list = node.style && node.style.listStyleType;
4902
+ if (list === 'lower-alpha') {
4903
+ return 'Lower Alpha';
4904
+ }
4905
+ else if (list === 'number') {
4906
+ return 'Number';
4907
+ }
4908
+ else if (list === 'upper-alpha') {
4909
+ return 'Upper Alpha';
4910
+ }
4911
+ else if (list === 'lower-roman') {
4912
+ return 'Lower Roman';
4913
+ }
4914
+ else if (list === 'upper-roman') {
4915
+ return 'Upper Roman';
4916
+ }
4917
+ else if (list === 'lower-greek') {
4918
+ return 'Lower Greek';
4919
+ }
4920
+ else if (list === 'none') {
4921
+ return 'None';
4922
+ }
4923
+ else if (this.isOrderedList(node)) {
4924
+ return true;
4925
+ }
4926
+ else {
4927
+ return null;
4928
+ }
4929
+ };
4930
+ ToolbarStatus.isBulletFormatList = function (node) {
4931
+ var list = node.style && node.style.listStyleType;
4932
+ if (list === 'circle') {
4933
+ return 'Circle';
4934
+ }
4935
+ else if (list === 'square') {
4936
+ return 'Square';
4937
+ }
4938
+ else if (list === 'none') {
4939
+ return 'None';
4940
+ }
4941
+ else if (list === 'disc') {
4942
+ return 'Disc';
4943
+ }
4944
+ else if (this.isUnorderedList(node)) {
4945
+ return true;
4946
+ }
4947
+ else {
4948
+ return null;
4949
+ }
4950
+ };
4951
+ return ToolbarStatus;
4952
+ }());
4953
+
4954
+ /**
4955
+ * `Toolbar renderer` module is used to render toolbar in RichTextEditor.
4956
+ *
4957
+ * @hidden
4958
+ * @deprecated
4959
+ */
4960
+ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
4961
+ /**
4962
+ * Constructor for toolbar renderer module
4963
+ *
4964
+ * @param {IRichTextEditor} parent - specifies the parent element.
4965
+ * @param {ServiceLocator} serviceLocator - specifies the serviceLocator
4966
+ */
4967
+ function ToolbarRenderer(parent, serviceLocator) {
4968
+ this.parent = parent;
4969
+ if (serviceLocator) {
4970
+ this.l10n = serviceLocator.getService('rteLocale');
4971
+ }
4972
+ this.wireEvent();
4973
+ }
4974
+ ToolbarRenderer.prototype.wireEvent = function () {
4975
+ this.parent.on(destroy, this.unWireEvent, this);
4976
+ this.parent.on(destroyTooltip, this.destroyTooltip, this);
4977
+ this.parent.on(closeTooltip, this.closeTooltip, this);
4978
+ };
4979
+ ToolbarRenderer.prototype.destroyTooltip = function () {
4980
+ var currentDocument = this.parent.iframeSettings.enable ? this.parent.contentModule.getPanel().ownerDocument :
4981
+ this.parent.contentModule.getDocument();
4982
+ if (!isNullOrUndefined(currentDocument.querySelector('.e-tooltip-wrap')) && !isNullOrUndefined(currentDocument.querySelector('[data-tooltip-id]'))) {
4983
+ var tooltipTargetEle = currentDocument.querySelector('[data-tooltip-id]');
4984
+ var event_1 = new MouseEvent('mouseleave', { bubbles: true, cancelable: true });
4985
+ tooltipTargetEle.dispatchEvent(event_1);
4986
+ }
4987
+ };
4988
+ ToolbarRenderer.prototype.unWireEvent = function () {
4989
+ this.parent.off(destroy, this.unWireEvent);
4990
+ this.parent.off(destroyTooltip, this.destroyTooltip);
4991
+ this.parent.off(closeTooltip, this.closeTooltip);
4992
+ };
4993
+ ToolbarRenderer.prototype.toolbarBeforeCreate = function (e) {
4994
+ if (this.mode === 'Extended') {
4995
+ e.enableCollision = false;
4996
+ }
4997
+ };
4998
+ ToolbarRenderer.prototype.toolbarCreated = function () {
4999
+ this.parent.notify(toolbarCreated, this);
5000
+ };
5001
+ ToolbarRenderer.prototype.toolbarClicked = function (args) {
5002
+ if (!this.parent.enabled) {
5003
+ return;
5004
+ }
5005
+ this.parent.trigger('toolbarClick', args);
5006
+ if (!this.parent.readonly || isNullOrUndefined(args.item)) {
5007
+ this.parent.notify(toolbarClick, args);
5008
+ }
5009
+ };
5010
+ ToolbarRenderer.prototype.dropDownSelected = function (args) {
5011
+ this.parent.notify(dropDownSelect, { element: args.element, item: args.item, originalEvent: args.event });
5012
+ this.destroyTooltip();
5013
+ };
5014
+ ToolbarRenderer.prototype.beforeDropDownItemRender = function (args) {
5015
+ if (this.parent.readonly || !this.parent.enabled) {
5016
+ return;
5017
+ }
5018
+ this.parent.notify(beforeDropDownItemRender, args);
5019
+ };
5020
+ ToolbarRenderer.prototype.tooltipBeforeRender = function (args) {
5021
+ if (!isNullOrUndefined(args.target.getAttribute('title'))) {
5022
+ var tooltipTarget = args.target.getAttribute('title');
5023
+ var tooltipText = void 0;
5024
+ switch (tooltipTarget) {
5025
+ case 'Minimize':
5026
+ tooltipText = this.l10n.getConstant('minimize');
5027
+ args.target.setAttribute('title', tooltipText + ' (Esc)');
5028
+ break;
5029
+ case 'Maximize':
5030
+ tooltipText = this.l10n.getConstant('maximize');
5031
+ args.target.setAttribute('title', tooltipText + ' (Ctrl+Shift+F)');
5032
+ break;
5033
+ }
5034
+ }
5035
+ if (args.target.querySelector('.e-active')) {
5036
+ args.cancel = true;
5037
+ }
3670
5038
  };
3671
5039
  ToolbarRenderer.prototype.dropDownOpen = function (args) {
3672
5040
  if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1 && !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-merge')) &&
@@ -3689,19 +5057,6 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
3689
5057
  addClass([listEle[1], listEle[2]], 'e-disabled');
3690
5058
  }
3691
5059
  }
3692
- if (this.parent.showTooltip) {
3693
- this.dropdownTooltip = new Tooltip({
3694
- target: '[aria-owns="' + this.parent.getID() + '"].e-rte-elements [title]',
3695
- showTipPointer: true,
3696
- openDelay: 400,
3697
- opensOn: 'Hover',
3698
- beforeRender: this.tooltipBeforeRender.bind(this),
3699
- cssClass: this.parent.getCssClass(),
3700
- windowCollision: true,
3701
- position: 'BottomCenter'
3702
- });
3703
- this.dropdownTooltip.appendTo(args.element);
3704
- }
3705
5060
  this.parent.notify(selectionSave, args);
3706
5061
  };
3707
5062
  ToolbarRenderer.prototype.dropDownClose = function (args) {
@@ -3847,11 +5202,22 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
3847
5202
  }
3848
5203
  //Formats preselect
3849
5204
  if (args.items[0].command === 'Formats' || args.items[0].command === 'Font') {
5205
+ var fontName_1 = [];
5206
+ var formats_1 = [];
5207
+ _this.parent.format.types.forEach(function (item) {
5208
+ formats_1.push(item.value.toLocaleLowerCase());
5209
+ });
5210
+ _this.parent.fontFamily.items.forEach(function (item) {
5211
+ fontName_1.push(item.value);
5212
+ });
5213
+ var toolbarStatus = ToolbarStatus.get(_this.parent.contentModule.getDocument(), _this.parent.contentModule.getEditPanel(), formats_1, null, fontName_1);
3850
5214
  for (var index = 0; index < args.element.childNodes.length; index++) {
3851
5215
  var divNode = _this.parent.createElement('div');
3852
5216
  divNode.innerHTML = dropDown.content.trim();
3853
- if (divNode.textContent.trim() !== ''
3854
- && args.element.childNodes[index].textContent.trim() === divNode.textContent.trim()) {
5217
+ if ((divNode.textContent.trim() !== ''
5218
+ && args.element.childNodes[index].textContent.trim() === divNode.textContent.trim()) ||
5219
+ ((args.items[0].command === 'Formats' && !isNullOrUndefined(toolbarStatus.formats) && _this.parent.format.types[index].value.toLowerCase() === toolbarStatus.formats.toLowerCase() && args.element.childNodes[index].classList.contains(_this.parent.format.types[index].cssClass))
5220
+ || (args.items[0].command === 'Font' && !isNullOrUndefined(toolbarStatus.fontname) && _this.parent.fontFamily.items[index].value.toLowerCase() === toolbarStatus.fontname.toLowerCase() && args.element.childNodes[index].classList.contains(_this.parent.fontFamily.items[index].cssClass)))) {
3855
5221
  if (!args.element.childNodes[index].classList.contains('e-active')) {
3856
5222
  addClass([args.element.childNodes[index]], 'e-active');
3857
5223
  }
@@ -4037,6 +5403,8 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
4037
5403
  target: colorPicker.element.parentElement, cssClass: css,
4038
5404
  enablePersistence: this.parent.enablePersistence, enableRtl: this.parent.enableRtl,
4039
5405
  beforeOpen: function (dropDownArgs) {
5406
+ colorPicker.inline = true;
5407
+ colorPicker.dataBind();
4040
5408
  if (proxy.parent.readonly || !proxy.parent.enabled) {
4041
5409
  dropDownArgs.cancel = true;
4042
5410
  return;
@@ -4175,18 +5543,14 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
4175
5543
  var colorPicker = new ColorPicker({
4176
5544
  enablePersistence: this.parent.enablePersistence,
4177
5545
  enableRtl: this.parent.enableRtl,
4178
- inline: true,
4179
- value: null,
4180
- cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass + ' ' + 'e-rte-picker-init',
5546
+ inline: false,
5547
+ value: '#fff',
4181
5548
  created: function () {
4182
5549
  var value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
4183
- colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
4184
- colorPicker.value = value;
5550
+ colorPicker.setProperties({ value: value });
4185
5551
  },
4186
5552
  mode: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.mode : proxy.parent.fontColor.mode),
4187
5553
  modeSwitcher: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.modeSwitcher : proxy.parent.fontColor.modeSwitcher),
4188
- presetColors: (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode : this.parent.fontColor.colorCode,
4189
- columns: (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns,
4190
5554
  beforeTileRender: function (args) {
4191
5555
  args.element.classList.add(CLS_COLOR_PALETTE);
4192
5556
  args.element.classList.add(CLS_CUSTOM_TILE);
@@ -4231,6 +5595,10 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
4231
5595
  }
4232
5596
  });
4233
5597
  colorPicker.isStringTemplate = true;
5598
+ colorPicker.columns = (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns;
5599
+ colorPicker.presetColors = (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode :
5600
+ this.parent.fontColor.colorCode;
5601
+ colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
4234
5602
  colorPicker.createElement = this.parent.createElement;
4235
5603
  colorPicker.appendTo(document.getElementById(args.target));
4236
5604
  return colorPicker;
@@ -4435,15 +5803,16 @@ var BaseToolbar = /** @__PURE__ @class */ (function () {
4435
5803
  for (var num = 0; num < items.length; num++) {
4436
5804
  var tooltipText = items[num].tooltipText;
4437
5805
  var shortCutKey = void 0;
5806
+ var isMacDev = window.navigator.platform.toLocaleLowerCase().includes('mac');
4438
5807
  if (windowKeys["" + tooltipText]) {
4439
- shortCutKey = window.navigator.platform.toLocaleLowerCase().includes('mac') ? windowKeys["" + tooltipText].replace('Ctrl', 'Cmd') : windowKeys["" + tooltipText];
5808
+ shortCutKey = isMacDev ? windowKeys["" + tooltipText].replace('Ctrl+', '').replace('Shift+', '⇧').replace('Alt+', '⌥') : windowKeys["" + tooltipText];
4440
5809
  }
4441
5810
  else {
4442
5811
  shortCutKey = tooltipText;
4443
5812
  }
4444
5813
  if (shortCutKey) {
4445
5814
  if (!(items[num].command === "Images" && items[num].subCommand === "InsertLink")) {
4446
- items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
5815
+ items[num].tooltipText = (tooltipText !== shortCutKey) ? (isMacDev) ? shortCutKey : tooltipText + ' (' + shortCutKey + ')' : tooltipText;
4447
5816
  }
4448
5817
  }
4449
5818
  }
@@ -4494,28 +5863,10 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
4494
5863
  if (item.cssClass) {
4495
5864
  addClass([args.element], item.cssClass);
4496
5865
  }
4497
- if (item.command === 'Images' || item.command === 'Videos' || item.command === 'Audios' || item.command === 'Table') {
4498
- args.element.setAttribute('title', getQuickToolbarTooltipText(item.text) !== '' ? getQuickToolbarTooltipText(item.text) : item.text);
4499
- }
4500
5866
  if (item.command === 'Alignments' || item.subCommand === 'JustifyLeft'
4501
5867
  || item.subCommand === 'JustifyRight' || item.subCommand === 'JustifyCenter') {
4502
5868
  args.element.setAttribute('title', getTooltipText(item.subCommand.toLocaleLowerCase(), this.locator));
4503
5869
  }
4504
- if (item.command === 'Formats') {
4505
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.subCommand.toLocaleLowerCase(), this.locator, formatsLocale));
4506
- }
4507
- if (item.command === 'Font') {
4508
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) : item.text);
4509
- }
4510
- if (item.subCommand === 'BulletFormatList') {
4511
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) : item.text);
4512
- }
4513
- if (item.subCommand === 'NumberFormatList') {
4514
- args.element.setAttribute('title', (getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale)) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale) : item.text);
4515
- }
4516
- if (item.subCommand === 'FontSize') {
4517
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.value.toLocaleLowerCase(), null, null, this.parent));
4518
- }
4519
5870
  };
4520
5871
  DropDownButtons.prototype.dropdownContent = function (width, type, content) {
4521
5872
  return ('<span style="display: inline-flex;' + 'width:' + ((type === 'quick') ? 'auto' : width) + '" >' +
@@ -4821,7 +6172,7 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
4821
6172
  if (targetElement.classList.contains(CLS_DROPDOWN_BTN)) {
4822
6173
  return;
4823
6174
  }
4824
- this.tableRowsDropDown = this.toolbarRenderer.renderDropDownButton({
6175
+ this.tableCellDropDown = this.toolbarRenderer.renderDropDownButton({
4825
6176
  iconCss: 'e-table-cell e-icons',
4826
6177
  cssClass: CLS_DROPDOWN_POPUP + ' ' + CLS_DROPDOWN_ITEMS + ' ' + CLS_QUICK_DROPDOWN,
4827
6178
  itemName: 'TableCell',
@@ -4929,6 +6280,10 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
4929
6280
  this.removeDropDownClasses(this.tableColumnsDropDown.element);
4930
6281
  this.tableColumnsDropDown.destroy();
4931
6282
  }
6283
+ if (this.tableCellDropDown) {
6284
+ this.removeDropDownClasses(this.tableCellDropDown.element);
6285
+ this.tableCellDropDown.destroy();
6286
+ }
4932
6287
  if (this.tableCellVerticalAlignDropDown) {
4933
6288
  this.removeDropDownClasses(this.tableCellVerticalAlignDropDown.element);
4934
6289
  this.tableCellVerticalAlignDropDown.destroy();
@@ -4982,7 +6337,7 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
4982
6337
  var dropDownObj = [
4983
6338
  this.formatDropDown, this.fontNameDropDown, this.fontSizeDropDown, this.alignDropDown, this.imageAlignDropDown,
4984
6339
  this.displayDropDown, this.numberFormatListDropDown, this.bulletFormatListDropDown, this.tableRowsDropDown,
4985
- this.tableColumnsDropDown, this.tableCellVerticalAlignDropDown
6340
+ this.tableColumnsDropDown, this.tableCellDropDown, this.tableCellVerticalAlignDropDown
4986
6341
  ];
4987
6342
  for (var i = 0; i < dropDownObj.length; i++) {
4988
6343
  this.updateCss(dropDownObj[i], e);
@@ -5000,7 +6355,7 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
5000
6355
  this.parent.on(bindCssClass, this.setCssClass, this);
5001
6356
  };
5002
6357
  DropDownButtons.prototype.onIframeMouseDown = function () {
5003
- if (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0) {
6358
+ if (!isNullOrUndefined(this.parent.getToolbarElement()) && (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0 || this.parent.getToolbarElement().querySelectorAll('.e-dropdown-btn.e-rte-inline-dropdown[aria-expanded="true"]').length > 0)) {
5004
6359
  dispatchEvent(document, 'mousedown');
5005
6360
  }
5006
6361
  };
@@ -6400,26 +7755,19 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6400
7755
  }
6401
7756
  target = isAligned ? e.target : target;
6402
7757
  var targetOffsetLeft;
6403
- var currentOffsetWidth;
6404
7758
  if (!isNullOrUndefined(closest(target, 'table'))) {
6405
7759
  targetOffsetLeft = target.offsetLeft;
6406
- var parentTable = closest(target, 'table');
6407
- var checkOffSetParentWidth = false;
6408
- if (!isNullOrUndefined(closest(parentTable, 'TD'))) {
6409
- checkOffSetParentWidth = true;
6410
- }
7760
+ var parentTable = closest(target.parentElement, 'td');
6411
7761
  while (!isNullOrUndefined(parentTable)) {
6412
7762
  targetOffsetLeft += parentTable.offsetLeft;
6413
- currentOffsetWidth = checkOffSetParentWidth ? parentTable.offsetWidth : target.offsetWidth;
6414
7763
  parentTable = closest(parentTable.parentElement, 'table');
6415
7764
  }
6416
7765
  }
6417
7766
  else {
6418
- currentOffsetWidth = target.offsetWidth;
6419
7767
  targetOffsetLeft = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft;
6420
7768
  }
6421
- if (currentOffsetWidth > e.popWidth) {
6422
- x = (currentOffsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + targetOffsetLeft;
7769
+ if (target.offsetWidth > e.popWidth) {
7770
+ x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + targetOffsetLeft;
6423
7771
  }
6424
7772
  else {
6425
7773
  x = e.parentData.left + targetOffsetLeft;
@@ -6559,6 +7907,7 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6559
7907
  target: '#' + _this.element.id + ' [title]',
6560
7908
  openDelay: 400,
6561
7909
  showTipPointer: true,
7910
+ beforeRender: _this.tooltipBeforeRender.bind(_this),
6562
7911
  windowCollision: true,
6563
7912
  position: 'BottomCenter',
6564
7913
  cssClass: _this.parent.getCssClass()
@@ -6619,6 +7968,11 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6619
7968
  }
6620
7969
  });
6621
7970
  };
7971
+ BaseQuickToolbar.prototype.tooltipBeforeRender = function (args) {
7972
+ if (args.target.querySelector('.e-active')) {
7973
+ args.cancel = true;
7974
+ }
7975
+ };
6622
7976
  /**
6623
7977
  * hidePopup method
6624
7978
  *
@@ -6651,9 +8005,6 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6651
8005
  this.parent.enableToolbarItem(this.parent.toolbarSettings.items);
6652
8006
  }
6653
8007
  }
6654
- if (this.parent.showTooltip && !isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
6655
- this.parent.notify(destroyTooltip, { args: event });
6656
- }
6657
8008
  this.removeEleFromDOM();
6658
8009
  this.isRendered = false;
6659
8010
  };
@@ -6865,6 +8216,7 @@ var PopupRenderer = /** @__PURE__ @class */ (function () {
6865
8216
  */
6866
8217
  var QuickToolbar = /** @__PURE__ @class */ (function () {
6867
8218
  function QuickToolbar(parent, locator) {
8219
+ this.debounceTimeout = 1000;
6868
8220
  this.parent = parent;
6869
8221
  this.locator = locator;
6870
8222
  this.renderFactory = this.locator.getService('rendererFactory');
@@ -7056,7 +8408,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
7056
8408
  clearTimeout(this.deBouncer);
7057
8409
  this.deBouncer = window.setTimeout(function () {
7058
8410
  _this.showInlineQTBar(x, y, target);
7059
- }, 1000);
8411
+ }, this.debounceTimeout);
7060
8412
  };
7061
8413
  QuickToolbar.prototype.mouseUpHandler = function (e) {
7062
8414
  if (this.parent.inlineMode.enable && (!Browser.isDevice || isIDevice())) {
@@ -7106,7 +8458,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
7106
8458
  this.offsetY = pageYOffset(args, this.parent.element, this.parent.iframeSettings.enable);
7107
8459
  var range = this.parent.getRange();
7108
8460
  if ((range.endContainer.parentElement.tagName === range.startContainer.parentElement.tagName && (range.startContainer.parentElement.tagName === 'A' && range.endContainer.parentElement.tagName === 'A')) ||
7109
- (target.tagName === 'IMG') || (target.tagName === 'VIDEO') || (target.tagName === 'AUDIO') || (target.childNodes[0] && target.childNodes[0].nodeType === 1 && target.childNodes[0].classList.contains('e-rte-audio')) ||
8461
+ (target.tagName === 'IMG') || (target.tagName === 'VIDEO' || this.isEmbedVidElem(target)) || (target.tagName === 'AUDIO') || (target.childNodes[0] && target.childNodes[0].nodeType === 1 && target.childNodes[0].classList.contains('e-rte-audio')) ||
7110
8462
  (this.parent.getRange().startOffset === this.parent.getRange().endOffset)) {
7111
8463
  return;
7112
8464
  }
@@ -7114,6 +8466,15 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
7114
8466
  this.textQTBar.showPopup(this.offsetX, this.offsetY, target, 'text');
7115
8467
  }
7116
8468
  };
8469
+ QuickToolbar.prototype.isEmbedVidElem = function (target) {
8470
+ if ((target && target.nodeType !== 3 && target.nodeName !== 'BR' && (target.classList && target.classList.contains(CLS_VID_CLICK_ELEM))) ||
8471
+ (target && target.nodeName === 'IFRAME')) {
8472
+ return true;
8473
+ }
8474
+ else {
8475
+ return false;
8476
+ }
8477
+ };
7117
8478
  QuickToolbar.prototype.keyDownHandler = function (e) {
7118
8479
  var preventHide = e.args.altKey;
7119
8480
  if (this.parent.inlineMode.enable && e.args.metaKey && e.args.keyCode === 65) {
@@ -7169,7 +8530,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
7169
8530
  clearTimeout(this.deBouncer);
7170
8531
  this.deBouncer = window.setTimeout(function () {
7171
8532
  _this.onSelectionChange(e);
7172
- }, 1000);
8533
+ }, this.debounceTimeout);
7173
8534
  };
7174
8535
  QuickToolbar.prototype.onSelectionChange = function (e) {
7175
8536
  if (!isNullOrUndefined(select('.' + CLS_INLINE_POP, document.body))) {
@@ -7811,228 +9172,6 @@ var MarkdownSelection = /** @__PURE__ @class */ (function () {
7811
9172
  return MarkdownSelection;
7812
9173
  }());
7813
9174
 
7814
- /**
7815
- * Defines common util methods used by Rich Text Editor.
7816
- */
7817
- var inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
7818
- 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
7819
- 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
7820
- 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
7821
- 'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
7822
- /**
7823
- * @returns {void}
7824
- * @hidden
7825
- */
7826
- function isIDevice$1() {
7827
- var result = false;
7828
- if (Browser.isDevice && Browser.isIos) {
7829
- result = true;
7830
- }
7831
- return result;
7832
- }
7833
- /**
7834
- * @param {Element} editableElement - specifies the editable element.
7835
- * @param {string} selector - specifies the string values.
7836
- * @returns {void}
7837
- * @hidden
7838
- */
7839
- function setEditFrameFocus(editableElement, selector) {
7840
- if (editableElement.nodeName === 'BODY' && !isNullOrUndefined(selector)) {
7841
- var iframe = top.window.document.querySelector(selector);
7842
- if (!isNullOrUndefined(iframe)) {
7843
- iframe.contentWindow.focus();
7844
- }
7845
- }
7846
- }
7847
- /**
7848
- * @param {string} value - specifies the string value
7849
- * @param {string} enterAction - specifies the enter key action API
7850
- * @returns {void}
7851
- * @hidden
7852
- */
7853
- function updateTextNode$1(value, enterAction) {
7854
- var tempNode = document.createElement('div');
7855
- tempNode.innerHTML = value;
7856
- tempNode.setAttribute('class', 'tempDiv');
7857
- var resultElm = document.createElement('div');
7858
- var childNodes = tempNode.childNodes;
7859
- if (childNodes.length > 0) {
7860
- var isPreviousInlineElem = void 0;
7861
- var previousParent = void 0;
7862
- var paraElm = void 0;
7863
- while (tempNode.firstChild) {
7864
- if ((tempNode.firstChild.nodeName === '#text' &&
7865
- (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
7866
- inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
7867
- if (!isPreviousInlineElem) {
7868
- if (enterAction === 'BR') {
7869
- resultElm.appendChild(tempNode.firstChild);
7870
- previousParent = resultElm;
7871
- }
7872
- else {
7873
- paraElm = createElement('p');
7874
- resultElm.appendChild(paraElm);
7875
- paraElm.appendChild(tempNode.firstChild);
7876
- previousParent = paraElm;
7877
- isPreviousInlineElem = true;
7878
- }
7879
- }
7880
- else {
7881
- previousParent.appendChild(tempNode.firstChild);
7882
- previousParent = paraElm;
7883
- isPreviousInlineElem = true;
7884
- }
7885
- }
7886
- else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
7887
- (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
7888
- detach(tempNode.firstChild);
7889
- }
7890
- else {
7891
- resultElm.appendChild(tempNode.firstChild);
7892
- isPreviousInlineElem = false;
7893
- }
7894
- }
7895
- var tableElm = resultElm.querySelectorAll('table');
7896
- for (var i = 0; i < tableElm.length; i++) {
7897
- if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table')) {
7898
- tableElm[i].classList.add('e-rte-paste-table');
7899
- if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
7900
- tableElm[i].classList.remove('e-rte-paste-word-table');
7901
- continue; // Skiping the removal of the border if the source is from word.
7902
- }
7903
- else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
7904
- tableElm[i].classList.remove('e-rte-paste-excel-table');
7905
- if (tableElm[i].getAttribute('border') === '0') {
7906
- tableElm[i].removeAttribute('border');
7907
- }
7908
- var tdElm = tableElm[i].querySelectorAll('td');
7909
- for (var j = 0; j < tdElm.length; j++) {
7910
- if (tdElm[j].style.borderLeft === 'none') {
7911
- tdElm[j].style.removeProperty('border-left');
7912
- }
7913
- if (tdElm[j].style.borderRight === 'none') {
7914
- tdElm[j].style.removeProperty('border-right');
7915
- }
7916
- if (tdElm[j].style.borderBottom === 'none') {
7917
- tdElm[j].style.removeProperty('border-bottom');
7918
- }
7919
- if (tdElm[j].style.borderTop === 'none') {
7920
- tdElm[j].style.removeProperty('border-top');
7921
- }
7922
- if (tdElm[j].style.border === 'none') {
7923
- tdElm[j].style.removeProperty('border');
7924
- }
7925
- }
7926
- }
7927
- else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
7928
- tableElm[i].classList.remove('e-rte-paste-onenote-table');
7929
- continue;
7930
- }
7931
- }
7932
- }
7933
- var imageElm = resultElm.querySelectorAll('img');
7934
- for (var i = 0; i < imageElm.length; i++) {
7935
- if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
7936
- continue; // Should not add the class if the image is Broken.
7937
- }
7938
- if (!imageElm[i].classList.contains('e-rte-image')) {
7939
- imageElm[i].classList.add('e-rte-image');
7940
- }
7941
- if (!(imageElm[i].classList.contains('e-imginline') ||
7942
- imageElm[i].classList.contains('e-imgbreak'))) {
7943
- imageElm[i].classList.add('e-imginline');
7944
- }
7945
- }
7946
- }
7947
- return resultElm.innerHTML;
7948
- }
7949
- /**
7950
- * @param {Node} startChildNodes - specifies the node
7951
- * @returns {void}
7952
- * @hidden
7953
- */
7954
- function getLastTextNode(startChildNodes) {
7955
- var finalNode = startChildNodes;
7956
- do {
7957
- if (finalNode.childNodes.length > 0) {
7958
- finalNode = finalNode.childNodes[0];
7959
- }
7960
- } while (finalNode.childNodes.length > 0);
7961
- return finalNode;
7962
- }
7963
- /**
7964
- * @returns {void}
7965
- * @hidden
7966
- */
7967
- function getDefaultHtmlTbStatus() {
7968
- return {
7969
- bold: false,
7970
- italic: false,
7971
- subscript: false,
7972
- superscript: false,
7973
- strikethrough: false,
7974
- orderedlist: false,
7975
- unorderedlist: false,
7976
- numberFormatList: false,
7977
- bulletFormatList: false,
7978
- underline: false,
7979
- alignments: null,
7980
- backgroundcolor: null,
7981
- fontcolor: null,
7982
- fontname: null,
7983
- fontsize: null,
7984
- formats: null,
7985
- createlink: false,
7986
- insertcode: false
7987
- };
7988
- }
7989
- /**
7990
- * @returns {void}
7991
- * @hidden
7992
- */
7993
- function getDefaultMDTbStatus() {
7994
- return {
7995
- bold: false,
7996
- italic: false,
7997
- subscript: false,
7998
- superscript: false,
7999
- strikethrough: false,
8000
- orderedlist: false,
8001
- uppercase: false,
8002
- lowercase: false,
8003
- inlinecode: false,
8004
- unorderedlist: false,
8005
- formats: null
8006
- };
8007
- }
8008
- /**
8009
- * @param {Range} range - specifies the range
8010
- * @returns {void}
8011
- * @hidden
8012
- */
8013
- function nestedListCleanUp(range) {
8014
- if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
8015
- range.extractContents();
8016
- while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
8017
- (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
8018
- var emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
8019
- if (emptyLI.length > 0) {
8020
- emptyLI.forEach(function (item) {
8021
- item.remove();
8022
- });
8023
- }
8024
- }
8025
- var liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
8026
- if (liElem.length > 0) {
8027
- liElem.forEach(function (item) {
8028
- if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
8029
- item.style.listStyleType = "none";
8030
- }
8031
- });
8032
- }
8033
- }
8034
- }
8035
-
8036
9175
  /**
8037
9176
  * MarkdownToolbarStatus module for refresh the toolbar status
8038
9177
  */
@@ -8414,7 +9553,8 @@ var Formatter = /** @__PURE__ @class */ (function () {
8414
9553
  _this.saveData();
8415
9554
  }
8416
9555
  self.isBlur = false;
8417
- if (isNullOrUndefined(saveSelection) || isNullOrUndefined(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption")) ? true : !(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption").getAttribute("contenteditable") == "false")) {
9556
+ var quickToolbarAction = !isNullOrUndefined(event) && !isNullOrUndefined(event.target) && (!isNullOrUndefined(closest(event.target, ".e-rte-elements.e-dropdown-popup.e-rte-dropdown-popup.e-quick-dropdown.e-popup-open")) || !isNullOrUndefined(closest(event.target, ".e-rte-elements.e-rte-quick-popup.e-popup-open")));
9557
+ if (isNullOrUndefined(saveSelection) || (!quickToolbarAction && (isNullOrUndefined(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption")) ? true : !(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption").getAttribute("contenteditable") == "false")))) {
8418
9558
  self.contentModule.getEditPanel().focus();
8419
9559
  }
8420
9560
  if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
@@ -8457,7 +9597,8 @@ var Formatter = /** @__PURE__ @class */ (function () {
8457
9597
  event: e, callBack: function () {
8458
9598
  self.notify(contentChanged, {});
8459
9599
  _this.enableUndo(self);
8460
- }
9600
+ },
9601
+ enterAction: self.enterKey
8461
9602
  });
8462
9603
  };
8463
9604
  /**
@@ -10538,844 +11679,302 @@ var MarkdownFormatter = /** @__PURE__ @class */ (function (_super) {
10538
11679
  this.keyConfig = markdownKeyConfig;
10539
11680
  this.formatTags = markdownFormatTags;
10540
11681
  this.listTags = markdownListsTags;
10541
- this.selectionTags = markdownSelectionTags;
10542
- };
10543
- /**
10544
- * Update the formatter of RichTextEditor
10545
- *
10546
- * @param {Element} editElement - specifies the edit element.
10547
- * @param {Document} doc - specifies the document.
10548
- * @param {number} options - specifies the options
10549
- * @returns {void}
10550
- * @hidden
10551
- * @deprecated
10552
- */
10553
- MarkdownFormatter.prototype.updateFormatter = function (editElement, doc, options) {
10554
- if (editElement) {
10555
- this.editorManager = new MarkdownParser({
10556
- element: editElement,
10557
- formatTags: this.formatTags,
10558
- listTags: this.listTags,
10559
- selectionTags: this.selectionTags,
10560
- options: options
10561
- });
10562
- }
10563
- };
10564
- return MarkdownFormatter;
10565
- }(Formatter));
10566
-
10567
- /**
10568
- * Markdown module is used to render Rich Text Editor as Markdown editor content
10569
- *
10570
- * @hidden
10571
- * @deprecated
10572
- */
10573
- var MarkdownRender = /** @__PURE__ @class */ (function () {
10574
- /**
10575
- * Constructor for content renderer module
10576
- *
10577
- * @param {IRichTextEditor} parent - specifies the parent.
10578
- */
10579
- function MarkdownRender(parent) {
10580
- this.parent = parent;
10581
- }
10582
- /**
10583
- * The function is used to render Rich Text Editor content div
10584
- *
10585
- * @returns {void}
10586
- * @hidden
10587
- * @deprecated
10588
- */
10589
- MarkdownRender.prototype.renderPanel = function () {
10590
- var rteObj = this.parent;
10591
- var div = this.parent.createElement('div', { id: this.parent.getID() + '_view', className: 'e-rte-content' });
10592
- this.editableElement = this.parent.createElement('textarea', {
10593
- className: 'e-content',
10594
- id: this.parent.getID() + '_editable-content',
10595
- attrs: { 'aria-labelledby': this.parent.getID() + '_view' }
10596
- });
10597
- div.appendChild(this.editableElement);
10598
- this.setPanel(div);
10599
- rteObj.element.appendChild(div);
10600
- };
10601
- /**
10602
- * Get the content div element of RichTextEditor
10603
- *
10604
- * @returns {Element} - specifies the element
10605
- * @hidden
10606
- * @deprecated
10607
- */
10608
- MarkdownRender.prototype.getPanel = function () {
10609
- return this.contentPanel;
10610
- };
10611
- /**
10612
- * Get the editable element of RichTextEditor
10613
- *
10614
- * @returns {Element} - specifies the element
10615
- * @hidden
10616
- * @deprecated
10617
- */
10618
- MarkdownRender.prototype.getEditPanel = function () {
10619
- return this.editableElement;
10620
- };
10621
- /**
10622
- * Returns the text content as string.
10623
- *
10624
- * @returns {string} - specifies the string values.
10625
- */
10626
- MarkdownRender.prototype.getText = function () {
10627
- return this.getEditPanel().value;
10628
- };
10629
- /**
10630
- * Set the content div element of RichTextEditor
10631
- *
10632
- * @param {Element} panel - specifies the element.
10633
- * @returns {void}
10634
- * @hidden
10635
- * @deprecated
10636
- */
10637
- MarkdownRender.prototype.setPanel = function (panel) {
10638
- this.contentPanel = panel;
10639
- };
10640
- /**
10641
- * Get the document of RichTextEditor
10642
- *
10643
- * @returns {void}
10644
- * @hidden
10645
- * @deprecated
10646
- */
10647
- MarkdownRender.prototype.getDocument = function () {
10648
- return this.getEditPanel().ownerDocument;
10649
- };
10650
- return MarkdownRender;
10651
- }());
10652
-
10653
- /**
10654
- * `MarkdownEditor` module is used to markdown editor
10655
- */
10656
- var MarkdownEditor = /** @__PURE__ @class */ (function () {
10657
- function MarkdownEditor(parent, serviceLocator) {
10658
- this.parent = parent;
10659
- this.locator = serviceLocator;
10660
- this.renderFactory = this.locator.getService('rendererFactory');
10661
- this.addEventListener();
10662
- }
10663
- /**
10664
- * Destroys the Markdown.
10665
- *
10666
- * @function destroy
10667
- * @returns {void}
10668
- * @hidden
10669
- * @deprecated
10670
- */
10671
- MarkdownEditor.prototype.destroy = function () {
10672
- if (isNullOrUndefined(this.parent)) {
10673
- return;
10674
- }
10675
- this.removeEventListener();
10676
- };
10677
- MarkdownEditor.prototype.moduleDestroy = function () {
10678
- this.parent = null;
10679
- this.toolbarUpdate.parent = null;
10680
- };
10681
- MarkdownEditor.prototype.addEventListener = function () {
10682
- if (this.parent.isDestroyed) {
10683
- return;
10684
- }
10685
- this.saveSelection = new MarkdownSelection();
10686
- this.parent.on(initialLoad, this.instantiateRenderer, this);
10687
- this.parent.on(initialEnd, this.render, this);
10688
- this.parent.on(modelChanged, this.onPropertyChanged, this);
10689
- this.parent.on(markdownToolbarClick, this.onToolbarClick, this);
10690
- this.parent.on(destroy, this.destroy, this);
10691
- this.parent.on(selectAll$1, this.selectAll, this);
10692
- this.parent.on(getSelectedHtml, this.getSelectedHtml, this);
10693
- this.parent.on(selectionSave, this.onSelectionSave, this);
10694
- this.parent.on(selectionRestore, this.onSelectionRestore, this);
10695
- this.parent.on(readOnlyMode, this.updateReadOnly, this);
10696
- this.parent.on(moduleDestroy, this.moduleDestroy, this);
10697
- };
10698
- MarkdownEditor.prototype.updateReadOnly = function () {
10699
- if (this.parent.readonly) {
10700
- this.parent.contentModule.getEditPanel().setAttribute('readonly', 'readonly');
10701
- addClass([this.parent.element], CLS_RTE_READONLY);
10702
- }
10703
- else {
10704
- this.parent.contentModule.getEditPanel().removeAttribute('readonly');
10705
- removeClass([this.parent.element], CLS_RTE_READONLY);
10706
- }
10707
- };
10708
- MarkdownEditor.prototype.onSelectionSave = function () {
10709
- var textArea = this.parent.contentModule.getEditPanel();
10710
- this.saveSelection.save(textArea.selectionStart, textArea.selectionEnd);
10711
- };
10712
- // eslint-disable-next-line
10713
- MarkdownEditor.prototype.onSelectionRestore = function (e) {
10714
- this.contentRenderer.getEditPanel().focus();
10715
- var textArea = this.parent.contentModule.getEditPanel();
10716
- this.saveSelection.restore(textArea);
10717
- };
10718
- MarkdownEditor.prototype.onToolbarClick = function (args) {
10719
- var item = args.item;
10720
- var textArea = this.parent.contentModule.getEditPanel();
10721
- if (item.command !== 'Formats') {
10722
- textArea.focus();
10723
- }
10724
- var startOffset = textArea.selectionStart;
10725
- var endOffset = textArea.selectionEnd;
10726
- var text = textArea.value.substring(startOffset, endOffset);
10727
- switch (item.subCommand) {
10728
- case 'Maximize':
10729
- this.parent.notify(enableFullScreen, { args: args });
10730
- break;
10731
- case 'Minimize':
10732
- this.parent.notify(disableFullScreen, { args: args });
10733
- break;
10734
- case 'CreateLink':
10735
- this.parent.notify(insertLink, { member: 'link', args: args, text: text, module: 'Markdown' });
10736
- break;
10737
- case 'Image':
10738
- this.parent.notify(insertImage, { member: 'image', args: args, text: text, module: 'Markdown' });
10739
- break;
10740
- case 'CreateTable': {
10741
- var tableConstant = {
10742
- 'headingText': this.parent.localeObj.getConstant('TableHeadingText'),
10743
- 'colText': this.parent.localeObj.getConstant('TableColText')
10744
- };
10745
- this.parent.formatter.process(this.parent, args, args.originalEvent, tableConstant);
10746
- break;
10747
- }
10748
- default:
10749
- this.parent.formatter.process(this.parent, args, args.originalEvent, null);
10750
- break;
10751
- }
10752
- };
10753
- MarkdownEditor.prototype.instantiateRenderer = function () {
10754
- this.renderFactory.addRenderer(RenderType.Content, new MarkdownRender(this.parent));
10755
- };
10756
- MarkdownEditor.prototype.removeEventListener = function () {
10757
- if (this.parent.isDestroyed) {
10758
- return;
10759
- }
10760
- this.parent.off(initialEnd, this.render);
10761
- this.parent.off(modelChanged, this.onPropertyChanged);
10762
- this.parent.off(destroy, this.destroy);
10763
- this.parent.off(markdownToolbarClick, this.onToolbarClick);
10764
- this.parent.off(initialLoad, this.instantiateRenderer);
10765
- this.parent.off(selectAll$1, this.selectAll);
10766
- this.parent.off(getSelectedHtml, this.getSelectedHtml);
10767
- this.parent.off(selectionSave, this.onSelectionSave);
10768
- this.parent.off(selectionRestore, this.onSelectionRestore);
10769
- this.parent.off(readOnlyMode, this.updateReadOnly);
10770
- this.parent.off(moduleDestroy, this.moduleDestroy);
10771
- };
10772
- MarkdownEditor.prototype.render = function () {
10773
- this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
10774
- var editElement = this.contentRenderer.getEditPanel();
10775
- var option = { undoRedoSteps: this.parent.undoRedoSteps, undoRedoTimer: this.parent.undoRedoTimer };
10776
- if (isNullOrUndefined(this.parent.formatter)) {
10777
- this.parent.formatter = new MarkdownFormatter({
10778
- element: editElement,
10779
- options: option
10780
- });
10781
- }
10782
- else {
10783
- this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
10784
- }
10785
- if (this.parent.toolbarSettings.enable) {
10786
- this.toolbarUpdate = new MarkdownToolbarStatus(this.parent);
10787
- }
10788
- this.parent.notify(bindOnEnd, {});
10789
- };
10790
- /**
10791
- * Called internally if any of the property value changed.
10792
- *
10793
- * @param {RichTextEditorModel} e - specifies the editor model
10794
- * @returns {void}
10795
- * @hidden
10796
- * @deprecated
10797
- */
10798
- MarkdownEditor.prototype.onPropertyChanged = function (e) {
10799
- // On property code change here
10800
- if (!isNullOrUndefined(e.newProp.formatter)) {
10801
- var editElement = this.contentRenderer.getEditPanel();
10802
- var option = { undoRedoSteps: this.parent.undoRedoSteps,
10803
- undoRedoTimer: this.parent.undoRedoTimer };
10804
- this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
10805
- }
10806
- };
10807
- /**
10808
- * For internal use only - Get the module name.
10809
- *
10810
- * @returns {void}
10811
- */
10812
- MarkdownEditor.prototype.getModuleName = function () {
10813
- return 'markdownEditor';
10814
- };
10815
- /**
10816
- * For selecting all content in RTE
10817
- *
10818
- * @returns {void}
10819
- * @private
10820
- */
10821
- MarkdownEditor.prototype.selectAll = function () {
10822
- this.parent.formatter.editorManager.markdownSelection.setSelection(this.parent.contentModule.getEditPanel(), 0, this.parent.contentModule.getEditPanel().value.length);
10823
- };
10824
- /**
10825
- * For get a selected text in RTE
10826
- *
10827
- * @param {NotifyArgs} e - specifies the arguments.
10828
- * @returns {void}
10829
- * @private
10830
- */
10831
- MarkdownEditor.prototype.getSelectedHtml = function (e) {
10832
- e.callBack(this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()));
10833
- };
10834
- return MarkdownEditor;
10835
- }());
10836
-
10837
- /**
10838
- * Constant values for EditorManager
10839
- */
10840
- /**
10841
- * Image plugin events
10842
- *
10843
- * @hidden
10844
- */
10845
- var IMAGE = 'INSERT-IMAGE';
10846
- var AUDIO = 'INSERT-AUDIO';
10847
- var VIDEO = 'INSERT-VIDEO';
10848
- var TABLE = 'INSERT-TABLE';
10849
- var LINK = 'INSERT-LINK';
10850
- var INSERT_ROW = 'INSERT-ROW';
10851
- var INSERT_COLUMN = 'INSERT-COLUMN';
10852
- var DELETEROW = 'DELETE-ROW';
10853
- var DELETECOLUMN = 'DELETE-COLUMN';
10854
- var REMOVETABLE = 'REMOVE-TABLE';
10855
- var TABLEHEADER = 'TABLE-HEADER';
10856
- var TABLE_VERTICAL_ALIGN = 'TABLE_VERTICAL_ALIGN';
10857
- var TABLE_MERGE = 'TABLE_MERGE';
10858
- var TABLE_VERTICAL_SPLIT = 'TABLE_VERTICAL_SPLIT';
10859
- var TABLE_HORIZONTAL_SPLIT = 'TABLE_HORIZONTAL_SPLIT';
10860
- var TABLE_MOVE = 'TABLE_MOVE';
10861
- /**
10862
- * Alignments plugin events
10863
- *
10864
- * @hidden
10865
- */
10866
- var ALIGNMENT_TYPE = 'alignment-type';
10867
- /**
10868
- * Indents plugin events
10869
- *
10870
- * @hidden
10871
- */
10872
- var INDENT_TYPE = 'indent-type';
10873
- /**
10874
- * Constant tag names
10875
- *
10876
- * @hidden
10877
- */
10878
- var DEFAULT_TAG = 'p';
10879
- /**
10880
- * @hidden
10881
- */
10882
- var BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote',
10883
- 'canvas', 'details', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer',
10884
- 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav',
10885
- 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tbody', 'td', 'tfoot', 'th',
10886
- 'thead', 'tr', 'ul', 'video', 'body'];
10887
- /**
10888
- * @hidden
10889
- */
10890
- var IGNORE_BLOCK_TAGS = ['td', 'th'];
10891
- /**
10892
- * @hidden
10893
- */
10894
- var TABLE_BLOCK_TAGS = ['table', 'tbody', 'td', 'tfoot', 'th',
10895
- 'thead', 'tr'];
10896
- /**
10897
- * Selection plugin events
10898
- *
10899
- * @hidden
10900
- */
10901
- var SELECTION_TYPE = 'selection-type';
10902
- /**
10903
- * Insert HTML plugin events
10904
- *
10905
- * @hidden
10906
- */
10907
- var INSERTHTML_TYPE = 'inserthtml-type';
10908
- /**
10909
- * Insert Text plugin events
10910
- *
10911
- * @hidden
10912
- */
10913
- var INSERT_TEXT_TYPE = 'insert-text-type';
10914
- /**
10915
- * Clear Format HTML plugin events
10916
- *
10917
- * @hidden
10918
- */
10919
- var CLEAR_TYPE = 'clear-type';
10920
- /**
10921
- * Self closing tags
10922
- *
10923
- * @hidden
10924
- */
10925
- var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
10926
- /**
10927
- * Source
10928
- *
10929
- * @hidden
10930
- */
10931
- var PASTE_SOURCE = ['word', 'excel', 'onenote'];
10932
-
10933
- /**
10934
- * `Selection` module is used to handle RTE Selections.
10935
- */
10936
- var NodeSelection = /** @__PURE__ @class */ (function () {
10937
- function NodeSelection() {
10938
- this.startNodeName = [];
10939
- this.endNodeName = [];
10940
- }
10941
- NodeSelection.prototype.saveInstance = function (range, body) {
10942
- this.range = range.cloneRange();
10943
- this.rootNode = this.documentFromRange(range);
10944
- this.body = body;
10945
- this.startContainer = this.getNodeArray(range.startContainer, true);
10946
- this.endContainer = this.getNodeArray(range.endContainer, false);
10947
- this.startOffset = range.startOffset;
10948
- this.endOffset = range.endOffset;
10949
- this.html = this.body.innerHTML;
10950
- return this;
10951
- };
10952
- NodeSelection.prototype.documentFromRange = function (range) {
10953
- return (9 === range.startContainer.nodeType) ? range.startContainer : range.startContainer.ownerDocument;
10954
- };
10955
- NodeSelection.prototype.getRange = function (docElement) {
10956
- var select$$1 = this.get(docElement);
10957
- var range = select$$1 && select$$1.rangeCount > 0 ? select$$1.getRangeAt(select$$1.rangeCount - 1) : docElement.createRange();
10958
- return (range.startContainer !== docElement || range.endContainer !== docElement
10959
- || range.startOffset || range.endOffset || (range.setStart(docElement.body, 0), range.collapse(!0)), range);
10960
- };
10961
- /**
10962
- * get method
10963
- *
10964
- * @param {Document} docElement - specifies the get function
10965
- * @returns {void}
10966
- * @hidden
10967
- * @deprecated
10968
- */
10969
- NodeSelection.prototype.get = function (docElement) {
10970
- return docElement.defaultView.getSelection();
10971
- };
10972
- /**
10973
- * save method
10974
- *
10975
- * @param {Range} range - range value.
10976
- * @param {Document} docElement - specifies the document.
10977
- * @returns {void}
10978
- * @hidden
10979
- * @deprecated
10980
- */
10981
- NodeSelection.prototype.save = function (range, docElement) {
10982
- range = (range) ? range.cloneRange() : this.getRange(docElement);
10983
- return this.saveInstance(range, docElement.body);
10984
- };
10985
- /**
10986
- * getIndex method
10987
- *
10988
- * @param {Node} node - specifies the node value.
10989
- * @returns {void}
10990
- * @hidden
10991
- * @deprecated
10992
- */
10993
- NodeSelection.prototype.getIndex = function (node) {
10994
- var index;
10995
- var num = 0;
10996
- node = !node.previousSibling && node.tagName === 'BR' ? node : node.previousSibling;
10997
- if (node) {
10998
- for (var type = node.nodeType; node; null) {
10999
- index = node.nodeType;
11000
- num++;
11001
- //eslint-disable-next-line
11002
- type = index;
11003
- node = node.previousSibling;
11004
- }
11005
- }
11006
- return num;
11007
- };
11008
- NodeSelection.prototype.isChildNode = function (nodeCollection, parentNode) {
11009
- for (var index = 0; index < parentNode.childNodes.length; index++) {
11010
- if (nodeCollection.indexOf(parentNode.childNodes[index]) > -1) {
11011
- return true;
11012
- }
11013
- }
11014
- return false;
11015
- };
11016
- NodeSelection.prototype.getNode = function (startNode, endNode, nodeCollection) {
11017
- if (endNode === startNode &&
11018
- (startNode.nodeType === 3 || !startNode.firstChild || nodeCollection.indexOf(startNode.firstChild) !== -1
11019
- || this.isChildNode(nodeCollection, startNode))) {
11020
- return null;
11021
- }
11022
- if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
11023
- return null;
11024
- }
11025
- if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
11026
- return startNode.firstChild;
11027
- }
11028
- if (startNode.nextSibling) {
11029
- return startNode.nextSibling;
11030
- }
11031
- if (!startNode.parentNode) {
11032
- return null;
11033
- }
11034
- else {
11035
- return startNode.parentNode;
11036
- }
11682
+ this.selectionTags = markdownSelectionTags;
11037
11683
  };
11038
11684
  /**
11039
- * getNodeCollection method
11685
+ * Update the formatter of RichTextEditor
11040
11686
  *
11041
- * @param {Range} range -specifies the range.
11687
+ * @param {Element} editElement - specifies the edit element.
11688
+ * @param {Document} doc - specifies the document.
11689
+ * @param {number} options - specifies the options
11042
11690
  * @returns {void}
11043
11691
  * @hidden
11044
11692
  * @deprecated
11045
11693
  */
11046
- NodeSelection.prototype.getNodeCollection = function (range) {
11047
- var startNode = range.startContainer.childNodes[range.startOffset]
11048
- || range.startContainer;
11049
- var endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
11050
- || range.endContainer;
11051
- if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
11052
- startNode.childNodes.length === 0) {
11053
- return [startNode];
11054
- }
11055
- if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
11056
- return [startNode.nodeName === 'BR' || startNode.nodeName === '#text' ? startNode : startNode.childNodes[0]];
11694
+ MarkdownFormatter.prototype.updateFormatter = function (editElement, doc, options) {
11695
+ if (editElement) {
11696
+ this.editorManager = new MarkdownParser({
11697
+ element: editElement,
11698
+ formatTags: this.formatTags,
11699
+ listTags: this.listTags,
11700
+ selectionTags: this.selectionTags,
11701
+ options: options
11702
+ });
11057
11703
  }
11058
- var nodeCollection = [];
11059
- do {
11060
- if (nodeCollection.indexOf(startNode) === -1) {
11061
- nodeCollection.push(startNode);
11062
- }
11063
- startNode = this.getNode(startNode, endNode, nodeCollection);
11064
- } while (startNode);
11065
- return nodeCollection;
11066
11704
  };
11705
+ return MarkdownFormatter;
11706
+ }(Formatter));
11707
+
11708
+ /**
11709
+ * Markdown module is used to render Rich Text Editor as Markdown editor content
11710
+ *
11711
+ * @hidden
11712
+ * @deprecated
11713
+ */
11714
+ var MarkdownRender = /** @__PURE__ @class */ (function () {
11067
11715
  /**
11068
- * getParentNodeCollection method
11716
+ * Constructor for content renderer module
11069
11717
  *
11070
- * @param {Range} range - specifies the range value.
11071
- * @returns {void}
11072
- * @hidden
11073
- * @deprecated
11718
+ * @param {IRichTextEditor} parent - specifies the parent.
11074
11719
  */
11075
- NodeSelection.prototype.getParentNodeCollection = function (range) {
11076
- return this.getParentNodes(this.getNodeCollection(range), range);
11077
- };
11720
+ function MarkdownRender(parent) {
11721
+ this.parent = parent;
11722
+ }
11078
11723
  /**
11079
- * getParentNodes method
11724
+ * The function is used to render Rich Text Editor content div
11080
11725
  *
11081
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11082
- * @param {Range} range - specifies the range values.
11083
11726
  * @returns {void}
11084
11727
  * @hidden
11085
11728
  * @deprecated
11086
11729
  */
11087
- NodeSelection.prototype.getParentNodes = function (nodeCollection, range) {
11088
- nodeCollection = nodeCollection.reverse();
11089
- for (var index = 0; index < nodeCollection.length; index++) {
11090
- if ((nodeCollection.indexOf(nodeCollection[index].parentNode) !== -1)
11091
- || (nodeCollection[index].nodeType === 3 &&
11092
- range.startContainer !== range.endContainer &&
11093
- range.startContainer.parentNode !== range.endContainer.parentNode)) {
11094
- nodeCollection.splice(index, 1);
11095
- index--;
11096
- }
11097
- else if (nodeCollection[index].nodeType === 3) {
11098
- nodeCollection[index] = nodeCollection[index].parentNode;
11099
- }
11100
- }
11101
- return nodeCollection;
11730
+ MarkdownRender.prototype.renderPanel = function () {
11731
+ var rteObj = this.parent;
11732
+ var div = this.parent.createElement('div', { id: this.parent.getID() + '_view', className: 'e-rte-content' });
11733
+ this.editableElement = this.parent.createElement('textarea', {
11734
+ className: 'e-content',
11735
+ id: this.parent.getID() + '_editable-content',
11736
+ attrs: { 'aria-labelledby': this.parent.getID() + '_view' }
11737
+ });
11738
+ div.appendChild(this.editableElement);
11739
+ this.setPanel(div);
11740
+ rteObj.element.appendChild(div);
11102
11741
  };
11103
11742
  /**
11104
- * getSelectionNodeCollection method
11743
+ * Get the content div element of RichTextEditor
11105
11744
  *
11106
- * @param {Range} range - specifies the range value.
11107
- * @returns {void}
11745
+ * @returns {Element} - specifies the element
11108
11746
  * @hidden
11109
11747
  * @deprecated
11110
11748
  */
11111
- NodeSelection.prototype.getSelectionNodeCollection = function (range) {
11112
- return this.getSelectionNodes(this.getNodeCollection(range));
11749
+ MarkdownRender.prototype.getPanel = function () {
11750
+ return this.contentPanel;
11113
11751
  };
11114
11752
  /**
11115
- * getSelectionNodeCollection along with BR node method
11753
+ * Get the editable element of RichTextEditor
11116
11754
  *
11117
- * @param {Range} range - specifies the range value.
11118
- * @returns {void}
11755
+ * @returns {Element} - specifies the element
11119
11756
  * @hidden
11120
11757
  * @deprecated
11121
11758
  */
11122
- NodeSelection.prototype.getSelectionNodeCollectionBr = function (range) {
11123
- return this.getSelectionNodesBr(this.getNodeCollection(range));
11759
+ MarkdownRender.prototype.getEditPanel = function () {
11760
+ return this.editableElement;
11124
11761
  };
11125
11762
  /**
11126
- * getParentNodes method
11763
+ * Returns the text content as string.
11127
11764
  *
11128
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11129
- * @returns {void}
11130
- * @hidden
11131
- * @deprecated
11765
+ * @returns {string} - specifies the string values.
11132
11766
  */
11133
- NodeSelection.prototype.getSelectionNodes = function (nodeCollection) {
11134
- nodeCollection = nodeCollection.reverse();
11135
- // eslint-disable-next-line
11136
- var regEx = new RegExp(String.fromCharCode(8203), 'g');
11137
- for (var index = 0; index < nodeCollection.length; index++) {
11138
- if (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
11139
- (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx)))) {
11140
- nodeCollection.splice(index, 1);
11141
- index--;
11142
- }
11143
- }
11144
- return nodeCollection.reverse();
11767
+ MarkdownRender.prototype.getText = function () {
11768
+ return this.getEditPanel().value;
11145
11769
  };
11146
11770
  /**
11147
- * Get selection text nodes with br method.
11771
+ * Set the content div element of RichTextEditor
11148
11772
  *
11149
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11773
+ * @param {Element} panel - specifies the element.
11150
11774
  * @returns {void}
11151
11775
  * @hidden
11152
11776
  * @deprecated
11153
11777
  */
11154
- NodeSelection.prototype.getSelectionNodesBr = function (nodeCollection) {
11155
- nodeCollection = nodeCollection.reverse();
11156
- // eslint-disable-next-line
11157
- var regEx = new RegExp(String.fromCharCode(8203), 'g');
11158
- for (var index = 0; index < nodeCollection.length; index++) {
11159
- if (nodeCollection[index].nodeName !== 'BR' &&
11160
- (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
11161
- (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx))))) {
11162
- nodeCollection.splice(index, 1);
11163
- index--;
11164
- }
11165
- }
11166
- return nodeCollection.reverse();
11778
+ MarkdownRender.prototype.setPanel = function (panel) {
11779
+ this.contentPanel = panel;
11167
11780
  };
11168
11781
  /**
11169
- * getInsertNodeCollection method
11782
+ * Get the document of RichTextEditor
11170
11783
  *
11171
- * @param {Range} range - specifies the range value.
11172
11784
  * @returns {void}
11173
11785
  * @hidden
11174
11786
  * @deprecated
11175
11787
  */
11176
- NodeSelection.prototype.getInsertNodeCollection = function (range) {
11177
- return this.getInsertNodes(this.getNodeCollection(range));
11788
+ MarkdownRender.prototype.getDocument = function () {
11789
+ return this.getEditPanel().ownerDocument;
11178
11790
  };
11791
+ return MarkdownRender;
11792
+ }());
11793
+
11794
+ /**
11795
+ * `MarkdownEditor` module is used to markdown editor
11796
+ */
11797
+ var MarkdownEditor = /** @__PURE__ @class */ (function () {
11798
+ function MarkdownEditor(parent, serviceLocator) {
11799
+ this.parent = parent;
11800
+ this.locator = serviceLocator;
11801
+ this.renderFactory = this.locator.getService('rendererFactory');
11802
+ this.addEventListener();
11803
+ }
11179
11804
  /**
11180
- * getInsertNodes method
11805
+ * Destroys the Markdown.
11181
11806
  *
11182
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11807
+ * @function destroy
11183
11808
  * @returns {void}
11184
11809
  * @hidden
11185
11810
  * @deprecated
11186
11811
  */
11187
- NodeSelection.prototype.getInsertNodes = function (nodeCollection) {
11188
- nodeCollection = nodeCollection.reverse();
11189
- for (var index = 0; index < nodeCollection.length; index++) {
11190
- if ((nodeCollection[index].childNodes.length !== 0 &&
11191
- nodeCollection[index].nodeType !== 3) ||
11192
- (nodeCollection[index].nodeType === 3 &&
11193
- nodeCollection[index].textContent === '')) {
11194
- nodeCollection.splice(index, 1);
11195
- index--;
11196
- }
11812
+ MarkdownEditor.prototype.destroy = function () {
11813
+ if (isNullOrUndefined(this.parent)) {
11814
+ return;
11197
11815
  }
11198
- return nodeCollection.reverse();
11816
+ this.removeEventListener();
11199
11817
  };
11200
- /**
11201
- * getNodeArray method
11202
- *
11203
- * @param {Node} node - specifies the node content.
11204
- * @param {boolean} isStart - specifies the boolean value.
11205
- * @param {Document} root - specifies the root document.
11206
- * @returns {void}
11207
- * @hidden
11208
- * @deprecated
11209
- */
11210
- NodeSelection.prototype.getNodeArray = function (node, isStart, root) {
11211
- var array = [];
11212
- // eslint-disable-next-line
11213
- ((isStart) ? (this.startNodeName = []) : (this.endNodeName = []));
11214
- for (; node !== (root ? root : this.rootNode); null) {
11215
- if (isNullOrUndefined(node)) {
11216
- break;
11217
- }
11218
- // eslint-disable-next-line
11219
- (isStart) ? this.startNodeName.push(node.nodeName.toLowerCase()) : this.endNodeName.push(node.nodeName.toLowerCase());
11220
- array.push(this.getIndex(node));
11221
- node = node.parentNode;
11818
+ MarkdownEditor.prototype.moduleDestroy = function () {
11819
+ this.parent = null;
11820
+ this.toolbarUpdate.parent = null;
11821
+ };
11822
+ MarkdownEditor.prototype.addEventListener = function () {
11823
+ if (this.parent.isDestroyed) {
11824
+ return;
11222
11825
  }
11223
- return array;
11826
+ this.saveSelection = new MarkdownSelection();
11827
+ this.parent.on(initialLoad, this.instantiateRenderer, this);
11828
+ this.parent.on(initialEnd, this.render, this);
11829
+ this.parent.on(modelChanged, this.onPropertyChanged, this);
11830
+ this.parent.on(markdownToolbarClick, this.onToolbarClick, this);
11831
+ this.parent.on(destroy, this.destroy, this);
11832
+ this.parent.on(selectAll$1, this.selectAll, this);
11833
+ this.parent.on(getSelectedHtml, this.getSelectedHtml, this);
11834
+ this.parent.on(selectionSave, this.onSelectionSave, this);
11835
+ this.parent.on(selectionRestore, this.onSelectionRestore, this);
11836
+ this.parent.on(readOnlyMode, this.updateReadOnly, this);
11837
+ this.parent.on(moduleDestroy, this.moduleDestroy, this);
11224
11838
  };
11225
- NodeSelection.prototype.setRangePoint = function (range, isvalid, num, size) {
11226
- var node = this.rootNode;
11227
- var index = num.length;
11228
- var constant = size;
11229
- for (; index--; null) {
11230
- node = node && node.childNodes[num[index]];
11839
+ MarkdownEditor.prototype.updateReadOnly = function () {
11840
+ if (this.parent.readonly) {
11841
+ this.parent.contentModule.getEditPanel().setAttribute('readonly', 'readonly');
11842
+ addClass([this.parent.element], CLS_RTE_READONLY);
11231
11843
  }
11232
- if (node && constant >= 0 && node.nodeName !== 'html') {
11233
- if (node.nodeType === 3 && node.nodeValue.replace(/\u00a0/g, '&nbsp;') === '&nbsp;') {
11234
- constant = node.textContent.length;
11235
- }
11236
- range[isvalid ? 'setStart' : 'setEnd'](node, constant);
11844
+ else {
11845
+ this.parent.contentModule.getEditPanel().removeAttribute('readonly');
11846
+ removeClass([this.parent.element], CLS_RTE_READONLY);
11237
11847
  }
11238
- return range;
11239
11848
  };
11240
- /**
11241
- * restore method
11242
- *
11243
- * @returns {void}
11244
- * @hidden
11245
- * @deprecated
11246
- */
11247
- NodeSelection.prototype.restore = function () {
11248
- var range = this.range.cloneRange();
11249
- range = this.setRangePoint(range, true, this.startContainer, this.startOffset);
11250
- range = this.setRangePoint(range, false, this.endContainer, this.endOffset);
11251
- this.selectRange(this.rootNode, range);
11252
- return range;
11849
+ MarkdownEditor.prototype.onSelectionSave = function () {
11850
+ var textArea = this.parent.contentModule.getEditPanel();
11851
+ this.saveSelection.save(textArea.selectionStart, textArea.selectionEnd);
11253
11852
  };
11254
- NodeSelection.prototype.selectRange = function (docElement, range) {
11255
- this.setRange(docElement, range);
11256
- this.save(range, docElement);
11853
+ // eslint-disable-next-line
11854
+ MarkdownEditor.prototype.onSelectionRestore = function (e) {
11855
+ this.contentRenderer.getEditPanel().focus();
11856
+ var textArea = this.parent.contentModule.getEditPanel();
11857
+ this.saveSelection.restore(textArea);
11257
11858
  };
11258
- /**
11259
- * setRange method
11260
- *
11261
- * @param {Document} docElement - specifies the document.
11262
- * @param {Range} range - specifies the range.
11263
- * @returns {void}
11264
- * @hidden
11265
- * @deprecated
11266
- */
11267
- NodeSelection.prototype.setRange = function (docElement, range) {
11268
- var selection = this.get(docElement);
11269
- selection.removeAllRanges();
11270
- selection.addRange(range);
11859
+ MarkdownEditor.prototype.onToolbarClick = function (args) {
11860
+ var item = args.item;
11861
+ var textArea = this.parent.contentModule.getEditPanel();
11862
+ if (item.command !== 'Formats') {
11863
+ textArea.focus();
11864
+ }
11865
+ var startOffset = textArea.selectionStart;
11866
+ var endOffset = textArea.selectionEnd;
11867
+ var text = textArea.value.substring(startOffset, endOffset);
11868
+ switch (item.subCommand) {
11869
+ case 'Maximize':
11870
+ this.parent.notify(enableFullScreen, { args: args });
11871
+ break;
11872
+ case 'Minimize':
11873
+ this.parent.notify(disableFullScreen, { args: args });
11874
+ break;
11875
+ case 'CreateLink':
11876
+ this.parent.notify(insertLink, { member: 'link', args: args, text: text, module: 'Markdown' });
11877
+ break;
11878
+ case 'Image':
11879
+ this.parent.notify(insertImage, { member: 'image', args: args, text: text, module: 'Markdown' });
11880
+ break;
11881
+ case 'CreateTable': {
11882
+ var tableConstant = {
11883
+ 'headingText': this.parent.localeObj.getConstant('TableHeadingText'),
11884
+ 'colText': this.parent.localeObj.getConstant('TableColText')
11885
+ };
11886
+ this.parent.formatter.process(this.parent, args, args.originalEvent, tableConstant);
11887
+ break;
11888
+ }
11889
+ default:
11890
+ this.parent.formatter.process(this.parent, args, args.originalEvent, null);
11891
+ break;
11892
+ }
11271
11893
  };
11272
- /**
11273
- * setSelectionText method
11274
- *
11275
- * @param {Document} docElement - specifies the documrent
11276
- * @param {Node} startNode - specifies the starting node.
11277
- * @param {Node} endNode - specifies the the end node.
11278
- * @param {number} startIndex - specifies the starting index.
11279
- * @param {number} endIndex - specifies the end index.
11280
- * @returns {void}
11281
- * @hidden
11282
- * @deprecated
11283
- */
11284
- NodeSelection.prototype.setSelectionText = function (docElement, startNode, endNode, startIndex, endIndex) {
11285
- var range = docElement.createRange();
11286
- range.setStart(startNode, startIndex);
11287
- range.setEnd(endNode, endIndex);
11288
- this.setRange(docElement, range);
11894
+ MarkdownEditor.prototype.instantiateRenderer = function () {
11895
+ this.renderFactory.addRenderer(RenderType.Content, new MarkdownRender(this.parent));
11289
11896
  };
11290
- /**
11291
- * setSelectionContents method
11292
- *
11293
- * @param {Document} docElement - specifies the document.
11294
- * @param {Node} element - specifies the node.
11295
- * @returns {void}
11296
- * @hidden
11297
- * @deprecated
11298
- */
11299
- NodeSelection.prototype.setSelectionContents = function (docElement, element) {
11300
- var range = docElement.createRange();
11301
- range.selectNode(element);
11302
- this.setRange(docElement, range);
11897
+ MarkdownEditor.prototype.removeEventListener = function () {
11898
+ if (this.parent.isDestroyed) {
11899
+ return;
11900
+ }
11901
+ this.parent.off(initialEnd, this.render);
11902
+ this.parent.off(modelChanged, this.onPropertyChanged);
11903
+ this.parent.off(destroy, this.destroy);
11904
+ this.parent.off(markdownToolbarClick, this.onToolbarClick);
11905
+ this.parent.off(initialLoad, this.instantiateRenderer);
11906
+ this.parent.off(selectAll$1, this.selectAll);
11907
+ this.parent.off(getSelectedHtml, this.getSelectedHtml);
11908
+ this.parent.off(selectionSave, this.onSelectionSave);
11909
+ this.parent.off(selectionRestore, this.onSelectionRestore);
11910
+ this.parent.off(readOnlyMode, this.updateReadOnly);
11911
+ this.parent.off(moduleDestroy, this.moduleDestroy);
11303
11912
  };
11304
- /**
11305
- * setSelectionNode method
11306
- *
11307
- * @param {Document} docElement - specifies the document.
11308
- * @param {Node} element - specifies the node.
11309
- * @returns {void}
11310
- * @hidden
11311
- * @deprecated
11312
- */
11313
- NodeSelection.prototype.setSelectionNode = function (docElement, element) {
11314
- var range = docElement.createRange();
11315
- range.selectNodeContents(element);
11316
- this.setRange(docElement, range);
11913
+ MarkdownEditor.prototype.render = function () {
11914
+ this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
11915
+ var editElement = this.contentRenderer.getEditPanel();
11916
+ var option = { undoRedoSteps: this.parent.undoRedoSteps, undoRedoTimer: this.parent.undoRedoTimer };
11917
+ if (isNullOrUndefined(this.parent.formatter)) {
11918
+ this.parent.formatter = new MarkdownFormatter({
11919
+ element: editElement,
11920
+ options: option
11921
+ });
11922
+ }
11923
+ else {
11924
+ this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
11925
+ }
11926
+ if (this.parent.toolbarSettings.enable) {
11927
+ this.toolbarUpdate = new MarkdownToolbarStatus(this.parent);
11928
+ }
11929
+ this.parent.notify(bindOnEnd, {});
11317
11930
  };
11318
11931
  /**
11319
- * getSelectedNodes method
11932
+ * Called internally if any of the property value changed.
11320
11933
  *
11321
- * @param {Document} docElement - specifies the document.
11934
+ * @param {RichTextEditorModel} e - specifies the editor model
11322
11935
  * @returns {void}
11323
11936
  * @hidden
11324
11937
  * @deprecated
11325
11938
  */
11326
- NodeSelection.prototype.getSelectedNodes = function (docElement) {
11327
- return this.getNodeCollection(this.getRange(docElement));
11939
+ MarkdownEditor.prototype.onPropertyChanged = function (e) {
11940
+ // On property code change here
11941
+ if (!isNullOrUndefined(e.newProp.formatter)) {
11942
+ var editElement = this.contentRenderer.getEditPanel();
11943
+ var option = { undoRedoSteps: this.parent.undoRedoSteps,
11944
+ undoRedoTimer: this.parent.undoRedoTimer };
11945
+ this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
11946
+ }
11328
11947
  };
11329
11948
  /**
11330
- * Clear method
11949
+ * For internal use only - Get the module name.
11331
11950
  *
11332
- * @param {Document} docElement - specifies the document.
11333
11951
  * @returns {void}
11334
- * @hidden
11335
- * @deprecated
11336
11952
  */
11337
- NodeSelection.prototype.Clear = function (docElement) {
11338
- this.get(docElement).removeAllRanges();
11953
+ MarkdownEditor.prototype.getModuleName = function () {
11954
+ return 'markdownEditor';
11339
11955
  };
11340
11956
  /**
11341
- * insertParentNode method
11957
+ * For selecting all content in RTE
11342
11958
  *
11343
- * @param {Document} docElement - specifies the document.
11344
- * @param {Node} newNode - specicfies the new node.
11345
- * @param {Range} range - specifies the range.
11346
11959
  * @returns {void}
11347
- * @hidden
11348
- * @deprecated
11960
+ * @private
11349
11961
  */
11350
- NodeSelection.prototype.insertParentNode = function (docElement, newNode, range) {
11351
- range.surroundContents(newNode);
11352
- this.selectRange(docElement, range);
11962
+ MarkdownEditor.prototype.selectAll = function () {
11963
+ this.parent.formatter.editorManager.markdownSelection.setSelection(this.parent.contentModule.getEditPanel(), 0, this.parent.contentModule.getEditPanel().value.length);
11353
11964
  };
11354
11965
  /**
11355
- * setCursorPoint method
11966
+ * For get a selected text in RTE
11356
11967
  *
11357
- * @param {Document} docElement - specifies the document.
11358
- * @param {Element} element - specifies the element.
11359
- * @param {number} point - specifies the point.
11968
+ * @param {NotifyArgs} e - specifies the arguments.
11360
11969
  * @returns {void}
11361
- * @hidden
11362
- * @deprecated
11970
+ * @private
11363
11971
  */
11364
- NodeSelection.prototype.setCursorPoint = function (docElement, element, point) {
11365
- var range = docElement.createRange();
11366
- var selection = docElement.defaultView.getSelection();
11367
- range.setStart(element, point);
11368
- range.collapse(true);
11369
- selection.removeAllRanges();
11370
- selection.addRange(range);
11972
+ MarkdownEditor.prototype.getSelectedHtml = function (e) {
11973
+ e.callBack(this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()));
11371
11974
  };
11372
- return NodeSelection;
11975
+ return MarkdownEditor;
11373
11976
  }());
11374
11977
 
11375
- /**
11376
- * `Selection` module is used to handle RTE Selections.
11377
- */
11378
-
11379
11978
  var markerClassName = {
11380
11979
  startSelection: 'e-editor-select-start',
11381
11980
  endSelection: 'e-editor-select-end'
@@ -12502,11 +13101,17 @@ var Lists = /** @__PURE__ @class */ (function () {
12502
13101
  Lists.prototype.removeList = function (range, e) {
12503
13102
  var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
12504
13103
  var endNode = (!isNullOrUndefined(range.endContainer.parentElement.closest('li')) && range.endContainer.parentElement.closest('li').childElementCount > 1 && range.endContainer.nodeName === '#text') ? range.endContainer : this.parent.domNode.getSelectedNode(range.endContainer, range.endOffset);
13104
+ var parentList = (range.startContainer.nodeName === '#text') ? range.startContainer.parentElement.closest('li') : range.startContainer.closest('li');
13105
+ var fullContent = '';
13106
+ if (!isNullOrUndefined(parentList) && !isNullOrUndefined(parentList.childNodes)) {
13107
+ parentList.childNodes.forEach(function (e) {
13108
+ fullContent = fullContent + e.textContent;
13109
+ });
13110
+ }
12505
13111
  startNode = startNode.nodeName === 'BR' ? startNode.parentElement : startNode;
12506
13112
  endNode = endNode.nodeName === 'BR' ? endNode.parentElement : endNode;
12507
13113
  startNode = startNode.nodeName !== 'LI' && !isNullOrUndefined(startNode.closest('LI')) ? startNode.closest('LI') : startNode;
12508
13114
  endNode = endNode.nodeName !== 'LI' && endNode.nodeName !== '#text' && !isNullOrUndefined(endNode.closest('LI')) ? endNode.closest('LI') : endNode;
12509
- var parentList = (range.startContainer.nodeName === '#text') ? range.startContainer.parentElement.closest('li') : range.startContainer.closest('li');
12510
13115
  if (((range.commonAncestorContainer.nodeName === 'OL' || range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'LI') &&
12511
13116
  isNullOrUndefined(endNode.nextElementSibling) && endNode.textContent.length === range.endOffset &&
12512
13117
  isNullOrUndefined(startNode.previousElementSibling) && range.startOffset === 0) ||
@@ -12523,10 +13128,23 @@ var Lists = /** @__PURE__ @class */ (function () {
12523
13128
  }
12524
13129
  e.event.preventDefault();
12525
13130
  }
12526
- else if (!isNullOrUndefined(parentList) && parentList.textContent === range.startContainer.textContent && parentList.closest('li').previousElementSibling === null) {
13131
+ else if (!isNullOrUndefined(parentList) && !range.collapsed && parentList.textContent === fullContent) {
12527
13132
  range.deleteContents();
12528
- this.parent.editableElement.querySelectorAll('li:empty').forEach(function (e) { return e.remove(); });
12529
- this.parent.editableElement.querySelectorAll('ol:empty').forEach(function (e) { return e.remove(); });
13133
+ this.parent.editableElement.querySelectorAll('li').forEach(function (li) {
13134
+ if (!li.firstChild || li.textContent.trim() === '') {
13135
+ li.parentNode.removeChild(li);
13136
+ }
13137
+ });
13138
+ this.parent.editableElement.querySelectorAll('ol').forEach(function (ol) {
13139
+ if (!ol.firstChild || ol.textContent.trim() === '') {
13140
+ ol.parentNode.removeChild(ol);
13141
+ }
13142
+ });
13143
+ this.parent.editableElement.querySelectorAll('ul').forEach(function (ul) {
13144
+ if (!ul.firstChild || ul.textContent.trim() === '') {
13145
+ ul.parentNode.removeChild(ul);
13146
+ }
13147
+ });
12530
13148
  e.event.preventDefault();
12531
13149
  }
12532
13150
  };
@@ -12923,6 +13541,10 @@ var Lists = /** @__PURE__ @class */ (function () {
12923
13541
  }
12924
13542
  else {
12925
13543
  this.checkLists(elements, type, item);
13544
+ var marginLeftAttribute = '';
13545
+ if (elements[0].style.marginLeft !== '') {
13546
+ marginLeftAttribute = ' style = "margin-left: ' + elements[0].style.marginLeft + ';"';
13547
+ }
12926
13548
  for (var i = 0; i < elements.length; i++) {
12927
13549
  if (!isNullOrUndefined(item) && !isNullOrUndefined(item.listStyle)) {
12928
13550
  if (item.listStyle === 'listImage') {
@@ -12933,6 +13555,9 @@ var Lists = /** @__PURE__ @class */ (function () {
12933
13555
  setStyleAttribute(elements[i], { 'list-style-type': item.listStyle.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() });
12934
13556
  }
12935
13557
  }
13558
+ var elemAtt = void 0;
13559
+ elements[i].style.removeProperty('margin-left');
13560
+ elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
12936
13561
  if (elements[i].getAttribute('contenteditable') === 'true'
12937
13562
  && elements[i].childNodes.length === 1 && elements[i].childNodes[0].nodeName === 'TABLE') {
12938
13563
  var listEle = document.createElement(type);
@@ -12941,8 +13566,7 @@ var Lists = /** @__PURE__ @class */ (function () {
12941
13566
  }
12942
13567
  else if ('LI' !== elements[i].tagName && isNullOrUndefined(item) &&
12943
13568
  elements[i].nodeName === 'BLOCKQUOTE') {
12944
- var elemAtt = this.domNode.attributes(elements[i]);
12945
- var openTag = '<' + type + '>';
13569
+ var openTag = '<' + type + marginLeftAttribute + '>';
12946
13570
  var closeTag = '</' + type + '>';
12947
13571
  var newTag = 'li' + elemAtt;
12948
13572
  var replaceHTML = elements[i].innerHTML;
@@ -12951,8 +13575,7 @@ var Lists = /** @__PURE__ @class */ (function () {
12951
13575
  elements[i].innerHTML = collectionString;
12952
13576
  }
12953
13577
  else if ('LI' !== elements[i].tagName && isNullOrUndefined(item)) {
12954
- var elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
12955
- var openTag = '<' + type + '>';
13578
+ var openTag = '<' + type + marginLeftAttribute + '>';
12956
13579
  var closeTag = '</' + type + '>';
12957
13580
  var newTag = 'li' + elemAtt;
12958
13581
  var replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
@@ -12963,8 +13586,8 @@ var Lists = /** @__PURE__ @class */ (function () {
12963
13586
  }
12964
13587
  else if (!isNullOrUndefined(item) && 'LI' !== elements[i].tagName) {
12965
13588
  // eslint-disable-next-line
12966
- var elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
12967
- var openTag = '<' + type + elemAtt + '>';
13589
+ var currentElemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
13590
+ var openTag = '<' + type + currentElemAtt + '>';
12968
13591
  var closeTag = '</' + type + '>';
12969
13592
  var newTag = 'li';
12970
13593
  var replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
@@ -13160,16 +13783,16 @@ var Lists = /** @__PURE__ @class */ (function () {
13160
13783
  var parentElement = parentNode;
13161
13784
  if (elements.length === parentElement.querySelectorAll('li').length) {
13162
13785
  if (!isNullOrUndefined(parentElement.style.listStyleType)) {
13163
- parentNode.style.removeProperty('list-style-type');
13786
+ parentNode.style.removeProperty("list-style-type");
13164
13787
  }
13165
13788
  if (!isNullOrUndefined(parentElement.style.listStyleImage)) {
13166
- parentNode.style.removeProperty('list-style-image');
13789
+ parentNode.style.removeProperty("list-style-image");
13167
13790
  }
13168
13791
  if (parentElement.style.length === 0) {
13169
- parentNode.removeAttribute('style');
13792
+ parentNode.removeAttribute("style");
13170
13793
  }
13171
13794
  }
13172
- var wrapper = '<' + DEFAULT_TAG + wrapperclass + '></' + DEFAULT_TAG + '>';
13795
+ var wrapper = '<' + DEFAULT_TAG + wrapperclass + this.domNode.attributes(element) + '></' + DEFAULT_TAG + '>';
13173
13796
  if (e.enterAction !== 'BR') {
13174
13797
  this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
13175
13798
  }
@@ -13483,6 +14106,9 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
13483
14106
  else {
13484
14107
  var startOffset = this.GetCursorStart(indexes, range.startOffset, true);
13485
14108
  this.position = range.startOffset - startOffset;
14109
+ if (startOffset !== 0 && str[startOffset] && str[startOffset] === ' ') {
14110
+ startOffset = startOffset + 1;
14111
+ }
13486
14112
  cursorRange.setStart(range.startContainer, startOffset);
13487
14113
  cursorRange.setEnd(range.startContainer, this.GetCursorStart(indexes, range.startOffset, false));
13488
14114
  }
@@ -13563,6 +14189,12 @@ var Formats = /** @__PURE__ @class */ (function () {
13563
14189
  }
13564
14190
  }
13565
14191
  }
14192
+ if (e.enterAction !== 'BR' && !isNullOrUndefined(range.startContainer) && !isNullOrUndefined(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains("e-content") && range.startContainer.parentElement.isContentEditable) {
14193
+ var pTag = createElement(e.enterAction);
14194
+ range.startContainer.parentElement.insertBefore(pTag, range.startContainer);
14195
+ pTag.appendChild(range.startContainer);
14196
+ this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, pTag, 1);
14197
+ }
13566
14198
  };
13567
14199
  Formats.prototype.getBlockParent = function (node, endNode) {
13568
14200
  var currentParent;
@@ -14175,7 +14807,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
14175
14807
  range.deleteContents();
14176
14808
  range.setStart(startContainerParent, startIndex);
14177
14809
  range.setEnd(startContainerParent, startIndex);
14178
- if (!isNullOrUndefined(lasNode)) {
14810
+ if (!isNullOrUndefined(lasNode) && lasNode !== editNode) {
14179
14811
  detach(lasNode);
14180
14812
  }
14181
14813
  // eslint-disable-next-line
@@ -14342,7 +14974,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
14342
14974
  if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
14343
14975
  blockNode = range.startContainer;
14344
14976
  }
14345
- if (blockNode.closest('LI') && node && node.firstElementChild &&
14977
+ if (blockNode.closest('LI') && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
14346
14978
  ((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
14347
14979
  var liNode = void 0;
14348
14980
  while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
@@ -14372,7 +15004,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
14372
15004
  }
14373
15005
  }
14374
15006
  else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNullOrUndefined(currentNode.parentElement) &&
14375
- (currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
15007
+ (currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
14376
15008
  currentNode.parentElement.textContent.trim().length > 0) {
14377
15009
  splitedElm = currentNode;
14378
15010
  if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
@@ -14381,6 +15013,12 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
14381
15013
  }
14382
15014
  if (!range.collapsed) {
14383
15015
  range.deleteContents();
15016
+ var value = range.startContainer;
15017
+ if (!isNullOrUndefined(value) && value.nodeName === 'LI' && !isNullOrUndefined(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
15018
+ value.parentElement.querySelectorAll('li').forEach(function (item) {
15019
+ item.remove();
15020
+ });
15021
+ }
14384
15022
  }
14385
15023
  range.insertNode(node);
14386
15024
  this.contentsDeleted = true;
@@ -14573,7 +15211,8 @@ var LinkCommand = /** @__PURE__ @class */ (function () {
14573
15211
  }
14574
15212
  if (!isNullOrUndefined(e.item.text) && e.item.text !== '') {
14575
15213
  linkText = anchorEle.innerText;
14576
- anchorEle.innerText = e.item.text;
15214
+ anchorEle.firstChild.nodeName === '#text' ? anchorEle.innerText = e.item.text :
15215
+ anchorEle.firstChild.innerText = e.item.text;
14577
15216
  }
14578
15217
  if (!isNullOrUndefined(e.item.target)) {
14579
15218
  anchorEle.setAttribute('target', e.item.target);
@@ -14589,7 +15228,8 @@ var LinkCommand = /** @__PURE__ @class */ (function () {
14589
15228
  }
14590
15229
  else {
14591
15230
  var startIndex = e.item.action === 'Paste' ? anchorEle.childNodes[0].textContent.length : 0;
14592
- e.item.selection.setSelectionText(this.parent.currentDocument, anchorEle.childNodes[0], anchorEle.childNodes[0], startIndex, anchorEle.childNodes[0].textContent.length);
15231
+ var endIndex = anchorEle.firstChild.nodeName === '#text' ? anchorEle.childNodes[0].textContent.length : anchorEle.childNodes.length;
15232
+ e.item.selection.setSelectionText(this.parent.currentDocument, anchorEle.childNodes[0], anchorEle.childNodes[0], startIndex, endIndex);
14593
15233
  }
14594
15234
  }
14595
15235
  else {
@@ -15011,7 +15651,7 @@ var Indents = /** @__PURE__ @class */ (function () {
15011
15651
  isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
15012
15652
  }
15013
15653
  else {
15014
- indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
15654
+ indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px' || marginLeftOrRight === '0in') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
15015
15655
  isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
15016
15656
  /* eslint-enable */
15017
15657
  }
@@ -15524,7 +16164,7 @@ var AudioCommand = /** @__PURE__ @class */ (function () {
15524
16164
  isReplaced = true;
15525
16165
  }
15526
16166
  else {
15527
- wrapElement = createElement('span', { className: CLASS_AUDIO_WRAP, attrs: { contentEditable: 'false', title: e.item.fileName } });
16167
+ wrapElement = createElement('span', { className: CLASS_AUDIO_WRAP, attrs: { contentEditable: 'false', title: ((!isNullOrUndefined(e.item.title)) ? e.item.title : (!isNullOrUndefined(e.item.fileName) ? e.item.fileName : '')) } });
15528
16168
  var audElement = createElement('audio', { className: CLASS_AUDIO + ' ' + CLASS_AUDIO_INLINE, attrs: { controls: '' } });
15529
16169
  var sourceElement = createElement('source');
15530
16170
  var clickElement = createElement('span', { className: CLASS_CLICK_ELEM });
@@ -15720,7 +16360,7 @@ var VideoCommand = /** @__PURE__ @class */ (function () {
15720
16360
  }
15721
16361
  else {
15722
16362
  if (!e.item.isEmbedUrl) {
15723
- wrapElement = createElement('span', { className: CLASS_VIDEO_WRAP, attrs: { contentEditable: 'false', title: e.item.fileName } });
16363
+ wrapElement = createElement('span', { className: CLASS_VIDEO_WRAP, attrs: { contentEditable: 'false', title: ((!isNullOrUndefined(e.item.title)) ? e.item.title : (!isNullOrUndefined(e.item.fileName) ? e.item.fileName : '')) } });
15724
16364
  vidElement = createElement('video', { className: CLASS_VIDEO + ' ' + CLASS_VIDEO_INLINE, attrs: { controls: '' } });
15725
16365
  sourceElement = createElement('source');
15726
16366
  this.setStyle(sourceElement, e, vidElement);
@@ -16580,28 +17220,23 @@ var TableCommand = /** @__PURE__ @class */ (function () {
16580
17220
  var newCell = this.activeCell.cloneNode(true);
16581
17221
  newCell.removeAttribute('class');
16582
17222
  newCell.innerHTML = '</br>';
16583
- var avgWidth = parseFloat(this.activeCell.style.width) / 2;
16584
- if (this.activeCell.tagName === 'TH' && isNaN(avgWidth)) {
16585
- var cellCount = this.curTable.querySelector('tr').childElementCount;
16586
- var colSpanCount = 0;
16587
- for (var i = 0; i < cellCount; i++) {
16588
- colSpanCount = colSpanCount + (parseInt(this.curTable.querySelector('tr').children[i].getAttribute('colspan'), 10) || 1);
16589
- }
16590
- avgWidth = parseFloat((((this.activeCell.offsetWidth / 2) / this.curTable.offsetWidth) * 100).toFixed(1));
16591
- }
16592
17223
  var activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
16593
17224
  var correspondingColumns = this.getCorrespondingColumns();
16594
- var activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10);
17225
+ var activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10) || 1;
16595
17226
  if (activeCellcolSpan > 1) {
16596
- // eslint-disable-next-line
16597
- 1 < Math.ceil(activeCellcolSpan / 2) ? this.activeCell.setAttribute('colspan', (activeCellcolSpan / 2).toString())
16598
- : this.activeCell.removeAttribute('colspan');
16599
- // eslint-disable-next-line
16600
- 1 < (activeCellcolSpan - activeCellcolSpan / 2) ? newCell.setAttribute('colspan',
16601
- // eslint-disable-next-line
16602
- (activeCellcolSpan - activeCellcolSpan / 2).toString()) : newCell.removeAttribute('colspan');
17227
+ var colSpan = Math.ceil(activeCellcolSpan / 2);
17228
+ var getColSizes = this.getColSizes(this.curTable);
17229
+ var activeCellUpdatedWidth = this.getSplitColWidth(activeCellIndex[1], activeCellIndex[1] + colSpan - 1, getColSizes);
17230
+ var newCellWidth = this.getSplitColWidth(activeCellIndex[1] + colSpan, activeCellIndex[1] + activeCellcolSpan - 1, getColSizes);
17231
+ var activeCellWidth = this.convertPixelToPercentage(this.activeCell.offsetWidth, this.curTable.offsetWidth);
17232
+ newCellWidth = (activeCellWidth - activeCellUpdatedWidth) < newCellWidth ? (activeCellWidth - activeCellUpdatedWidth) : newCellWidth;
17233
+ 1 < colSpan ? this.activeCell.setAttribute('colspan', colSpan.toString()) : this.activeCell.removeAttribute('colspan');
17234
+ 1 < activeCellcolSpan - colSpan ? newCell.setAttribute('colspan', (activeCellcolSpan - colSpan).toString()) : newCell.removeAttribute('colspan');
17235
+ this.activeCell.style.width = activeCellUpdatedWidth + '%';
17236
+ newCell.style.width = newCellWidth + '%';
16603
17237
  }
16604
17238
  else {
17239
+ var avgWidth = parseFloat(this.activeCell.style.width) / 2;
16605
17240
  for (var i = 0; i <= allRows.length - 1; i++) {
16606
17241
  if (0 === i || correspondingColumns[i][activeCellIndex[1]] !== correspondingColumns[i - 1][activeCellIndex[1]]) {
16607
17242
  var currentCell = correspondingColumns[i][activeCellIndex[1]];
@@ -16611,9 +17246,9 @@ var TableCommand = /** @__PURE__ @class */ (function () {
16611
17246
  }
16612
17247
  }
16613
17248
  }
17249
+ this.activeCell.style.width = avgWidth + '%';
17250
+ newCell.style.width = avgWidth + '%';
16614
17251
  }
16615
- this.activeCell.style.width = avgWidth + '%';
16616
- newCell.style.width = avgWidth + '%';
16617
17252
  this.activeCell.parentNode.insertBefore(newCell, this.activeCell.nextSibling);
16618
17253
  if (e.callBack) {
16619
17254
  e.callBack({
@@ -16625,6 +17260,54 @@ var TableCommand = /** @__PURE__ @class */ (function () {
16625
17260
  });
16626
17261
  }
16627
17262
  };
17263
+ TableCommand.prototype.getSplitColWidth = function (startIndex, endInex, sizes) {
17264
+ var width = 0;
17265
+ for (var i = startIndex; i <= endInex; i++) {
17266
+ width += sizes[i];
17267
+ }
17268
+ return this.convertPixelToPercentage(width, this.curTable.offsetWidth);
17269
+ };
17270
+ TableCommand.prototype.getColSizes = function (curTable) {
17271
+ var cellColl = curTable.rows[0].cells;
17272
+ var cellCount = 0;
17273
+ for (var cell = 0; cell < cellColl.length; cell++) {
17274
+ cellCount = cellCount + cellColl[cell].colSpan;
17275
+ }
17276
+ var sizes = new Array(cellCount);
17277
+ var rowSpanCells = new Map();
17278
+ for (var i = 0; i < curTable.rows.length; i++) {
17279
+ var currentColIndex = 0;
17280
+ for (var k = 0; k < curTable.rows[i].cells.length; k++) {
17281
+ for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
17282
+ var key = "" + (i + l) + currentColIndex;
17283
+ rowSpanCells.set(key, curTable.rows[i].cells[k]);
17284
+ }
17285
+ var cellIndex = this.getCellIndex(rowSpanCells, i, k);
17286
+ if (cellIndex > currentColIndex) {
17287
+ currentColIndex = cellIndex;
17288
+ }
17289
+ var width = curTable.rows[i].cells[k].offsetWidth;
17290
+ if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
17291
+ sizes[currentColIndex] = width;
17292
+ }
17293
+ currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
17294
+ }
17295
+ }
17296
+ return sizes;
17297
+ };
17298
+ TableCommand.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
17299
+ var cellKey = "" + rowIndex + colIndex;
17300
+ var spannedCell = rowSpanCells.get(cellKey);
17301
+ if (spannedCell) {
17302
+ return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
17303
+ }
17304
+ else {
17305
+ return colIndex;
17306
+ }
17307
+ };
17308
+ TableCommand.prototype.convertPixelToPercentage = function (value, offsetValue) {
17309
+ return (value / offsetValue) * 100;
17310
+ };
16628
17311
  TableCommand.prototype.getCorrespondingColumns = function () {
16629
17312
  var elementArray = [];
16630
17313
  // eslint-disable-next-line
@@ -16791,259 +17474,6 @@ var MinMax = /** @__PURE__ @class */ (function () {
16791
17474
  return MinMax;
16792
17475
  }());
16793
17476
 
16794
- /**
16795
- * Is formatted or not.
16796
- *
16797
- * @hidden
16798
- * @deprecated
16799
- */
16800
- var IsFormatted = /** @__PURE__ @class */ (function () {
16801
- function IsFormatted() {
16802
- }
16803
- /**
16804
- * getFormattedNode method
16805
- *
16806
- * @param {Node} node - specifies the node.
16807
- * @param {string} format - specifies the string value.
16808
- * @param {Node} endNode - specifies the end node
16809
- * @returns {Node} - returns the node
16810
- * @hidden
16811
- * @deprecated
16812
- */
16813
- IsFormatted.prototype.getFormattedNode = function (node, format, endNode) {
16814
- var parentNode = this.getFormatParent(node, format, endNode);
16815
- if (parentNode !== null && parentNode !== endNode) {
16816
- return parentNode;
16817
- }
16818
- return null;
16819
- };
16820
- IsFormatted.prototype.getFormatParent = function (node, format, endNode) {
16821
- do {
16822
- node = node.parentNode;
16823
- } while (node && (node !== endNode) && !this.isFormattedNode(node, format));
16824
- return node;
16825
- };
16826
- IsFormatted.prototype.isFormattedNode = function (node, format) {
16827
- switch (format) {
16828
- case 'bold':
16829
- return IsFormatted.isBold(node);
16830
- case 'italic':
16831
- return IsFormatted.isItalic(node);
16832
- case 'underline':
16833
- return IsFormatted.isUnderline(node);
16834
- case 'strikethrough':
16835
- return IsFormatted.isStrikethrough(node);
16836
- case 'superscript':
16837
- return IsFormatted.isSuperscript(node);
16838
- case 'subscript':
16839
- return IsFormatted.isSubscript(node);
16840
- case 'fontcolor':
16841
- return this.isFontColor(node);
16842
- case 'fontname':
16843
- return this.isFontName(node);
16844
- case 'fontsize':
16845
- return this.isFontSize(node);
16846
- case 'backgroundcolor':
16847
- return this.isBackgroundColor(node);
16848
- default:
16849
- return false;
16850
- }
16851
- };
16852
- /**
16853
- * isBold method
16854
- *
16855
- * @param {Node} node - specifies the node value
16856
- * @returns {boolean} - returns the boolean value
16857
- * @hidden
16858
- * @deprecated
16859
- */
16860
- IsFormatted.isBold = function (node) {
16861
- var validTags = ['strong', 'b'];
16862
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16863
- return true;
16864
- }
16865
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16866
- node.style && node.style.fontWeight === 'bold') {
16867
- return true;
16868
- }
16869
- else {
16870
- return false;
16871
- }
16872
- };
16873
- /**
16874
- * isItalic method
16875
- *
16876
- * @param {Node} node - specifies the node value
16877
- * @returns {boolean} - returns the boolean value
16878
- * @hidden
16879
- * @deprecated
16880
- */
16881
- IsFormatted.isItalic = function (node) {
16882
- var validTags = ['em', 'i'];
16883
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16884
- return true;
16885
- }
16886
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16887
- node.style && node.style.fontStyle === 'italic') {
16888
- return true;
16889
- }
16890
- else {
16891
- return false;
16892
- }
16893
- };
16894
- /**
16895
- * isUnderline method
16896
- *
16897
- * @param {Node} node - specifies the node value
16898
- * @returns {boolean} - returns the boolean value
16899
- * @hidden
16900
- * @deprecated
16901
- */
16902
- IsFormatted.isUnderline = function (node) {
16903
- var validTags = ['u'];
16904
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16905
- return true;
16906
- /* eslint-disable */
16907
- }
16908
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16909
- node.style && (node.style.textDecoration === 'underline' ||
16910
- node.style.textDecorationLine === 'underline')) {
16911
- /* eslint-enable */
16912
- return true;
16913
- }
16914
- else {
16915
- return false;
16916
- }
16917
- };
16918
- /**
16919
- * isStrikethrough method
16920
- *
16921
- * @param {Node} node - specifies the node value
16922
- * @returns {boolean} - returns the boolean value
16923
- * @hidden
16924
- * @deprecated
16925
- */
16926
- IsFormatted.isStrikethrough = function (node) {
16927
- var validTags = ['del', 'strike'];
16928
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16929
- return true;
16930
- /* eslint-disable */
16931
- }
16932
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16933
- node.style && (node.style.textDecoration === 'line-through' ||
16934
- node.style.textDecorationLine === 'line-through')) {
16935
- /* eslint-enable */
16936
- return true;
16937
- }
16938
- else {
16939
- return false;
16940
- }
16941
- };
16942
- /**
16943
- * isSuperscript method
16944
- *
16945
- * @param {Node} node - specifies the node value
16946
- * @returns {boolean} - returns the boolean value
16947
- * @hidden
16948
- * @deprecated
16949
- */
16950
- IsFormatted.isSuperscript = function (node) {
16951
- var validTags = ['sup'];
16952
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16953
- return true;
16954
- }
16955
- else {
16956
- return false;
16957
- }
16958
- };
16959
- /**
16960
- * isSubscript method
16961
- *
16962
- * @param {Node} node - specifies the node value
16963
- * @returns {boolean} - returns the boolean value
16964
- * @hidden
16965
- * @deprecated
16966
- */
16967
- IsFormatted.isSubscript = function (node) {
16968
- var validTags = ['sub'];
16969
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16970
- return true;
16971
- }
16972
- else {
16973
- return false;
16974
- }
16975
- };
16976
- IsFormatted.prototype.isFontColor = function (node) {
16977
- var color = node.style && node.style.color;
16978
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16979
- color !== null && color !== '' && color !== undefined) {
16980
- return true;
16981
- }
16982
- else {
16983
- return false;
16984
- }
16985
- };
16986
- IsFormatted.prototype.isBackgroundColor = function (node) {
16987
- var backColor = node.style && node.style.backgroundColor;
16988
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16989
- backColor !== null && backColor !== '' && backColor !== undefined) {
16990
- return true;
16991
- }
16992
- else {
16993
- return false;
16994
- }
16995
- };
16996
- IsFormatted.prototype.isFontSize = function (node) {
16997
- var size = node.style && node.style.fontSize;
16998
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16999
- size !== null && size !== '' && size !== undefined) {
17000
- return true;
17001
- }
17002
- else {
17003
- return false;
17004
- }
17005
- };
17006
- IsFormatted.prototype.isFontName = function (node) {
17007
- var name = node.style && node.style.fontFamily;
17008
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
17009
- name !== null && name !== '' && name !== undefined) {
17010
- return true;
17011
- }
17012
- else {
17013
- return false;
17014
- }
17015
- };
17016
- // Get Formatted Node
17017
- IsFormatted.inlineTags = [
17018
- 'a',
17019
- 'abbr',
17020
- 'acronym',
17021
- 'b',
17022
- 'bdo',
17023
- 'big',
17024
- 'cite',
17025
- 'code',
17026
- 'dfn',
17027
- 'em',
17028
- 'font',
17029
- 'i',
17030
- 'kbd',
17031
- 'label',
17032
- 'q',
17033
- 'samp',
17034
- 'small',
17035
- 'span',
17036
- 'strong',
17037
- 'sub',
17038
- 'sup',
17039
- 'tt',
17040
- 'u',
17041
- 'var',
17042
- 'del'
17043
- ];
17044
- return IsFormatted;
17045
- }());
17046
-
17047
17477
  /**
17048
17478
  * `Selection` module is used to handle RTE Selections.
17049
17479
  */
@@ -17413,6 +17843,10 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17413
17843
  liElement.style.fontStyle = 'normal';
17414
17844
  }
17415
17845
  }
17846
+ else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
17847
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
17848
+ SelectionCommands.conCatenateTextNode(liElement, format, '', 'normal');
17849
+ }
17416
17850
  }
17417
17851
  if (child[0] && !isFontStyle) {
17418
17852
  var nodeTraverse = child[index] ? child[index] : child[0];
@@ -17471,6 +17905,10 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17471
17905
  liElement.style.fontFamily = value;
17472
17906
  }
17473
17907
  }
17908
+ if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
17909
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
17910
+ SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
17911
+ }
17474
17912
  if (child[num].textContent === startText) {
17475
17913
  if (num === 0) {
17476
17914
  range.setStartBefore(child[num]);
@@ -17578,7 +18016,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17578
18016
  parentElement = parentElement.parentElement;
17579
18017
  liElement = parentElement;
17580
18018
  }
17581
- if (format === 'fontcolor' || format === 'fontname') {
18019
+ if (format === 'fontcolor' || format === 'fontname' || format === 'fontsize') {
17582
18020
  var parentElem = nodes[index].parentElement;
17583
18021
  if (!isNullOrUndefined(parentElem) && parentElem.childNodes) {
17584
18022
  for (var i = 0; i < parentElem.childNodes.length; i++) {
@@ -17598,6 +18036,9 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17598
18036
  case 'fontname':
17599
18037
  liElement_1.style.fontFamily = value;
17600
18038
  break;
18039
+ case 'fontsize':
18040
+ liElement_1.style.fontSize = value;
18041
+ break;
17601
18042
  default:
17602
18043
  break;
17603
18044
  }
@@ -17613,6 +18054,9 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17613
18054
  case 'fontname':
17614
18055
  childElement.style.fontFamily = 'initial';
17615
18056
  break;
18057
+ case 'fontsize':
18058
+ childElement.style.fontSize = 'initial';
18059
+ break;
17616
18060
  default:
17617
18061
  break;
17618
18062
  }
@@ -17672,6 +18116,10 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17672
18116
  }
17673
18117
  nodeList[0] = currentFormatNode;
17674
18118
  this.applyStyles(nodeList, 0, element);
18119
+ if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
18120
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
18121
+ SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
18122
+ }
17675
18123
  }
17676
18124
  else {
17677
18125
  nodes[index] = this.applyStyles(nodes, index, element);
@@ -17692,6 +18140,10 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17692
18140
  liElement.style.fontStyle = 'italic';
17693
18141
  }
17694
18142
  }
18143
+ else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
18144
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
18145
+ SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format);
18146
+ }
17695
18147
  }
17696
18148
  }
17697
18149
  }
@@ -17895,7 +18347,9 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17895
18347
  }
17896
18348
  var blockChildNodes = parent.parentElement.childNodes;
17897
18349
  for (var k = 0; k < blockChildNodes.length; k++) {
17898
- if (blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) {
18350
+ if ((blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) &&
18351
+ blockChildNodes[k].textContent.charCodeAt(0) !== 160) {
18352
+ // 160 is the char code for &nbsp;
17899
18353
  detach(blockChildNodes[k]);
17900
18354
  }
17901
18355
  }
@@ -17931,6 +18385,64 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17931
18385
  }
17932
18386
  return result;
17933
18387
  };
18388
+ SelectionCommands.conCatenateTextNode = function (liElement, format, value, formatStr, constVal) {
18389
+ var result = '';
18390
+ switch (format) {
18391
+ case 'bold':
18392
+ liElement.querySelectorAll('strong').forEach(function (e) {
18393
+ result = result + e.textContent;
18394
+ });
18395
+ if (result === value) {
18396
+ liElement.style.fontWeight = formatStr;
18397
+ }
18398
+ break;
18399
+ case 'italic':
18400
+ liElement.querySelectorAll('em').forEach(function (e) {
18401
+ result = result + e.textContent;
18402
+ });
18403
+ if (result === value) {
18404
+ liElement.style.fontStyle = formatStr;
18405
+ }
18406
+ break;
18407
+ case 'fontcolor':
18408
+ var colorStyle_1 = '';
18409
+ liElement.querySelectorAll('span').forEach(function (span) {
18410
+ colorStyle_1 = span.style.color;
18411
+ if (colorStyle_1 === constVal) {
18412
+ result = result + span.textContent;
18413
+ }
18414
+ });
18415
+ if (result === value) {
18416
+ liElement.style.color = colorStyle_1;
18417
+ liElement.style.textDecoration = 'inherit';
18418
+ }
18419
+ break;
18420
+ case 'fontsize':
18421
+ var fontSize_1 = '';
18422
+ liElement.querySelectorAll('span').forEach(function (span) {
18423
+ fontSize_1 = span.style.getPropertyValue('font-size');
18424
+ if (fontSize_1 === constVal) {
18425
+ result = result + span.textContent;
18426
+ }
18427
+ });
18428
+ if (result === value) {
18429
+ liElement.style.fontSize = fontSize_1;
18430
+ }
18431
+ break;
18432
+ case 'fontname':
18433
+ var fontFamily_1 = '';
18434
+ liElement.querySelectorAll('span').forEach(function (span) {
18435
+ fontFamily_1 = span.style.getPropertyValue('font-family');
18436
+ if (fontFamily_1 === constVal) {
18437
+ result = result + span.textContent;
18438
+ }
18439
+ });
18440
+ if (result === value) {
18441
+ liElement.style.fontFamily = fontFamily_1;
18442
+ }
18443
+ break;
18444
+ }
18445
+ };
17934
18446
  SelectionCommands.enterAction = 'P';
17935
18447
  return SelectionCommands;
17936
18448
  }());
@@ -19686,376 +20198,6 @@ var InsertTextExec = /** @__PURE__ @class */ (function () {
19686
20198
  return InsertTextExec;
19687
20199
  }());
19688
20200
 
19689
- /**
19690
- * Update Toolbar Status
19691
- *
19692
- * @hidden
19693
- * @deprecated
19694
- */
19695
- var statusCollection = getDefaultHtmlTbStatus();
19696
- var ToolbarStatus = /** @__PURE__ @class */ (function () {
19697
- function ToolbarStatus() {
19698
- }
19699
- /**
19700
- * get method
19701
- *
19702
- * @param {Document} docElement - specifies the document element
19703
- * @param {Node} rootNode - specifies the content editable element
19704
- * @param {string[]} formatNode - specifies the format node
19705
- * @param {string[]} fontSize - specifies the font size
19706
- * @param {string[]} fontName - specifies the font name.
19707
- * @param {Node} documentNode - specifies the document node.
19708
- * @returns {IToolbarStatus} - returns the toolbar status
19709
- * @hidden
19710
- * @deprecated
19711
- */
19712
- ToolbarStatus.get = function (docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
19713
- var formatCollection = JSON.parse(JSON.stringify(statusCollection));
19714
- var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
19715
- var nodeSelection = new NodeSelection();
19716
- var range = nodeSelection.getRange(docElement);
19717
- var nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
19718
- nodeSelection.getSelectionNodeCollectionBr(range);
19719
- var nodesLength = nodes.length;
19720
- var isNodeChanged = false;
19721
- for (var index = 0; index < nodes.length; index++) {
19722
- while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
19723
- nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
19724
- (this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
19725
- range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
19726
- nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
19727
- nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
19728
- isNodeChanged = true;
19729
- }
19730
- if (isNodeChanged && nodes[index]) {
19731
- nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
19732
- isNodeChanged = false;
19733
- }
19734
- if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
19735
- (nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
19736
- nodes.splice(index, 1);
19737
- index--;
19738
- }
19739
- }
19740
- for (var index = 0; index < nodes.length; index++) {
19741
- // eslint-disable-next-line max-len
19742
- formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], rootNode, formatNode, fontSize, fontName);
19743
- if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
19744
- nodeCollection.bold = formatCollection.bold;
19745
- }
19746
- if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
19747
- nodeCollection.insertcode = formatCollection.insertcode;
19748
- }
19749
- if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
19750
- nodeCollection.italic = formatCollection.italic;
19751
- }
19752
- if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
19753
- nodeCollection.underline = formatCollection.underline;
19754
- }
19755
- if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
19756
- nodeCollection.strikethrough = formatCollection.strikethrough;
19757
- }
19758
- if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
19759
- nodeCollection.superscript = formatCollection.superscript;
19760
- }
19761
- if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
19762
- nodeCollection.subscript = formatCollection.subscript;
19763
- }
19764
- if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
19765
- nodeCollection.fontcolor = formatCollection.fontcolor;
19766
- }
19767
- if (index === 0 && formatCollection.fontname) {
19768
- nodeCollection.fontname = formatCollection.fontname;
19769
- }
19770
- else {
19771
- nodeCollection.fontname = formatCollection.fontname === nodeCollection.fontname ? formatCollection.fontname : 'empty';
19772
- }
19773
- if (index === 0 && formatCollection.fontsize) {
19774
- nodeCollection.fontsize = formatCollection.fontsize;
19775
- }
19776
- else {
19777
- nodeCollection.fontsize = formatCollection.fontsize === nodeCollection.fontsize ? formatCollection.fontsize : 'empty';
19778
- }
19779
- if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
19780
- nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
19781
- }
19782
- if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
19783
- nodeCollection.orderedlist = formatCollection.orderedlist;
19784
- }
19785
- if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
19786
- nodeCollection.unorderedlist = formatCollection.unorderedlist;
19787
- }
19788
- if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
19789
- nodeCollection.alignments = formatCollection.alignments;
19790
- }
19791
- if (index === 0 && formatCollection.formats) {
19792
- nodeCollection.formats = formatCollection.formats;
19793
- }
19794
- else {
19795
- nodeCollection.formats = formatCollection.formats === nodeCollection.formats ? formatCollection.formats : 'empty';
19796
- }
19797
- if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
19798
- nodeCollection.createlink = formatCollection.createlink;
19799
- }
19800
- if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
19801
- nodeCollection.numberFormatList = formatCollection.numberFormatList;
19802
- }
19803
- if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
19804
- nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
19805
- }
19806
- formatCollection = JSON.parse(JSON.stringify(statusCollection));
19807
- }
19808
- return nodeCollection;
19809
- };
19810
- ToolbarStatus.getImmediateBlockNode = function (node) {
19811
- do {
19812
- node = node.parentNode;
19813
- } while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
19814
- return node;
19815
- };
19816
- ToolbarStatus.getFormatParent = function (docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
19817
- var isListUpdated = false;
19818
- var isComplexListUpdated = false;
19819
- if (targetNode.contains(node) ||
19820
- (node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
19821
- do {
19822
- formatCollection = this.isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName);
19823
- if (formatCollection.orderedlist || formatCollection.unorderedlist) {
19824
- isListUpdated = true;
19825
- }
19826
- if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
19827
- isComplexListUpdated = true;
19828
- }
19829
- node = node.parentNode;
19830
- } while (node && (node !== targetNode));
19831
- }
19832
- return formatCollection;
19833
- };
19834
- ToolbarStatus.isFormattedNode = function (docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName) {
19835
- if (!formatCollection.bold) {
19836
- formatCollection.bold = IsFormatted.isBold(node);
19837
- }
19838
- if (!formatCollection.italic) {
19839
- formatCollection.italic = IsFormatted.isItalic(node);
19840
- }
19841
- if (!formatCollection.underline) {
19842
- formatCollection.underline = IsFormatted.isUnderline(node);
19843
- }
19844
- if (!formatCollection.strikethrough) {
19845
- formatCollection.strikethrough = IsFormatted.isStrikethrough(node);
19846
- }
19847
- if (!formatCollection.superscript) {
19848
- formatCollection.superscript = IsFormatted.isSuperscript(node);
19849
- }
19850
- if (!formatCollection.subscript) {
19851
- formatCollection.subscript = IsFormatted.isSubscript(node);
19852
- }
19853
- if (!formatCollection.fontcolor) {
19854
- formatCollection.fontcolor = this.isFontColor(docElement, node);
19855
- }
19856
- if (!formatCollection.fontname) {
19857
- formatCollection.fontname = this.isFontName(docElement, node, fontName);
19858
- }
19859
- if (!formatCollection.fontsize) {
19860
- formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
19861
- }
19862
- if (!formatCollection.backgroundcolor) {
19863
- formatCollection.backgroundcolor = this.isBackgroundColor(node);
19864
- }
19865
- if (!formatCollection.orderedlist && !isListUpdated) {
19866
- formatCollection.orderedlist = this.isOrderedList(node);
19867
- }
19868
- if (!formatCollection.unorderedlist && !isListUpdated) {
19869
- formatCollection.unorderedlist = this.isUnorderedList(node);
19870
- }
19871
- if (!formatCollection.alignments) {
19872
- formatCollection.alignments = this.isAlignment(node);
19873
- }
19874
- if (!formatCollection.formats) {
19875
- formatCollection.formats = this.isFormats(node, formatNode);
19876
- if (formatCollection.formats === 'pre') {
19877
- formatCollection.insertcode = true;
19878
- }
19879
- }
19880
- if (!formatCollection.createlink) {
19881
- formatCollection.createlink = this.isLink(node);
19882
- }
19883
- if (!formatCollection.numberFormatList && !isComplexListUpdated) {
19884
- formatCollection.numberFormatList = this.isNumberFormatList(node);
19885
- }
19886
- if (!formatCollection.bulletFormatList && !isComplexListUpdated) {
19887
- formatCollection.bulletFormatList = this.isBulletFormatList(node);
19888
- }
19889
- return formatCollection;
19890
- };
19891
- ToolbarStatus.isFontColor = function (docElement, node) {
19892
- var color = node.style && node.style.color;
19893
- if ((color === null || color === undefined || color === '') && node.nodeType !== 3) {
19894
- color = this.getComputedStyle(docElement, node, 'color');
19895
- }
19896
- if (color !== null && color !== '' && color !== undefined) {
19897
- return color;
19898
- }
19899
- else {
19900
- return null;
19901
- }
19902
- };
19903
- ToolbarStatus.isLink = function (node) {
19904
- if (node.nodeName.toLocaleLowerCase() === 'a') {
19905
- return true;
19906
- }
19907
- else {
19908
- return false;
19909
- }
19910
- };
19911
- ToolbarStatus.isBackgroundColor = function (node) {
19912
- var backColor = node.style && node.style.backgroundColor;
19913
- if (backColor !== null && backColor !== '' && backColor !== undefined) {
19914
- return backColor;
19915
- }
19916
- else {
19917
- return null;
19918
- }
19919
- };
19920
- ToolbarStatus.isFontSize = function (docElement, node, fontSize) {
19921
- var size = node.style && node.style.fontSize;
19922
- if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
19923
- node.parentElement.classList.contains('e-content')) {
19924
- size = this.getComputedStyle(docElement, node, 'font-size');
19925
- }
19926
- if ((size !== null && size !== '' && size !== undefined)
19927
- && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
19928
- return size;
19929
- }
19930
- else {
19931
- return null;
19932
- }
19933
- };
19934
- ToolbarStatus.isFontName = function (docElement, node, fontName) {
19935
- var name = node.style && node.style.fontFamily;
19936
- if ((name === null || name === undefined || name === '') && node.nodeType !== 3) {
19937
- name = this.getComputedStyle(docElement, node, 'font-family');
19938
- }
19939
- var index = null;
19940
- if ((name !== null && name !== '' && name !== undefined)
19941
- && (fontName === null || fontName === undefined || (fontName.filter(function (value, pos) {
19942
- // eslint-disable-next-line
19943
- var pattern = new RegExp(name, 'i');
19944
- if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
19945
- (value.split(',')[0] && !isNullOrUndefined(value.split(',')[0].trim().match(pattern)) &&
19946
- value.split(',')[0].trim() === value.split(',')[0].trim().match(pattern)[0])) {
19947
- index = pos;
19948
- }
19949
- }) && (index !== null)))) {
19950
- // eslint-disable-next-line
19951
- return (index !== null) ? fontName[index] : name.replace(/"/g, '');
19952
- }
19953
- else {
19954
- return null;
19955
- }
19956
- };
19957
- ToolbarStatus.isOrderedList = function (node) {
19958
- if (node.nodeName.toLocaleLowerCase() === 'ol') {
19959
- return true;
19960
- }
19961
- else {
19962
- return false;
19963
- }
19964
- };
19965
- ToolbarStatus.isUnorderedList = function (node) {
19966
- if (node.nodeName.toLocaleLowerCase() === 'ul') {
19967
- return true;
19968
- }
19969
- else {
19970
- return false;
19971
- }
19972
- };
19973
- ToolbarStatus.isAlignment = function (node) {
19974
- var align = node.style && node.style.textAlign;
19975
- if (align === 'left') {
19976
- return 'justifyleft';
19977
- }
19978
- else if (align === 'center') {
19979
- return 'justifycenter';
19980
- }
19981
- else if (align === 'right') {
19982
- return 'justifyright';
19983
- }
19984
- else if (align === 'justify') {
19985
- return 'justifyfull';
19986
- }
19987
- else {
19988
- return null;
19989
- }
19990
- };
19991
- ToolbarStatus.isFormats = function (node, formatNode) {
19992
- if (((formatNode === undefined || formatNode === null)
19993
- && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) > -1)
19994
- || (formatNode !== null && formatNode !== undefined
19995
- && formatNode.indexOf(node.nodeName.toLocaleLowerCase()) > -1)) {
19996
- return node.nodeName.toLocaleLowerCase();
19997
- }
19998
- else {
19999
- return null;
20000
- }
20001
- };
20002
- ToolbarStatus.getComputedStyle = function (docElement, node, prop) {
20003
- return docElement.defaultView.getComputedStyle(node, null).getPropertyValue(prop);
20004
- };
20005
- ToolbarStatus.isNumberFormatList = function (node) {
20006
- var list = node.style && node.style.listStyleType;
20007
- if (list === 'lower-alpha') {
20008
- return 'Lower Alpha';
20009
- }
20010
- else if (list === 'number') {
20011
- return 'Number';
20012
- }
20013
- else if (list === 'upper-alpha') {
20014
- return 'Upper Alpha';
20015
- }
20016
- else if (list === 'lower-roman') {
20017
- return 'Lower Roman';
20018
- }
20019
- else if (list === 'upper-roman') {
20020
- return 'Upper Roman';
20021
- }
20022
- else if (list === 'lower-greek') {
20023
- return 'Lower Greek';
20024
- }
20025
- else if (list === 'none') {
20026
- return 'None';
20027
- }
20028
- else if (this.isOrderedList(node)) {
20029
- return true;
20030
- }
20031
- else {
20032
- return null;
20033
- }
20034
- };
20035
- ToolbarStatus.isBulletFormatList = function (node) {
20036
- var list = node.style && node.style.listStyleType;
20037
- if (list === 'circle') {
20038
- return 'Circle';
20039
- }
20040
- else if (list === 'square') {
20041
- return 'Square';
20042
- }
20043
- else if (list === 'none') {
20044
- return 'None';
20045
- }
20046
- else if (list === 'disc') {
20047
- return 'Disc';
20048
- }
20049
- else if (this.isUnorderedList(node)) {
20050
- return true;
20051
- }
20052
- else {
20053
- return null;
20054
- }
20055
- };
20056
- return ToolbarStatus;
20057
- }());
20058
-
20059
20201
  var EmojiPickerAction = /** @__PURE__ @class */ (function () {
20060
20202
  function EmojiPickerAction(parent) {
20061
20203
  this.parent = parent;
@@ -21901,12 +22043,17 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21901
22043
  }
21902
22044
  var lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
21903
22045
  while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
21904
- lastNode.nodeName !== 'BR') {
22046
+ lastNode.nodeName !== 'BR' && !isNullOrUndefined(lastNode.lastChild)) {
21905
22047
  lastNode = lastNode.lastChild;
21906
22048
  }
21907
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
21908
- // eslint-disable-next-line
21909
- lastNode, lastNode.textContent.length);
22049
+ if (lastNode.nodeName === 'IMG') {
22050
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastNode.parentElement, lastNode.parentElement.childNodes.length);
22051
+ }
22052
+ else {
22053
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
22054
+ // eslint-disable-next-line
22055
+ lastNode, lastNode.textContent.length);
22056
+ }
21910
22057
  if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
21911
22058
  detach(this.oldRangeElement.querySelector('BR'));
21912
22059
  }
@@ -22812,6 +22959,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
22812
22959
  var _this = this;
22813
22960
  this.parent.inputElement.contentEditable = 'true';
22814
22961
  e.element = imgElem;
22962
+ e.requestType = UploadRequest.Pasted;
22815
22963
  this.parent.trigger(imageUploadSuccess, e, function (e) {
22816
22964
  if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
22817
22965
  var url = _this.parent.insertImageSettings.path + e.file.name;
@@ -23120,21 +23268,6 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
23120
23268
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
23121
23269
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
23122
23270
  _this.parent.formatter.onSuccess(_this.parent, args);
23123
- if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem) &&
23124
- returnArgs.imgElem.length > 0) {
23125
- var pasteContent = returnArgs.elements;
23126
- var imageContent = returnArgs.imgElem;
23127
- var lastElementChild = _this.findLastElement(pasteContent[pasteContent.length - 1]);
23128
- var isImageAtLast = !isNullOrUndefined(lastElementChild) ? lastElementChild.nodeName === 'IMG' : false;
23129
- if (isImageAtLast || pasteContent[pasteContent.length - 1] === imageContent[imageContent.length - 1]) {
23130
- _this.parent.notify(insertCompleted, {
23131
- args: args.event,
23132
- type: 'Images',
23133
- isNotify: true,
23134
- elements: imageContent[imageContent.length - 1]
23135
- });
23136
- }
23137
- }
23138
23271
  }, clipBoardElem, null, null, this.parent.enterKey);
23139
23272
  this.removeTempClass();
23140
23273
  this.parent.notify(toolbarRefresh, {});
@@ -23533,16 +23666,6 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
23533
23666
  }
23534
23667
  return clipBoardElem;
23535
23668
  };
23536
- PasteCleanup.prototype.findLastElement = function (element) {
23537
- if (!isNullOrUndefined(element) && !isNullOrUndefined(element.lastElementChild)) {
23538
- var lastChild = element.lastElementChild;
23539
- while (lastChild && lastChild.lastElementChild) {
23540
- lastChild = lastChild.lastElementChild;
23541
- }
23542
- return lastChild;
23543
- }
23544
- return null;
23545
- };
23546
23669
  PasteCleanup.prototype.processPictureElement = function (clipBoardElem) {
23547
23670
  var pictureElems = clipBoardElem.querySelectorAll('picture');
23548
23671
  for (var i = 0; i < pictureElems.length; i++) {
@@ -24236,6 +24359,9 @@ var FormatPainter = /** @__PURE__ @class */ (function () {
24236
24359
  if ((originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste')) {
24237
24360
  originalEvent.stopPropagation();
24238
24361
  }
24362
+ if (Browser.userAgent.indexOf('Firefox') !== -1) {
24363
+ originalEvent.preventDefault();
24364
+ }
24239
24365
  this.actionHandler(event, 'keyBoard');
24240
24366
  }
24241
24367
  };
@@ -24982,7 +25108,7 @@ var EmojiPicker = /** @__PURE__ @class */ (function () {
24982
25108
  }
24983
25109
  }
24984
25110
  }
24985
- if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':')) {
25111
+ if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':' && value !== ': :')) {
24986
25112
  noEmojiObj.innerHTML = '<span style="color: rgba(0, 0, 0, 0.75); font-weight: 500; font-size: 16px;">' + this.i10n.getConstant('emojiPickerNoResultFound') + ' 😥 </span>' + '<br>' + '<span style="color: rgba(0, 0, 0, 0.75);"> ' + this.i10n.getConstant('emojiPickerTrySomethingElse') + ' ? </span>';
24987
25113
  noEmojiObj.style.margin = '55px';
24988
25114
  emojipickerAll.appendChild(noEmojiObj);
@@ -27220,7 +27346,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
27220
27346
  _this.uploadObj.remove();
27221
27347
  }
27222
27348
  _this.parent.isBlur = false;
27223
- if (event && event.event.returnValue) {
27349
+ if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
27224
27350
  if (_this.parent.editorMode === 'HTML') {
27225
27351
  selection.restore();
27226
27352
  }
@@ -27339,6 +27465,9 @@ var Image$1 = /** @__PURE__ @class */ (function () {
27339
27465
  removeClass([items[i]], 'e-resize');
27340
27466
  }
27341
27467
  }
27468
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
27469
+ this.dialogObj.hide();
27470
+ }
27342
27471
  };
27343
27472
  Image.prototype.removeResizeEle = function () {
27344
27473
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
@@ -27615,6 +27744,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
27615
27744
  }
27616
27745
  },
27617
27746
  success: function (e) {
27747
+ e.requestType = UploadRequest.Uploaded;
27618
27748
  _this.parent.trigger(imageUploadSuccess, e, function (e) {
27619
27749
  if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
27620
27750
  var url = _this.parent.insertImageSettings.path + e.file.name;
@@ -28059,6 +28189,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
28059
28189
  imageElement.style.opacity = '1';
28060
28190
  imageElement.classList.add(CLS_IMG_FOCUS);
28061
28191
  e.element = imageElement;
28192
+ e.requestType = UploadRequest.Dropped;
28062
28193
  this.parent.trigger(imageUploadSuccess, e, function (e) {
28063
28194
  if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
28064
28195
  var url = _this.parent.insertImageSettings.path + e.file.name;
@@ -28188,6 +28319,7 @@ var Audio = /** @__PURE__ @class */ (function () {
28188
28319
  this.parent.on(editAreaClick, this.editAreaClickHandler, this);
28189
28320
  this.parent.on(insertCompleted, this.showAudioQuickToolbar, this);
28190
28321
  this.parent.on(destroy, this.removeEventListener, this);
28322
+ this.parent.on(iframeMouseDown, this.closeDialog, this);
28191
28323
  };
28192
28324
  Audio.prototype.removeEventListener = function () {
28193
28325
  if (this.parent.isDestroyed) {
@@ -28206,6 +28338,7 @@ var Audio = /** @__PURE__ @class */ (function () {
28206
28338
  this.parent.off(editAreaClick, this.editAreaClickHandler);
28207
28339
  this.parent.off(insertCompleted, this.showAudioQuickToolbar);
28208
28340
  this.parent.off(destroy, this.removeEventListener);
28341
+ this.parent.off(iframeMouseDown, this.closeDialog);
28209
28342
  if (!isNullOrUndefined(this.contentModule)) {
28210
28343
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
28211
28344
  EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
@@ -28454,7 +28587,7 @@ var Audio = /** @__PURE__ @class */ (function () {
28454
28587
  this.parent.formatter.saveData();
28455
28588
  }
28456
28589
  e.selection.restore();
28457
- this.parent.formatter.process(this.parent, e.args, e.args, {
28590
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
28458
28591
  selectNode: e.selectNode,
28459
28592
  subCommand: e.args.item.subCommand
28460
28593
  });
@@ -28550,6 +28683,9 @@ var Audio = /** @__PURE__ @class */ (function () {
28550
28683
  this.prevSelectedAudEle.style.outline = '';
28551
28684
  }
28552
28685
  }
28686
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
28687
+ this.dialogObj.hide();
28688
+ }
28553
28689
  };
28554
28690
  Audio.prototype.alignmentSelect = function (e) {
28555
28691
  var item = e.item;
@@ -28582,7 +28718,7 @@ var Audio = /** @__PURE__ @class */ (function () {
28582
28718
  }
28583
28719
  var subCommand = (e.args.item) ?
28584
28720
  e.args.item.subCommand : 'Break';
28585
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
28721
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
28586
28722
  };
28587
28723
  Audio.prototype.inline = function (e) {
28588
28724
  if (e.selectNode[0].nodeName !== 'AUDIO') {
@@ -28590,7 +28726,7 @@ var Audio = /** @__PURE__ @class */ (function () {
28590
28726
  }
28591
28727
  var subCommand = (e.args.item) ?
28592
28728
  e.args.item.subCommand : 'Inline';
28593
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
28729
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
28594
28730
  };
28595
28731
  Audio.prototype.editAreaClickHandler = function (e) {
28596
28732
  if (this.parent.readonly) {
@@ -28730,7 +28866,7 @@ var Audio = /** @__PURE__ @class */ (function () {
28730
28866
  _this.uploadObj.removing();
28731
28867
  }
28732
28868
  _this.parent.isBlur = false;
28733
- if (event && event.event.returnValue) {
28869
+ if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
28734
28870
  if (_this.parent.editorMode === 'HTML') {
28735
28871
  selection.restore();
28736
28872
  }
@@ -29823,7 +29959,7 @@ var Video = /** @__PURE__ @class */ (function () {
29823
29959
  this.parent.formatter.saveData();
29824
29960
  }
29825
29961
  e.selection.restore();
29826
- this.parent.formatter.process(this.parent, e.args, e.args, {
29962
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
29827
29963
  selectNode: e.selectNode,
29828
29964
  subCommand: e.args.item.subCommand
29829
29965
  });
@@ -29913,6 +30049,9 @@ var Video = /** @__PURE__ @class */ (function () {
29913
30049
  this.prevSelectedVidEle.style.outline = '';
29914
30050
  }
29915
30051
  }
30052
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
30053
+ this.dialogObj.hide();
30054
+ }
29916
30055
  };
29917
30056
  Video.prototype.removeResizeEle = function () {
29918
30057
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
@@ -29930,7 +30069,7 @@ var Video = /** @__PURE__ @class */ (function () {
29930
30069
  }
29931
30070
  var subCommand = (e.args.item) ?
29932
30071
  e.args.item.subCommand : 'Break';
29933
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
30072
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
29934
30073
  };
29935
30074
  Video.prototype.inline = function (e) {
29936
30075
  if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
@@ -29938,12 +30077,12 @@ var Video = /** @__PURE__ @class */ (function () {
29938
30077
  }
29939
30078
  var subCommand = (e.args.item) ?
29940
30079
  e.args.item.subCommand : 'Inline';
29941
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
30080
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
29942
30081
  };
29943
30082
  Video.prototype.alignVideo = function (e, type) {
29944
30083
  var subCommand = (e.args.item) ?
29945
30084
  e.args.item.subCommand : type;
29946
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
30085
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
29947
30086
  };
29948
30087
  Video.prototype.editAreaClickHandler = function (e) {
29949
30088
  if (this.parent.readonly) {
@@ -30087,7 +30226,7 @@ var Video = /** @__PURE__ @class */ (function () {
30087
30226
  _this.uploadObj.removing();
30088
30227
  }
30089
30228
  _this.parent.isBlur = false;
30090
- if (event && event.event.returnValue) {
30229
+ if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
30091
30230
  if (_this.parent.editorMode === 'HTML') {
30092
30231
  selection.restore();
30093
30232
  }
@@ -30179,21 +30318,26 @@ var Video = /** @__PURE__ @class */ (function () {
30179
30318
  }
30180
30319
  }
30181
30320
  });
30182
- if (e.selectNode && ((e.selectNode[0] && e.selectNode[0].nodeType !== 3 &&
30183
- e.selectNode[0].nodeName !== 'BR' &&
30184
- (e.selectNode[0].classList &&
30185
- e.selectNode[0].classList.contains(CLS_VID_CLICK_ELEM))) ||
30186
- e.selectNode[0].nodeName === 'IFRAME' || e.selectNode[0].nodeName === 'VIDEO')) {
30187
- var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
30188
- var sourceElement = e.selectNode[0].querySelector('source');
30189
- this.inputUrl.value = sourceElement.src.match(regex) ? sourceElement.src : '';
30321
+ if (e.selectNode && e.selectNode[0] && (e.selectNode[0].nodeName === 'VIDEO' || this.isEmbedVidElem(e.selectNode[0]))) {
30322
+ if (e.selectNode[0].nodeName === 'VIDEO') {
30323
+ var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
30324
+ var sourceElement = e.selectNode[0].querySelector('source');
30325
+ this.inputUrl.value = sourceElement && sourceElement.src && sourceElement.src.match(regex) ? sourceElement.src : '';
30326
+ }
30327
+ else {
30328
+ this.embedInputUrl.value = e.selectNode[0].nodeName === 'IFRAME' ? e.selectNode[0].outerHTML
30329
+ : e.selectNode[0].querySelector('iframe').outerHTML;
30330
+ }
30190
30331
  }
30332
+ var isWebUrl = this.inputUrl.value ? true : false;
30191
30333
  var embedUrlBtn = new RadioButton({
30192
30334
  label: this.i10n.getConstant('embeddedCode'),
30193
- checked: true,
30335
+ checked: !isWebUrl,
30194
30336
  name: 'URL',
30195
30337
  created: function () {
30196
- urlContent.appendChild(_this.embedInputUrl);
30338
+ if (!isWebUrl) {
30339
+ urlContent.appendChild(_this.embedInputUrl);
30340
+ }
30197
30341
  },
30198
30342
  change: function () {
30199
30343
  urlContent.innerHTML = '';
@@ -30203,7 +30347,13 @@ var Video = /** @__PURE__ @class */ (function () {
30203
30347
  embedUrlBtn.appendTo(videoUrl.querySelector('#embedURL'));
30204
30348
  var webUrlBtn = new RadioButton({
30205
30349
  label: this.i10n.getConstant('webUrl'),
30350
+ checked: isWebUrl,
30206
30351
  name: 'URL',
30352
+ created: function () {
30353
+ if (isWebUrl) {
30354
+ urlContent.appendChild(_this.inputUrl);
30355
+ }
30356
+ },
30207
30357
  change: function () {
30208
30358
  urlContent.innerHTML = '';
30209
30359
  urlContent.appendChild(_this.inputUrl);
@@ -31363,13 +31513,14 @@ var Table = /** @__PURE__ @class */ (function () {
31363
31513
  }
31364
31514
  var target = e.target || e.targetTouches[0].target;
31365
31515
  var closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
31366
- if (!isNullOrUndefined(this.curTable) && !isNullOrUndefined(closestTable) && closestTable !== this.curTable &&
31516
+ var isResizing = this.parent.contentModule.getEditPanel().querySelectorAll('.e-table-box.e-rbox-select, .e-table-rhelper.e-column-helper, .e-table-rhelper.e-row-helper').length > 0;
31517
+ if (!isResizing && !isNullOrUndefined(this.curTable) && !isNullOrUndefined(closestTable) && closestTable !== this.curTable &&
31367
31518
  this.parent.contentModule.getEditPanel().contains(closestTable)) {
31368
31519
  this.removeResizeElement();
31369
31520
  this.removeHelper(e);
31370
31521
  this.cancelResizeAction();
31371
31522
  }
31372
- if (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH') {
31523
+ if (!isResizing && (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH')) {
31373
31524
  this.curTable = (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable))
31374
31525
  && (target.nodeName === 'TD' || target.nodeName === 'TH') ?
31375
31526
  closestTable : target;
@@ -31515,7 +31666,6 @@ var Table = /** @__PURE__ @class */ (function () {
31515
31666
  e.preventDefault();
31516
31667
  this.parent.preventDefaultResize(e);
31517
31668
  removeClass(this.curTable.querySelectorAll('td,th'), CLS_TABLE_SEL);
31518
- this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
31519
31669
  this.pageX = this.getPointX(e);
31520
31670
  this.pageY = this.getPointY(e);
31521
31671
  this.resizeBtnInit();
@@ -31775,7 +31925,8 @@ var Table = /** @__PURE__ @class */ (function () {
31775
31925
  var width = parseFloat(_this.curTable.style.width);
31776
31926
  currentMarginLeft = 100 - width;
31777
31927
  }
31778
- if (currentMarginLeft && currentMarginLeft < 1) {
31928
+ // For table pasted from word, Margin left can be anything so we are avoiding the below process.
31929
+ if (!_this.curTable.classList.contains('e-rte-paste-table') && currentMarginLeft && currentMarginLeft < 1) {
31779
31930
  _this.curTable.style.marginLeft = null;
31780
31931
  _this.curTable.style.width = '100%';
31781
31932
  return;
@@ -31941,7 +32092,13 @@ var Table = /** @__PURE__ @class */ (function () {
31941
32092
  tableTrPercentage[i] = percentage;
31942
32093
  }
31943
32094
  for (var i = 0; i < currentTableTrElement.length; i++) {
31944
- currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
32095
+ if (currentTableTrElement[i].parentElement.nodeName === 'THEAD') {
32096
+ currentTableTrElement[i].parentElement.style.height = tableTrPercentage[i] + '%';
32097
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
32098
+ }
32099
+ else {
32100
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
32101
+ }
31945
32102
  }
31946
32103
  var args = { event: e, requestType: 'table' };
31947
32104
  this.parent.trigger(resizeStop, args);
@@ -32091,6 +32248,9 @@ var Table = /** @__PURE__ @class */ (function () {
32091
32248
  if (this.popupObj) {
32092
32249
  this.popupObj.hide();
32093
32250
  }
32251
+ if (this.parent.inlineMode.enable && this.editdlgObj) {
32252
+ this.editdlgObj.hide();
32253
+ }
32094
32254
  };
32095
32255
  Table.prototype.docClick = function (e) {
32096
32256
  var target = e.args.target;
@@ -33375,6 +33535,17 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
33375
33535
  this.getRangeNode();
33376
33536
  var isTableEnter = true;
33377
33537
  this.formatTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'];
33538
+ var isCursorAtTableEnd = this.range.collapsed && (this.range.startContainer.nodeType === 1) &&
33539
+ this.range.startContainer.isContentEditable &&
33540
+ this.range.startContainer.childNodes[this.range.startOffset - 1] &&
33541
+ this.range.startContainer.childNodes[this.range.startOffset - 1].nodeName === 'TABLE';
33542
+ var isCursorAtTableStart = this.range.collapsed && (this.range.startContainer.nodeType === 1) &&
33543
+ this.range.startContainer.isContentEditable && this.range.startContainer.childNodes[this.range.startOffset] &&
33544
+ this.range.startContainer.childNodes[this.range.startOffset].nodeName === 'TABLE';
33545
+ if (isCursorAtTableEnd || isCursorAtTableStart) {
33546
+ this.handleCursorAtTableSide(e, isCursorAtTableStart, isCursorAtTableEnd);
33547
+ return;
33548
+ }
33378
33549
  if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
33379
33550
  isTableEnter = false;
33380
33551
  var curElement = this.startNode;
@@ -33383,7 +33554,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
33383
33554
  curElement = curElement.parentElement;
33384
33555
  blockElement = curElement;
33385
33556
  }
33386
- isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
33557
+ isTableEnter = blockElement.tagName === 'TH' || blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
33387
33558
  }
33388
33559
  if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
33389
33560
  if (isNullOrUndefined(this.startNode.closest('LI, UL, OL')) && isNullOrUndefined(this.endNode.closest('LI, UL, OL')) &&
@@ -33398,6 +33569,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
33398
33569
  };
33399
33570
  this.parent.trigger(actionBegin, actionBeginArgs, function (actionBeginArgs) {
33400
33571
  if (!actionBeginArgs.cancel) {
33572
+ if (_this.parent.formatter.getUndoRedoStack().length === 0) {
33573
+ _this.parent.formatter.saveData();
33574
+ }
33401
33575
  if (!(_this.range.startOffset === _this.range.endOffset && _this.range.startContainer === _this.range.endContainer)) {
33402
33576
  if (!(_this.range.startContainer.nodeName === 'SPAN' && (_this.range.startContainer.classList.contains('e-video-wrap') ||
33403
33577
  _this.range.startContainer.classList.contains('e-audio-wrap')))) {
@@ -33829,6 +34003,41 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
33829
34003
  }
33830
34004
  return insertElem;
33831
34005
  };
34006
+ EnterKeyAction.prototype.handleCursorAtTableSide = function (e, isStart, isEnd) {
34007
+ var _this = this;
34008
+ if (this.parent.enterKey !== 'BR') {
34009
+ var shiftKey_2 = e.args.shiftKey;
34010
+ var actionBeginArgs = {
34011
+ cancel: false,
34012
+ name: actionBegin,
34013
+ requestType: shiftKey_2 ? 'ShiftEnterAction' : 'EnterAction',
34014
+ originalEvent: e.args
34015
+ };
34016
+ this.parent.trigger(actionBegin, actionBeginArgs, function (actionBeginArgs) {
34017
+ if (!actionBeginArgs.cancel) {
34018
+ var newElement = _this.parent.createElement(_this.parent.enterKey);
34019
+ newElement.innerHTML = '<br>';
34020
+ var tableElement = void 0;
34021
+ if (isStart) {
34022
+ tableElement = _this.range.startContainer.childNodes[_this.range.startOffset];
34023
+ tableElement.parentElement.insertBefore(newElement, tableElement);
34024
+ }
34025
+ if (isEnd) {
34026
+ tableElement = _this.range.startContainer.childNodes[_this.range.startOffset - 1];
34027
+ if (!isNullOrUndefined(tableElement.nextSibling)) {
34028
+ tableElement.parentElement.insertBefore(newElement, tableElement.nextSibling);
34029
+ }
34030
+ else if (isNullOrUndefined(tableElement.nextSibling)) {
34031
+ tableElement.parentElement.appendChild(newElement);
34032
+ }
34033
+ }
34034
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
34035
+ e.args.preventDefault();
34036
+ _this.parent.trigger(actionComplete, { requestType: shiftKey_2 ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
34037
+ }
34038
+ });
34039
+ }
34040
+ };
33832
34041
  return EnterKeyAction;
33833
34042
  }());
33834
34043
 
@@ -34560,8 +34769,8 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
34560
34769
  !(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which == 67))) {
34561
34770
  this.formatter.saveData();
34562
34771
  }
34563
- if (e.action !== 'insert-link' &&
34564
- e.action !== 'format-copy' && e.action !== 'format-paste' &&
34772
+ var keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
34773
+ if (keyboardEventAction.indexOf(e.action) === -1 &&
34565
34774
  (!e.target || !(e.target.classList.contains('e-mention') && !isNullOrUndefined(document.querySelector('#' + e.target.id + '_popup.e-popup-open')) && e.code === 'Tab')) &&
34566
34775
  (e.action && e.action !== 'paste' && e.action !== 'space'
34567
34776
  || e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
@@ -36217,12 +36426,9 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
36217
36426
  * @deprecated
36218
36427
  */
36219
36428
  RichTextEditor.prototype.autoResize = function () {
36220
- var _this = this;
36221
36429
  if (this.height === 'auto') {
36222
36430
  if (this.editorMode === 'Markdown') {
36223
- setTimeout(function () {
36224
- _this.setAutoHeight(_this.inputElement);
36225
- }, 0);
36431
+ this.setAutoHeight(this.inputElement);
36226
36432
  }
36227
36433
  else if (this.iframeSettings.enable) {
36228
36434
  var iframeElement = this.element.querySelector('#' + this.getID() + '_rte-view');
@@ -36235,21 +36441,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
36235
36441
  }
36236
36442
  };
36237
36443
  RichTextEditor.prototype.setAutoHeight = function (element) {
36238
- if (!isNullOrUndefined(element) && !this.iframeSettings.enable) {
36444
+ if (!isNullOrUndefined(element)) {
36239
36445
  element.style.height = this.inputElement.scrollHeight + 'px';
36240
36446
  element.style.overflow = 'hidden';
36241
36447
  }
36242
- else if (!isNullOrUndefined(element) && !isNullOrUndefined(element.parentElement) && this.iframeSettings.enable) {
36243
- var newRange = this.getRange();
36244
- element.style.height = 'auto';
36245
- var newHeight = element.contentDocument.body.scrollHeight + 'px';
36246
- element.style.height = newHeight;
36247
- element.style.overflow = 'hidden';
36248
- // 16 px added for padding doesn't affect the editor height
36249
- if (newRange.startContainer.nodeName !== '#text' && newRange.startContainer.nodeName !== 'BODY' && window.innerHeight < newRange.startContainer.getBoundingClientRect().top + element.getBoundingClientRect().top + 16) {
36250
- newRange.startContainer.scrollIntoView(false);
36251
- }
36252
- }
36253
36448
  };
36254
36449
  RichTextEditor.prototype.wireEvents = function () {
36255
36450
  this.element.addEventListener('focusin', this.onFocusHandler, true);
@@ -36748,5 +36943,5 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
36748
36943
  * Rich Text Editor component exported items
36749
36944
  */
36750
36945
 
36751
- export { Toolbar$2 as Toolbar, KeyboardEvents$1 as KeyboardEvents, BaseToolbar, BaseQuickToolbar, QuickToolbar, Count, ColorPickerInput, MarkdownToolbarStatus, ExecCommandCallBack, ToolbarAction, MarkdownEditor, HtmlEditor, PasteCleanup, Resize, DropDownButtons, FileManager$1 as FileManager, FullScreen, setAttributes, HtmlToolbarStatus, XhtmlValidation, FormatPainter, EmojiPicker, HTMLFormatter, Formatter, MarkdownFormatter, ContentRender, Render, ToolbarRenderer, Link, Image$1 as Image, Audio, Video, ViewSource, Table, DialogRenderer, IframeContentRender, MarkdownRender, PopupRenderer, RichTextEditor, RenderType, ToolbarType, DialogType, executeGroup, created, destroyed, tableclass, load, initialLoad, contentChanged, initialEnd, iframeMouseDown, destroy, toolbarClick, toolbarRefresh, refreshBegin, toolbarUpdated, bindOnEnd, renderColorPicker, htmlToolbarClick, markdownToolbarClick, destroyColorPicker, modelChanged, tableModulekeyUp, keyUp, keyDown, mouseUp, toolbarCreated, toolbarRenderComplete, enableFullScreen, disableFullScreen, dropDownSelect, beforeDropDownItemRender, execCommandCallBack, imageToolbarAction, audioToolbarAction, videoToolbarAction, linkToolbarAction, windowResize, resizeStart, onResize, resizeStop, undo, redo, insertLink, unLink, editLink, openLink, actionBegin, actionComplete, updatedToolbarStatus, actionSuccess, updateToolbarItem, insertImage, insertAudio, insertVideo, insertCompleted, imageLeft, imageRight, imageCenter, imageBreak, imageInline, imageLink, imageAlt, imageDelete, audioDelete, videoDelete, imageCaption, imageSize, videoSize, sourceCode, updateSource, toolbarOpen, beforeDropDownOpen, selectionSave, selectionRestore, expandPopupClick, count, contentFocus, contentBlur, mouseDown, sourceCodeMouseDown, editAreaClick, scroll, contentscroll, colorPickerChanged, tableColorPickerChanged, focusChange, selectAll$1 as selectAll, selectRange, getSelectedHtml, renderInlineToolbar, paste, imgModule, rtlMode, createTable, docClick, tableToolbarAction, checkUndo, readOnlyMode, moduleDestroy, pasteClean, enterHandler, beforeDialogOpen, clearDialogObj, dialogOpen, beforeDialogClose, dialogClose, beforeQuickToolbarOpen, quickToolbarOpen, quickToolbarClose, popupHide, imageSelected, imageUploading, imageUploadSuccess, imageUploadFailed, imageRemoving, fileSelected, fileUploading, fileUploadSuccess, fileUploadFailed, fileRemoving, afterImageDelete, afterMediaDelete, drop, xhtmlValidation, beforeImageUpload, beforeFileUpload, resizeInitialized, renderFileManager, beforeImageDrop, dynamicModule, beforePasteCleanup, afterPasteCleanup, updateTbItemsStatus, showLinkDialog, closeLinkDialog, showImageDialog, showAudioDialog, showVideoDialog, closeImageDialog, closeAudioDialog, closeVideoDialog, showTableDialog, closeTableDialog, bindCssClass, formatPainterClick, formatPainterDoubleClick, emojiPicker, destroyTooltip, hidePopup, cleanupResizeElements, afterKeyDown, updateValueOnIdle, documentClickClosedBy, showColorPicker, closeTooltip, blockEmptyNodes, inlineEmptyNodes, supportedUnits, conversionFactors, onHandleFontsizeChange, CLS_RTE, CLS_RTL, CLS_CONTENT, CLS_DISABLED, CLS_SCRIPT_SHEET, CLS_STYLE_SHEET, CLS_TOOLBAR, CLS_TB_FIXED, CLS_TB_FLOAT, CLS_INLINE, CLS_TB_INLINE, CLS_RTE_EXPAND_TB, CLS_FULL_SCREEN, CLS_QUICK_TB, CLS_TEXT_QUICK_TB, CLS_POP, CLS_TB_STATIC, CLS_QUICK_POP, CLS_QUICK_DROPDOWN, CLS_IMAGE_POP, CLS_TEXT_POP, CLS_INLINE_POP, CLS_INLINE_DROPDOWN, CLS_DROPDOWN_POPUP, CLS_DROPDOWN_ICONS, CLS_DROPDOWN_ITEMS, CLS_DROPDOWN_BTN, CLS_RTE_CONTENT, CLS_TB_ITEM, CLS_TB_EXTENDED, CLS_TB_WRAP, CLS_POPUP, CLS_SEPARATOR, CLS_MINIMIZE, CLS_MAXIMIZE, CLS_BACK, CLS_SHOW, CLS_HIDE, CLS_VISIBLE, CLS_FOCUS, CLS_RM_WHITE_SPACE, CLS_IMGRIGHT, CLS_IMGLEFT, CLS_IMGCENTER, CLS_IMGBREAK, CLS_AUDIOBREAK, CLS_CLICKELEM, CLS_VID_CLICK_ELEM, CLS_AUDIOWRAP, CLS_VIDEOWRAP, CLS_VIDEOBREAK, CLS_CAPTION, CLS_RTE_CAPTION, CLS_CAPINLINE, CLS_IMGINLINE, CLS_AUDIOINLINE, CLS_VIDEOINLINE, CLS_COUNT, CLS_WARNING, CLS_ERROR, CLS_ICONS, CLS_ACTIVE, CLS_EXPAND_OPEN, CLS_RTE_ELEMENTS, CLS_TB_BTN, CLS_HR_SEPARATOR, CLS_TB_IOS_FIX, CLS_LIST_PRIMARY_CONTENT, CLS_NUMBERFORMATLIST_TB_BTN, CLS_BULLETFORMATLIST_TB_BTN, CLS_FORMATS_TB_BTN, CLS_FONT_NAME_TB_BTN, CLS_FONT_SIZE_TB_BTN, CLS_ALIGN_TB_BTN, CLS_FONT_COLOR_TARGET, CLS_BACKGROUND_COLOR_TARGET, CLS_COLOR_CONTENT, CLS_FONT_COLOR_DROPDOWN, CLS_BACKGROUND_COLOR_DROPDOWN, CLS_COLOR_PALETTE, CLS_FONT_COLOR_PICKER, CLS_BACKGROUND_COLOR_PICKER, CLS_RTE_READONLY, CLS_TABLE_SEL, CLS_TB_DASH_BOR, CLS_TB_ALT_BOR, CLS_TB_COL_RES, CLS_TB_ROW_RES, CLS_TB_BOX_RES, CLS_RTE_HIDDEN, CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT, CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT, CLS_RTE_RES_HANDLE, CLS_RTE_RES_EAST, CLS_RTE_IMAGE, CLS_RESIZE, CLS_IMG_FOCUS, CLS_AUD_FOCUS, CLS_VID_FOCUS, CLS_RTE_DRAG_IMAGE, CLS_RTE_UPLOAD_POPUP, CLS_POPUP_OPEN, CLS_IMG_RESIZE, CLS_DROPAREA, CLS_IMG_INNER, CLS_UPLOAD_FILES, CLS_RTE_DIALOG_UPLOAD, CLS_RTE_RES_CNT, CLS_CUSTOM_TILE, CLS_NOCOLOR_ITEM, CLS_TABLE, CLS_TABLE_BORDER, CLS_RTE_TABLE_RESIZE, CLS_RTE_FIXED_TB_EXPAND, CLS_RTE_TB_ENABLED, CLS_RTE_RES_WEST, CLS_RTE_SOURCE_CODE_TXTAREA, getIndex, hasClass, getDropDownValue, isIDevice, getFormattedFontSize, pageYOffset, getTooltipText, getTooltipTextDropdownItems, getQuickToolbarTooltipText, setToolbarStatus, getCollection, getTBarItemsIndex, updateUndoRedoStatus, dispatchEvent, parseHtml, getTextNodesUnder, toObjectLowerCase, getEditValue, updateTextNode, getDefaultValue, isEditableValueEmpty, decode, sanitizeHelper, convertToBlob, getLocaleFontFormat, updateDropDownFontFormatLocale, ServiceLocator, RendererFactory, EditorManager, IMAGE, AUDIO, VIDEO, TABLE, LINK, INSERT_ROW, INSERT_COLUMN, DELETEROW, DELETECOLUMN, REMOVETABLE, TABLEHEADER, TABLE_VERTICAL_ALIGN, TABLE_MERGE, TABLE_VERTICAL_SPLIT, TABLE_HORIZONTAL_SPLIT, TABLE_MOVE, ALIGNMENT_TYPE, INDENT_TYPE, DEFAULT_TAG, BLOCK_TAGS, IGNORE_BLOCK_TAGS, TABLE_BLOCK_TAGS, SELECTION_TYPE, INSERTHTML_TYPE, INSERT_TEXT_TYPE, CLEAR_TYPE, SELF_CLOSING_TAGS, PASTE_SOURCE, CLASS_IMAGE_RIGHT, CLASS_IMAGE_LEFT, CLASS_IMAGE_CENTER, CLASS_VIDEO_RIGHT, CLASS_VIDEO_LEFT, CLASS_VIDEO_CENTER, CLASS_IMAGE_BREAK, CLASS_AUDIO_BREAK, CLASS_VIDEO_BREAK, CLASS_CAPTION, CLASS_RTE_CAPTION, CLASS_CAPTION_INLINE, CLASS_IMAGE_INLINE, CLASS_AUDIO_INLINE, CLASS_CLICK_ELEM, CLASS_VIDEO_CLICK_ELEM, CLASS_AUDIO, CLASS_VIDEO, CLASS_AUDIO_WRAP, CLASS_VIDEO_WRAP, CLASS_EMBED_VIDEO_WRAP, CLASS_AUDIO_FOCUS, CLASS_VIDEO_FOCUS, CLASS_VIDEO_INLINE, Lists, markerClassName, DOMNode, Alignments, Indents, Formats, LinkCommand, InsertMethods, InsertTextExec, InsertHtmlExec, InsertHtml, IsFormatted, MsWordPaste, NodeCutter, ImageCommand, AudioCommand, VideoCommand, SelectionCommands, SelectionBasedExec, ClearFormatExec, UndoRedoManager, TableCommand, statusCollection, ToolbarStatus, FormatPainterActions, EmojiPickerAction, NodeSelection, MarkdownParser, LISTS_COMMAND, selectionCommand, LINK_COMMAND, CLEAR_COMMAND, MD_TABLE, INSERT_TEXT_COMMAND, ClearFormat, MDLists, MDFormats, MarkdownSelection, UndoRedoCommands, MDSelectionFormats, MDLink, MDTable, markdownFormatTags, markdownSelectionTags, markdownListsTags, htmlKeyConfig, markdownKeyConfig, pasteCleanupGroupingTags, listConversionFilters, selfClosingTags, imageResizeFactor, KEY_DOWN, ACTION, FORMAT_TYPE, KEY_DOWN_HANDLER, LIST_TYPE, KEY_UP_HANDLER, KEY_UP, MODEL_CHANGED_PLUGIN, MODEL_CHANGED, MS_WORD_CLEANUP_PLUGIN, MS_WORD_CLEANUP, ON_BEGIN, SPACE_ACTION, FORMAT_PAINTER_ACTIONS, EMOJI_PICKER_ACTIONS, MOUSE_DOWN };
36946
+ export { Toolbar$2 as Toolbar, KeyboardEvents$1 as KeyboardEvents, BaseToolbar, BaseQuickToolbar, QuickToolbar, Count, ColorPickerInput, MarkdownToolbarStatus, ExecCommandCallBack, ToolbarAction, MarkdownEditor, HtmlEditor, PasteCleanup, Resize, DropDownButtons, FileManager$1 as FileManager, FullScreen, setAttributes, HtmlToolbarStatus, XhtmlValidation, FormatPainter, EmojiPicker, HTMLFormatter, Formatter, MarkdownFormatter, ContentRender, Render, ToolbarRenderer, Link, Image$1 as Image, Audio, Video, ViewSource, Table, DialogRenderer, IframeContentRender, MarkdownRender, PopupRenderer, RichTextEditor, RenderType, ToolbarType, DialogType, UploadRequest, executeGroup, created, destroyed, tableclass, load, initialLoad, contentChanged, initialEnd, iframeMouseDown, destroy, toolbarClick, toolbarRefresh, refreshBegin, toolbarUpdated, bindOnEnd, renderColorPicker, htmlToolbarClick, markdownToolbarClick, destroyColorPicker, modelChanged, tableModulekeyUp, keyUp, keyDown, mouseUp, toolbarCreated, toolbarRenderComplete, enableFullScreen, disableFullScreen, dropDownSelect, beforeDropDownItemRender, execCommandCallBack, imageToolbarAction, audioToolbarAction, videoToolbarAction, linkToolbarAction, windowResize, resizeStart, onResize, resizeStop, undo, redo, insertLink, unLink, editLink, openLink, actionBegin, actionComplete, updatedToolbarStatus, actionSuccess, updateToolbarItem, insertImage, insertAudio, insertVideo, insertCompleted, imageLeft, imageRight, imageCenter, imageBreak, imageInline, imageLink, imageAlt, imageDelete, audioDelete, videoDelete, imageCaption, imageSize, videoSize, sourceCode, updateSource, toolbarOpen, beforeDropDownOpen, selectionSave, selectionRestore, expandPopupClick, count, contentFocus, contentBlur, mouseDown, sourceCodeMouseDown, editAreaClick, scroll, contentscroll, colorPickerChanged, tableColorPickerChanged, focusChange, selectAll$1 as selectAll, selectRange, getSelectedHtml, renderInlineToolbar, paste, imgModule, rtlMode, createTable, docClick, tableToolbarAction, checkUndo, readOnlyMode, moduleDestroy, pasteClean, enterHandler, beforeDialogOpen, clearDialogObj, dialogOpen, beforeDialogClose, dialogClose, beforeQuickToolbarOpen, quickToolbarOpen, quickToolbarClose, popupHide, imageSelected, imageUploading, imageUploadSuccess, imageUploadFailed, imageRemoving, fileSelected, fileUploading, fileUploadSuccess, fileUploadFailed, fileRemoving, afterImageDelete, afterMediaDelete, drop, xhtmlValidation, beforeImageUpload, beforeFileUpload, resizeInitialized, renderFileManager, beforeImageDrop, dynamicModule, beforePasteCleanup, afterPasteCleanup, updateTbItemsStatus, showLinkDialog, closeLinkDialog, showImageDialog, showAudioDialog, showVideoDialog, closeImageDialog, closeAudioDialog, closeVideoDialog, showTableDialog, closeTableDialog, bindCssClass, formatPainterClick, formatPainterDoubleClick, emojiPicker, destroyTooltip, hidePopup, cleanupResizeElements, afterKeyDown, updateValueOnIdle, documentClickClosedBy, showColorPicker, closeTooltip, blockEmptyNodes, inlineEmptyNodes, supportedUnits, conversionFactors, onHandleFontsizeChange, CLS_RTE, CLS_RTL, CLS_CONTENT, CLS_DISABLED, CLS_SCRIPT_SHEET, CLS_STYLE_SHEET, CLS_TOOLBAR, CLS_TB_FIXED, CLS_TB_FLOAT, CLS_INLINE, CLS_TB_INLINE, CLS_RTE_EXPAND_TB, CLS_FULL_SCREEN, CLS_QUICK_TB, CLS_TEXT_QUICK_TB, CLS_POP, CLS_TB_STATIC, CLS_QUICK_POP, CLS_QUICK_DROPDOWN, CLS_IMAGE_POP, CLS_TEXT_POP, CLS_INLINE_POP, CLS_INLINE_DROPDOWN, CLS_DROPDOWN_POPUP, CLS_DROPDOWN_ICONS, CLS_DROPDOWN_ITEMS, CLS_DROPDOWN_BTN, CLS_RTE_CONTENT, CLS_TB_ITEM, CLS_TB_EXTENDED, CLS_TB_WRAP, CLS_POPUP, CLS_SEPARATOR, CLS_MINIMIZE, CLS_MAXIMIZE, CLS_BACK, CLS_SHOW, CLS_HIDE, CLS_VISIBLE, CLS_FOCUS, CLS_RM_WHITE_SPACE, CLS_IMGRIGHT, CLS_IMGLEFT, CLS_IMGCENTER, CLS_IMGBREAK, CLS_AUDIOBREAK, CLS_CLICKELEM, CLS_VID_CLICK_ELEM, CLS_AUDIOWRAP, CLS_VIDEOWRAP, CLS_VIDEOBREAK, CLS_CAPTION, CLS_RTE_CAPTION, CLS_CAPINLINE, CLS_IMGINLINE, CLS_AUDIOINLINE, CLS_VIDEOINLINE, CLS_COUNT, CLS_WARNING, CLS_ERROR, CLS_ICONS, CLS_ACTIVE, CLS_EXPAND_OPEN, CLS_RTE_ELEMENTS, CLS_TB_BTN, CLS_HR_SEPARATOR, CLS_TB_IOS_FIX, CLS_LIST_PRIMARY_CONTENT, CLS_NUMBERFORMATLIST_TB_BTN, CLS_BULLETFORMATLIST_TB_BTN, CLS_FORMATS_TB_BTN, CLS_FONT_NAME_TB_BTN, CLS_FONT_SIZE_TB_BTN, CLS_ALIGN_TB_BTN, CLS_FONT_COLOR_TARGET, CLS_BACKGROUND_COLOR_TARGET, CLS_COLOR_CONTENT, CLS_FONT_COLOR_DROPDOWN, CLS_BACKGROUND_COLOR_DROPDOWN, CLS_COLOR_PALETTE, CLS_FONT_COLOR_PICKER, CLS_BACKGROUND_COLOR_PICKER, CLS_RTE_READONLY, CLS_TABLE_SEL, CLS_TB_DASH_BOR, CLS_TB_ALT_BOR, CLS_TB_COL_RES, CLS_TB_ROW_RES, CLS_TB_BOX_RES, CLS_RTE_HIDDEN, CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT, CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT, CLS_RTE_RES_HANDLE, CLS_RTE_RES_EAST, CLS_RTE_IMAGE, CLS_RESIZE, CLS_IMG_FOCUS, CLS_AUD_FOCUS, CLS_VID_FOCUS, CLS_RTE_DRAG_IMAGE, CLS_RTE_UPLOAD_POPUP, CLS_POPUP_OPEN, CLS_IMG_RESIZE, CLS_DROPAREA, CLS_IMG_INNER, CLS_UPLOAD_FILES, CLS_RTE_DIALOG_UPLOAD, CLS_RTE_RES_CNT, CLS_CUSTOM_TILE, CLS_NOCOLOR_ITEM, CLS_TABLE, CLS_TABLE_BORDER, CLS_RTE_TABLE_RESIZE, CLS_RTE_FIXED_TB_EXPAND, CLS_RTE_TB_ENABLED, CLS_RTE_RES_WEST, CLS_RTE_SOURCE_CODE_TXTAREA, getIndex, hasClass, getDropDownValue, isIDevice, getFormattedFontSize, pageYOffset, getTooltipText, setToolbarStatus, getCollection, getTBarItemsIndex, updateUndoRedoStatus, dispatchEvent, parseHtml, getTextNodesUnder, toObjectLowerCase, getEditValue, updateTextNode, getDefaultValue, isEditableValueEmpty, decode, sanitizeHelper, convertToBlob, getLocaleFontFormat, updateDropDownFontFormatLocale, ServiceLocator, RendererFactory, EditorManager, IMAGE, AUDIO, VIDEO, TABLE, LINK, INSERT_ROW, INSERT_COLUMN, DELETEROW, DELETECOLUMN, REMOVETABLE, TABLEHEADER, TABLE_VERTICAL_ALIGN, TABLE_MERGE, TABLE_VERTICAL_SPLIT, TABLE_HORIZONTAL_SPLIT, TABLE_MOVE, ALIGNMENT_TYPE, INDENT_TYPE, DEFAULT_TAG, BLOCK_TAGS, IGNORE_BLOCK_TAGS, TABLE_BLOCK_TAGS, SELECTION_TYPE, INSERTHTML_TYPE, INSERT_TEXT_TYPE, CLEAR_TYPE, SELF_CLOSING_TAGS, PASTE_SOURCE, CLASS_IMAGE_RIGHT, CLASS_IMAGE_LEFT, CLASS_IMAGE_CENTER, CLASS_VIDEO_RIGHT, CLASS_VIDEO_LEFT, CLASS_VIDEO_CENTER, CLASS_IMAGE_BREAK, CLASS_AUDIO_BREAK, CLASS_VIDEO_BREAK, CLASS_CAPTION, CLASS_RTE_CAPTION, CLASS_CAPTION_INLINE, CLASS_IMAGE_INLINE, CLASS_AUDIO_INLINE, CLASS_CLICK_ELEM, CLASS_VIDEO_CLICK_ELEM, CLASS_AUDIO, CLASS_VIDEO, CLASS_AUDIO_WRAP, CLASS_VIDEO_WRAP, CLASS_EMBED_VIDEO_WRAP, CLASS_AUDIO_FOCUS, CLASS_VIDEO_FOCUS, CLASS_VIDEO_INLINE, Lists, markerClassName, DOMNode, Alignments, Indents, Formats, LinkCommand, InsertMethods, InsertTextExec, InsertHtmlExec, InsertHtml, IsFormatted, MsWordPaste, NodeCutter, ImageCommand, AudioCommand, VideoCommand, SelectionCommands, SelectionBasedExec, ClearFormatExec, UndoRedoManager, TableCommand, statusCollection, ToolbarStatus, FormatPainterActions, EmojiPickerAction, NodeSelection, MarkdownParser, LISTS_COMMAND, selectionCommand, LINK_COMMAND, CLEAR_COMMAND, MD_TABLE, INSERT_TEXT_COMMAND, ClearFormat, MDLists, MDFormats, MarkdownSelection, UndoRedoCommands, MDSelectionFormats, MDLink, MDTable, markdownFormatTags, markdownSelectionTags, markdownListsTags, htmlKeyConfig, markdownKeyConfig, pasteCleanupGroupingTags, listConversionFilters, selfClosingTags, imageResizeFactor, KEY_DOWN, ACTION, FORMAT_TYPE, KEY_DOWN_HANDLER, LIST_TYPE, KEY_UP_HANDLER, KEY_UP, MODEL_CHANGED_PLUGIN, MODEL_CHANGED, MS_WORD_CLEANUP_PLUGIN, MS_WORD_CLEANUP, ON_BEGIN, SPACE_ACTION, FORMAT_PAINTER_ACTIONS, EMOJI_PICKER_ACTIONS, MOUSE_DOWN };
36752
36947
  //# sourceMappingURL=ej2-richtexteditor.es5.js.map