@syncfusion/ej2-richtexteditor 25.1.38 → 25.1.39

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 (92) hide show
  1. package/CHANGELOG.md +22 -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 +1926 -1773
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +1987 -1835
  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 +9 -9
  13. package/src/editor-manager/plugin/indents.js +1 -1
  14. package/src/editor-manager/plugin/inserthtml.js +8 -2
  15. package/src/editor-manager/plugin/link.js +4 -2
  16. package/src/editor-manager/plugin/lists.js +38 -14
  17. package/src/editor-manager/plugin/nodecutter.js +3 -0
  18. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  19. package/src/editor-manager/plugin/selection-commands.js +84 -2
  20. package/src/editor-manager/plugin/table.d.ts +4 -0
  21. package/src/editor-manager/plugin/table.js +62 -19
  22. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +1 -0
  23. package/src/rich-text-editor/actions/base-quick-toolbar.js +9 -13
  24. package/src/rich-text-editor/actions/base-toolbar.js +3 -2
  25. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +1 -0
  26. package/src/rich-text-editor/actions/dropdown-buttons.js +8 -23
  27. package/src/rich-text-editor/actions/emoji-picker.js +1 -1
  28. package/src/rich-text-editor/actions/enter-key.js +4 -1
  29. package/src/rich-text-editor/actions/format-painter.js +4 -1
  30. package/src/rich-text-editor/actions/html-editor.js +9 -4
  31. package/src/rich-text-editor/actions/quick-toolbar.d.ts +2 -0
  32. package/src/rich-text-editor/actions/quick-toolbar.js +14 -4
  33. package/src/rich-text-editor/base/rich-text-editor.js +4 -18
  34. package/src/rich-text-editor/base/util.d.ts +0 -4
  35. package/src/rich-text-editor/base/util.js +1 -35
  36. package/src/rich-text-editor/formatter/formatter.js +2 -1
  37. package/src/rich-text-editor/renderer/audio-module.js +9 -4
  38. package/src/rich-text-editor/renderer/image-module.js +4 -1
  39. package/src/rich-text-editor/renderer/table-module.js +15 -5
  40. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -1
  41. package/src/rich-text-editor/renderer/toolbar-renderer.js +27 -23
  42. package/src/rich-text-editor/renderer/video-module.js +29 -15
  43. package/styles/bootstrap-dark.css +11 -0
  44. package/styles/bootstrap.css +11 -0
  45. package/styles/bootstrap4.css +11 -0
  46. package/styles/bootstrap5-dark.css +11 -0
  47. package/styles/bootstrap5.css +11 -0
  48. package/styles/fabric-dark.css +11 -0
  49. package/styles/fabric.css +11 -0
  50. package/styles/fluent-dark.css +11 -0
  51. package/styles/fluent.css +11 -0
  52. package/styles/highcontrast-light.css +11 -0
  53. package/styles/highcontrast.css +11 -0
  54. package/styles/material-dark.css +11 -0
  55. package/styles/material.css +11 -0
  56. package/styles/material3-dark.css +11 -0
  57. package/styles/material3.css +11 -0
  58. package/styles/rich-text-editor/_bds-definition.scss +6 -0
  59. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +6 -0
  60. package/styles/rich-text-editor/_bootstrap-definition.scss +6 -0
  61. package/styles/rich-text-editor/_bootstrap4-definition.scss +6 -0
  62. package/styles/rich-text-editor/_bootstrap5-definition.scss +6 -0
  63. package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -0
  64. package/styles/rich-text-editor/_fabric-definition.scss +6 -0
  65. package/styles/rich-text-editor/_fluent-definition.scss +6 -0
  66. package/styles/rich-text-editor/_fusionnew-definition.scss +6 -0
  67. package/styles/rich-text-editor/_highcontrast-definition.scss +6 -0
  68. package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -0
  69. package/styles/rich-text-editor/_layout.scss +10 -0
  70. package/styles/rich-text-editor/_material-dark-definition.scss +6 -0
  71. package/styles/rich-text-editor/_material-definition.scss +6 -0
  72. package/styles/rich-text-editor/_material3-definition.scss +6 -0
  73. package/styles/rich-text-editor/_tailwind-definition.scss +6 -0
  74. package/styles/rich-text-editor/bootstrap-dark.css +11 -0
  75. package/styles/rich-text-editor/bootstrap.css +11 -0
  76. package/styles/rich-text-editor/bootstrap4.css +11 -0
  77. package/styles/rich-text-editor/bootstrap5-dark.css +11 -0
  78. package/styles/rich-text-editor/bootstrap5.css +11 -0
  79. package/styles/rich-text-editor/fabric-dark.css +11 -0
  80. package/styles/rich-text-editor/fabric.css +11 -0
  81. package/styles/rich-text-editor/fluent-dark.css +11 -0
  82. package/styles/rich-text-editor/fluent.css +11 -0
  83. package/styles/rich-text-editor/highcontrast-light.css +11 -0
  84. package/styles/rich-text-editor/highcontrast.css +11 -0
  85. package/styles/rich-text-editor/material-dark.css +11 -0
  86. package/styles/rich-text-editor/material.css +11 -0
  87. package/styles/rich-text-editor/material3-dark.css +11 -0
  88. package/styles/rich-text-editor/material3.css +11 -0
  89. package/styles/rich-text-editor/tailwind-dark.css +11 -0
  90. package/styles/rich-text-editor/tailwind.css +11 -0
  91. package/styles/tailwind-dark.css +11 -0
  92. package/styles/tailwind.css +11 -0
@@ -3089,40 +3089,6 @@ function getTooltipText(item, serviceLocator) {
3089
3089
  const tooltipText = i10n.getConstant(itemLocale);
3090
3090
  return tooltipText;
3091
3091
  }
3092
- function getTooltipTextDropdownItems(item, serviceLocator, localeItems, rteObj) {
3093
- if (localeItems) {
3094
- const i10n = serviceLocator.getService('rteLocale');
3095
- for (let i = 0; i < localeItems.length; i++) {
3096
- const itemLocale = localeItems[i].value.toLocaleLowerCase();
3097
- const numberValue = localeItems[i].locale;
3098
- const numberLocale = defaultLocale[`${numberValue}`].toLocaleLowerCase();
3099
- if (item === itemLocale || item === numberLocale) {
3100
- const tooltipText = localeItems[i].locale;
3101
- return i10n.getConstant(tooltipText);
3102
- }
3103
- }
3104
- }
3105
- else {
3106
- const fontsize = rteObj.fontSize.items;
3107
- for (let i = 0; i < fontsize.length; i++) {
3108
- if (item === rteObj.fontSize.items[i].value) {
3109
- const fontSize$$1 = rteObj.fontSize.items[i].text;
3110
- return fontSize$$1;
3111
- }
3112
- }
3113
- }
3114
- return '';
3115
- }
3116
- function getQuickToolbarTooltipText(item) {
3117
- const keys = Object.keys(defaultLocale);
3118
- for (let i = 0; i < keys.length; i++) {
3119
- const tooltipText = defaultLocale[`${keys[i]}`];
3120
- if (item === tooltipText) {
3121
- return tooltipText;
3122
- }
3123
- }
3124
- return '';
3125
- }
3126
3092
  /**
3127
3093
  * @param {ISetToolbarStatusArgs} e - specifies the e element
3128
3094
  * @param {boolean} isPopToolbar - specifies the boolean value
@@ -3591,6 +3557,1386 @@ function updateDropDownFontFormatLocale(self) {
3591
3557
  });
3592
3558
  }
3593
3559
 
3560
+ /**
3561
+ * Is formatted or not.
3562
+ *
3563
+ * @hidden
3564
+ * @deprecated
3565
+ */
3566
+ class IsFormatted {
3567
+ /**
3568
+ * getFormattedNode method
3569
+ *
3570
+ * @param {Node} node - specifies the node.
3571
+ * @param {string} format - specifies the string value.
3572
+ * @param {Node} endNode - specifies the end node
3573
+ * @returns {Node} - returns the node
3574
+ * @hidden
3575
+ * @deprecated
3576
+ */
3577
+ getFormattedNode(node, format, endNode) {
3578
+ const parentNode = this.getFormatParent(node, format, endNode);
3579
+ if (parentNode !== null && parentNode !== endNode) {
3580
+ return parentNode;
3581
+ }
3582
+ return null;
3583
+ }
3584
+ getFormatParent(node, format, endNode) {
3585
+ do {
3586
+ node = node.parentNode;
3587
+ } while (node && (node !== endNode) && !this.isFormattedNode(node, format));
3588
+ return node;
3589
+ }
3590
+ isFormattedNode(node, format) {
3591
+ switch (format) {
3592
+ case 'bold':
3593
+ return IsFormatted.isBold(node);
3594
+ case 'italic':
3595
+ return IsFormatted.isItalic(node);
3596
+ case 'underline':
3597
+ return IsFormatted.isUnderline(node);
3598
+ case 'strikethrough':
3599
+ return IsFormatted.isStrikethrough(node);
3600
+ case 'superscript':
3601
+ return IsFormatted.isSuperscript(node);
3602
+ case 'subscript':
3603
+ return IsFormatted.isSubscript(node);
3604
+ case 'fontcolor':
3605
+ return this.isFontColor(node);
3606
+ case 'fontname':
3607
+ return this.isFontName(node);
3608
+ case 'fontsize':
3609
+ return this.isFontSize(node);
3610
+ case 'backgroundcolor':
3611
+ return this.isBackgroundColor(node);
3612
+ default:
3613
+ return false;
3614
+ }
3615
+ }
3616
+ /**
3617
+ * isBold method
3618
+ *
3619
+ * @param {Node} node - specifies the node value
3620
+ * @returns {boolean} - returns the boolean value
3621
+ * @hidden
3622
+ * @deprecated
3623
+ */
3624
+ static isBold(node) {
3625
+ const validTags = ['strong', 'b'];
3626
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3627
+ return true;
3628
+ }
3629
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3630
+ node.style && node.style.fontWeight === 'bold') {
3631
+ return true;
3632
+ }
3633
+ else {
3634
+ return false;
3635
+ }
3636
+ }
3637
+ /**
3638
+ * isItalic method
3639
+ *
3640
+ * @param {Node} node - specifies the node value
3641
+ * @returns {boolean} - returns the boolean value
3642
+ * @hidden
3643
+ * @deprecated
3644
+ */
3645
+ static isItalic(node) {
3646
+ const validTags = ['em', 'i'];
3647
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3648
+ return true;
3649
+ }
3650
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3651
+ node.style && node.style.fontStyle === 'italic') {
3652
+ return true;
3653
+ }
3654
+ else {
3655
+ return false;
3656
+ }
3657
+ }
3658
+ /**
3659
+ * isUnderline method
3660
+ *
3661
+ * @param {Node} node - specifies the node value
3662
+ * @returns {boolean} - returns the boolean value
3663
+ * @hidden
3664
+ * @deprecated
3665
+ */
3666
+ static isUnderline(node) {
3667
+ const validTags = ['u'];
3668
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3669
+ return true;
3670
+ /* eslint-disable */
3671
+ }
3672
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3673
+ node.style && (node.style.textDecoration === 'underline' ||
3674
+ node.style.textDecorationLine === 'underline')) {
3675
+ /* eslint-enable */
3676
+ return true;
3677
+ }
3678
+ else {
3679
+ return false;
3680
+ }
3681
+ }
3682
+ /**
3683
+ * isStrikethrough method
3684
+ *
3685
+ * @param {Node} node - specifies the node value
3686
+ * @returns {boolean} - returns the boolean value
3687
+ * @hidden
3688
+ * @deprecated
3689
+ */
3690
+ static isStrikethrough(node) {
3691
+ const validTags = ['del', 'strike'];
3692
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3693
+ return true;
3694
+ /* eslint-disable */
3695
+ }
3696
+ else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3697
+ node.style && (node.style.textDecoration === 'line-through' ||
3698
+ node.style.textDecorationLine === 'line-through')) {
3699
+ /* eslint-enable */
3700
+ return true;
3701
+ }
3702
+ else {
3703
+ return false;
3704
+ }
3705
+ }
3706
+ /**
3707
+ * isSuperscript method
3708
+ *
3709
+ * @param {Node} node - specifies the node value
3710
+ * @returns {boolean} - returns the boolean value
3711
+ * @hidden
3712
+ * @deprecated
3713
+ */
3714
+ static isSuperscript(node) {
3715
+ const validTags = ['sup'];
3716
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3717
+ return true;
3718
+ }
3719
+ else {
3720
+ return false;
3721
+ }
3722
+ }
3723
+ /**
3724
+ * isSubscript method
3725
+ *
3726
+ * @param {Node} node - specifies the node value
3727
+ * @returns {boolean} - returns the boolean value
3728
+ * @hidden
3729
+ * @deprecated
3730
+ */
3731
+ static isSubscript(node) {
3732
+ const validTags = ['sub'];
3733
+ if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
3734
+ return true;
3735
+ }
3736
+ else {
3737
+ return false;
3738
+ }
3739
+ }
3740
+ isFontColor(node) {
3741
+ const color = node.style && node.style.color;
3742
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3743
+ color !== null && color !== '' && color !== undefined) {
3744
+ return true;
3745
+ }
3746
+ else {
3747
+ return false;
3748
+ }
3749
+ }
3750
+ isBackgroundColor(node) {
3751
+ const backColor = node.style && node.style.backgroundColor;
3752
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3753
+ backColor !== null && backColor !== '' && backColor !== undefined) {
3754
+ return true;
3755
+ }
3756
+ else {
3757
+ return false;
3758
+ }
3759
+ }
3760
+ isFontSize(node) {
3761
+ const size = node.style && node.style.fontSize;
3762
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3763
+ size !== null && size !== '' && size !== undefined) {
3764
+ return true;
3765
+ }
3766
+ else {
3767
+ return false;
3768
+ }
3769
+ }
3770
+ isFontName(node) {
3771
+ const name = node.style && node.style.fontFamily;
3772
+ if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
3773
+ name !== null && name !== '' && name !== undefined) {
3774
+ return true;
3775
+ }
3776
+ else {
3777
+ return false;
3778
+ }
3779
+ }
3780
+ }
3781
+ // Get Formatted Node
3782
+ IsFormatted.inlineTags = [
3783
+ 'a',
3784
+ 'abbr',
3785
+ 'acronym',
3786
+ 'b',
3787
+ 'bdo',
3788
+ 'big',
3789
+ 'cite',
3790
+ 'code',
3791
+ 'dfn',
3792
+ 'em',
3793
+ 'font',
3794
+ 'i',
3795
+ 'kbd',
3796
+ 'label',
3797
+ 'q',
3798
+ 'samp',
3799
+ 'small',
3800
+ 'span',
3801
+ 'strong',
3802
+ 'sub',
3803
+ 'sup',
3804
+ 'tt',
3805
+ 'u',
3806
+ 'var',
3807
+ 'del'
3808
+ ];
3809
+
3810
+ /**
3811
+ * Constant values for EditorManager
3812
+ */
3813
+ /**
3814
+ * Image plugin events
3815
+ *
3816
+ * @hidden
3817
+ */
3818
+ const IMAGE = 'INSERT-IMAGE';
3819
+ const AUDIO = 'INSERT-AUDIO';
3820
+ const VIDEO = 'INSERT-VIDEO';
3821
+ const TABLE = 'INSERT-TABLE';
3822
+ const LINK = 'INSERT-LINK';
3823
+ const INSERT_ROW = 'INSERT-ROW';
3824
+ const INSERT_COLUMN = 'INSERT-COLUMN';
3825
+ const DELETEROW = 'DELETE-ROW';
3826
+ const DELETECOLUMN = 'DELETE-COLUMN';
3827
+ const REMOVETABLE = 'REMOVE-TABLE';
3828
+ const TABLEHEADER = 'TABLE-HEADER';
3829
+ const TABLE_VERTICAL_ALIGN = 'TABLE_VERTICAL_ALIGN';
3830
+ const TABLE_MERGE = 'TABLE_MERGE';
3831
+ const TABLE_VERTICAL_SPLIT = 'TABLE_VERTICAL_SPLIT';
3832
+ const TABLE_HORIZONTAL_SPLIT = 'TABLE_HORIZONTAL_SPLIT';
3833
+ const TABLE_MOVE = 'TABLE_MOVE';
3834
+ /**
3835
+ * Alignments plugin events
3836
+ *
3837
+ * @hidden
3838
+ */
3839
+ const ALIGNMENT_TYPE = 'alignment-type';
3840
+ /**
3841
+ * Indents plugin events
3842
+ *
3843
+ * @hidden
3844
+ */
3845
+ const INDENT_TYPE = 'indent-type';
3846
+ /**
3847
+ * Constant tag names
3848
+ *
3849
+ * @hidden
3850
+ */
3851
+ const DEFAULT_TAG = 'p';
3852
+ /**
3853
+ * @hidden
3854
+ */
3855
+ const BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote',
3856
+ 'canvas', 'details', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer',
3857
+ 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav',
3858
+ 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tbody', 'td', 'tfoot', 'th',
3859
+ 'thead', 'tr', 'ul', 'video', 'body'];
3860
+ /**
3861
+ * @hidden
3862
+ */
3863
+ const IGNORE_BLOCK_TAGS = ['td', 'th'];
3864
+ /**
3865
+ * @hidden
3866
+ */
3867
+ const TABLE_BLOCK_TAGS = ['table', 'tbody', 'td', 'tfoot', 'th',
3868
+ 'thead', 'tr'];
3869
+ /**
3870
+ * Selection plugin events
3871
+ *
3872
+ * @hidden
3873
+ */
3874
+ const SELECTION_TYPE = 'selection-type';
3875
+ /**
3876
+ * Insert HTML plugin events
3877
+ *
3878
+ * @hidden
3879
+ */
3880
+ const INSERTHTML_TYPE = 'inserthtml-type';
3881
+ /**
3882
+ * Insert Text plugin events
3883
+ *
3884
+ * @hidden
3885
+ */
3886
+ const INSERT_TEXT_TYPE = 'insert-text-type';
3887
+ /**
3888
+ * Clear Format HTML plugin events
3889
+ *
3890
+ * @hidden
3891
+ */
3892
+ const CLEAR_TYPE = 'clear-type';
3893
+ /**
3894
+ * Self closing tags
3895
+ *
3896
+ * @hidden
3897
+ */
3898
+ const SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
3899
+ /**
3900
+ * Source
3901
+ *
3902
+ * @hidden
3903
+ */
3904
+ const PASTE_SOURCE = ['word', 'excel', 'onenote'];
3905
+
3906
+ /**
3907
+ * `Selection` module is used to handle RTE Selections.
3908
+ */
3909
+ class NodeSelection {
3910
+ constructor() {
3911
+ this.startNodeName = [];
3912
+ this.endNodeName = [];
3913
+ }
3914
+ saveInstance(range, body) {
3915
+ this.range = range.cloneRange();
3916
+ this.rootNode = this.documentFromRange(range);
3917
+ this.body = body;
3918
+ this.startContainer = this.getNodeArray(range.startContainer, true);
3919
+ this.endContainer = this.getNodeArray(range.endContainer, false);
3920
+ this.startOffset = range.startOffset;
3921
+ this.endOffset = range.endOffset;
3922
+ this.html = this.body.innerHTML;
3923
+ return this;
3924
+ }
3925
+ documentFromRange(range) {
3926
+ return (9 === range.startContainer.nodeType) ? range.startContainer : range.startContainer.ownerDocument;
3927
+ }
3928
+ getRange(docElement) {
3929
+ const select$$1 = this.get(docElement);
3930
+ const range = select$$1 && select$$1.rangeCount > 0 ? select$$1.getRangeAt(select$$1.rangeCount - 1) : docElement.createRange();
3931
+ return (range.startContainer !== docElement || range.endContainer !== docElement
3932
+ || range.startOffset || range.endOffset || (range.setStart(docElement.body, 0), range.collapse(!0)), range);
3933
+ }
3934
+ /**
3935
+ * get method
3936
+ *
3937
+ * @param {Document} docElement - specifies the get function
3938
+ * @returns {void}
3939
+ * @hidden
3940
+ * @deprecated
3941
+ */
3942
+ get(docElement) {
3943
+ return docElement.defaultView.getSelection();
3944
+ }
3945
+ /**
3946
+ * save method
3947
+ *
3948
+ * @param {Range} range - range value.
3949
+ * @param {Document} docElement - specifies the document.
3950
+ * @returns {void}
3951
+ * @hidden
3952
+ * @deprecated
3953
+ */
3954
+ save(range, docElement) {
3955
+ range = (range) ? range.cloneRange() : this.getRange(docElement);
3956
+ return this.saveInstance(range, docElement.body);
3957
+ }
3958
+ /**
3959
+ * getIndex method
3960
+ *
3961
+ * @param {Node} node - specifies the node value.
3962
+ * @returns {void}
3963
+ * @hidden
3964
+ * @deprecated
3965
+ */
3966
+ getIndex(node) {
3967
+ let index;
3968
+ let num = 0;
3969
+ node = !node.previousSibling && node.tagName === 'BR' ? node : node.previousSibling;
3970
+ if (node) {
3971
+ for (let type = node.nodeType; node; null) {
3972
+ index = node.nodeType;
3973
+ num++;
3974
+ //eslint-disable-next-line
3975
+ type = index;
3976
+ node = node.previousSibling;
3977
+ }
3978
+ }
3979
+ return num;
3980
+ }
3981
+ isChildNode(nodeCollection, parentNode) {
3982
+ for (let index = 0; index < parentNode.childNodes.length; index++) {
3983
+ if (nodeCollection.indexOf(parentNode.childNodes[index]) > -1) {
3984
+ return true;
3985
+ }
3986
+ }
3987
+ return false;
3988
+ }
3989
+ getNode(startNode, endNode, nodeCollection) {
3990
+ if (endNode === startNode &&
3991
+ (startNode.nodeType === 3 || !startNode.firstChild || nodeCollection.indexOf(startNode.firstChild) !== -1
3992
+ || this.isChildNode(nodeCollection, startNode))) {
3993
+ return null;
3994
+ }
3995
+ if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
3996
+ return null;
3997
+ }
3998
+ if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
3999
+ return startNode.firstChild;
4000
+ }
4001
+ if (startNode.nextSibling) {
4002
+ return startNode.nextSibling;
4003
+ }
4004
+ if (!startNode.parentNode) {
4005
+ return null;
4006
+ }
4007
+ else {
4008
+ return startNode.parentNode;
4009
+ }
4010
+ }
4011
+ /**
4012
+ * getNodeCollection method
4013
+ *
4014
+ * @param {Range} range -specifies the range.
4015
+ * @returns {void}
4016
+ * @hidden
4017
+ * @deprecated
4018
+ */
4019
+ getNodeCollection(range) {
4020
+ let startNode = range.startContainer.childNodes[range.startOffset]
4021
+ || range.startContainer;
4022
+ const endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
4023
+ || range.endContainer;
4024
+ if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
4025
+ startNode.childNodes.length === 0) {
4026
+ return [startNode];
4027
+ }
4028
+ if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
4029
+ return [startNode.nodeName === 'BR' || startNode.nodeName === '#text' ? startNode : startNode.childNodes[0]];
4030
+ }
4031
+ const nodeCollection = [];
4032
+ do {
4033
+ if (nodeCollection.indexOf(startNode) === -1) {
4034
+ nodeCollection.push(startNode);
4035
+ }
4036
+ startNode = this.getNode(startNode, endNode, nodeCollection);
4037
+ } while (startNode);
4038
+ return nodeCollection;
4039
+ }
4040
+ /**
4041
+ * getParentNodeCollection method
4042
+ *
4043
+ * @param {Range} range - specifies the range value.
4044
+ * @returns {void}
4045
+ * @hidden
4046
+ * @deprecated
4047
+ */
4048
+ getParentNodeCollection(range) {
4049
+ return this.getParentNodes(this.getNodeCollection(range), range);
4050
+ }
4051
+ /**
4052
+ * getParentNodes method
4053
+ *
4054
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4055
+ * @param {Range} range - specifies the range values.
4056
+ * @returns {void}
4057
+ * @hidden
4058
+ * @deprecated
4059
+ */
4060
+ getParentNodes(nodeCollection, range) {
4061
+ nodeCollection = nodeCollection.reverse();
4062
+ for (let index = 0; index < nodeCollection.length; index++) {
4063
+ if ((nodeCollection.indexOf(nodeCollection[index].parentNode) !== -1)
4064
+ || (nodeCollection[index].nodeType === 3 &&
4065
+ range.startContainer !== range.endContainer &&
4066
+ range.startContainer.parentNode !== range.endContainer.parentNode)) {
4067
+ nodeCollection.splice(index, 1);
4068
+ index--;
4069
+ }
4070
+ else if (nodeCollection[index].nodeType === 3) {
4071
+ nodeCollection[index] = nodeCollection[index].parentNode;
4072
+ }
4073
+ }
4074
+ return nodeCollection;
4075
+ }
4076
+ /**
4077
+ * getSelectionNodeCollection method
4078
+ *
4079
+ * @param {Range} range - specifies the range value.
4080
+ * @returns {void}
4081
+ * @hidden
4082
+ * @deprecated
4083
+ */
4084
+ getSelectionNodeCollection(range) {
4085
+ return this.getSelectionNodes(this.getNodeCollection(range));
4086
+ }
4087
+ /**
4088
+ * getSelectionNodeCollection along with BR node method
4089
+ *
4090
+ * @param {Range} range - specifies the range value.
4091
+ * @returns {void}
4092
+ * @hidden
4093
+ * @deprecated
4094
+ */
4095
+ getSelectionNodeCollectionBr(range) {
4096
+ return this.getSelectionNodesBr(this.getNodeCollection(range));
4097
+ }
4098
+ /**
4099
+ * getParentNodes method
4100
+ *
4101
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4102
+ * @returns {void}
4103
+ * @hidden
4104
+ * @deprecated
4105
+ */
4106
+ getSelectionNodes(nodeCollection) {
4107
+ nodeCollection = nodeCollection.reverse();
4108
+ // eslint-disable-next-line
4109
+ const regEx = new RegExp(String.fromCharCode(8203), 'g');
4110
+ for (let index = 0; index < nodeCollection.length; index++) {
4111
+ if (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
4112
+ (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx)))) {
4113
+ nodeCollection.splice(index, 1);
4114
+ index--;
4115
+ }
4116
+ }
4117
+ return nodeCollection.reverse();
4118
+ }
4119
+ /**
4120
+ * Get selection text nodes with br method.
4121
+ *
4122
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4123
+ * @returns {void}
4124
+ * @hidden
4125
+ * @deprecated
4126
+ */
4127
+ getSelectionNodesBr(nodeCollection) {
4128
+ nodeCollection = nodeCollection.reverse();
4129
+ // eslint-disable-next-line
4130
+ const regEx = new RegExp(String.fromCharCode(8203), 'g');
4131
+ for (let index = 0; index < nodeCollection.length; index++) {
4132
+ if (nodeCollection[index].nodeName !== 'BR' &&
4133
+ (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
4134
+ (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx))))) {
4135
+ nodeCollection.splice(index, 1);
4136
+ index--;
4137
+ }
4138
+ }
4139
+ return nodeCollection.reverse();
4140
+ }
4141
+ /**
4142
+ * getInsertNodeCollection method
4143
+ *
4144
+ * @param {Range} range - specifies the range value.
4145
+ * @returns {void}
4146
+ * @hidden
4147
+ * @deprecated
4148
+ */
4149
+ getInsertNodeCollection(range) {
4150
+ return this.getInsertNodes(this.getNodeCollection(range));
4151
+ }
4152
+ /**
4153
+ * getInsertNodes method
4154
+ *
4155
+ * @param {Node[]} nodeCollection - specifies the collection of nodes.
4156
+ * @returns {void}
4157
+ * @hidden
4158
+ * @deprecated
4159
+ */
4160
+ getInsertNodes(nodeCollection) {
4161
+ nodeCollection = nodeCollection.reverse();
4162
+ for (let index = 0; index < nodeCollection.length; index++) {
4163
+ if ((nodeCollection[index].childNodes.length !== 0 &&
4164
+ nodeCollection[index].nodeType !== 3) ||
4165
+ (nodeCollection[index].nodeType === 3 &&
4166
+ nodeCollection[index].textContent === '')) {
4167
+ nodeCollection.splice(index, 1);
4168
+ index--;
4169
+ }
4170
+ }
4171
+ return nodeCollection.reverse();
4172
+ }
4173
+ /**
4174
+ * getNodeArray method
4175
+ *
4176
+ * @param {Node} node - specifies the node content.
4177
+ * @param {boolean} isStart - specifies the boolean value.
4178
+ * @param {Document} root - specifies the root document.
4179
+ * @returns {void}
4180
+ * @hidden
4181
+ * @deprecated
4182
+ */
4183
+ getNodeArray(node, isStart, root) {
4184
+ const array = [];
4185
+ // eslint-disable-next-line
4186
+ ((isStart) ? (this.startNodeName = []) : (this.endNodeName = []));
4187
+ for (; node !== (root ? root : this.rootNode); null) {
4188
+ if (isNullOrUndefined(node)) {
4189
+ break;
4190
+ }
4191
+ // eslint-disable-next-line
4192
+ (isStart) ? this.startNodeName.push(node.nodeName.toLowerCase()) : this.endNodeName.push(node.nodeName.toLowerCase());
4193
+ array.push(this.getIndex(node));
4194
+ node = node.parentNode;
4195
+ }
4196
+ return array;
4197
+ }
4198
+ setRangePoint(range, isvalid, num, size) {
4199
+ let node = this.rootNode;
4200
+ let index = num.length;
4201
+ let constant = size;
4202
+ for (; index--; null) {
4203
+ node = node && node.childNodes[num[index]];
4204
+ }
4205
+ if (node && constant >= 0 && node.nodeName !== 'html') {
4206
+ if (node.nodeType === 3 && node.nodeValue.replace(/\u00a0/g, '&nbsp;') === '&nbsp;') {
4207
+ constant = node.textContent.length;
4208
+ }
4209
+ range[isvalid ? 'setStart' : 'setEnd'](node, constant);
4210
+ }
4211
+ return range;
4212
+ }
4213
+ /**
4214
+ * restore method
4215
+ *
4216
+ * @returns {void}
4217
+ * @hidden
4218
+ * @deprecated
4219
+ */
4220
+ restore() {
4221
+ let range = this.range.cloneRange();
4222
+ range = this.setRangePoint(range, true, this.startContainer, this.startOffset);
4223
+ range = this.setRangePoint(range, false, this.endContainer, this.endOffset);
4224
+ this.selectRange(this.rootNode, range);
4225
+ return range;
4226
+ }
4227
+ selectRange(docElement, range) {
4228
+ this.setRange(docElement, range);
4229
+ this.save(range, docElement);
4230
+ }
4231
+ /**
4232
+ * setRange method
4233
+ *
4234
+ * @param {Document} docElement - specifies the document.
4235
+ * @param {Range} range - specifies the range.
4236
+ * @returns {void}
4237
+ * @hidden
4238
+ * @deprecated
4239
+ */
4240
+ setRange(docElement, range) {
4241
+ const selection = this.get(docElement);
4242
+ selection.removeAllRanges();
4243
+ selection.addRange(range);
4244
+ }
4245
+ /**
4246
+ * setSelectionText method
4247
+ *
4248
+ * @param {Document} docElement - specifies the documrent
4249
+ * @param {Node} startNode - specifies the starting node.
4250
+ * @param {Node} endNode - specifies the the end node.
4251
+ * @param {number} startIndex - specifies the starting index.
4252
+ * @param {number} endIndex - specifies the end index.
4253
+ * @returns {void}
4254
+ * @hidden
4255
+ * @deprecated
4256
+ */
4257
+ setSelectionText(docElement, startNode, endNode, startIndex, endIndex) {
4258
+ const range = docElement.createRange();
4259
+ range.setStart(startNode, startIndex);
4260
+ range.setEnd(endNode, endIndex);
4261
+ this.setRange(docElement, range);
4262
+ }
4263
+ /**
4264
+ * setSelectionContents method
4265
+ *
4266
+ * @param {Document} docElement - specifies the document.
4267
+ * @param {Node} element - specifies the node.
4268
+ * @returns {void}
4269
+ * @hidden
4270
+ * @deprecated
4271
+ */
4272
+ setSelectionContents(docElement, element) {
4273
+ const range = docElement.createRange();
4274
+ range.selectNode(element);
4275
+ this.setRange(docElement, range);
4276
+ }
4277
+ /**
4278
+ * setSelectionNode method
4279
+ *
4280
+ * @param {Document} docElement - specifies the document.
4281
+ * @param {Node} element - specifies the node.
4282
+ * @returns {void}
4283
+ * @hidden
4284
+ * @deprecated
4285
+ */
4286
+ setSelectionNode(docElement, element) {
4287
+ const range = docElement.createRange();
4288
+ range.selectNodeContents(element);
4289
+ this.setRange(docElement, range);
4290
+ }
4291
+ /**
4292
+ * getSelectedNodes method
4293
+ *
4294
+ * @param {Document} docElement - specifies the document.
4295
+ * @returns {void}
4296
+ * @hidden
4297
+ * @deprecated
4298
+ */
4299
+ getSelectedNodes(docElement) {
4300
+ return this.getNodeCollection(this.getRange(docElement));
4301
+ }
4302
+ /**
4303
+ * Clear method
4304
+ *
4305
+ * @param {Document} docElement - specifies the document.
4306
+ * @returns {void}
4307
+ * @hidden
4308
+ * @deprecated
4309
+ */
4310
+ Clear(docElement) {
4311
+ this.get(docElement).removeAllRanges();
4312
+ }
4313
+ /**
4314
+ * insertParentNode method
4315
+ *
4316
+ * @param {Document} docElement - specifies the document.
4317
+ * @param {Node} newNode - specicfies the new node.
4318
+ * @param {Range} range - specifies the range.
4319
+ * @returns {void}
4320
+ * @hidden
4321
+ * @deprecated
4322
+ */
4323
+ insertParentNode(docElement, newNode, range) {
4324
+ range.surroundContents(newNode);
4325
+ this.selectRange(docElement, range);
4326
+ }
4327
+ /**
4328
+ * setCursorPoint method
4329
+ *
4330
+ * @param {Document} docElement - specifies the document.
4331
+ * @param {Element} element - specifies the element.
4332
+ * @param {number} point - specifies the point.
4333
+ * @returns {void}
4334
+ * @hidden
4335
+ * @deprecated
4336
+ */
4337
+ setCursorPoint(docElement, element, point) {
4338
+ const range = docElement.createRange();
4339
+ const selection = docElement.defaultView.getSelection();
4340
+ range.setStart(element, point);
4341
+ range.collapse(true);
4342
+ selection.removeAllRanges();
4343
+ selection.addRange(range);
4344
+ }
4345
+ }
4346
+
4347
+ /**
4348
+ * `Selection` module is used to handle RTE Selections.
4349
+ */
4350
+
4351
+ /**
4352
+ * Defines common util methods used by Rich Text Editor.
4353
+ */
4354
+ const inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
4355
+ 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
4356
+ 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
4357
+ 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
4358
+ 'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
4359
+ /**
4360
+ * @returns {void}
4361
+ * @hidden
4362
+ */
4363
+ function isIDevice$1() {
4364
+ let result = false;
4365
+ if (Browser.isDevice && Browser.isIos) {
4366
+ result = true;
4367
+ }
4368
+ return result;
4369
+ }
4370
+ /**
4371
+ * @param {Element} editableElement - specifies the editable element.
4372
+ * @param {string} selector - specifies the string values.
4373
+ * @returns {void}
4374
+ * @hidden
4375
+ */
4376
+ function setEditFrameFocus(editableElement, selector) {
4377
+ if (editableElement.nodeName === 'BODY' && !isNullOrUndefined(selector)) {
4378
+ const iframe = top.window.document.querySelector(selector);
4379
+ if (!isNullOrUndefined(iframe)) {
4380
+ iframe.contentWindow.focus();
4381
+ }
4382
+ }
4383
+ }
4384
+ /**
4385
+ * @param {string} value - specifies the string value
4386
+ * @param {string} enterAction - specifies the enter key action API
4387
+ * @returns {void}
4388
+ * @hidden
4389
+ */
4390
+ function updateTextNode$1(value, enterAction) {
4391
+ const tempNode = document.createElement('div');
4392
+ tempNode.innerHTML = value;
4393
+ tempNode.setAttribute('class', 'tempDiv');
4394
+ const resultElm = document.createElement('div');
4395
+ const childNodes = tempNode.childNodes;
4396
+ if (childNodes.length > 0) {
4397
+ let isPreviousInlineElem;
4398
+ let previousParent;
4399
+ let paraElm;
4400
+ while (tempNode.firstChild) {
4401
+ if ((tempNode.firstChild.nodeName === '#text' &&
4402
+ (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
4403
+ inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
4404
+ if (!isPreviousInlineElem) {
4405
+ if (enterAction === 'BR') {
4406
+ resultElm.appendChild(tempNode.firstChild);
4407
+ previousParent = resultElm;
4408
+ }
4409
+ else {
4410
+ paraElm = createElement('p');
4411
+ resultElm.appendChild(paraElm);
4412
+ paraElm.appendChild(tempNode.firstChild);
4413
+ previousParent = paraElm;
4414
+ isPreviousInlineElem = true;
4415
+ }
4416
+ }
4417
+ else {
4418
+ previousParent.appendChild(tempNode.firstChild);
4419
+ previousParent = paraElm;
4420
+ isPreviousInlineElem = true;
4421
+ }
4422
+ }
4423
+ else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
4424
+ (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
4425
+ detach(tempNode.firstChild);
4426
+ }
4427
+ else {
4428
+ resultElm.appendChild(tempNode.firstChild);
4429
+ isPreviousInlineElem = false;
4430
+ }
4431
+ }
4432
+ const tableElm = resultElm.querySelectorAll('table');
4433
+ for (let i = 0; i < tableElm.length; i++) {
4434
+ if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table')) {
4435
+ tableElm[i].classList.add('e-rte-paste-table');
4436
+ if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
4437
+ tableElm[i].classList.remove('e-rte-paste-word-table');
4438
+ continue; // Skiping the removal of the border if the source is from word.
4439
+ }
4440
+ else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
4441
+ tableElm[i].classList.remove('e-rte-paste-excel-table');
4442
+ if (tableElm[i].getAttribute('border') === '0') {
4443
+ tableElm[i].removeAttribute('border');
4444
+ }
4445
+ const tdElm = tableElm[i].querySelectorAll('td');
4446
+ for (let j = 0; j < tdElm.length; j++) {
4447
+ if (tdElm[j].style.borderLeft === 'none') {
4448
+ tdElm[j].style.removeProperty('border-left');
4449
+ }
4450
+ if (tdElm[j].style.borderRight === 'none') {
4451
+ tdElm[j].style.removeProperty('border-right');
4452
+ }
4453
+ if (tdElm[j].style.borderBottom === 'none') {
4454
+ tdElm[j].style.removeProperty('border-bottom');
4455
+ }
4456
+ if (tdElm[j].style.borderTop === 'none') {
4457
+ tdElm[j].style.removeProperty('border-top');
4458
+ }
4459
+ if (tdElm[j].style.border === 'none') {
4460
+ tdElm[j].style.removeProperty('border');
4461
+ }
4462
+ }
4463
+ }
4464
+ else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
4465
+ tableElm[i].classList.remove('e-rte-paste-onenote-table');
4466
+ continue;
4467
+ }
4468
+ }
4469
+ }
4470
+ const imageElm = resultElm.querySelectorAll('img');
4471
+ for (let i = 0; i < imageElm.length; i++) {
4472
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
4473
+ continue; // Should not add the class if the image is Broken.
4474
+ }
4475
+ if (!imageElm[i].classList.contains('e-rte-image')) {
4476
+ imageElm[i].classList.add('e-rte-image');
4477
+ }
4478
+ if (!(imageElm[i].classList.contains('e-imginline') ||
4479
+ imageElm[i].classList.contains('e-imgbreak'))) {
4480
+ imageElm[i].classList.add('e-imginline');
4481
+ }
4482
+ }
4483
+ }
4484
+ return resultElm.innerHTML;
4485
+ }
4486
+ /**
4487
+ * @param {Node} startChildNodes - specifies the node
4488
+ * @returns {void}
4489
+ * @hidden
4490
+ */
4491
+ function getLastTextNode(startChildNodes) {
4492
+ let finalNode = startChildNodes;
4493
+ do {
4494
+ if (finalNode.childNodes.length > 0) {
4495
+ finalNode = finalNode.childNodes[0];
4496
+ }
4497
+ } while (finalNode.childNodes.length > 0);
4498
+ return finalNode;
4499
+ }
4500
+ /**
4501
+ * @returns {void}
4502
+ * @hidden
4503
+ */
4504
+ function getDefaultHtmlTbStatus() {
4505
+ return {
4506
+ bold: false,
4507
+ italic: false,
4508
+ subscript: false,
4509
+ superscript: false,
4510
+ strikethrough: false,
4511
+ orderedlist: false,
4512
+ unorderedlist: false,
4513
+ numberFormatList: false,
4514
+ bulletFormatList: false,
4515
+ underline: false,
4516
+ alignments: null,
4517
+ backgroundcolor: null,
4518
+ fontcolor: null,
4519
+ fontname: null,
4520
+ fontsize: null,
4521
+ formats: null,
4522
+ createlink: false,
4523
+ insertcode: false
4524
+ };
4525
+ }
4526
+ /**
4527
+ * @returns {void}
4528
+ * @hidden
4529
+ */
4530
+ function getDefaultMDTbStatus() {
4531
+ return {
4532
+ bold: false,
4533
+ italic: false,
4534
+ subscript: false,
4535
+ superscript: false,
4536
+ strikethrough: false,
4537
+ orderedlist: false,
4538
+ uppercase: false,
4539
+ lowercase: false,
4540
+ inlinecode: false,
4541
+ unorderedlist: false,
4542
+ formats: null
4543
+ };
4544
+ }
4545
+ /**
4546
+ * @param {Range} range - specifies the range
4547
+ * @returns {void}
4548
+ * @hidden
4549
+ */
4550
+ function nestedListCleanUp(range) {
4551
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
4552
+ range.extractContents();
4553
+ while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
4554
+ (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
4555
+ let emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
4556
+ if (emptyLI.length > 0) {
4557
+ emptyLI.forEach((item) => {
4558
+ item.remove();
4559
+ });
4560
+ }
4561
+ }
4562
+ let liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
4563
+ if (liElem.length > 0) {
4564
+ liElem.forEach((item) => {
4565
+ if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
4566
+ item.style.listStyleType = "none";
4567
+ }
4568
+ });
4569
+ }
4570
+ }
4571
+ }
4572
+
4573
+ /**
4574
+ * Update Toolbar Status
4575
+ *
4576
+ * @hidden
4577
+ * @deprecated
4578
+ */
4579
+ const statusCollection = getDefaultHtmlTbStatus();
4580
+ class ToolbarStatus {
4581
+ /**
4582
+ * get method
4583
+ *
4584
+ * @param {Document} docElement - specifies the document element
4585
+ * @param {Node} rootNode - specifies the content editable element
4586
+ * @param {string[]} formatNode - specifies the format node
4587
+ * @param {string[]} fontSize - specifies the font size
4588
+ * @param {string[]} fontName - specifies the font name.
4589
+ * @param {Node} documentNode - specifies the document node.
4590
+ * @returns {IToolbarStatus} - returns the toolbar status
4591
+ * @hidden
4592
+ * @deprecated
4593
+ */
4594
+ static get(docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
4595
+ let formatCollection = JSON.parse(JSON.stringify(statusCollection));
4596
+ const nodeCollection = JSON.parse(JSON.stringify(statusCollection));
4597
+ const nodeSelection = new NodeSelection();
4598
+ const range = nodeSelection.getRange(docElement);
4599
+ const nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
4600
+ nodeSelection.getSelectionNodeCollectionBr(range);
4601
+ const nodesLength = nodes.length;
4602
+ let isNodeChanged = false;
4603
+ for (let index = 0; index < nodes.length; index++) {
4604
+ while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
4605
+ nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
4606
+ (this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
4607
+ range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
4608
+ nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
4609
+ nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
4610
+ isNodeChanged = true;
4611
+ }
4612
+ if (isNodeChanged && nodes[index]) {
4613
+ nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
4614
+ isNodeChanged = false;
4615
+ }
4616
+ if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
4617
+ (nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
4618
+ nodes.splice(index, 1);
4619
+ index--;
4620
+ }
4621
+ }
4622
+ for (let index = 0; index < nodes.length; index++) {
4623
+ // eslint-disable-next-line max-len
4624
+ formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], rootNode, formatNode, fontSize, fontName);
4625
+ if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
4626
+ nodeCollection.bold = formatCollection.bold;
4627
+ }
4628
+ if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
4629
+ nodeCollection.insertcode = formatCollection.insertcode;
4630
+ }
4631
+ if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
4632
+ nodeCollection.italic = formatCollection.italic;
4633
+ }
4634
+ if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
4635
+ nodeCollection.underline = formatCollection.underline;
4636
+ }
4637
+ if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
4638
+ nodeCollection.strikethrough = formatCollection.strikethrough;
4639
+ }
4640
+ if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
4641
+ nodeCollection.superscript = formatCollection.superscript;
4642
+ }
4643
+ if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
4644
+ nodeCollection.subscript = formatCollection.subscript;
4645
+ }
4646
+ if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
4647
+ nodeCollection.fontcolor = formatCollection.fontcolor;
4648
+ }
4649
+ if (index === 0 && formatCollection.fontname) {
4650
+ nodeCollection.fontname = formatCollection.fontname;
4651
+ }
4652
+ else {
4653
+ nodeCollection.fontname = formatCollection.fontname === nodeCollection.fontname ? formatCollection.fontname : 'empty';
4654
+ }
4655
+ if (index === 0 && formatCollection.fontsize) {
4656
+ nodeCollection.fontsize = formatCollection.fontsize;
4657
+ }
4658
+ else {
4659
+ nodeCollection.fontsize = formatCollection.fontsize === nodeCollection.fontsize ? formatCollection.fontsize : 'empty';
4660
+ }
4661
+ if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
4662
+ nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
4663
+ }
4664
+ if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
4665
+ nodeCollection.orderedlist = formatCollection.orderedlist;
4666
+ }
4667
+ if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
4668
+ nodeCollection.unorderedlist = formatCollection.unorderedlist;
4669
+ }
4670
+ if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
4671
+ nodeCollection.alignments = formatCollection.alignments;
4672
+ }
4673
+ if (index === 0 && formatCollection.formats) {
4674
+ nodeCollection.formats = formatCollection.formats;
4675
+ }
4676
+ else {
4677
+ nodeCollection.formats = formatCollection.formats === nodeCollection.formats ? formatCollection.formats : 'empty';
4678
+ }
4679
+ if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
4680
+ nodeCollection.createlink = formatCollection.createlink;
4681
+ }
4682
+ if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
4683
+ nodeCollection.numberFormatList = formatCollection.numberFormatList;
4684
+ }
4685
+ if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
4686
+ nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
4687
+ }
4688
+ formatCollection = JSON.parse(JSON.stringify(statusCollection));
4689
+ }
4690
+ return nodeCollection;
4691
+ }
4692
+ static getImmediateBlockNode(node) {
4693
+ do {
4694
+ node = node.parentNode;
4695
+ } while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
4696
+ return node;
4697
+ }
4698
+ static getFormatParent(docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
4699
+ let isListUpdated = false;
4700
+ let isComplexListUpdated = false;
4701
+ if (targetNode.contains(node) ||
4702
+ (node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
4703
+ do {
4704
+ formatCollection = this.isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName);
4705
+ if (formatCollection.orderedlist || formatCollection.unorderedlist) {
4706
+ isListUpdated = true;
4707
+ }
4708
+ if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
4709
+ isComplexListUpdated = true;
4710
+ }
4711
+ node = node.parentNode;
4712
+ } while (node && (node !== targetNode));
4713
+ }
4714
+ return formatCollection;
4715
+ }
4716
+ static isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName) {
4717
+ if (!formatCollection.bold) {
4718
+ formatCollection.bold = IsFormatted.isBold(node);
4719
+ }
4720
+ if (!formatCollection.italic) {
4721
+ formatCollection.italic = IsFormatted.isItalic(node);
4722
+ }
4723
+ if (!formatCollection.underline) {
4724
+ formatCollection.underline = IsFormatted.isUnderline(node);
4725
+ }
4726
+ if (!formatCollection.strikethrough) {
4727
+ formatCollection.strikethrough = IsFormatted.isStrikethrough(node);
4728
+ }
4729
+ if (!formatCollection.superscript) {
4730
+ formatCollection.superscript = IsFormatted.isSuperscript(node);
4731
+ }
4732
+ if (!formatCollection.subscript) {
4733
+ formatCollection.subscript = IsFormatted.isSubscript(node);
4734
+ }
4735
+ if (!formatCollection.fontcolor) {
4736
+ formatCollection.fontcolor = this.isFontColor(docElement, node);
4737
+ }
4738
+ if (!formatCollection.fontname) {
4739
+ formatCollection.fontname = this.isFontName(docElement, node, fontName);
4740
+ }
4741
+ if (!formatCollection.fontsize) {
4742
+ formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
4743
+ }
4744
+ if (!formatCollection.backgroundcolor) {
4745
+ formatCollection.backgroundcolor = this.isBackgroundColor(node);
4746
+ }
4747
+ if (!formatCollection.orderedlist && !isListUpdated) {
4748
+ formatCollection.orderedlist = this.isOrderedList(node);
4749
+ }
4750
+ if (!formatCollection.unorderedlist && !isListUpdated) {
4751
+ formatCollection.unorderedlist = this.isUnorderedList(node);
4752
+ }
4753
+ if (!formatCollection.alignments) {
4754
+ formatCollection.alignments = this.isAlignment(node);
4755
+ }
4756
+ if (!formatCollection.formats) {
4757
+ formatCollection.formats = this.isFormats(node, formatNode);
4758
+ if (formatCollection.formats === 'pre') {
4759
+ formatCollection.insertcode = true;
4760
+ }
4761
+ }
4762
+ if (!formatCollection.createlink) {
4763
+ formatCollection.createlink = this.isLink(node);
4764
+ }
4765
+ if (!formatCollection.numberFormatList && !isComplexListUpdated) {
4766
+ formatCollection.numberFormatList = this.isNumberFormatList(node);
4767
+ }
4768
+ if (!formatCollection.bulletFormatList && !isComplexListUpdated) {
4769
+ formatCollection.bulletFormatList = this.isBulletFormatList(node);
4770
+ }
4771
+ return formatCollection;
4772
+ }
4773
+ static isFontColor(docElement, node) {
4774
+ let color = node.style && node.style.color;
4775
+ if ((color === null || color === undefined || color === '') && node.nodeType !== 3) {
4776
+ color = this.getComputedStyle(docElement, node, 'color');
4777
+ }
4778
+ if (color !== null && color !== '' && color !== undefined) {
4779
+ return color;
4780
+ }
4781
+ else {
4782
+ return null;
4783
+ }
4784
+ }
4785
+ static isLink(node) {
4786
+ if (node.nodeName.toLocaleLowerCase() === 'a') {
4787
+ return true;
4788
+ }
4789
+ else {
4790
+ return false;
4791
+ }
4792
+ }
4793
+ static isBackgroundColor(node) {
4794
+ const backColor = node.style && node.style.backgroundColor;
4795
+ if (backColor !== null && backColor !== '' && backColor !== undefined) {
4796
+ return backColor;
4797
+ }
4798
+ else {
4799
+ return null;
4800
+ }
4801
+ }
4802
+ static isFontSize(docElement, node, fontSize) {
4803
+ let size = node.style && node.style.fontSize;
4804
+ if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
4805
+ node.parentElement.classList.contains('e-content')) {
4806
+ size = this.getComputedStyle(docElement, node, 'font-size');
4807
+ }
4808
+ if ((size !== null && size !== '' && size !== undefined)
4809
+ && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
4810
+ return size;
4811
+ }
4812
+ else {
4813
+ return null;
4814
+ }
4815
+ }
4816
+ static isFontName(docElement, node, fontName) {
4817
+ let name = node.style && node.style.fontFamily;
4818
+ if ((name === null || name === undefined || name === '') && node.nodeType !== 3) {
4819
+ name = this.getComputedStyle(docElement, node, 'font-family');
4820
+ }
4821
+ let index = null;
4822
+ if ((name !== null && name !== '' && name !== undefined)
4823
+ && (fontName === null || fontName === undefined || (fontName.filter((value, pos) => {
4824
+ // eslint-disable-next-line
4825
+ const pattern = new RegExp(name, 'i');
4826
+ if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
4827
+ (value.split(',')[0] && !isNullOrUndefined(value.split(',')[0].trim().match(pattern)) &&
4828
+ value.split(',')[0].trim() === value.split(',')[0].trim().match(pattern)[0])) {
4829
+ index = pos;
4830
+ }
4831
+ }) && (index !== null)))) {
4832
+ // eslint-disable-next-line
4833
+ return (index !== null) ? fontName[index] : name.replace(/"/g, '');
4834
+ }
4835
+ else {
4836
+ return null;
4837
+ }
4838
+ }
4839
+ static isOrderedList(node) {
4840
+ if (node.nodeName.toLocaleLowerCase() === 'ol') {
4841
+ return true;
4842
+ }
4843
+ else {
4844
+ return false;
4845
+ }
4846
+ }
4847
+ static isUnorderedList(node) {
4848
+ if (node.nodeName.toLocaleLowerCase() === 'ul') {
4849
+ return true;
4850
+ }
4851
+ else {
4852
+ return false;
4853
+ }
4854
+ }
4855
+ static isAlignment(node) {
4856
+ const align = node.style && node.style.textAlign;
4857
+ if (align === 'left') {
4858
+ return 'justifyleft';
4859
+ }
4860
+ else if (align === 'center') {
4861
+ return 'justifycenter';
4862
+ }
4863
+ else if (align === 'right') {
4864
+ return 'justifyright';
4865
+ }
4866
+ else if (align === 'justify') {
4867
+ return 'justifyfull';
4868
+ }
4869
+ else {
4870
+ return null;
4871
+ }
4872
+ }
4873
+ static isFormats(node, formatNode) {
4874
+ if (((formatNode === undefined || formatNode === null)
4875
+ && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) > -1)
4876
+ || (formatNode !== null && formatNode !== undefined
4877
+ && formatNode.indexOf(node.nodeName.toLocaleLowerCase()) > -1)) {
4878
+ return node.nodeName.toLocaleLowerCase();
4879
+ }
4880
+ else {
4881
+ return null;
4882
+ }
4883
+ }
4884
+ static getComputedStyle(docElement, node, prop) {
4885
+ return docElement.defaultView.getComputedStyle(node, null).getPropertyValue(prop);
4886
+ }
4887
+ static isNumberFormatList(node) {
4888
+ const list = node.style && node.style.listStyleType;
4889
+ if (list === 'lower-alpha') {
4890
+ return 'Lower Alpha';
4891
+ }
4892
+ else if (list === 'number') {
4893
+ return 'Number';
4894
+ }
4895
+ else if (list === 'upper-alpha') {
4896
+ return 'Upper Alpha';
4897
+ }
4898
+ else if (list === 'lower-roman') {
4899
+ return 'Lower Roman';
4900
+ }
4901
+ else if (list === 'upper-roman') {
4902
+ return 'Upper Roman';
4903
+ }
4904
+ else if (list === 'lower-greek') {
4905
+ return 'Lower Greek';
4906
+ }
4907
+ else if (list === 'none') {
4908
+ return 'None';
4909
+ }
4910
+ else if (this.isOrderedList(node)) {
4911
+ return true;
4912
+ }
4913
+ else {
4914
+ return null;
4915
+ }
4916
+ }
4917
+ static isBulletFormatList(node) {
4918
+ const list = node.style && node.style.listStyleType;
4919
+ if (list === 'circle') {
4920
+ return 'Circle';
4921
+ }
4922
+ else if (list === 'square') {
4923
+ return 'Square';
4924
+ }
4925
+ else if (list === 'none') {
4926
+ return 'None';
4927
+ }
4928
+ else if (list === 'disc') {
4929
+ return 'Disc';
4930
+ }
4931
+ else if (this.isUnorderedList(node)) {
4932
+ return true;
4933
+ }
4934
+ else {
4935
+ return null;
4936
+ }
4937
+ }
4938
+ }
4939
+
3594
4940
  /**
3595
4941
  * `Toolbar renderer` module is used to render toolbar in RichTextEditor.
3596
4942
  *
@@ -3648,7 +4994,7 @@ class ToolbarRenderer {
3648
4994
  }
3649
4995
  }
3650
4996
  dropDownSelected(args) {
3651
- this.parent.notify(dropDownSelect, args);
4997
+ this.parent.notify(dropDownSelect, { element: args.element, item: args.item, originalEvent: args.event });
3652
4998
  this.destroyTooltip();
3653
4999
  }
3654
5000
  beforeDropDownItemRender(args) {
@@ -3672,6 +5018,9 @@ class ToolbarRenderer {
3672
5018
  break;
3673
5019
  }
3674
5020
  }
5021
+ if (args.target.querySelector('.e-active')) {
5022
+ args.cancel = true;
5023
+ }
3675
5024
  }
3676
5025
  dropDownOpen(args) {
3677
5026
  if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1 && !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-merge')) &&
@@ -3692,19 +5041,6 @@ class ToolbarRenderer {
3692
5041
  addClass([listEle[1], listEle[2]], 'e-disabled');
3693
5042
  }
3694
5043
  }
3695
- if (this.parent.showTooltip) {
3696
- this.dropdownTooltip = new Tooltip({
3697
- target: '[aria-owns="' + this.parent.getID() + '"].e-rte-elements [title]',
3698
- showTipPointer: true,
3699
- openDelay: 400,
3700
- opensOn: 'Hover',
3701
- beforeRender: this.tooltipBeforeRender.bind(this),
3702
- cssClass: this.parent.getCssClass(),
3703
- windowCollision: true,
3704
- position: 'BottomCenter'
3705
- });
3706
- this.dropdownTooltip.appendTo(args.element);
3707
- }
3708
5044
  this.parent.notify(selectionSave, args);
3709
5045
  }
3710
5046
  dropDownClose(args) {
@@ -3849,11 +5185,22 @@ class ToolbarRenderer {
3849
5185
  }
3850
5186
  //Formats preselect
3851
5187
  if (args.items[0].command === 'Formats' || args.items[0].command === 'Font') {
5188
+ const fontName = [];
5189
+ const formats = [];
5190
+ this.parent.format.types.forEach((item) => {
5191
+ formats.push(item.value.toLocaleLowerCase());
5192
+ });
5193
+ this.parent.fontFamily.items.forEach((item) => {
5194
+ fontName.push(item.value);
5195
+ });
5196
+ const toolbarStatus = ToolbarStatus.get(this.parent.contentModule.getDocument(), this.parent.contentModule.getEditPanel(), formats, null, fontName);
3852
5197
  for (let index = 0; index < args.element.childNodes.length; index++) {
3853
5198
  const divNode = this.parent.createElement('div');
3854
5199
  divNode.innerHTML = dropDown.content.trim();
3855
- if (divNode.textContent.trim() !== ''
3856
- && args.element.childNodes[index].textContent.trim() === divNode.textContent.trim()) {
5200
+ if ((divNode.textContent.trim() !== ''
5201
+ && args.element.childNodes[index].textContent.trim() === divNode.textContent.trim()) ||
5202
+ ((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))
5203
+ || (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)))) {
3857
5204
  if (!args.element.childNodes[index].classList.contains('e-active')) {
3858
5205
  addClass([args.element.childNodes[index]], 'e-active');
3859
5206
  }
@@ -4037,6 +5384,8 @@ class ToolbarRenderer {
4037
5384
  target: colorPicker.element.parentElement, cssClass: css,
4038
5385
  enablePersistence: this.parent.enablePersistence, enableRtl: this.parent.enableRtl,
4039
5386
  beforeOpen: (dropDownArgs) => {
5387
+ colorPicker.inline = true;
5388
+ colorPicker.dataBind();
4040
5389
  if (proxy.parent.readonly || !proxy.parent.enabled) {
4041
5390
  dropDownArgs.cancel = true;
4042
5391
  return;
@@ -4174,18 +5523,14 @@ class ToolbarRenderer {
4174
5523
  const colorPicker = new ColorPicker({
4175
5524
  enablePersistence: this.parent.enablePersistence,
4176
5525
  enableRtl: this.parent.enableRtl,
4177
- inline: true,
4178
- value: null,
4179
- cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass + ' ' + 'e-rte-picker-init',
5526
+ inline: false,
5527
+ value: '#fff',
4180
5528
  created: () => {
4181
5529
  const value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
4182
- colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
4183
- colorPicker.value = value;
5530
+ colorPicker.setProperties({ value: value });
4184
5531
  },
4185
5532
  mode: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.mode : proxy.parent.fontColor.mode),
4186
5533
  modeSwitcher: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.modeSwitcher : proxy.parent.fontColor.modeSwitcher),
4187
- presetColors: (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode : this.parent.fontColor.colorCode,
4188
- columns: (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns,
4189
5534
  beforeTileRender: (args) => {
4190
5535
  args.element.classList.add(CLS_COLOR_PALETTE);
4191
5536
  args.element.classList.add(CLS_CUSTOM_TILE);
@@ -4230,6 +5575,10 @@ class ToolbarRenderer {
4230
5575
  }
4231
5576
  });
4232
5577
  colorPicker.isStringTemplate = true;
5578
+ colorPicker.columns = (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns;
5579
+ colorPicker.presetColors = (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode :
5580
+ this.parent.fontColor.colorCode;
5581
+ colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
4233
5582
  colorPicker.createElement = this.parent.createElement;
4234
5583
  colorPicker.appendTo(document.getElementById(args.target));
4235
5584
  return colorPicker;
@@ -4427,15 +5776,16 @@ class BaseToolbar {
4427
5776
  for (let num = 0; num < items.length; num++) {
4428
5777
  const tooltipText = items[num].tooltipText;
4429
5778
  let shortCutKey;
5779
+ const isMacDev = window.navigator.platform.toLocaleLowerCase().includes('mac');
4430
5780
  if (windowKeys[`${tooltipText}`]) {
4431
- shortCutKey = window.navigator.platform.toLocaleLowerCase().includes('mac') ? windowKeys[`${tooltipText}`].replace('Ctrl', 'Cmd') : windowKeys[`${tooltipText}`];
5781
+ shortCutKey = isMacDev ? windowKeys[`${tooltipText}`].replace('Ctrl+', '').replace('Shift+', '⇧').replace('Alt+', '⌥') : windowKeys[`${tooltipText}`];
4432
5782
  }
4433
5783
  else {
4434
5784
  shortCutKey = tooltipText;
4435
5785
  }
4436
5786
  if (shortCutKey) {
4437
5787
  if (!(items[num].command === "Images" && items[num].subCommand === "InsertLink")) {
4438
- items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
5788
+ items[num].tooltipText = (tooltipText !== shortCutKey) ? (isMacDev) ? shortCutKey : tooltipText + ' (' + shortCutKey + ')' : tooltipText;
4439
5789
  }
4440
5790
  }
4441
5791
  }
@@ -4485,28 +5835,10 @@ class DropDownButtons {
4485
5835
  if (item.cssClass) {
4486
5836
  addClass([args.element], item.cssClass);
4487
5837
  }
4488
- if (item.command === 'Images' || item.command === 'Videos' || item.command === 'Audios' || item.command === 'Table') {
4489
- args.element.setAttribute('title', getQuickToolbarTooltipText(item.text) !== '' ? getQuickToolbarTooltipText(item.text) : item.text);
4490
- }
4491
5838
  if (item.command === 'Alignments' || item.subCommand === 'JustifyLeft'
4492
5839
  || item.subCommand === 'JustifyRight' || item.subCommand === 'JustifyCenter') {
4493
5840
  args.element.setAttribute('title', getTooltipText(item.subCommand.toLocaleLowerCase(), this.locator));
4494
5841
  }
4495
- if (item.command === 'Formats') {
4496
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.subCommand.toLocaleLowerCase(), this.locator, formatsLocale));
4497
- }
4498
- if (item.command === 'Font') {
4499
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, fontNameLocale) : item.text);
4500
- }
4501
- if (item.subCommand === 'BulletFormatList') {
4502
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, bulletFormatListLocale) : item.text);
4503
- }
4504
- if (item.subCommand === 'NumberFormatList') {
4505
- args.element.setAttribute('title', (getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale)) !== '' ? getTooltipTextDropdownItems(item.text.toLocaleLowerCase(), this.locator, numberFormatListLocale) : item.text);
4506
- }
4507
- if (item.subCommand === 'FontSize') {
4508
- args.element.setAttribute('title', getTooltipTextDropdownItems(item.value.toLocaleLowerCase(), null, null, this.parent));
4509
- }
4510
5842
  }
4511
5843
  dropdownContent(width, type, content) {
4512
5844
  return ('<span style="display: inline-flex;' + 'width:' + ((type === 'quick') ? 'auto' : width) + '" >' +
@@ -4807,7 +6139,7 @@ class DropDownButtons {
4807
6139
  if (targetElement.classList.contains(CLS_DROPDOWN_BTN)) {
4808
6140
  return;
4809
6141
  }
4810
- this.tableRowsDropDown = this.toolbarRenderer.renderDropDownButton({
6142
+ this.tableCellDropDown = this.toolbarRenderer.renderDropDownButton({
4811
6143
  iconCss: 'e-table-cell e-icons',
4812
6144
  cssClass: CLS_DROPDOWN_POPUP + ' ' + CLS_DROPDOWN_ITEMS + ' ' + CLS_QUICK_DROPDOWN,
4813
6145
  itemName: 'TableCell',
@@ -4915,6 +6247,10 @@ class DropDownButtons {
4915
6247
  this.removeDropDownClasses(this.tableColumnsDropDown.element);
4916
6248
  this.tableColumnsDropDown.destroy();
4917
6249
  }
6250
+ if (this.tableCellDropDown) {
6251
+ this.removeDropDownClasses(this.tableCellDropDown.element);
6252
+ this.tableCellDropDown.destroy();
6253
+ }
4918
6254
  if (this.tableCellVerticalAlignDropDown) {
4919
6255
  this.removeDropDownClasses(this.tableCellVerticalAlignDropDown.element);
4920
6256
  this.tableCellVerticalAlignDropDown.destroy();
@@ -4968,7 +6304,7 @@ class DropDownButtons {
4968
6304
  const dropDownObj = [
4969
6305
  this.formatDropDown, this.fontNameDropDown, this.fontSizeDropDown, this.alignDropDown, this.imageAlignDropDown,
4970
6306
  this.displayDropDown, this.numberFormatListDropDown, this.bulletFormatListDropDown, this.tableRowsDropDown,
4971
- this.tableColumnsDropDown, this.tableCellVerticalAlignDropDown
6307
+ this.tableColumnsDropDown, this.tableCellDropDown, this.tableCellVerticalAlignDropDown
4972
6308
  ];
4973
6309
  for (let i = 0; i < dropDownObj.length; i++) {
4974
6310
  this.updateCss(dropDownObj[i], e);
@@ -4986,7 +6322,7 @@ class DropDownButtons {
4986
6322
  this.parent.on(bindCssClass, this.setCssClass, this);
4987
6323
  }
4988
6324
  onIframeMouseDown() {
4989
- if (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0) {
6325
+ 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)) {
4990
6326
  dispatchEvent(document, 'mousedown');
4991
6327
  }
4992
6328
  }
@@ -6356,26 +7692,19 @@ class BaseQuickToolbar {
6356
7692
  }
6357
7693
  target = isAligned ? e.target : target;
6358
7694
  let targetOffsetLeft;
6359
- let currentOffsetWidth;
6360
7695
  if (!isNullOrUndefined(closest(target, 'table'))) {
6361
7696
  targetOffsetLeft = target.offsetLeft;
6362
- let parentTable = closest(target, 'table');
6363
- let checkOffSetParentWidth = false;
6364
- if (!isNullOrUndefined(closest(parentTable, 'TD'))) {
6365
- checkOffSetParentWidth = true;
6366
- }
7697
+ let parentTable = closest(target.parentElement, 'td');
6367
7698
  while (!isNullOrUndefined(parentTable)) {
6368
7699
  targetOffsetLeft += parentTable.offsetLeft;
6369
- currentOffsetWidth = checkOffSetParentWidth ? parentTable.offsetWidth : target.offsetWidth;
6370
7700
  parentTable = closest(parentTable.parentElement, 'table');
6371
7701
  }
6372
7702
  }
6373
7703
  else {
6374
- currentOffsetWidth = target.offsetWidth;
6375
7704
  targetOffsetLeft = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft;
6376
7705
  }
6377
- if (currentOffsetWidth > e.popWidth) {
6378
- x = (currentOffsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + targetOffsetLeft;
7706
+ if (target.offsetWidth > e.popWidth) {
7707
+ x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + targetOffsetLeft;
6379
7708
  }
6380
7709
  else {
6381
7710
  x = e.parentData.left + targetOffsetLeft;
@@ -6514,6 +7843,7 @@ class BaseQuickToolbar {
6514
7843
  target: '#' + this.element.id + ' [title]',
6515
7844
  openDelay: 400,
6516
7845
  showTipPointer: true,
7846
+ beforeRender: this.tooltipBeforeRender.bind(this),
6517
7847
  windowCollision: true,
6518
7848
  position: 'BottomCenter',
6519
7849
  cssClass: this.parent.getCssClass()
@@ -6574,6 +7904,11 @@ class BaseQuickToolbar {
6574
7904
  }
6575
7905
  });
6576
7906
  }
7907
+ tooltipBeforeRender(args) {
7908
+ if (args.target.querySelector('.e-active')) {
7909
+ args.cancel = true;
7910
+ }
7911
+ }
6577
7912
  /**
6578
7913
  * hidePopup method
6579
7914
  *
@@ -6606,9 +7941,6 @@ class BaseQuickToolbar {
6606
7941
  this.parent.enableToolbarItem(this.parent.toolbarSettings.items);
6607
7942
  }
6608
7943
  }
6609
- if (this.parent.showTooltip && !isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
6610
- this.parent.notify(destroyTooltip, { args: event });
6611
- }
6612
7944
  this.removeEleFromDOM();
6613
7945
  this.isRendered = false;
6614
7946
  }
@@ -6817,6 +8149,7 @@ class PopupRenderer {
6817
8149
  */
6818
8150
  class QuickToolbar {
6819
8151
  constructor(parent, locator) {
8152
+ this.debounceTimeout = 1000;
6820
8153
  this.parent = parent;
6821
8154
  this.locator = locator;
6822
8155
  this.renderFactory = this.locator.getService('rendererFactory');
@@ -7007,7 +8340,7 @@ class QuickToolbar {
7007
8340
  clearTimeout(this.deBouncer);
7008
8341
  this.deBouncer = window.setTimeout(() => {
7009
8342
  this.showInlineQTBar(x, y, target);
7010
- }, 1000);
8343
+ }, this.debounceTimeout);
7011
8344
  }
7012
8345
  mouseUpHandler(e) {
7013
8346
  if (this.parent.inlineMode.enable && (!Browser.isDevice || isIDevice())) {
@@ -7057,7 +8390,7 @@ class QuickToolbar {
7057
8390
  this.offsetY = pageYOffset(args, this.parent.element, this.parent.iframeSettings.enable);
7058
8391
  const range = this.parent.getRange();
7059
8392
  if ((range.endContainer.parentElement.tagName === range.startContainer.parentElement.tagName && (range.startContainer.parentElement.tagName === 'A' && range.endContainer.parentElement.tagName === 'A')) ||
7060
- (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')) ||
8393
+ (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')) ||
7061
8394
  (this.parent.getRange().startOffset === this.parent.getRange().endOffset)) {
7062
8395
  return;
7063
8396
  }
@@ -7065,6 +8398,15 @@ class QuickToolbar {
7065
8398
  this.textQTBar.showPopup(this.offsetX, this.offsetY, target, 'text');
7066
8399
  }
7067
8400
  }
8401
+ isEmbedVidElem(target) {
8402
+ if ((target && target.nodeType !== 3 && target.nodeName !== 'BR' && (target.classList && target.classList.contains(CLS_VID_CLICK_ELEM))) ||
8403
+ (target && target.nodeName === 'IFRAME')) {
8404
+ return true;
8405
+ }
8406
+ else {
8407
+ return false;
8408
+ }
8409
+ }
7068
8410
  keyDownHandler(e) {
7069
8411
  const preventHide = e.args.altKey;
7070
8412
  if (this.parent.inlineMode.enable && e.args.metaKey && e.args.keyCode === 65) {
@@ -7119,7 +8461,7 @@ class QuickToolbar {
7119
8461
  clearTimeout(this.deBouncer);
7120
8462
  this.deBouncer = window.setTimeout(() => {
7121
8463
  this.onSelectionChange(e);
7122
- }, 1000);
8464
+ }, this.debounceTimeout);
7123
8465
  }
7124
8466
  onSelectionChange(e) {
7125
8467
  if (!isNullOrUndefined(select('.' + CLS_INLINE_POP, document.body))) {
@@ -7755,228 +9097,6 @@ class MarkdownSelection {
7755
9097
  }
7756
9098
  }
7757
9099
 
7758
- /**
7759
- * Defines common util methods used by Rich Text Editor.
7760
- */
7761
- const inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
7762
- 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
7763
- 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
7764
- 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
7765
- 'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
7766
- /**
7767
- * @returns {void}
7768
- * @hidden
7769
- */
7770
- function isIDevice$1() {
7771
- let result = false;
7772
- if (Browser.isDevice && Browser.isIos) {
7773
- result = true;
7774
- }
7775
- return result;
7776
- }
7777
- /**
7778
- * @param {Element} editableElement - specifies the editable element.
7779
- * @param {string} selector - specifies the string values.
7780
- * @returns {void}
7781
- * @hidden
7782
- */
7783
- function setEditFrameFocus(editableElement, selector) {
7784
- if (editableElement.nodeName === 'BODY' && !isNullOrUndefined(selector)) {
7785
- const iframe = top.window.document.querySelector(selector);
7786
- if (!isNullOrUndefined(iframe)) {
7787
- iframe.contentWindow.focus();
7788
- }
7789
- }
7790
- }
7791
- /**
7792
- * @param {string} value - specifies the string value
7793
- * @param {string} enterAction - specifies the enter key action API
7794
- * @returns {void}
7795
- * @hidden
7796
- */
7797
- function updateTextNode$1(value, enterAction) {
7798
- const tempNode = document.createElement('div');
7799
- tempNode.innerHTML = value;
7800
- tempNode.setAttribute('class', 'tempDiv');
7801
- const resultElm = document.createElement('div');
7802
- const childNodes = tempNode.childNodes;
7803
- if (childNodes.length > 0) {
7804
- let isPreviousInlineElem;
7805
- let previousParent;
7806
- let paraElm;
7807
- while (tempNode.firstChild) {
7808
- if ((tempNode.firstChild.nodeName === '#text' &&
7809
- (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
7810
- inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
7811
- if (!isPreviousInlineElem) {
7812
- if (enterAction === 'BR') {
7813
- resultElm.appendChild(tempNode.firstChild);
7814
- previousParent = resultElm;
7815
- }
7816
- else {
7817
- paraElm = createElement('p');
7818
- resultElm.appendChild(paraElm);
7819
- paraElm.appendChild(tempNode.firstChild);
7820
- previousParent = paraElm;
7821
- isPreviousInlineElem = true;
7822
- }
7823
- }
7824
- else {
7825
- previousParent.appendChild(tempNode.firstChild);
7826
- previousParent = paraElm;
7827
- isPreviousInlineElem = true;
7828
- }
7829
- }
7830
- else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
7831
- (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
7832
- detach(tempNode.firstChild);
7833
- }
7834
- else {
7835
- resultElm.appendChild(tempNode.firstChild);
7836
- isPreviousInlineElem = false;
7837
- }
7838
- }
7839
- const tableElm = resultElm.querySelectorAll('table');
7840
- for (let i = 0; i < tableElm.length; i++) {
7841
- if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table')) {
7842
- tableElm[i].classList.add('e-rte-paste-table');
7843
- if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
7844
- tableElm[i].classList.remove('e-rte-paste-word-table');
7845
- continue; // Skiping the removal of the border if the source is from word.
7846
- }
7847
- else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
7848
- tableElm[i].classList.remove('e-rte-paste-excel-table');
7849
- if (tableElm[i].getAttribute('border') === '0') {
7850
- tableElm[i].removeAttribute('border');
7851
- }
7852
- const tdElm = tableElm[i].querySelectorAll('td');
7853
- for (let j = 0; j < tdElm.length; j++) {
7854
- if (tdElm[j].style.borderLeft === 'none') {
7855
- tdElm[j].style.removeProperty('border-left');
7856
- }
7857
- if (tdElm[j].style.borderRight === 'none') {
7858
- tdElm[j].style.removeProperty('border-right');
7859
- }
7860
- if (tdElm[j].style.borderBottom === 'none') {
7861
- tdElm[j].style.removeProperty('border-bottom');
7862
- }
7863
- if (tdElm[j].style.borderTop === 'none') {
7864
- tdElm[j].style.removeProperty('border-top');
7865
- }
7866
- if (tdElm[j].style.border === 'none') {
7867
- tdElm[j].style.removeProperty('border');
7868
- }
7869
- }
7870
- }
7871
- else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
7872
- tableElm[i].classList.remove('e-rte-paste-onenote-table');
7873
- continue;
7874
- }
7875
- }
7876
- }
7877
- const imageElm = resultElm.querySelectorAll('img');
7878
- for (let i = 0; i < imageElm.length; i++) {
7879
- if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
7880
- continue; // Should not add the class if the image is Broken.
7881
- }
7882
- if (!imageElm[i].classList.contains('e-rte-image')) {
7883
- imageElm[i].classList.add('e-rte-image');
7884
- }
7885
- if (!(imageElm[i].classList.contains('e-imginline') ||
7886
- imageElm[i].classList.contains('e-imgbreak'))) {
7887
- imageElm[i].classList.add('e-imginline');
7888
- }
7889
- }
7890
- }
7891
- return resultElm.innerHTML;
7892
- }
7893
- /**
7894
- * @param {Node} startChildNodes - specifies the node
7895
- * @returns {void}
7896
- * @hidden
7897
- */
7898
- function getLastTextNode(startChildNodes) {
7899
- let finalNode = startChildNodes;
7900
- do {
7901
- if (finalNode.childNodes.length > 0) {
7902
- finalNode = finalNode.childNodes[0];
7903
- }
7904
- } while (finalNode.childNodes.length > 0);
7905
- return finalNode;
7906
- }
7907
- /**
7908
- * @returns {void}
7909
- * @hidden
7910
- */
7911
- function getDefaultHtmlTbStatus() {
7912
- return {
7913
- bold: false,
7914
- italic: false,
7915
- subscript: false,
7916
- superscript: false,
7917
- strikethrough: false,
7918
- orderedlist: false,
7919
- unorderedlist: false,
7920
- numberFormatList: false,
7921
- bulletFormatList: false,
7922
- underline: false,
7923
- alignments: null,
7924
- backgroundcolor: null,
7925
- fontcolor: null,
7926
- fontname: null,
7927
- fontsize: null,
7928
- formats: null,
7929
- createlink: false,
7930
- insertcode: false
7931
- };
7932
- }
7933
- /**
7934
- * @returns {void}
7935
- * @hidden
7936
- */
7937
- function getDefaultMDTbStatus() {
7938
- return {
7939
- bold: false,
7940
- italic: false,
7941
- subscript: false,
7942
- superscript: false,
7943
- strikethrough: false,
7944
- orderedlist: false,
7945
- uppercase: false,
7946
- lowercase: false,
7947
- inlinecode: false,
7948
- unorderedlist: false,
7949
- formats: null
7950
- };
7951
- }
7952
- /**
7953
- * @param {Range} range - specifies the range
7954
- * @returns {void}
7955
- * @hidden
7956
- */
7957
- function nestedListCleanUp(range) {
7958
- if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
7959
- range.extractContents();
7960
- while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
7961
- (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
7962
- let emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
7963
- if (emptyLI.length > 0) {
7964
- emptyLI.forEach((item) => {
7965
- item.remove();
7966
- });
7967
- }
7968
- }
7969
- let liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
7970
- if (liElem.length > 0) {
7971
- liElem.forEach((item) => {
7972
- if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
7973
- item.style.listStyleType = "none";
7974
- }
7975
- });
7976
- }
7977
- }
7978
- }
7979
-
7980
9100
  /**
7981
9101
  * MarkdownToolbarStatus module for refresh the toolbar status
7982
9102
  */
@@ -8353,7 +9473,8 @@ class Formatter {
8353
9473
  this.saveData();
8354
9474
  }
8355
9475
  self.isBlur = false;
8356
- if (isNullOrUndefined(saveSelection) || isNullOrUndefined(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption")) ? true : !(closest(saveSelection.range.startContainer.parentElement, ".e-img-caption").getAttribute("contenteditable") == "false")) {
9476
+ 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")));
9477
+ 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")))) {
8357
9478
  self.contentModule.getEditPanel().focus();
8358
9479
  }
8359
9480
  if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
@@ -10446,844 +11567,303 @@ class MarkdownFormatter extends Formatter {
10446
11567
  this.updateFormatter(this.element, document, options.options);
10447
11568
  }
10448
11569
  }
10449
- initialize() {
10450
- this.keyConfig = markdownKeyConfig;
10451
- this.formatTags = markdownFormatTags;
10452
- this.listTags = markdownListsTags;
10453
- this.selectionTags = markdownSelectionTags;
10454
- }
10455
- /**
10456
- * Update the formatter of RichTextEditor
10457
- *
10458
- * @param {Element} editElement - specifies the edit element.
10459
- * @param {Document} doc - specifies the document.
10460
- * @param {number} options - specifies the options
10461
- * @returns {void}
10462
- * @hidden
10463
- * @deprecated
10464
- */
10465
- updateFormatter(editElement, doc, options) {
10466
- if (editElement) {
10467
- this.editorManager = new MarkdownParser({
10468
- element: editElement,
10469
- formatTags: this.formatTags,
10470
- listTags: this.listTags,
10471
- selectionTags: this.selectionTags,
10472
- options: options
10473
- });
10474
- }
10475
- }
10476
- }
10477
-
10478
- /**
10479
- * Markdown module is used to render Rich Text Editor as Markdown editor content
10480
- *
10481
- * @hidden
10482
- * @deprecated
10483
- */
10484
- class MarkdownRender {
10485
- /**
10486
- * Constructor for content renderer module
10487
- *
10488
- * @param {IRichTextEditor} parent - specifies the parent.
10489
- */
10490
- constructor(parent) {
10491
- this.parent = parent;
10492
- }
10493
- /**
10494
- * The function is used to render Rich Text Editor content div
10495
- *
10496
- * @returns {void}
10497
- * @hidden
10498
- * @deprecated
10499
- */
10500
- renderPanel() {
10501
- const rteObj = this.parent;
10502
- const div = this.parent.createElement('div', { id: this.parent.getID() + '_view', className: 'e-rte-content' });
10503
- this.editableElement = this.parent.createElement('textarea', {
10504
- className: 'e-content',
10505
- id: this.parent.getID() + '_editable-content',
10506
- attrs: { 'aria-labelledby': this.parent.getID() + '_view' }
10507
- });
10508
- div.appendChild(this.editableElement);
10509
- this.setPanel(div);
10510
- rteObj.element.appendChild(div);
10511
- }
10512
- /**
10513
- * Get the content div element of RichTextEditor
10514
- *
10515
- * @returns {Element} - specifies the element
10516
- * @hidden
10517
- * @deprecated
10518
- */
10519
- getPanel() {
10520
- return this.contentPanel;
10521
- }
10522
- /**
10523
- * Get the editable element of RichTextEditor
10524
- *
10525
- * @returns {Element} - specifies the element
10526
- * @hidden
10527
- * @deprecated
10528
- */
10529
- getEditPanel() {
10530
- return this.editableElement;
10531
- }
10532
- /**
10533
- * Returns the text content as string.
10534
- *
10535
- * @returns {string} - specifies the string values.
10536
- */
10537
- getText() {
10538
- return this.getEditPanel().value;
10539
- }
10540
- /**
10541
- * Set the content div element of RichTextEditor
10542
- *
10543
- * @param {Element} panel - specifies the element.
10544
- * @returns {void}
10545
- * @hidden
10546
- * @deprecated
10547
- */
10548
- setPanel(panel) {
10549
- this.contentPanel = panel;
10550
- }
10551
- /**
10552
- * Get the document of RichTextEditor
10553
- *
10554
- * @returns {void}
10555
- * @hidden
10556
- * @deprecated
10557
- */
10558
- getDocument() {
10559
- return this.getEditPanel().ownerDocument;
10560
- }
10561
- }
10562
-
10563
- /**
10564
- * `MarkdownEditor` module is used to markdown editor
10565
- */
10566
- class MarkdownEditor {
10567
- constructor(parent, serviceLocator) {
10568
- this.parent = parent;
10569
- this.locator = serviceLocator;
10570
- this.renderFactory = this.locator.getService('rendererFactory');
10571
- this.addEventListener();
10572
- }
10573
- /**
10574
- * Destroys the Markdown.
10575
- *
10576
- * @function destroy
10577
- * @returns {void}
10578
- * @hidden
10579
- * @deprecated
10580
- */
10581
- destroy() {
10582
- if (isNullOrUndefined(this.parent)) {
10583
- return;
10584
- }
10585
- this.removeEventListener();
10586
- }
10587
- moduleDestroy() {
10588
- this.parent = null;
10589
- this.toolbarUpdate.parent = null;
10590
- }
10591
- addEventListener() {
10592
- if (this.parent.isDestroyed) {
10593
- return;
10594
- }
10595
- this.saveSelection = new MarkdownSelection();
10596
- this.parent.on(initialLoad, this.instantiateRenderer, this);
10597
- this.parent.on(initialEnd, this.render, this);
10598
- this.parent.on(modelChanged, this.onPropertyChanged, this);
10599
- this.parent.on(markdownToolbarClick, this.onToolbarClick, this);
10600
- this.parent.on(destroy, this.destroy, this);
10601
- this.parent.on(selectAll$1, this.selectAll, this);
10602
- this.parent.on(getSelectedHtml, this.getSelectedHtml, this);
10603
- this.parent.on(selectionSave, this.onSelectionSave, this);
10604
- this.parent.on(selectionRestore, this.onSelectionRestore, this);
10605
- this.parent.on(readOnlyMode, this.updateReadOnly, this);
10606
- this.parent.on(moduleDestroy, this.moduleDestroy, this);
10607
- }
10608
- updateReadOnly() {
10609
- if (this.parent.readonly) {
10610
- this.parent.contentModule.getEditPanel().setAttribute('readonly', 'readonly');
10611
- addClass([this.parent.element], CLS_RTE_READONLY);
10612
- }
10613
- else {
10614
- this.parent.contentModule.getEditPanel().removeAttribute('readonly');
10615
- removeClass([this.parent.element], CLS_RTE_READONLY);
10616
- }
10617
- }
10618
- onSelectionSave() {
10619
- const textArea = this.parent.contentModule.getEditPanel();
10620
- this.saveSelection.save(textArea.selectionStart, textArea.selectionEnd);
10621
- }
10622
- // eslint-disable-next-line
10623
- onSelectionRestore(e) {
10624
- this.contentRenderer.getEditPanel().focus();
10625
- const textArea = this.parent.contentModule.getEditPanel();
10626
- this.saveSelection.restore(textArea);
10627
- }
10628
- onToolbarClick(args) {
10629
- const item = args.item;
10630
- const textArea = this.parent.contentModule.getEditPanel();
10631
- if (item.command !== 'Formats') {
10632
- textArea.focus();
10633
- }
10634
- const startOffset = textArea.selectionStart;
10635
- const endOffset = textArea.selectionEnd;
10636
- const text = textArea.value.substring(startOffset, endOffset);
10637
- switch (item.subCommand) {
10638
- case 'Maximize':
10639
- this.parent.notify(enableFullScreen, { args: args });
10640
- break;
10641
- case 'Minimize':
10642
- this.parent.notify(disableFullScreen, { args: args });
10643
- break;
10644
- case 'CreateLink':
10645
- this.parent.notify(insertLink, { member: 'link', args: args, text: text, module: 'Markdown' });
10646
- break;
10647
- case 'Image':
10648
- this.parent.notify(insertImage, { member: 'image', args: args, text: text, module: 'Markdown' });
10649
- break;
10650
- case 'CreateTable': {
10651
- const tableConstant = {
10652
- 'headingText': this.parent.localeObj.getConstant('TableHeadingText'),
10653
- 'colText': this.parent.localeObj.getConstant('TableColText')
10654
- };
10655
- this.parent.formatter.process(this.parent, args, args.originalEvent, tableConstant);
10656
- break;
10657
- }
10658
- default:
10659
- this.parent.formatter.process(this.parent, args, args.originalEvent, null);
10660
- break;
10661
- }
10662
- }
10663
- instantiateRenderer() {
10664
- this.renderFactory.addRenderer(RenderType.Content, new MarkdownRender(this.parent));
10665
- }
10666
- removeEventListener() {
10667
- if (this.parent.isDestroyed) {
10668
- return;
10669
- }
10670
- this.parent.off(initialEnd, this.render);
10671
- this.parent.off(modelChanged, this.onPropertyChanged);
10672
- this.parent.off(destroy, this.destroy);
10673
- this.parent.off(markdownToolbarClick, this.onToolbarClick);
10674
- this.parent.off(initialLoad, this.instantiateRenderer);
10675
- this.parent.off(selectAll$1, this.selectAll);
10676
- this.parent.off(getSelectedHtml, this.getSelectedHtml);
10677
- this.parent.off(selectionSave, this.onSelectionSave);
10678
- this.parent.off(selectionRestore, this.onSelectionRestore);
10679
- this.parent.off(readOnlyMode, this.updateReadOnly);
10680
- this.parent.off(moduleDestroy, this.moduleDestroy);
10681
- }
10682
- render() {
10683
- this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
10684
- const editElement = this.contentRenderer.getEditPanel();
10685
- const option = { undoRedoSteps: this.parent.undoRedoSteps, undoRedoTimer: this.parent.undoRedoTimer };
10686
- if (isNullOrUndefined(this.parent.formatter)) {
10687
- this.parent.formatter = new MarkdownFormatter({
10688
- element: editElement,
10689
- options: option
10690
- });
10691
- }
10692
- else {
10693
- this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
10694
- }
10695
- if (this.parent.toolbarSettings.enable) {
10696
- this.toolbarUpdate = new MarkdownToolbarStatus(this.parent);
10697
- }
10698
- this.parent.notify(bindOnEnd, {});
10699
- }
10700
- /**
10701
- * Called internally if any of the property value changed.
10702
- *
10703
- * @param {RichTextEditorModel} e - specifies the editor model
10704
- * @returns {void}
10705
- * @hidden
10706
- * @deprecated
10707
- */
10708
- onPropertyChanged(e) {
10709
- // On property code change here
10710
- if (!isNullOrUndefined(e.newProp.formatter)) {
10711
- const editElement = this.contentRenderer.getEditPanel();
10712
- const option = { undoRedoSteps: this.parent.undoRedoSteps,
10713
- undoRedoTimer: this.parent.undoRedoTimer };
10714
- this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
10715
- }
10716
- }
10717
- /**
10718
- * For internal use only - Get the module name.
10719
- *
10720
- * @returns {void}
10721
- */
10722
- getModuleName() {
10723
- return 'markdownEditor';
10724
- }
10725
- /**
10726
- * For selecting all content in RTE
10727
- *
10728
- * @returns {void}
10729
- * @private
10730
- */
10731
- selectAll() {
10732
- this.parent.formatter.editorManager.markdownSelection.setSelection(this.parent.contentModule.getEditPanel(), 0, this.parent.contentModule.getEditPanel().value.length);
10733
- }
10734
- /**
10735
- * For get a selected text in RTE
10736
- *
10737
- * @param {NotifyArgs} e - specifies the arguments.
10738
- * @returns {void}
10739
- * @private
10740
- */
10741
- getSelectedHtml(e) {
10742
- e.callBack(this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()));
10743
- }
10744
- }
10745
-
10746
- /**
10747
- * Constant values for EditorManager
10748
- */
10749
- /**
10750
- * Image plugin events
10751
- *
10752
- * @hidden
10753
- */
10754
- const IMAGE = 'INSERT-IMAGE';
10755
- const AUDIO = 'INSERT-AUDIO';
10756
- const VIDEO = 'INSERT-VIDEO';
10757
- const TABLE = 'INSERT-TABLE';
10758
- const LINK = 'INSERT-LINK';
10759
- const INSERT_ROW = 'INSERT-ROW';
10760
- const INSERT_COLUMN = 'INSERT-COLUMN';
10761
- const DELETEROW = 'DELETE-ROW';
10762
- const DELETECOLUMN = 'DELETE-COLUMN';
10763
- const REMOVETABLE = 'REMOVE-TABLE';
10764
- const TABLEHEADER = 'TABLE-HEADER';
10765
- const TABLE_VERTICAL_ALIGN = 'TABLE_VERTICAL_ALIGN';
10766
- const TABLE_MERGE = 'TABLE_MERGE';
10767
- const TABLE_VERTICAL_SPLIT = 'TABLE_VERTICAL_SPLIT';
10768
- const TABLE_HORIZONTAL_SPLIT = 'TABLE_HORIZONTAL_SPLIT';
10769
- const TABLE_MOVE = 'TABLE_MOVE';
10770
- /**
10771
- * Alignments plugin events
10772
- *
10773
- * @hidden
10774
- */
10775
- const ALIGNMENT_TYPE = 'alignment-type';
10776
- /**
10777
- * Indents plugin events
10778
- *
10779
- * @hidden
10780
- */
10781
- const INDENT_TYPE = 'indent-type';
10782
- /**
10783
- * Constant tag names
10784
- *
10785
- * @hidden
10786
- */
10787
- const DEFAULT_TAG = 'p';
10788
- /**
10789
- * @hidden
10790
- */
10791
- const BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote',
10792
- 'canvas', 'details', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer',
10793
- 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav',
10794
- 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tbody', 'td', 'tfoot', 'th',
10795
- 'thead', 'tr', 'ul', 'video', 'body'];
10796
- /**
10797
- * @hidden
10798
- */
10799
- const IGNORE_BLOCK_TAGS = ['td', 'th'];
10800
- /**
10801
- * @hidden
10802
- */
10803
- const TABLE_BLOCK_TAGS = ['table', 'tbody', 'td', 'tfoot', 'th',
10804
- 'thead', 'tr'];
10805
- /**
10806
- * Selection plugin events
10807
- *
10808
- * @hidden
10809
- */
10810
- const SELECTION_TYPE = 'selection-type';
10811
- /**
10812
- * Insert HTML plugin events
10813
- *
10814
- * @hidden
10815
- */
10816
- const INSERTHTML_TYPE = 'inserthtml-type';
10817
- /**
10818
- * Insert Text plugin events
10819
- *
10820
- * @hidden
10821
- */
10822
- const INSERT_TEXT_TYPE = 'insert-text-type';
10823
- /**
10824
- * Clear Format HTML plugin events
10825
- *
10826
- * @hidden
10827
- */
10828
- const CLEAR_TYPE = 'clear-type';
10829
- /**
10830
- * Self closing tags
10831
- *
10832
- * @hidden
10833
- */
10834
- const SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
10835
- /**
10836
- * Source
10837
- *
10838
- * @hidden
10839
- */
10840
- const PASTE_SOURCE = ['word', 'excel', 'onenote'];
10841
-
10842
- /**
10843
- * `Selection` module is used to handle RTE Selections.
10844
- */
10845
- class NodeSelection {
10846
- constructor() {
10847
- this.startNodeName = [];
10848
- this.endNodeName = [];
10849
- }
10850
- saveInstance(range, body) {
10851
- this.range = range.cloneRange();
10852
- this.rootNode = this.documentFromRange(range);
10853
- this.body = body;
10854
- this.startContainer = this.getNodeArray(range.startContainer, true);
10855
- this.endContainer = this.getNodeArray(range.endContainer, false);
10856
- this.startOffset = range.startOffset;
10857
- this.endOffset = range.endOffset;
10858
- this.html = this.body.innerHTML;
10859
- return this;
10860
- }
10861
- documentFromRange(range) {
10862
- return (9 === range.startContainer.nodeType) ? range.startContainer : range.startContainer.ownerDocument;
10863
- }
10864
- getRange(docElement) {
10865
- const select$$1 = this.get(docElement);
10866
- const range = select$$1 && select$$1.rangeCount > 0 ? select$$1.getRangeAt(select$$1.rangeCount - 1) : docElement.createRange();
10867
- return (range.startContainer !== docElement || range.endContainer !== docElement
10868
- || range.startOffset || range.endOffset || (range.setStart(docElement.body, 0), range.collapse(!0)), range);
10869
- }
10870
- /**
10871
- * get method
10872
- *
10873
- * @param {Document} docElement - specifies the get function
10874
- * @returns {void}
10875
- * @hidden
10876
- * @deprecated
10877
- */
10878
- get(docElement) {
10879
- return docElement.defaultView.getSelection();
10880
- }
10881
- /**
10882
- * save method
10883
- *
10884
- * @param {Range} range - range value.
10885
- * @param {Document} docElement - specifies the document.
10886
- * @returns {void}
10887
- * @hidden
10888
- * @deprecated
10889
- */
10890
- save(range, docElement) {
10891
- range = (range) ? range.cloneRange() : this.getRange(docElement);
10892
- return this.saveInstance(range, docElement.body);
10893
- }
10894
- /**
10895
- * getIndex method
10896
- *
10897
- * @param {Node} node - specifies the node value.
10898
- * @returns {void}
10899
- * @hidden
10900
- * @deprecated
10901
- */
10902
- getIndex(node) {
10903
- let index;
10904
- let num = 0;
10905
- node = !node.previousSibling && node.tagName === 'BR' ? node : node.previousSibling;
10906
- if (node) {
10907
- for (let type = node.nodeType; node; null) {
10908
- index = node.nodeType;
10909
- num++;
10910
- //eslint-disable-next-line
10911
- type = index;
10912
- node = node.previousSibling;
10913
- }
10914
- }
10915
- return num;
10916
- }
10917
- isChildNode(nodeCollection, parentNode) {
10918
- for (let index = 0; index < parentNode.childNodes.length; index++) {
10919
- if (nodeCollection.indexOf(parentNode.childNodes[index]) > -1) {
10920
- return true;
10921
- }
10922
- }
10923
- return false;
10924
- }
10925
- getNode(startNode, endNode, nodeCollection) {
10926
- if (endNode === startNode &&
10927
- (startNode.nodeType === 3 || !startNode.firstChild || nodeCollection.indexOf(startNode.firstChild) !== -1
10928
- || this.isChildNode(nodeCollection, startNode))) {
10929
- return null;
10930
- }
10931
- if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
10932
- return null;
10933
- }
10934
- if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
10935
- return startNode.firstChild;
10936
- }
10937
- if (startNode.nextSibling) {
10938
- return startNode.nextSibling;
10939
- }
10940
- if (!startNode.parentNode) {
10941
- return null;
10942
- }
10943
- else {
10944
- return startNode.parentNode;
10945
- }
10946
- }
11570
+ initialize() {
11571
+ this.keyConfig = markdownKeyConfig;
11572
+ this.formatTags = markdownFormatTags;
11573
+ this.listTags = markdownListsTags;
11574
+ this.selectionTags = markdownSelectionTags;
11575
+ }
10947
11576
  /**
10948
- * getNodeCollection method
11577
+ * Update the formatter of RichTextEditor
10949
11578
  *
10950
- * @param {Range} range -specifies the range.
11579
+ * @param {Element} editElement - specifies the edit element.
11580
+ * @param {Document} doc - specifies the document.
11581
+ * @param {number} options - specifies the options
10951
11582
  * @returns {void}
10952
11583
  * @hidden
10953
11584
  * @deprecated
10954
11585
  */
10955
- getNodeCollection(range) {
10956
- let startNode = range.startContainer.childNodes[range.startOffset]
10957
- || range.startContainer;
10958
- const endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
10959
- || range.endContainer;
10960
- if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
10961
- startNode.childNodes.length === 0) {
10962
- return [startNode];
10963
- }
10964
- if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
10965
- return [startNode.nodeName === 'BR' || startNode.nodeName === '#text' ? startNode : startNode.childNodes[0]];
11586
+ updateFormatter(editElement, doc, options) {
11587
+ if (editElement) {
11588
+ this.editorManager = new MarkdownParser({
11589
+ element: editElement,
11590
+ formatTags: this.formatTags,
11591
+ listTags: this.listTags,
11592
+ selectionTags: this.selectionTags,
11593
+ options: options
11594
+ });
10966
11595
  }
10967
- const nodeCollection = [];
10968
- do {
10969
- if (nodeCollection.indexOf(startNode) === -1) {
10970
- nodeCollection.push(startNode);
10971
- }
10972
- startNode = this.getNode(startNode, endNode, nodeCollection);
10973
- } while (startNode);
10974
- return nodeCollection;
10975
11596
  }
11597
+ }
11598
+
11599
+ /**
11600
+ * Markdown module is used to render Rich Text Editor as Markdown editor content
11601
+ *
11602
+ * @hidden
11603
+ * @deprecated
11604
+ */
11605
+ class MarkdownRender {
10976
11606
  /**
10977
- * getParentNodeCollection method
11607
+ * Constructor for content renderer module
10978
11608
  *
10979
- * @param {Range} range - specifies the range value.
10980
- * @returns {void}
10981
- * @hidden
10982
- * @deprecated
11609
+ * @param {IRichTextEditor} parent - specifies the parent.
10983
11610
  */
10984
- getParentNodeCollection(range) {
10985
- return this.getParentNodes(this.getNodeCollection(range), range);
11611
+ constructor(parent) {
11612
+ this.parent = parent;
10986
11613
  }
10987
11614
  /**
10988
- * getParentNodes method
11615
+ * The function is used to render Rich Text Editor content div
10989
11616
  *
10990
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
10991
- * @param {Range} range - specifies the range values.
10992
11617
  * @returns {void}
10993
11618
  * @hidden
10994
11619
  * @deprecated
10995
11620
  */
10996
- getParentNodes(nodeCollection, range) {
10997
- nodeCollection = nodeCollection.reverse();
10998
- for (let index = 0; index < nodeCollection.length; index++) {
10999
- if ((nodeCollection.indexOf(nodeCollection[index].parentNode) !== -1)
11000
- || (nodeCollection[index].nodeType === 3 &&
11001
- range.startContainer !== range.endContainer &&
11002
- range.startContainer.parentNode !== range.endContainer.parentNode)) {
11003
- nodeCollection.splice(index, 1);
11004
- index--;
11005
- }
11006
- else if (nodeCollection[index].nodeType === 3) {
11007
- nodeCollection[index] = nodeCollection[index].parentNode;
11008
- }
11009
- }
11010
- return nodeCollection;
11621
+ renderPanel() {
11622
+ const rteObj = this.parent;
11623
+ const div = this.parent.createElement('div', { id: this.parent.getID() + '_view', className: 'e-rte-content' });
11624
+ this.editableElement = this.parent.createElement('textarea', {
11625
+ className: 'e-content',
11626
+ id: this.parent.getID() + '_editable-content',
11627
+ attrs: { 'aria-labelledby': this.parent.getID() + '_view' }
11628
+ });
11629
+ div.appendChild(this.editableElement);
11630
+ this.setPanel(div);
11631
+ rteObj.element.appendChild(div);
11011
11632
  }
11012
11633
  /**
11013
- * getSelectionNodeCollection method
11634
+ * Get the content div element of RichTextEditor
11014
11635
  *
11015
- * @param {Range} range - specifies the range value.
11016
- * @returns {void}
11636
+ * @returns {Element} - specifies the element
11017
11637
  * @hidden
11018
11638
  * @deprecated
11019
11639
  */
11020
- getSelectionNodeCollection(range) {
11021
- return this.getSelectionNodes(this.getNodeCollection(range));
11640
+ getPanel() {
11641
+ return this.contentPanel;
11022
11642
  }
11023
11643
  /**
11024
- * getSelectionNodeCollection along with BR node method
11644
+ * Get the editable element of RichTextEditor
11025
11645
  *
11026
- * @param {Range} range - specifies the range value.
11027
- * @returns {void}
11646
+ * @returns {Element} - specifies the element
11028
11647
  * @hidden
11029
11648
  * @deprecated
11030
11649
  */
11031
- getSelectionNodeCollectionBr(range) {
11032
- return this.getSelectionNodesBr(this.getNodeCollection(range));
11650
+ getEditPanel() {
11651
+ return this.editableElement;
11033
11652
  }
11034
11653
  /**
11035
- * getParentNodes method
11654
+ * Returns the text content as string.
11036
11655
  *
11037
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11038
- * @returns {void}
11039
- * @hidden
11040
- * @deprecated
11656
+ * @returns {string} - specifies the string values.
11041
11657
  */
11042
- getSelectionNodes(nodeCollection) {
11043
- nodeCollection = nodeCollection.reverse();
11044
- // eslint-disable-next-line
11045
- const regEx = new RegExp(String.fromCharCode(8203), 'g');
11046
- for (let index = 0; index < nodeCollection.length; index++) {
11047
- if (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
11048
- (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx)))) {
11049
- nodeCollection.splice(index, 1);
11050
- index--;
11051
- }
11052
- }
11053
- return nodeCollection.reverse();
11658
+ getText() {
11659
+ return this.getEditPanel().value;
11054
11660
  }
11055
11661
  /**
11056
- * Get selection text nodes with br method.
11662
+ * Set the content div element of RichTextEditor
11057
11663
  *
11058
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11664
+ * @param {Element} panel - specifies the element.
11059
11665
  * @returns {void}
11060
11666
  * @hidden
11061
11667
  * @deprecated
11062
11668
  */
11063
- getSelectionNodesBr(nodeCollection) {
11064
- nodeCollection = nodeCollection.reverse();
11065
- // eslint-disable-next-line
11066
- const regEx = new RegExp(String.fromCharCode(8203), 'g');
11067
- for (let index = 0; index < nodeCollection.length; index++) {
11068
- if (nodeCollection[index].nodeName !== 'BR' &&
11069
- (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
11070
- (nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx))))) {
11071
- nodeCollection.splice(index, 1);
11072
- index--;
11073
- }
11074
- }
11075
- return nodeCollection.reverse();
11669
+ setPanel(panel) {
11670
+ this.contentPanel = panel;
11076
11671
  }
11077
11672
  /**
11078
- * getInsertNodeCollection method
11673
+ * Get the document of RichTextEditor
11079
11674
  *
11080
- * @param {Range} range - specifies the range value.
11081
11675
  * @returns {void}
11082
11676
  * @hidden
11083
11677
  * @deprecated
11084
11678
  */
11085
- getInsertNodeCollection(range) {
11086
- return this.getInsertNodes(this.getNodeCollection(range));
11679
+ getDocument() {
11680
+ return this.getEditPanel().ownerDocument;
11681
+ }
11682
+ }
11683
+
11684
+ /**
11685
+ * `MarkdownEditor` module is used to markdown editor
11686
+ */
11687
+ class MarkdownEditor {
11688
+ constructor(parent, serviceLocator) {
11689
+ this.parent = parent;
11690
+ this.locator = serviceLocator;
11691
+ this.renderFactory = this.locator.getService('rendererFactory');
11692
+ this.addEventListener();
11087
11693
  }
11088
11694
  /**
11089
- * getInsertNodes method
11695
+ * Destroys the Markdown.
11090
11696
  *
11091
- * @param {Node[]} nodeCollection - specifies the collection of nodes.
11697
+ * @function destroy
11092
11698
  * @returns {void}
11093
11699
  * @hidden
11094
11700
  * @deprecated
11095
11701
  */
11096
- getInsertNodes(nodeCollection) {
11097
- nodeCollection = nodeCollection.reverse();
11098
- for (let index = 0; index < nodeCollection.length; index++) {
11099
- if ((nodeCollection[index].childNodes.length !== 0 &&
11100
- nodeCollection[index].nodeType !== 3) ||
11101
- (nodeCollection[index].nodeType === 3 &&
11102
- nodeCollection[index].textContent === '')) {
11103
- nodeCollection.splice(index, 1);
11104
- index--;
11105
- }
11702
+ destroy() {
11703
+ if (isNullOrUndefined(this.parent)) {
11704
+ return;
11106
11705
  }
11107
- return nodeCollection.reverse();
11706
+ this.removeEventListener();
11108
11707
  }
11109
- /**
11110
- * getNodeArray method
11111
- *
11112
- * @param {Node} node - specifies the node content.
11113
- * @param {boolean} isStart - specifies the boolean value.
11114
- * @param {Document} root - specifies the root document.
11115
- * @returns {void}
11116
- * @hidden
11117
- * @deprecated
11118
- */
11119
- getNodeArray(node, isStart, root) {
11120
- const array = [];
11121
- // eslint-disable-next-line
11122
- ((isStart) ? (this.startNodeName = []) : (this.endNodeName = []));
11123
- for (; node !== (root ? root : this.rootNode); null) {
11124
- if (isNullOrUndefined(node)) {
11125
- break;
11126
- }
11127
- // eslint-disable-next-line
11128
- (isStart) ? this.startNodeName.push(node.nodeName.toLowerCase()) : this.endNodeName.push(node.nodeName.toLowerCase());
11129
- array.push(this.getIndex(node));
11130
- node = node.parentNode;
11708
+ moduleDestroy() {
11709
+ this.parent = null;
11710
+ this.toolbarUpdate.parent = null;
11711
+ }
11712
+ addEventListener() {
11713
+ if (this.parent.isDestroyed) {
11714
+ return;
11131
11715
  }
11132
- return array;
11716
+ this.saveSelection = new MarkdownSelection();
11717
+ this.parent.on(initialLoad, this.instantiateRenderer, this);
11718
+ this.parent.on(initialEnd, this.render, this);
11719
+ this.parent.on(modelChanged, this.onPropertyChanged, this);
11720
+ this.parent.on(markdownToolbarClick, this.onToolbarClick, this);
11721
+ this.parent.on(destroy, this.destroy, this);
11722
+ this.parent.on(selectAll$1, this.selectAll, this);
11723
+ this.parent.on(getSelectedHtml, this.getSelectedHtml, this);
11724
+ this.parent.on(selectionSave, this.onSelectionSave, this);
11725
+ this.parent.on(selectionRestore, this.onSelectionRestore, this);
11726
+ this.parent.on(readOnlyMode, this.updateReadOnly, this);
11727
+ this.parent.on(moduleDestroy, this.moduleDestroy, this);
11133
11728
  }
11134
- setRangePoint(range, isvalid, num, size) {
11135
- let node = this.rootNode;
11136
- let index = num.length;
11137
- let constant = size;
11138
- for (; index--; null) {
11139
- node = node && node.childNodes[num[index]];
11729
+ updateReadOnly() {
11730
+ if (this.parent.readonly) {
11731
+ this.parent.contentModule.getEditPanel().setAttribute('readonly', 'readonly');
11732
+ addClass([this.parent.element], CLS_RTE_READONLY);
11140
11733
  }
11141
- if (node && constant >= 0 && node.nodeName !== 'html') {
11142
- if (node.nodeType === 3 && node.nodeValue.replace(/\u00a0/g, '&nbsp;') === '&nbsp;') {
11143
- constant = node.textContent.length;
11144
- }
11145
- range[isvalid ? 'setStart' : 'setEnd'](node, constant);
11734
+ else {
11735
+ this.parent.contentModule.getEditPanel().removeAttribute('readonly');
11736
+ removeClass([this.parent.element], CLS_RTE_READONLY);
11146
11737
  }
11147
- return range;
11148
11738
  }
11149
- /**
11150
- * restore method
11151
- *
11152
- * @returns {void}
11153
- * @hidden
11154
- * @deprecated
11155
- */
11156
- restore() {
11157
- let range = this.range.cloneRange();
11158
- range = this.setRangePoint(range, true, this.startContainer, this.startOffset);
11159
- range = this.setRangePoint(range, false, this.endContainer, this.endOffset);
11160
- this.selectRange(this.rootNode, range);
11161
- return range;
11739
+ onSelectionSave() {
11740
+ const textArea = this.parent.contentModule.getEditPanel();
11741
+ this.saveSelection.save(textArea.selectionStart, textArea.selectionEnd);
11162
11742
  }
11163
- selectRange(docElement, range) {
11164
- this.setRange(docElement, range);
11165
- this.save(range, docElement);
11743
+ // eslint-disable-next-line
11744
+ onSelectionRestore(e) {
11745
+ this.contentRenderer.getEditPanel().focus();
11746
+ const textArea = this.parent.contentModule.getEditPanel();
11747
+ this.saveSelection.restore(textArea);
11166
11748
  }
11167
- /**
11168
- * setRange method
11169
- *
11170
- * @param {Document} docElement - specifies the document.
11171
- * @param {Range} range - specifies the range.
11172
- * @returns {void}
11173
- * @hidden
11174
- * @deprecated
11175
- */
11176
- setRange(docElement, range) {
11177
- const selection = this.get(docElement);
11178
- selection.removeAllRanges();
11179
- selection.addRange(range);
11749
+ onToolbarClick(args) {
11750
+ const item = args.item;
11751
+ const textArea = this.parent.contentModule.getEditPanel();
11752
+ if (item.command !== 'Formats') {
11753
+ textArea.focus();
11754
+ }
11755
+ const startOffset = textArea.selectionStart;
11756
+ const endOffset = textArea.selectionEnd;
11757
+ const text = textArea.value.substring(startOffset, endOffset);
11758
+ switch (item.subCommand) {
11759
+ case 'Maximize':
11760
+ this.parent.notify(enableFullScreen, { args: args });
11761
+ break;
11762
+ case 'Minimize':
11763
+ this.parent.notify(disableFullScreen, { args: args });
11764
+ break;
11765
+ case 'CreateLink':
11766
+ this.parent.notify(insertLink, { member: 'link', args: args, text: text, module: 'Markdown' });
11767
+ break;
11768
+ case 'Image':
11769
+ this.parent.notify(insertImage, { member: 'image', args: args, text: text, module: 'Markdown' });
11770
+ break;
11771
+ case 'CreateTable': {
11772
+ const tableConstant = {
11773
+ 'headingText': this.parent.localeObj.getConstant('TableHeadingText'),
11774
+ 'colText': this.parent.localeObj.getConstant('TableColText')
11775
+ };
11776
+ this.parent.formatter.process(this.parent, args, args.originalEvent, tableConstant);
11777
+ break;
11778
+ }
11779
+ default:
11780
+ this.parent.formatter.process(this.parent, args, args.originalEvent, null);
11781
+ break;
11782
+ }
11180
11783
  }
11181
- /**
11182
- * setSelectionText method
11183
- *
11184
- * @param {Document} docElement - specifies the documrent
11185
- * @param {Node} startNode - specifies the starting node.
11186
- * @param {Node} endNode - specifies the the end node.
11187
- * @param {number} startIndex - specifies the starting index.
11188
- * @param {number} endIndex - specifies the end index.
11189
- * @returns {void}
11190
- * @hidden
11191
- * @deprecated
11192
- */
11193
- setSelectionText(docElement, startNode, endNode, startIndex, endIndex) {
11194
- const range = docElement.createRange();
11195
- range.setStart(startNode, startIndex);
11196
- range.setEnd(endNode, endIndex);
11197
- this.setRange(docElement, range);
11784
+ instantiateRenderer() {
11785
+ this.renderFactory.addRenderer(RenderType.Content, new MarkdownRender(this.parent));
11198
11786
  }
11199
- /**
11200
- * setSelectionContents method
11201
- *
11202
- * @param {Document} docElement - specifies the document.
11203
- * @param {Node} element - specifies the node.
11204
- * @returns {void}
11205
- * @hidden
11206
- * @deprecated
11207
- */
11208
- setSelectionContents(docElement, element) {
11209
- const range = docElement.createRange();
11210
- range.selectNode(element);
11211
- this.setRange(docElement, range);
11787
+ removeEventListener() {
11788
+ if (this.parent.isDestroyed) {
11789
+ return;
11790
+ }
11791
+ this.parent.off(initialEnd, this.render);
11792
+ this.parent.off(modelChanged, this.onPropertyChanged);
11793
+ this.parent.off(destroy, this.destroy);
11794
+ this.parent.off(markdownToolbarClick, this.onToolbarClick);
11795
+ this.parent.off(initialLoad, this.instantiateRenderer);
11796
+ this.parent.off(selectAll$1, this.selectAll);
11797
+ this.parent.off(getSelectedHtml, this.getSelectedHtml);
11798
+ this.parent.off(selectionSave, this.onSelectionSave);
11799
+ this.parent.off(selectionRestore, this.onSelectionRestore);
11800
+ this.parent.off(readOnlyMode, this.updateReadOnly);
11801
+ this.parent.off(moduleDestroy, this.moduleDestroy);
11212
11802
  }
11213
- /**
11214
- * setSelectionNode method
11215
- *
11216
- * @param {Document} docElement - specifies the document.
11217
- * @param {Node} element - specifies the node.
11218
- * @returns {void}
11219
- * @hidden
11220
- * @deprecated
11221
- */
11222
- setSelectionNode(docElement, element) {
11223
- const range = docElement.createRange();
11224
- range.selectNodeContents(element);
11225
- this.setRange(docElement, range);
11803
+ render() {
11804
+ this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
11805
+ const editElement = this.contentRenderer.getEditPanel();
11806
+ const option = { undoRedoSteps: this.parent.undoRedoSteps, undoRedoTimer: this.parent.undoRedoTimer };
11807
+ if (isNullOrUndefined(this.parent.formatter)) {
11808
+ this.parent.formatter = new MarkdownFormatter({
11809
+ element: editElement,
11810
+ options: option
11811
+ });
11812
+ }
11813
+ else {
11814
+ this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
11815
+ }
11816
+ if (this.parent.toolbarSettings.enable) {
11817
+ this.toolbarUpdate = new MarkdownToolbarStatus(this.parent);
11818
+ }
11819
+ this.parent.notify(bindOnEnd, {});
11226
11820
  }
11227
11821
  /**
11228
- * getSelectedNodes method
11822
+ * Called internally if any of the property value changed.
11229
11823
  *
11230
- * @param {Document} docElement - specifies the document.
11824
+ * @param {RichTextEditorModel} e - specifies the editor model
11231
11825
  * @returns {void}
11232
11826
  * @hidden
11233
11827
  * @deprecated
11234
11828
  */
11235
- getSelectedNodes(docElement) {
11236
- return this.getNodeCollection(this.getRange(docElement));
11829
+ onPropertyChanged(e) {
11830
+ // On property code change here
11831
+ if (!isNullOrUndefined(e.newProp.formatter)) {
11832
+ const editElement = this.contentRenderer.getEditPanel();
11833
+ const option = { undoRedoSteps: this.parent.undoRedoSteps,
11834
+ undoRedoTimer: this.parent.undoRedoTimer };
11835
+ this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
11836
+ }
11237
11837
  }
11238
11838
  /**
11239
- * Clear method
11839
+ * For internal use only - Get the module name.
11240
11840
  *
11241
- * @param {Document} docElement - specifies the document.
11242
11841
  * @returns {void}
11243
- * @hidden
11244
- * @deprecated
11245
11842
  */
11246
- Clear(docElement) {
11247
- this.get(docElement).removeAllRanges();
11843
+ getModuleName() {
11844
+ return 'markdownEditor';
11248
11845
  }
11249
11846
  /**
11250
- * insertParentNode method
11847
+ * For selecting all content in RTE
11251
11848
  *
11252
- * @param {Document} docElement - specifies the document.
11253
- * @param {Node} newNode - specicfies the new node.
11254
- * @param {Range} range - specifies the range.
11255
11849
  * @returns {void}
11256
- * @hidden
11257
- * @deprecated
11850
+ * @private
11258
11851
  */
11259
- insertParentNode(docElement, newNode, range) {
11260
- range.surroundContents(newNode);
11261
- this.selectRange(docElement, range);
11852
+ selectAll() {
11853
+ this.parent.formatter.editorManager.markdownSelection.setSelection(this.parent.contentModule.getEditPanel(), 0, this.parent.contentModule.getEditPanel().value.length);
11262
11854
  }
11263
11855
  /**
11264
- * setCursorPoint method
11856
+ * For get a selected text in RTE
11265
11857
  *
11266
- * @param {Document} docElement - specifies the document.
11267
- * @param {Element} element - specifies the element.
11268
- * @param {number} point - specifies the point.
11858
+ * @param {NotifyArgs} e - specifies the arguments.
11269
11859
  * @returns {void}
11270
- * @hidden
11271
- * @deprecated
11860
+ * @private
11272
11861
  */
11273
- setCursorPoint(docElement, element, point) {
11274
- const range = docElement.createRange();
11275
- const selection = docElement.defaultView.getSelection();
11276
- range.setStart(element, point);
11277
- range.collapse(true);
11278
- selection.removeAllRanges();
11279
- selection.addRange(range);
11862
+ getSelectedHtml(e) {
11863
+ e.callBack(this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()));
11280
11864
  }
11281
11865
  }
11282
11866
 
11283
- /**
11284
- * `Selection` module is used to handle RTE Selections.
11285
- */
11286
-
11287
11867
  const markerClassName = {
11288
11868
  startSelection: 'e-editor-select-start',
11289
11869
  endSelection: 'e-editor-select-end'
@@ -12409,11 +12989,17 @@ class Lists {
12409
12989
  removeList(range, e) {
12410
12990
  let startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
12411
12991
  let 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);
12992
+ const parentList = (range.startContainer.nodeName === '#text') ? range.startContainer.parentElement.closest('li') : range.startContainer.closest('li');
12993
+ let fullContent = '';
12994
+ if (!isNullOrUndefined(parentList) && !isNullOrUndefined(parentList.childNodes)) {
12995
+ parentList.childNodes.forEach((e) => {
12996
+ fullContent = fullContent + e.textContent;
12997
+ });
12998
+ }
12412
12999
  startNode = startNode.nodeName === 'BR' ? startNode.parentElement : startNode;
12413
13000
  endNode = endNode.nodeName === 'BR' ? endNode.parentElement : endNode;
12414
13001
  startNode = startNode.nodeName !== 'LI' && !isNullOrUndefined(startNode.closest('LI')) ? startNode.closest('LI') : startNode;
12415
13002
  endNode = endNode.nodeName !== 'LI' && endNode.nodeName !== '#text' && !isNullOrUndefined(endNode.closest('LI')) ? endNode.closest('LI') : endNode;
12416
- const parentList = (range.startContainer.nodeName === '#text') ? range.startContainer.parentElement.closest('li') : range.startContainer.closest('li');
12417
13003
  if (((range.commonAncestorContainer.nodeName === 'OL' || range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'LI') &&
12418
13004
  isNullOrUndefined(endNode.nextElementSibling) && endNode.textContent.length === range.endOffset &&
12419
13005
  isNullOrUndefined(startNode.previousElementSibling) && range.startOffset === 0) ||
@@ -12430,10 +13016,23 @@ class Lists {
12430
13016
  }
12431
13017
  e.event.preventDefault();
12432
13018
  }
12433
- else if (!isNullOrUndefined(parentList) && parentList.textContent === range.startContainer.textContent && parentList.closest('li').previousElementSibling === null) {
13019
+ else if (!isNullOrUndefined(parentList) && !range.collapsed && parentList.textContent === fullContent) {
12434
13020
  range.deleteContents();
12435
- this.parent.editableElement.querySelectorAll('li:empty').forEach((e) => e.remove());
12436
- this.parent.editableElement.querySelectorAll('ol:empty').forEach((e) => e.remove());
13021
+ this.parent.editableElement.querySelectorAll('li').forEach((li) => {
13022
+ if (!li.firstChild || li.textContent.trim() === '') {
13023
+ li.parentNode.removeChild(li);
13024
+ }
13025
+ });
13026
+ this.parent.editableElement.querySelectorAll('ol').forEach((ol) => {
13027
+ if (!ol.firstChild || ol.textContent.trim() === '') {
13028
+ ol.parentNode.removeChild(ol);
13029
+ }
13030
+ });
13031
+ this.parent.editableElement.querySelectorAll('ul').forEach((ul) => {
13032
+ if (!ul.firstChild || ul.textContent.trim() === '') {
13033
+ ul.parentNode.removeChild(ul);
13034
+ }
13035
+ });
12437
13036
  e.event.preventDefault();
12438
13037
  }
12439
13038
  }
@@ -12830,6 +13429,10 @@ class Lists {
12830
13429
  }
12831
13430
  else {
12832
13431
  this.checkLists(elements, type, item);
13432
+ let marginLeftAttribute = '';
13433
+ if (elements[0].style.marginLeft !== '') {
13434
+ marginLeftAttribute = ' style = "margin-left: ' + elements[0].style.marginLeft + ';"';
13435
+ }
12833
13436
  for (let i = 0; i < elements.length; i++) {
12834
13437
  if (!isNullOrUndefined(item) && !isNullOrUndefined(item.listStyle)) {
12835
13438
  if (item.listStyle === 'listImage') {
@@ -12840,6 +13443,9 @@ class Lists {
12840
13443
  setStyleAttribute(elements[i], { 'list-style-type': item.listStyle.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() });
12841
13444
  }
12842
13445
  }
13446
+ let elemAtt;
13447
+ elements[i].style.removeProperty('margin-left');
13448
+ elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
12843
13449
  if (elements[i].getAttribute('contenteditable') === 'true'
12844
13450
  && elements[i].childNodes.length === 1 && elements[i].childNodes[0].nodeName === 'TABLE') {
12845
13451
  const listEle = document.createElement(type);
@@ -12848,8 +13454,7 @@ class Lists {
12848
13454
  }
12849
13455
  else if ('LI' !== elements[i].tagName && isNullOrUndefined(item) &&
12850
13456
  elements[i].nodeName === 'BLOCKQUOTE') {
12851
- const elemAtt = this.domNode.attributes(elements[i]);
12852
- const openTag = '<' + type + '>';
13457
+ const openTag = '<' + type + marginLeftAttribute + '>';
12853
13458
  const closeTag = '</' + type + '>';
12854
13459
  const newTag = 'li' + elemAtt;
12855
13460
  const replaceHTML = elements[i].innerHTML;
@@ -12858,8 +13463,7 @@ class Lists {
12858
13463
  elements[i].innerHTML = collectionString;
12859
13464
  }
12860
13465
  else if ('LI' !== elements[i].tagName && isNullOrUndefined(item)) {
12861
- const elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
12862
- const openTag = '<' + type + '>';
13466
+ const openTag = '<' + type + marginLeftAttribute + '>';
12863
13467
  const closeTag = '</' + type + '>';
12864
13468
  const newTag = 'li' + elemAtt;
12865
13469
  const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
@@ -12870,8 +13474,8 @@ class Lists {
12870
13474
  }
12871
13475
  else if (!isNullOrUndefined(item) && 'LI' !== elements[i].tagName) {
12872
13476
  // eslint-disable-next-line
12873
- const elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
12874
- const openTag = '<' + type + elemAtt + '>';
13477
+ const currentElemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
13478
+ const openTag = '<' + type + currentElemAtt + '>';
12875
13479
  const closeTag = '</' + type + '>';
12876
13480
  const newTag = 'li';
12877
13481
  const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
@@ -13064,19 +13668,19 @@ class Lists {
13064
13668
  if (DEFAULT_TAG && 0 === element.querySelectorAll(BLOCK_TAGS.join(', ')).length) {
13065
13669
  const wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
13066
13670
  ' class="' + className + ' e-rte-wrap-inner"';
13067
- const parentElement = parentNode;
13671
+ let parentElement = parentNode;
13068
13672
  if (elements.length === parentElement.querySelectorAll('li').length) {
13069
13673
  if (!isNullOrUndefined(parentElement.style.listStyleType)) {
13070
- parentNode.style.removeProperty('list-style-type');
13674
+ parentNode.style.removeProperty("list-style-type");
13071
13675
  }
13072
13676
  if (!isNullOrUndefined(parentElement.style.listStyleImage)) {
13073
- parentNode.style.removeProperty('list-style-image');
13677
+ parentNode.style.removeProperty("list-style-image");
13074
13678
  }
13075
13679
  if (parentElement.style.length === 0) {
13076
- parentNode.removeAttribute('style');
13680
+ parentNode.removeAttribute("style");
13077
13681
  }
13078
13682
  }
13079
- const wrapper = '<' + DEFAULT_TAG + wrapperclass + '></' + DEFAULT_TAG + '>';
13683
+ const wrapper = '<' + DEFAULT_TAG + wrapperclass + this.domNode.attributes(element) + '></' + DEFAULT_TAG + '>';
13080
13684
  if (e.enterAction !== 'BR') {
13081
13685
  this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
13082
13686
  }
@@ -13384,8 +13988,11 @@ class NodeCutter {
13384
13988
  this.position = 1;
13385
13989
  }
13386
13990
  else {
13387
- const startOffset = this.GetCursorStart(indexes, range.startOffset, true);
13991
+ let startOffset = this.GetCursorStart(indexes, range.startOffset, true);
13388
13992
  this.position = range.startOffset - startOffset;
13993
+ if (startOffset !== 0 && str[startOffset] && str[startOffset] === ' ') {
13994
+ startOffset = startOffset + 1;
13995
+ }
13389
13996
  cursorRange.setStart(range.startContainer, startOffset);
13390
13997
  cursorRange.setEnd(range.startContainer, this.GetCursorStart(indexes, range.startOffset, false));
13391
13998
  }
@@ -14241,7 +14848,7 @@ class InsertHtml {
14241
14848
  if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
14242
14849
  blockNode = range.startContainer;
14243
14850
  }
14244
- if (blockNode.closest('LI') && node && node.firstElementChild &&
14851
+ if (blockNode.closest('LI') && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
14245
14852
  ((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
14246
14853
  let liNode;
14247
14854
  while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
@@ -14271,7 +14878,7 @@ class InsertHtml {
14271
14878
  }
14272
14879
  }
14273
14880
  else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNullOrUndefined(currentNode.parentElement) &&
14274
- (currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
14881
+ (currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
14275
14882
  currentNode.parentElement.textContent.trim().length > 0) {
14276
14883
  splitedElm = currentNode;
14277
14884
  if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
@@ -14280,6 +14887,12 @@ class InsertHtml {
14280
14887
  }
14281
14888
  if (!range.collapsed) {
14282
14889
  range.deleteContents();
14890
+ const value = range.startContainer;
14891
+ if (!isNullOrUndefined(value) && value.nodeName === 'LI' && !isNullOrUndefined(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
14892
+ value.parentElement.querySelectorAll('li').forEach((item) => {
14893
+ item.remove();
14894
+ });
14895
+ }
14283
14896
  }
14284
14897
  range.insertNode(node);
14285
14898
  this.contentsDeleted = true;
@@ -14471,7 +15084,8 @@ class LinkCommand {
14471
15084
  }
14472
15085
  if (!isNullOrUndefined(e.item.text) && e.item.text !== '') {
14473
15086
  linkText = anchorEle.innerText;
14474
- anchorEle.innerText = e.item.text;
15087
+ anchorEle.firstChild.nodeName === '#text' ? anchorEle.innerText = e.item.text :
15088
+ anchorEle.firstChild.innerText = e.item.text;
14475
15089
  }
14476
15090
  if (!isNullOrUndefined(e.item.target)) {
14477
15091
  anchorEle.setAttribute('target', e.item.target);
@@ -14487,7 +15101,8 @@ class LinkCommand {
14487
15101
  }
14488
15102
  else {
14489
15103
  const startIndex = e.item.action === 'Paste' ? anchorEle.childNodes[0].textContent.length : 0;
14490
- e.item.selection.setSelectionText(this.parent.currentDocument, anchorEle.childNodes[0], anchorEle.childNodes[0], startIndex, anchorEle.childNodes[0].textContent.length);
15104
+ const endIndex = anchorEle.firstChild.nodeName === '#text' ? anchorEle.childNodes[0].textContent.length : anchorEle.childNodes.length;
15105
+ e.item.selection.setSelectionText(this.parent.currentDocument, anchorEle.childNodes[0], anchorEle.childNodes[0], startIndex, endIndex);
14491
15106
  }
14492
15107
  }
14493
15108
  else {
@@ -14907,7 +15522,7 @@ class Indents {
14907
15522
  isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
14908
15523
  }
14909
15524
  else {
14910
- indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
15525
+ indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px' || marginLeftOrRight === '0in') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
14911
15526
  isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
14912
15527
  /* eslint-enable */
14913
15528
  }
@@ -16470,28 +17085,23 @@ class TableCommand {
16470
17085
  const newCell = this.activeCell.cloneNode(true);
16471
17086
  newCell.removeAttribute('class');
16472
17087
  newCell.innerHTML = '</br>';
16473
- let avgWidth = parseFloat(this.activeCell.style.width) / 2;
16474
- if (this.activeCell.tagName === 'TH' && isNaN(avgWidth)) {
16475
- const cellCount = this.curTable.querySelector('tr').childElementCount;
16476
- let colSpanCount = 0;
16477
- for (let i = 0; i < cellCount; i++) {
16478
- colSpanCount = colSpanCount + (parseInt(this.curTable.querySelector('tr').children[i].getAttribute('colspan'), 10) || 1);
16479
- }
16480
- avgWidth = parseFloat((((this.activeCell.offsetWidth / 2) / this.curTable.offsetWidth) * 100).toFixed(1));
16481
- }
16482
17088
  const activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
16483
17089
  const correspondingColumns = this.getCorrespondingColumns();
16484
- const activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10);
17090
+ const activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10) || 1;
16485
17091
  if (activeCellcolSpan > 1) {
16486
- // eslint-disable-next-line
16487
- 1 < Math.ceil(activeCellcolSpan / 2) ? this.activeCell.setAttribute('colspan', (activeCellcolSpan / 2).toString())
16488
- : this.activeCell.removeAttribute('colspan');
16489
- // eslint-disable-next-line
16490
- 1 < (activeCellcolSpan - activeCellcolSpan / 2) ? newCell.setAttribute('colspan',
16491
- // eslint-disable-next-line
16492
- (activeCellcolSpan - activeCellcolSpan / 2).toString()) : newCell.removeAttribute('colspan');
17092
+ const colSpan = Math.ceil(activeCellcolSpan / 2);
17093
+ const getColSizes = this.getColSizes(this.curTable);
17094
+ const activeCellUpdatedWidth = this.getSplitColWidth(activeCellIndex[1], activeCellIndex[1] + colSpan - 1, getColSizes);
17095
+ let newCellWidth = this.getSplitColWidth(activeCellIndex[1] + colSpan, activeCellIndex[1] + activeCellcolSpan - 1, getColSizes);
17096
+ const activeCellWidth = this.convertPixelToPercentage(this.activeCell.offsetWidth, this.curTable.offsetWidth);
17097
+ newCellWidth = (activeCellWidth - activeCellUpdatedWidth) < newCellWidth ? (activeCellWidth - activeCellUpdatedWidth) : newCellWidth;
17098
+ 1 < colSpan ? this.activeCell.setAttribute('colspan', colSpan.toString()) : this.activeCell.removeAttribute('colspan');
17099
+ 1 < activeCellcolSpan - colSpan ? newCell.setAttribute('colspan', (activeCellcolSpan - colSpan).toString()) : newCell.removeAttribute('colspan');
17100
+ this.activeCell.style.width = activeCellUpdatedWidth + '%';
17101
+ newCell.style.width = newCellWidth + '%';
16493
17102
  }
16494
17103
  else {
17104
+ let avgWidth = parseFloat(this.activeCell.style.width) / 2;
16495
17105
  for (let i = 0; i <= allRows.length - 1; i++) {
16496
17106
  if (0 === i || correspondingColumns[i][activeCellIndex[1]] !== correspondingColumns[i - 1][activeCellIndex[1]]) {
16497
17107
  const currentCell = correspondingColumns[i][activeCellIndex[1]];
@@ -16501,9 +17111,9 @@ class TableCommand {
16501
17111
  }
16502
17112
  }
16503
17113
  }
17114
+ this.activeCell.style.width = avgWidth + '%';
17115
+ newCell.style.width = avgWidth + '%';
16504
17116
  }
16505
- this.activeCell.style.width = avgWidth + '%';
16506
- newCell.style.width = avgWidth + '%';
16507
17117
  this.activeCell.parentNode.insertBefore(newCell, this.activeCell.nextSibling);
16508
17118
  if (e.callBack) {
16509
17119
  e.callBack({
@@ -16515,6 +17125,54 @@ class TableCommand {
16515
17125
  });
16516
17126
  }
16517
17127
  }
17128
+ getSplitColWidth(startIndex, endInex, sizes) {
17129
+ let width = 0;
17130
+ for (let i = startIndex; i <= endInex; i++) {
17131
+ width += sizes[i];
17132
+ }
17133
+ return this.convertPixelToPercentage(width, this.curTable.offsetWidth);
17134
+ }
17135
+ getColSizes(curTable) {
17136
+ const cellColl = curTable.rows[0].cells;
17137
+ let cellCount = 0;
17138
+ for (let cell = 0; cell < cellColl.length; cell++) {
17139
+ cellCount = cellCount + cellColl[cell].colSpan;
17140
+ }
17141
+ const sizes = new Array(cellCount);
17142
+ const rowSpanCells = new Map();
17143
+ for (let i = 0; i < curTable.rows.length; i++) {
17144
+ let currentColIndex = 0;
17145
+ for (let k = 0; k < curTable.rows[i].cells.length; k++) {
17146
+ for (let l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
17147
+ const key = `${i + l}${currentColIndex}`;
17148
+ rowSpanCells.set(key, curTable.rows[i].cells[k]);
17149
+ }
17150
+ const cellIndex = this.getCellIndex(rowSpanCells, i, k);
17151
+ if (cellIndex > currentColIndex) {
17152
+ currentColIndex = cellIndex;
17153
+ }
17154
+ const width = curTable.rows[i].cells[k].offsetWidth;
17155
+ if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
17156
+ sizes[currentColIndex] = width;
17157
+ }
17158
+ currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
17159
+ }
17160
+ }
17161
+ return sizes;
17162
+ }
17163
+ getCellIndex(rowSpanCells, rowIndex, colIndex) {
17164
+ const cellKey = `${rowIndex}${colIndex}`;
17165
+ const spannedCell = rowSpanCells.get(cellKey);
17166
+ if (spannedCell) {
17167
+ return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
17168
+ }
17169
+ else {
17170
+ return colIndex;
17171
+ }
17172
+ }
17173
+ convertPixelToPercentage(value, offsetValue) {
17174
+ return (value / offsetValue) * 100;
17175
+ }
16518
17176
  getCorrespondingColumns() {
16519
17177
  const elementArray = [];
16520
17178
  // eslint-disable-next-line
@@ -16677,256 +17335,6 @@ class TableCommand {
16677
17335
  class MinMax {
16678
17336
  }
16679
17337
 
16680
- /**
16681
- * Is formatted or not.
16682
- *
16683
- * @hidden
16684
- * @deprecated
16685
- */
16686
- class IsFormatted {
16687
- /**
16688
- * getFormattedNode method
16689
- *
16690
- * @param {Node} node - specifies the node.
16691
- * @param {string} format - specifies the string value.
16692
- * @param {Node} endNode - specifies the end node
16693
- * @returns {Node} - returns the node
16694
- * @hidden
16695
- * @deprecated
16696
- */
16697
- getFormattedNode(node, format, endNode) {
16698
- const parentNode = this.getFormatParent(node, format, endNode);
16699
- if (parentNode !== null && parentNode !== endNode) {
16700
- return parentNode;
16701
- }
16702
- return null;
16703
- }
16704
- getFormatParent(node, format, endNode) {
16705
- do {
16706
- node = node.parentNode;
16707
- } while (node && (node !== endNode) && !this.isFormattedNode(node, format));
16708
- return node;
16709
- }
16710
- isFormattedNode(node, format) {
16711
- switch (format) {
16712
- case 'bold':
16713
- return IsFormatted.isBold(node);
16714
- case 'italic':
16715
- return IsFormatted.isItalic(node);
16716
- case 'underline':
16717
- return IsFormatted.isUnderline(node);
16718
- case 'strikethrough':
16719
- return IsFormatted.isStrikethrough(node);
16720
- case 'superscript':
16721
- return IsFormatted.isSuperscript(node);
16722
- case 'subscript':
16723
- return IsFormatted.isSubscript(node);
16724
- case 'fontcolor':
16725
- return this.isFontColor(node);
16726
- case 'fontname':
16727
- return this.isFontName(node);
16728
- case 'fontsize':
16729
- return this.isFontSize(node);
16730
- case 'backgroundcolor':
16731
- return this.isBackgroundColor(node);
16732
- default:
16733
- return false;
16734
- }
16735
- }
16736
- /**
16737
- * isBold method
16738
- *
16739
- * @param {Node} node - specifies the node value
16740
- * @returns {boolean} - returns the boolean value
16741
- * @hidden
16742
- * @deprecated
16743
- */
16744
- static isBold(node) {
16745
- const validTags = ['strong', 'b'];
16746
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16747
- return true;
16748
- }
16749
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16750
- node.style && node.style.fontWeight === 'bold') {
16751
- return true;
16752
- }
16753
- else {
16754
- return false;
16755
- }
16756
- }
16757
- /**
16758
- * isItalic method
16759
- *
16760
- * @param {Node} node - specifies the node value
16761
- * @returns {boolean} - returns the boolean value
16762
- * @hidden
16763
- * @deprecated
16764
- */
16765
- static isItalic(node) {
16766
- const validTags = ['em', 'i'];
16767
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16768
- return true;
16769
- }
16770
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16771
- node.style && node.style.fontStyle === 'italic') {
16772
- return true;
16773
- }
16774
- else {
16775
- return false;
16776
- }
16777
- }
16778
- /**
16779
- * isUnderline method
16780
- *
16781
- * @param {Node} node - specifies the node value
16782
- * @returns {boolean} - returns the boolean value
16783
- * @hidden
16784
- * @deprecated
16785
- */
16786
- static isUnderline(node) {
16787
- const validTags = ['u'];
16788
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16789
- return true;
16790
- /* eslint-disable */
16791
- }
16792
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16793
- node.style && (node.style.textDecoration === 'underline' ||
16794
- node.style.textDecorationLine === 'underline')) {
16795
- /* eslint-enable */
16796
- return true;
16797
- }
16798
- else {
16799
- return false;
16800
- }
16801
- }
16802
- /**
16803
- * isStrikethrough method
16804
- *
16805
- * @param {Node} node - specifies the node value
16806
- * @returns {boolean} - returns the boolean value
16807
- * @hidden
16808
- * @deprecated
16809
- */
16810
- static isStrikethrough(node) {
16811
- const validTags = ['del', 'strike'];
16812
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16813
- return true;
16814
- /* eslint-disable */
16815
- }
16816
- else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16817
- node.style && (node.style.textDecoration === 'line-through' ||
16818
- node.style.textDecorationLine === 'line-through')) {
16819
- /* eslint-enable */
16820
- return true;
16821
- }
16822
- else {
16823
- return false;
16824
- }
16825
- }
16826
- /**
16827
- * isSuperscript method
16828
- *
16829
- * @param {Node} node - specifies the node value
16830
- * @returns {boolean} - returns the boolean value
16831
- * @hidden
16832
- * @deprecated
16833
- */
16834
- static isSuperscript(node) {
16835
- const validTags = ['sup'];
16836
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16837
- return true;
16838
- }
16839
- else {
16840
- return false;
16841
- }
16842
- }
16843
- /**
16844
- * isSubscript method
16845
- *
16846
- * @param {Node} node - specifies the node value
16847
- * @returns {boolean} - returns the boolean value
16848
- * @hidden
16849
- * @deprecated
16850
- */
16851
- static isSubscript(node) {
16852
- const validTags = ['sub'];
16853
- if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
16854
- return true;
16855
- }
16856
- else {
16857
- return false;
16858
- }
16859
- }
16860
- isFontColor(node) {
16861
- const color = node.style && node.style.color;
16862
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16863
- color !== null && color !== '' && color !== undefined) {
16864
- return true;
16865
- }
16866
- else {
16867
- return false;
16868
- }
16869
- }
16870
- isBackgroundColor(node) {
16871
- const backColor = node.style && node.style.backgroundColor;
16872
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16873
- backColor !== null && backColor !== '' && backColor !== undefined) {
16874
- return true;
16875
- }
16876
- else {
16877
- return false;
16878
- }
16879
- }
16880
- isFontSize(node) {
16881
- const size = node.style && node.style.fontSize;
16882
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16883
- size !== null && size !== '' && size !== undefined) {
16884
- return true;
16885
- }
16886
- else {
16887
- return false;
16888
- }
16889
- }
16890
- isFontName(node) {
16891
- const name = node.style && node.style.fontFamily;
16892
- if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
16893
- name !== null && name !== '' && name !== undefined) {
16894
- return true;
16895
- }
16896
- else {
16897
- return false;
16898
- }
16899
- }
16900
- }
16901
- // Get Formatted Node
16902
- IsFormatted.inlineTags = [
16903
- 'a',
16904
- 'abbr',
16905
- 'acronym',
16906
- 'b',
16907
- 'bdo',
16908
- 'big',
16909
- 'cite',
16910
- 'code',
16911
- 'dfn',
16912
- 'em',
16913
- 'font',
16914
- 'i',
16915
- 'kbd',
16916
- 'label',
16917
- 'q',
16918
- 'samp',
16919
- 'small',
16920
- 'span',
16921
- 'strong',
16922
- 'sub',
16923
- 'sup',
16924
- 'tt',
16925
- 'u',
16926
- 'var',
16927
- 'del'
16928
- ];
16929
-
16930
17338
  /**
16931
17339
  * `Selection` module is used to handle RTE Selections.
16932
17340
  */
@@ -17294,6 +17702,10 @@ class SelectionCommands {
17294
17702
  liElement.style.fontStyle = 'normal';
17295
17703
  }
17296
17704
  }
17705
+ else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
17706
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
17707
+ SelectionCommands.conCatenateTextNode(liElement, format, '', 'normal');
17708
+ }
17297
17709
  }
17298
17710
  if (child[0] && !isFontStyle) {
17299
17711
  let nodeTraverse = child[index] ? child[index] : child[0];
@@ -17352,6 +17764,10 @@ class SelectionCommands {
17352
17764
  liElement.style.fontFamily = value;
17353
17765
  }
17354
17766
  }
17767
+ if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
17768
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
17769
+ SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
17770
+ }
17355
17771
  if (child[num].textContent === startText) {
17356
17772
  if (num === 0) {
17357
17773
  range.setStartBefore(child[num]);
@@ -17459,7 +17875,7 @@ class SelectionCommands {
17459
17875
  parentElement = parentElement.parentElement;
17460
17876
  liElement = parentElement;
17461
17877
  }
17462
- if (format === 'fontcolor' || format === 'fontname') {
17878
+ if (format === 'fontcolor' || format === 'fontname' || format === 'fontsize') {
17463
17879
  const parentElem = nodes[index].parentElement;
17464
17880
  if (!isNullOrUndefined(parentElem) && parentElem.childNodes) {
17465
17881
  for (let i = 0; i < parentElem.childNodes.length; i++) {
@@ -17479,6 +17895,9 @@ class SelectionCommands {
17479
17895
  case 'fontname':
17480
17896
  liElement.style.fontFamily = value;
17481
17897
  break;
17898
+ case 'fontsize':
17899
+ liElement.style.fontSize = value;
17900
+ break;
17482
17901
  default:
17483
17902
  break;
17484
17903
  }
@@ -17494,6 +17913,9 @@ class SelectionCommands {
17494
17913
  case 'fontname':
17495
17914
  childElement.style.fontFamily = 'initial';
17496
17915
  break;
17916
+ case 'fontsize':
17917
+ childElement.style.fontSize = 'initial';
17918
+ break;
17497
17919
  default:
17498
17920
  break;
17499
17921
  }
@@ -17553,6 +17975,10 @@ class SelectionCommands {
17553
17975
  }
17554
17976
  nodeList[0] = currentFormatNode;
17555
17977
  this.applyStyles(nodeList, 0, element);
17978
+ if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
17979
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
17980
+ SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
17981
+ }
17556
17982
  }
17557
17983
  else {
17558
17984
  nodes[index] = this.applyStyles(nodes, index, element);
@@ -17573,6 +17999,10 @@ class SelectionCommands {
17573
17999
  liElement.style.fontStyle = 'italic';
17574
18000
  }
17575
18001
  }
18002
+ else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
18003
+ && liElement.textContent.trim() !== nodes[index].textContent.trim()) {
18004
+ SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format);
18005
+ }
17576
18006
  }
17577
18007
  }
17578
18008
  }
@@ -17776,7 +18206,9 @@ class SelectionCommands {
17776
18206
  }
17777
18207
  const blockChildNodes = parent.parentElement.childNodes;
17778
18208
  for (let k = 0; k < blockChildNodes.length; k++) {
17779
- if (blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) {
18209
+ if ((blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) &&
18210
+ blockChildNodes[k].textContent.charCodeAt(0) !== 160) {
18211
+ // 160 is the char code for &nbsp;
17780
18212
  detach(blockChildNodes[k]);
17781
18213
  }
17782
18214
  }
@@ -17812,6 +18244,64 @@ class SelectionCommands {
17812
18244
  }
17813
18245
  return result;
17814
18246
  }
18247
+ static conCatenateTextNode(liElement, format, value, formatStr, constVal) {
18248
+ let result = '';
18249
+ switch (format) {
18250
+ case 'bold':
18251
+ liElement.querySelectorAll('strong').forEach(function (e) {
18252
+ result = result + e.textContent;
18253
+ });
18254
+ if (result === value) {
18255
+ liElement.style.fontWeight = formatStr;
18256
+ }
18257
+ break;
18258
+ case 'italic':
18259
+ liElement.querySelectorAll('em').forEach(function (e) {
18260
+ result = result + e.textContent;
18261
+ });
18262
+ if (result === value) {
18263
+ liElement.style.fontStyle = formatStr;
18264
+ }
18265
+ break;
18266
+ case 'fontcolor':
18267
+ let colorStyle = '';
18268
+ liElement.querySelectorAll('span').forEach(function (span) {
18269
+ colorStyle = span.style.color;
18270
+ if (colorStyle === constVal) {
18271
+ result = result + span.textContent;
18272
+ }
18273
+ });
18274
+ if (result === value) {
18275
+ liElement.style.color = colorStyle;
18276
+ liElement.style.textDecoration = 'inherit';
18277
+ }
18278
+ break;
18279
+ case 'fontsize':
18280
+ let fontSize = '';
18281
+ liElement.querySelectorAll('span').forEach(function (span) {
18282
+ fontSize = span.style.getPropertyValue('font-size');
18283
+ if (fontSize === constVal) {
18284
+ result = result + span.textContent;
18285
+ }
18286
+ });
18287
+ if (result === value) {
18288
+ liElement.style.fontSize = fontSize;
18289
+ }
18290
+ break;
18291
+ case 'fontname':
18292
+ let fontFamily = '';
18293
+ liElement.querySelectorAll('span').forEach(function (span) {
18294
+ fontFamily = span.style.getPropertyValue('font-family');
18295
+ if (fontFamily === constVal) {
18296
+ result = result + span.textContent;
18297
+ }
18298
+ });
18299
+ if (result === value) {
18300
+ liElement.style.fontFamily = fontFamily;
18301
+ }
18302
+ break;
18303
+ }
18304
+ }
17815
18305
  }
17816
18306
  SelectionCommands.enterAction = 'P';
17817
18307
 
@@ -19556,373 +20046,6 @@ class InsertTextExec {
19556
20046
  }
19557
20047
  }
19558
20048
 
19559
- /**
19560
- * Update Toolbar Status
19561
- *
19562
- * @hidden
19563
- * @deprecated
19564
- */
19565
- const statusCollection = getDefaultHtmlTbStatus();
19566
- class ToolbarStatus {
19567
- /**
19568
- * get method
19569
- *
19570
- * @param {Document} docElement - specifies the document element
19571
- * @param {Node} rootNode - specifies the content editable element
19572
- * @param {string[]} formatNode - specifies the format node
19573
- * @param {string[]} fontSize - specifies the font size
19574
- * @param {string[]} fontName - specifies the font name.
19575
- * @param {Node} documentNode - specifies the document node.
19576
- * @returns {IToolbarStatus} - returns the toolbar status
19577
- * @hidden
19578
- * @deprecated
19579
- */
19580
- static get(docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
19581
- let formatCollection = JSON.parse(JSON.stringify(statusCollection));
19582
- const nodeCollection = JSON.parse(JSON.stringify(statusCollection));
19583
- const nodeSelection = new NodeSelection();
19584
- const range = nodeSelection.getRange(docElement);
19585
- const nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
19586
- nodeSelection.getSelectionNodeCollectionBr(range);
19587
- const nodesLength = nodes.length;
19588
- let isNodeChanged = false;
19589
- for (let index = 0; index < nodes.length; index++) {
19590
- while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
19591
- nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
19592
- (this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
19593
- range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
19594
- nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
19595
- nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
19596
- isNodeChanged = true;
19597
- }
19598
- if (isNodeChanged && nodes[index]) {
19599
- nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
19600
- isNodeChanged = false;
19601
- }
19602
- if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
19603
- (nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
19604
- nodes.splice(index, 1);
19605
- index--;
19606
- }
19607
- }
19608
- for (let index = 0; index < nodes.length; index++) {
19609
- // eslint-disable-next-line max-len
19610
- formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], rootNode, formatNode, fontSize, fontName);
19611
- if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
19612
- nodeCollection.bold = formatCollection.bold;
19613
- }
19614
- if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
19615
- nodeCollection.insertcode = formatCollection.insertcode;
19616
- }
19617
- if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
19618
- nodeCollection.italic = formatCollection.italic;
19619
- }
19620
- if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
19621
- nodeCollection.underline = formatCollection.underline;
19622
- }
19623
- if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
19624
- nodeCollection.strikethrough = formatCollection.strikethrough;
19625
- }
19626
- if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
19627
- nodeCollection.superscript = formatCollection.superscript;
19628
- }
19629
- if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
19630
- nodeCollection.subscript = formatCollection.subscript;
19631
- }
19632
- if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
19633
- nodeCollection.fontcolor = formatCollection.fontcolor;
19634
- }
19635
- if (index === 0 && formatCollection.fontname) {
19636
- nodeCollection.fontname = formatCollection.fontname;
19637
- }
19638
- else {
19639
- nodeCollection.fontname = formatCollection.fontname === nodeCollection.fontname ? formatCollection.fontname : 'empty';
19640
- }
19641
- if (index === 0 && formatCollection.fontsize) {
19642
- nodeCollection.fontsize = formatCollection.fontsize;
19643
- }
19644
- else {
19645
- nodeCollection.fontsize = formatCollection.fontsize === nodeCollection.fontsize ? formatCollection.fontsize : 'empty';
19646
- }
19647
- if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
19648
- nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
19649
- }
19650
- if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
19651
- nodeCollection.orderedlist = formatCollection.orderedlist;
19652
- }
19653
- if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
19654
- nodeCollection.unorderedlist = formatCollection.unorderedlist;
19655
- }
19656
- if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
19657
- nodeCollection.alignments = formatCollection.alignments;
19658
- }
19659
- if (index === 0 && formatCollection.formats) {
19660
- nodeCollection.formats = formatCollection.formats;
19661
- }
19662
- else {
19663
- nodeCollection.formats = formatCollection.formats === nodeCollection.formats ? formatCollection.formats : 'empty';
19664
- }
19665
- if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
19666
- nodeCollection.createlink = formatCollection.createlink;
19667
- }
19668
- if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
19669
- nodeCollection.numberFormatList = formatCollection.numberFormatList;
19670
- }
19671
- if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
19672
- nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
19673
- }
19674
- formatCollection = JSON.parse(JSON.stringify(statusCollection));
19675
- }
19676
- return nodeCollection;
19677
- }
19678
- static getImmediateBlockNode(node) {
19679
- do {
19680
- node = node.parentNode;
19681
- } while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
19682
- return node;
19683
- }
19684
- static getFormatParent(docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
19685
- let isListUpdated = false;
19686
- let isComplexListUpdated = false;
19687
- if (targetNode.contains(node) ||
19688
- (node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
19689
- do {
19690
- formatCollection = this.isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName);
19691
- if (formatCollection.orderedlist || formatCollection.unorderedlist) {
19692
- isListUpdated = true;
19693
- }
19694
- if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
19695
- isComplexListUpdated = true;
19696
- }
19697
- node = node.parentNode;
19698
- } while (node && (node !== targetNode));
19699
- }
19700
- return formatCollection;
19701
- }
19702
- static isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName) {
19703
- if (!formatCollection.bold) {
19704
- formatCollection.bold = IsFormatted.isBold(node);
19705
- }
19706
- if (!formatCollection.italic) {
19707
- formatCollection.italic = IsFormatted.isItalic(node);
19708
- }
19709
- if (!formatCollection.underline) {
19710
- formatCollection.underline = IsFormatted.isUnderline(node);
19711
- }
19712
- if (!formatCollection.strikethrough) {
19713
- formatCollection.strikethrough = IsFormatted.isStrikethrough(node);
19714
- }
19715
- if (!formatCollection.superscript) {
19716
- formatCollection.superscript = IsFormatted.isSuperscript(node);
19717
- }
19718
- if (!formatCollection.subscript) {
19719
- formatCollection.subscript = IsFormatted.isSubscript(node);
19720
- }
19721
- if (!formatCollection.fontcolor) {
19722
- formatCollection.fontcolor = this.isFontColor(docElement, node);
19723
- }
19724
- if (!formatCollection.fontname) {
19725
- formatCollection.fontname = this.isFontName(docElement, node, fontName);
19726
- }
19727
- if (!formatCollection.fontsize) {
19728
- formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
19729
- }
19730
- if (!formatCollection.backgroundcolor) {
19731
- formatCollection.backgroundcolor = this.isBackgroundColor(node);
19732
- }
19733
- if (!formatCollection.orderedlist && !isListUpdated) {
19734
- formatCollection.orderedlist = this.isOrderedList(node);
19735
- }
19736
- if (!formatCollection.unorderedlist && !isListUpdated) {
19737
- formatCollection.unorderedlist = this.isUnorderedList(node);
19738
- }
19739
- if (!formatCollection.alignments) {
19740
- formatCollection.alignments = this.isAlignment(node);
19741
- }
19742
- if (!formatCollection.formats) {
19743
- formatCollection.formats = this.isFormats(node, formatNode);
19744
- if (formatCollection.formats === 'pre') {
19745
- formatCollection.insertcode = true;
19746
- }
19747
- }
19748
- if (!formatCollection.createlink) {
19749
- formatCollection.createlink = this.isLink(node);
19750
- }
19751
- if (!formatCollection.numberFormatList && !isComplexListUpdated) {
19752
- formatCollection.numberFormatList = this.isNumberFormatList(node);
19753
- }
19754
- if (!formatCollection.bulletFormatList && !isComplexListUpdated) {
19755
- formatCollection.bulletFormatList = this.isBulletFormatList(node);
19756
- }
19757
- return formatCollection;
19758
- }
19759
- static isFontColor(docElement, node) {
19760
- let color = node.style && node.style.color;
19761
- if ((color === null || color === undefined || color === '') && node.nodeType !== 3) {
19762
- color = this.getComputedStyle(docElement, node, 'color');
19763
- }
19764
- if (color !== null && color !== '' && color !== undefined) {
19765
- return color;
19766
- }
19767
- else {
19768
- return null;
19769
- }
19770
- }
19771
- static isLink(node) {
19772
- if (node.nodeName.toLocaleLowerCase() === 'a') {
19773
- return true;
19774
- }
19775
- else {
19776
- return false;
19777
- }
19778
- }
19779
- static isBackgroundColor(node) {
19780
- const backColor = node.style && node.style.backgroundColor;
19781
- if (backColor !== null && backColor !== '' && backColor !== undefined) {
19782
- return backColor;
19783
- }
19784
- else {
19785
- return null;
19786
- }
19787
- }
19788
- static isFontSize(docElement, node, fontSize) {
19789
- let size = node.style && node.style.fontSize;
19790
- if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
19791
- node.parentElement.classList.contains('e-content')) {
19792
- size = this.getComputedStyle(docElement, node, 'font-size');
19793
- }
19794
- if ((size !== null && size !== '' && size !== undefined)
19795
- && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
19796
- return size;
19797
- }
19798
- else {
19799
- return null;
19800
- }
19801
- }
19802
- static isFontName(docElement, node, fontName) {
19803
- let name = node.style && node.style.fontFamily;
19804
- if ((name === null || name === undefined || name === '') && node.nodeType !== 3) {
19805
- name = this.getComputedStyle(docElement, node, 'font-family');
19806
- }
19807
- let index = null;
19808
- if ((name !== null && name !== '' && name !== undefined)
19809
- && (fontName === null || fontName === undefined || (fontName.filter((value, pos) => {
19810
- // eslint-disable-next-line
19811
- const pattern = new RegExp(name, 'i');
19812
- if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
19813
- (value.split(',')[0] && !isNullOrUndefined(value.split(',')[0].trim().match(pattern)) &&
19814
- value.split(',')[0].trim() === value.split(',')[0].trim().match(pattern)[0])) {
19815
- index = pos;
19816
- }
19817
- }) && (index !== null)))) {
19818
- // eslint-disable-next-line
19819
- return (index !== null) ? fontName[index] : name.replace(/"/g, '');
19820
- }
19821
- else {
19822
- return null;
19823
- }
19824
- }
19825
- static isOrderedList(node) {
19826
- if (node.nodeName.toLocaleLowerCase() === 'ol') {
19827
- return true;
19828
- }
19829
- else {
19830
- return false;
19831
- }
19832
- }
19833
- static isUnorderedList(node) {
19834
- if (node.nodeName.toLocaleLowerCase() === 'ul') {
19835
- return true;
19836
- }
19837
- else {
19838
- return false;
19839
- }
19840
- }
19841
- static isAlignment(node) {
19842
- const align = node.style && node.style.textAlign;
19843
- if (align === 'left') {
19844
- return 'justifyleft';
19845
- }
19846
- else if (align === 'center') {
19847
- return 'justifycenter';
19848
- }
19849
- else if (align === 'right') {
19850
- return 'justifyright';
19851
- }
19852
- else if (align === 'justify') {
19853
- return 'justifyfull';
19854
- }
19855
- else {
19856
- return null;
19857
- }
19858
- }
19859
- static isFormats(node, formatNode) {
19860
- if (((formatNode === undefined || formatNode === null)
19861
- && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) > -1)
19862
- || (formatNode !== null && formatNode !== undefined
19863
- && formatNode.indexOf(node.nodeName.toLocaleLowerCase()) > -1)) {
19864
- return node.nodeName.toLocaleLowerCase();
19865
- }
19866
- else {
19867
- return null;
19868
- }
19869
- }
19870
- static getComputedStyle(docElement, node, prop) {
19871
- return docElement.defaultView.getComputedStyle(node, null).getPropertyValue(prop);
19872
- }
19873
- static isNumberFormatList(node) {
19874
- const list = node.style && node.style.listStyleType;
19875
- if (list === 'lower-alpha') {
19876
- return 'Lower Alpha';
19877
- }
19878
- else if (list === 'number') {
19879
- return 'Number';
19880
- }
19881
- else if (list === 'upper-alpha') {
19882
- return 'Upper Alpha';
19883
- }
19884
- else if (list === 'lower-roman') {
19885
- return 'Lower Roman';
19886
- }
19887
- else if (list === 'upper-roman') {
19888
- return 'Upper Roman';
19889
- }
19890
- else if (list === 'lower-greek') {
19891
- return 'Lower Greek';
19892
- }
19893
- else if (list === 'none') {
19894
- return 'None';
19895
- }
19896
- else if (this.isOrderedList(node)) {
19897
- return true;
19898
- }
19899
- else {
19900
- return null;
19901
- }
19902
- }
19903
- static isBulletFormatList(node) {
19904
- const list = node.style && node.style.listStyleType;
19905
- if (list === 'circle') {
19906
- return 'Circle';
19907
- }
19908
- else if (list === 'square') {
19909
- return 'Square';
19910
- }
19911
- else if (list === 'none') {
19912
- return 'None';
19913
- }
19914
- else if (list === 'disc') {
19915
- return 'Disc';
19916
- }
19917
- else if (this.isUnorderedList(node)) {
19918
- return true;
19919
- }
19920
- else {
19921
- return null;
19922
- }
19923
- }
19924
- }
19925
-
19926
20049
  class EmojiPickerAction {
19927
20050
  constructor(parent) {
19928
20051
  this.parent = parent;
@@ -21830,12 +21953,17 @@ class HtmlEditor {
21830
21953
  }
21831
21954
  let lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
21832
21955
  while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
21833
- lastNode.nodeName !== 'BR') {
21956
+ lastNode.nodeName !== 'BR' && !isNullOrUndefined(lastNode.lastChild)) {
21834
21957
  lastNode = lastNode.lastChild;
21835
21958
  }
21836
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
21837
- // eslint-disable-next-line
21838
- lastNode, lastNode.textContent.length);
21959
+ if (lastNode.nodeName === 'IMG') {
21960
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastNode.parentElement, lastNode.parentElement.childNodes.length);
21961
+ }
21962
+ else {
21963
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
21964
+ // eslint-disable-next-line
21965
+ lastNode, lastNode.textContent.length);
21966
+ }
21839
21967
  if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
21840
21968
  detach(this.oldRangeElement.querySelector('BR'));
21841
21969
  }
@@ -24144,6 +24272,9 @@ class FormatPainter {
24144
24272
  if ((originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste')) {
24145
24273
  originalEvent.stopPropagation();
24146
24274
  }
24275
+ if (Browser.userAgent.indexOf('Firefox') !== -1) {
24276
+ originalEvent.preventDefault();
24277
+ }
24147
24278
  this.actionHandler(event, 'keyBoard');
24148
24279
  }
24149
24280
  }
@@ -24887,7 +25018,7 @@ class EmojiPicker {
24887
25018
  }
24888
25019
  }
24889
25020
  }
24890
- if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':')) {
25021
+ if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':' && value !== ': :')) {
24891
25022
  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>';
24892
25023
  noEmojiObj.style.margin = '55px';
24893
25024
  emojipickerAll.appendChild(noEmojiObj);
@@ -27113,7 +27244,7 @@ class Image$1 {
27113
27244
  this.uploadObj.remove();
27114
27245
  }
27115
27246
  this.parent.isBlur = false;
27116
- if (event && event.event.returnValue) {
27247
+ if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
27117
27248
  if (this.parent.editorMode === 'HTML') {
27118
27249
  selection.restore();
27119
27250
  }
@@ -27232,6 +27363,9 @@ class Image$1 {
27232
27363
  removeClass([items[i]], 'e-resize');
27233
27364
  }
27234
27365
  }
27366
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
27367
+ this.dialogObj.hide();
27368
+ }
27235
27369
  }
27236
27370
  removeResizeEle() {
27237
27371
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
@@ -28070,6 +28204,7 @@ class Audio {
28070
28204
  this.parent.on(editAreaClick, this.editAreaClickHandler, this);
28071
28205
  this.parent.on(insertCompleted, this.showAudioQuickToolbar, this);
28072
28206
  this.parent.on(destroy, this.removeEventListener, this);
28207
+ this.parent.on(iframeMouseDown, this.closeDialog, this);
28073
28208
  }
28074
28209
  removeEventListener() {
28075
28210
  if (this.parent.isDestroyed) {
@@ -28088,6 +28223,7 @@ class Audio {
28088
28223
  this.parent.off(editAreaClick, this.editAreaClickHandler);
28089
28224
  this.parent.off(insertCompleted, this.showAudioQuickToolbar);
28090
28225
  this.parent.off(destroy, this.removeEventListener);
28226
+ this.parent.off(iframeMouseDown, this.closeDialog);
28091
28227
  if (!isNullOrUndefined(this.contentModule)) {
28092
28228
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
28093
28229
  EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
@@ -28336,7 +28472,7 @@ class Audio {
28336
28472
  this.parent.formatter.saveData();
28337
28473
  }
28338
28474
  e.selection.restore();
28339
- this.parent.formatter.process(this.parent, e.args, e.args, {
28475
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
28340
28476
  selectNode: e.selectNode,
28341
28477
  subCommand: e.args.item.subCommand
28342
28478
  });
@@ -28432,6 +28568,9 @@ class Audio {
28432
28568
  this.prevSelectedAudEle.style.outline = '';
28433
28569
  }
28434
28570
  }
28571
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
28572
+ this.dialogObj.hide();
28573
+ }
28435
28574
  }
28436
28575
  alignmentSelect(e) {
28437
28576
  const item = e.item;
@@ -28464,7 +28603,7 @@ class Audio {
28464
28603
  }
28465
28604
  const subCommand = (e.args.item) ?
28466
28605
  e.args.item.subCommand : 'Break';
28467
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
28606
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
28468
28607
  }
28469
28608
  inline(e) {
28470
28609
  if (e.selectNode[0].nodeName !== 'AUDIO') {
@@ -28472,7 +28611,7 @@ class Audio {
28472
28611
  }
28473
28612
  const subCommand = (e.args.item) ?
28474
28613
  e.args.item.subCommand : 'Inline';
28475
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
28614
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
28476
28615
  }
28477
28616
  editAreaClickHandler(e) {
28478
28617
  if (this.parent.readonly) {
@@ -28610,7 +28749,7 @@ class Audio {
28610
28749
  this.uploadObj.removing();
28611
28750
  }
28612
28751
  this.parent.isBlur = false;
28613
- if (event && event.event.returnValue) {
28752
+ if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
28614
28753
  if (this.parent.editorMode === 'HTML') {
28615
28754
  selection.restore();
28616
28755
  }
@@ -29696,7 +29835,7 @@ class Video {
29696
29835
  this.parent.formatter.saveData();
29697
29836
  }
29698
29837
  e.selection.restore();
29699
- this.parent.formatter.process(this.parent, e.args, e.args, {
29838
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
29700
29839
  selectNode: e.selectNode,
29701
29840
  subCommand: e.args.item.subCommand
29702
29841
  });
@@ -29786,6 +29925,9 @@ class Video {
29786
29925
  this.prevSelectedVidEle.style.outline = '';
29787
29926
  }
29788
29927
  }
29928
+ if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
29929
+ this.dialogObj.hide();
29930
+ }
29789
29931
  }
29790
29932
  removeResizeEle() {
29791
29933
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
@@ -29803,7 +29945,7 @@ class Video {
29803
29945
  }
29804
29946
  const subCommand = (e.args.item) ?
29805
29947
  e.args.item.subCommand : 'Break';
29806
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
29948
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
29807
29949
  }
29808
29950
  inline(e) {
29809
29951
  if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
@@ -29811,12 +29953,12 @@ class Video {
29811
29953
  }
29812
29954
  const subCommand = (e.args.item) ?
29813
29955
  e.args.item.subCommand : 'Inline';
29814
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
29956
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
29815
29957
  }
29816
29958
  alignVideo(e, type) {
29817
29959
  const subCommand = (e.args.item) ?
29818
29960
  e.args.item.subCommand : type;
29819
- this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
29961
+ this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
29820
29962
  }
29821
29963
  editAreaClickHandler(e) {
29822
29964
  if (this.parent.readonly) {
@@ -29958,7 +30100,7 @@ class Video {
29958
30100
  this.uploadObj.removing();
29959
30101
  }
29960
30102
  this.parent.isBlur = false;
29961
- if (event && event.event.returnValue) {
30103
+ if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
29962
30104
  if (this.parent.editorMode === 'HTML') {
29963
30105
  selection.restore();
29964
30106
  }
@@ -30049,21 +30191,26 @@ class Video {
30049
30191
  }
30050
30192
  }
30051
30193
  });
30052
- if (e.selectNode && ((e.selectNode[0] && e.selectNode[0].nodeType !== 3 &&
30053
- e.selectNode[0].nodeName !== 'BR' &&
30054
- (e.selectNode[0].classList &&
30055
- e.selectNode[0].classList.contains(CLS_VID_CLICK_ELEM))) ||
30056
- e.selectNode[0].nodeName === 'IFRAME' || e.selectNode[0].nodeName === 'VIDEO')) {
30057
- const regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
30058
- const sourceElement = e.selectNode[0].querySelector('source');
30059
- this.inputUrl.value = sourceElement.src.match(regex) ? sourceElement.src : '';
30194
+ if (e.selectNode && e.selectNode[0] && (e.selectNode[0].nodeName === 'VIDEO' || this.isEmbedVidElem(e.selectNode[0]))) {
30195
+ if (e.selectNode[0].nodeName === 'VIDEO') {
30196
+ const regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
30197
+ const sourceElement = e.selectNode[0].querySelector('source');
30198
+ this.inputUrl.value = sourceElement && sourceElement.src && sourceElement.src.match(regex) ? sourceElement.src : '';
30199
+ }
30200
+ else {
30201
+ this.embedInputUrl.value = e.selectNode[0].nodeName === 'IFRAME' ? e.selectNode[0].outerHTML
30202
+ : e.selectNode[0].querySelector('iframe').outerHTML;
30203
+ }
30060
30204
  }
30205
+ const isWebUrl = this.inputUrl.value ? true : false;
30061
30206
  const embedUrlBtn = new RadioButton({
30062
30207
  label: this.i10n.getConstant('embeddedCode'),
30063
- checked: true,
30208
+ checked: !isWebUrl,
30064
30209
  name: 'URL',
30065
30210
  created: () => {
30066
- urlContent.appendChild(this.embedInputUrl);
30211
+ if (!isWebUrl) {
30212
+ urlContent.appendChild(this.embedInputUrl);
30213
+ }
30067
30214
  },
30068
30215
  change: () => {
30069
30216
  urlContent.innerHTML = '';
@@ -30073,7 +30220,13 @@ class Video {
30073
30220
  embedUrlBtn.appendTo(videoUrl.querySelector('#embedURL'));
30074
30221
  const webUrlBtn = new RadioButton({
30075
30222
  label: this.i10n.getConstant('webUrl'),
30223
+ checked: isWebUrl,
30076
30224
  name: 'URL',
30225
+ created: () => {
30226
+ if (isWebUrl) {
30227
+ urlContent.appendChild(this.inputUrl);
30228
+ }
30229
+ },
30077
30230
  change: () => {
30078
30231
  urlContent.innerHTML = '';
30079
30232
  urlContent.appendChild(this.inputUrl);
@@ -31229,13 +31382,14 @@ class Table {
31229
31382
  }
31230
31383
  const target = e.target || e.targetTouches[0].target;
31231
31384
  const closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
31232
- if (!isNullOrUndefined(this.curTable) && !isNullOrUndefined(closestTable) && closestTable !== this.curTable &&
31385
+ const 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;
31386
+ if (!isResizing && !isNullOrUndefined(this.curTable) && !isNullOrUndefined(closestTable) && closestTable !== this.curTable &&
31233
31387
  this.parent.contentModule.getEditPanel().contains(closestTable)) {
31234
31388
  this.removeResizeElement();
31235
31389
  this.removeHelper(e);
31236
31390
  this.cancelResizeAction();
31237
31391
  }
31238
- if (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH') {
31392
+ if (!isResizing && (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH')) {
31239
31393
  this.curTable = (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable))
31240
31394
  && (target.nodeName === 'TD' || target.nodeName === 'TH') ?
31241
31395
  closestTable : target;
@@ -31380,7 +31534,6 @@ class Table {
31380
31534
  e.preventDefault();
31381
31535
  this.parent.preventDefaultResize(e);
31382
31536
  removeClass(this.curTable.querySelectorAll('td,th'), CLS_TABLE_SEL);
31383
- this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
31384
31537
  this.pageX = this.getPointX(e);
31385
31538
  this.pageY = this.getPointY(e);
31386
31539
  this.resizeBtnInit();
@@ -31639,7 +31792,8 @@ class Table {
31639
31792
  const width = parseFloat(this.curTable.style.width);
31640
31793
  currentMarginLeft = 100 - width;
31641
31794
  }
31642
- if (currentMarginLeft && currentMarginLeft < 1) {
31795
+ // For table pasted from word, Margin left can be anything so we are avoiding the below process.
31796
+ if (!this.curTable.classList.contains('e-rte-paste-table') && currentMarginLeft && currentMarginLeft < 1) {
31643
31797
  this.curTable.style.marginLeft = null;
31644
31798
  this.curTable.style.width = '100%';
31645
31799
  return;
@@ -31802,7 +31956,13 @@ class Table {
31802
31956
  tableTrPercentage[i] = percentage;
31803
31957
  }
31804
31958
  for (let i = 0; i < currentTableTrElement.length; i++) {
31805
- currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
31959
+ if (currentTableTrElement[i].parentElement.nodeName === 'THEAD') {
31960
+ currentTableTrElement[i].parentElement.style.height = tableTrPercentage[i] + '%';
31961
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
31962
+ }
31963
+ else {
31964
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
31965
+ }
31806
31966
  }
31807
31967
  const args = { event: e, requestType: 'table' };
31808
31968
  this.parent.trigger(resizeStop, args);
@@ -31951,6 +32111,9 @@ class Table {
31951
32111
  if (this.popupObj) {
31952
32112
  this.popupObj.hide();
31953
32113
  }
32114
+ if (this.parent.inlineMode.enable && this.editdlgObj) {
32115
+ this.editdlgObj.hide();
32116
+ }
31954
32117
  }
31955
32118
  docClick(e) {
31956
32119
  const target = e.args.target;
@@ -33098,7 +33261,7 @@ class EnterKeyAction {
33098
33261
  curElement = curElement.parentElement;
33099
33262
  blockElement = curElement;
33100
33263
  }
33101
- isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
33264
+ isTableEnter = blockElement.tagName === 'TH' || blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
33102
33265
  }
33103
33266
  if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
33104
33267
  if (isNullOrUndefined(this.startNode.closest('LI, UL, OL')) && isNullOrUndefined(this.endNode.closest('LI, UL, OL')) &&
@@ -33113,6 +33276,9 @@ class EnterKeyAction {
33113
33276
  };
33114
33277
  this.parent.trigger(actionBegin, actionBeginArgs, (actionBeginArgs) => {
33115
33278
  if (!actionBeginArgs.cancel) {
33279
+ if (this.parent.formatter.getUndoRedoStack().length === 0) {
33280
+ this.parent.formatter.saveData();
33281
+ }
33116
33282
  if (!(this.range.startOffset === this.range.endOffset && this.range.startContainer === this.range.endContainer)) {
33117
33283
  if (!(this.range.startContainer.nodeName === 'SPAN' && (this.range.startContainer.classList.contains('e-video-wrap') ||
33118
33284
  this.range.startContainer.classList.contains('e-audio-wrap')))) {
@@ -34247,8 +34413,8 @@ let RichTextEditor = class RichTextEditor extends Component {
34247
34413
  !(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which == 67))) {
34248
34414
  this.formatter.saveData();
34249
34415
  }
34250
- if (e.action !== 'insert-link' &&
34251
- e.action !== 'format-copy' && e.action !== 'format-paste' &&
34416
+ const keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
34417
+ if (keyboardEventAction.indexOf(e.action) === -1 &&
34252
34418
  (!e.target || !(e.target.classList.contains('e-mention') && !isNullOrUndefined(document.querySelector('#' + e.target.id + '_popup.e-popup-open')) && e.code === 'Tab')) &&
34253
34419
  (e.action && e.action !== 'paste' && e.action !== 'space'
34254
34420
  || e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
@@ -35900,9 +36066,7 @@ let RichTextEditor = class RichTextEditor extends Component {
35900
36066
  autoResize() {
35901
36067
  if (this.height === 'auto') {
35902
36068
  if (this.editorMode === 'Markdown') {
35903
- setTimeout(() => {
35904
- this.setAutoHeight(this.inputElement);
35905
- }, 0);
36069
+ this.setAutoHeight(this.inputElement);
35906
36070
  }
35907
36071
  else if (this.iframeSettings.enable) {
35908
36072
  const iframeElement = this.element.querySelector('#' + this.getID() + '_rte-view');
@@ -35915,21 +36079,10 @@ let RichTextEditor = class RichTextEditor extends Component {
35915
36079
  }
35916
36080
  }
35917
36081
  setAutoHeight(element) {
35918
- if (!isNullOrUndefined(element) && !this.iframeSettings.enable) {
36082
+ if (!isNullOrUndefined(element)) {
35919
36083
  element.style.height = this.inputElement.scrollHeight + 'px';
35920
36084
  element.style.overflow = 'hidden';
35921
36085
  }
35922
- else if (!isNullOrUndefined(element) && !isNullOrUndefined(element.parentElement) && this.iframeSettings.enable) {
35923
- const newRange = this.getRange();
35924
- element.style.height = 'auto';
35925
- const newHeight = element.contentDocument.body.scrollHeight + 'px';
35926
- element.style.height = newHeight;
35927
- element.style.overflow = 'hidden';
35928
- // 16 px added for padding doesn't affect the editor height
35929
- if (newRange.startContainer.nodeName !== '#text' && newRange.startContainer.nodeName !== 'BODY' && window.innerHeight < newRange.startContainer.getBoundingClientRect().top + element.getBoundingClientRect().top + 16) {
35930
- newRange.startContainer.scrollIntoView(false);
35931
- }
35932
- }
35933
36086
  }
35934
36087
  wireEvents() {
35935
36088
  this.element.addEventListener('focusin', this.onFocusHandler, true);
@@ -36427,5 +36580,5 @@ RichTextEditor = __decorate$1([
36427
36580
  * Rich Text Editor component exported items
36428
36581
  */
36429
36582
 
36430
- 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 };
36583
+ 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, 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 };
36431
36584
  //# sourceMappingURL=ej2-richtexteditor.es2015.js.map