@syncfusion/ej2-richtexteditor 25.1.38 → 25.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +1996 -1801
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +2058 -1863
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/editor-manager/plugin/audio.js +1 -1
- package/src/editor-manager/plugin/formats.js +6 -0
- package/src/editor-manager/plugin/indents.js +1 -1
- package/src/editor-manager/plugin/inserthtml.js +9 -3
- package/src/editor-manager/plugin/link.js +4 -2
- package/src/editor-manager/plugin/lists.js +38 -14
- package/src/editor-manager/plugin/nodecutter.js +3 -0
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +84 -2
- package/src/editor-manager/plugin/table.d.ts +4 -0
- package/src/editor-manager/plugin/table.js +62 -19
- package/src/editor-manager/plugin/video.js +1 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +1 -0
- package/src/rich-text-editor/actions/base-quick-toolbar.js +9 -13
- package/src/rich-text-editor/actions/base-toolbar.js +3 -2
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +1 -0
- package/src/rich-text-editor/actions/dropdown-buttons.js +8 -23
- package/src/rich-text-editor/actions/emoji-picker.js +1 -1
- package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
- package/src/rich-text-editor/actions/enter-key.js +50 -1
- package/src/rich-text-editor/actions/format-painter.js +4 -1
- package/src/rich-text-editor/actions/html-editor.js +9 -4
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +0 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +2 -26
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +2 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +14 -4
- package/src/rich-text-editor/base/enum.d.ts +11 -0
- package/src/rich-text-editor/base/enum.js +12 -0
- package/src/rich-text-editor/base/interface.d.ts +9 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -2
- package/src/rich-text-editor/base/rich-text-editor.js +4 -18
- package/src/rich-text-editor/base/util.d.ts +0 -4
- package/src/rich-text-editor/base/util.js +1 -35
- package/src/rich-text-editor/formatter/formatter.js +4 -2
- package/src/rich-text-editor/renderer/audio-module.js +9 -4
- package/src/rich-text-editor/renderer/image-module.js +7 -2
- package/src/rich-text-editor/renderer/table-module.js +15 -5
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -1
- package/src/rich-text-editor/renderer/toolbar-renderer.js +27 -23
- package/src/rich-text-editor/renderer/video-module.js +29 -15
- package/styles/bootstrap-dark.css +11 -0
- package/styles/bootstrap.css +11 -0
- package/styles/bootstrap4.css +11 -0
- package/styles/bootstrap5-dark.css +11 -0
- package/styles/bootstrap5.css +11 -0
- package/styles/fabric-dark.css +11 -0
- package/styles/fabric.css +11 -0
- package/styles/fluent-dark.css +11 -0
- package/styles/fluent.css +11 -0
- package/styles/highcontrast-light.css +11 -0
- package/styles/highcontrast.css +11 -0
- package/styles/material-dark.css +11 -0
- package/styles/material.css +11 -0
- package/styles/material3-dark.css +11 -0
- package/styles/material3.css +11 -0
- package/styles/rich-text-editor/_bds-definition.scss +6 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +6 -0
- package/styles/rich-text-editor/_bootstrap-definition.scss +6 -0
- package/styles/rich-text-editor/_bootstrap4-definition.scss +6 -0
- package/styles/rich-text-editor/_bootstrap5-definition.scss +6 -0
- package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -0
- package/styles/rich-text-editor/_fabric-definition.scss +6 -0
- package/styles/rich-text-editor/_fluent-definition.scss +6 -0
- package/styles/rich-text-editor/_fusionnew-definition.scss +6 -0
- package/styles/rich-text-editor/_highcontrast-definition.scss +6 -0
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -0
- package/styles/rich-text-editor/_layout.scss +10 -0
- package/styles/rich-text-editor/_material-dark-definition.scss +6 -0
- package/styles/rich-text-editor/_material-definition.scss +6 -0
- package/styles/rich-text-editor/_material3-definition.scss +6 -0
- package/styles/rich-text-editor/_tailwind-definition.scss +6 -0
- package/styles/rich-text-editor/bootstrap-dark.css +11 -0
- package/styles/rich-text-editor/bootstrap.css +11 -0
- package/styles/rich-text-editor/bootstrap4.css +11 -0
- package/styles/rich-text-editor/bootstrap5-dark.css +11 -0
- package/styles/rich-text-editor/bootstrap5.css +11 -0
- package/styles/rich-text-editor/fabric-dark.css +11 -0
- package/styles/rich-text-editor/fabric.css +11 -0
- package/styles/rich-text-editor/fluent-dark.css +11 -0
- package/styles/rich-text-editor/fluent.css +11 -0
- package/styles/rich-text-editor/highcontrast-light.css +11 -0
- package/styles/rich-text-editor/highcontrast.css +11 -0
- package/styles/rich-text-editor/material-dark.css +11 -0
- package/styles/rich-text-editor/material.css +11 -0
- package/styles/rich-text-editor/material3-dark.css +11 -0
- package/styles/rich-text-editor/material3.css +11 -0
- package/styles/rich-text-editor/tailwind-dark.css +11 -0
- package/styles/rich-text-editor/tailwind.css +11 -0
- package/styles/tailwind-dark.css +11 -0
- package/styles/tailwind.css +11 -0
|
@@ -1648,6 +1648,18 @@ var DialogType;
|
|
|
1648
1648
|
DialogType["InsertTable"] = "InsertTable";
|
|
1649
1649
|
/* eslint-enable */
|
|
1650
1650
|
})(DialogType || (DialogType = {}));
|
|
1651
|
+
/**
|
|
1652
|
+
* Defines types to be used as inserted image.
|
|
1653
|
+
*/
|
|
1654
|
+
var UploadRequest;
|
|
1655
|
+
(function (UploadRequest) {
|
|
1656
|
+
/** Defines UploadRequest as Uploaded */
|
|
1657
|
+
UploadRequest["Uploaded"] = "Uploaded";
|
|
1658
|
+
/** Defines UploadRequest as Dropped */
|
|
1659
|
+
UploadRequest["Dropped"] = "Dropped";
|
|
1660
|
+
/** Defines UploadRequest as Pasted */
|
|
1661
|
+
UploadRequest["Pasted"] = "Pasted";
|
|
1662
|
+
})(UploadRequest || (UploadRequest = {}));
|
|
1651
1663
|
|
|
1652
1664
|
/* eslint-disable */
|
|
1653
1665
|
/**
|
|
@@ -3089,40 +3101,6 @@ function getTooltipText(item, serviceLocator) {
|
|
|
3089
3101
|
const tooltipText = i10n.getConstant(itemLocale);
|
|
3090
3102
|
return tooltipText;
|
|
3091
3103
|
}
|
|
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
3104
|
/**
|
|
3127
3105
|
* @param {ISetToolbarStatusArgs} e - specifies the e element
|
|
3128
3106
|
* @param {boolean} isPopToolbar - specifies the boolean value
|
|
@@ -3591,6 +3569,1386 @@ function updateDropDownFontFormatLocale(self) {
|
|
|
3591
3569
|
});
|
|
3592
3570
|
}
|
|
3593
3571
|
|
|
3572
|
+
/**
|
|
3573
|
+
* Is formatted or not.
|
|
3574
|
+
*
|
|
3575
|
+
* @hidden
|
|
3576
|
+
* @deprecated
|
|
3577
|
+
*/
|
|
3578
|
+
class IsFormatted {
|
|
3579
|
+
/**
|
|
3580
|
+
* getFormattedNode method
|
|
3581
|
+
*
|
|
3582
|
+
* @param {Node} node - specifies the node.
|
|
3583
|
+
* @param {string} format - specifies the string value.
|
|
3584
|
+
* @param {Node} endNode - specifies the end node
|
|
3585
|
+
* @returns {Node} - returns the node
|
|
3586
|
+
* @hidden
|
|
3587
|
+
* @deprecated
|
|
3588
|
+
*/
|
|
3589
|
+
getFormattedNode(node, format, endNode) {
|
|
3590
|
+
const parentNode = this.getFormatParent(node, format, endNode);
|
|
3591
|
+
if (parentNode !== null && parentNode !== endNode) {
|
|
3592
|
+
return parentNode;
|
|
3593
|
+
}
|
|
3594
|
+
return null;
|
|
3595
|
+
}
|
|
3596
|
+
getFormatParent(node, format, endNode) {
|
|
3597
|
+
do {
|
|
3598
|
+
node = node.parentNode;
|
|
3599
|
+
} while (node && (node !== endNode) && !this.isFormattedNode(node, format));
|
|
3600
|
+
return node;
|
|
3601
|
+
}
|
|
3602
|
+
isFormattedNode(node, format) {
|
|
3603
|
+
switch (format) {
|
|
3604
|
+
case 'bold':
|
|
3605
|
+
return IsFormatted.isBold(node);
|
|
3606
|
+
case 'italic':
|
|
3607
|
+
return IsFormatted.isItalic(node);
|
|
3608
|
+
case 'underline':
|
|
3609
|
+
return IsFormatted.isUnderline(node);
|
|
3610
|
+
case 'strikethrough':
|
|
3611
|
+
return IsFormatted.isStrikethrough(node);
|
|
3612
|
+
case 'superscript':
|
|
3613
|
+
return IsFormatted.isSuperscript(node);
|
|
3614
|
+
case 'subscript':
|
|
3615
|
+
return IsFormatted.isSubscript(node);
|
|
3616
|
+
case 'fontcolor':
|
|
3617
|
+
return this.isFontColor(node);
|
|
3618
|
+
case 'fontname':
|
|
3619
|
+
return this.isFontName(node);
|
|
3620
|
+
case 'fontsize':
|
|
3621
|
+
return this.isFontSize(node);
|
|
3622
|
+
case 'backgroundcolor':
|
|
3623
|
+
return this.isBackgroundColor(node);
|
|
3624
|
+
default:
|
|
3625
|
+
return false;
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
/**
|
|
3629
|
+
* isBold method
|
|
3630
|
+
*
|
|
3631
|
+
* @param {Node} node - specifies the node value
|
|
3632
|
+
* @returns {boolean} - returns the boolean value
|
|
3633
|
+
* @hidden
|
|
3634
|
+
* @deprecated
|
|
3635
|
+
*/
|
|
3636
|
+
static isBold(node) {
|
|
3637
|
+
const validTags = ['strong', 'b'];
|
|
3638
|
+
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
3639
|
+
return true;
|
|
3640
|
+
}
|
|
3641
|
+
else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3642
|
+
node.style && node.style.fontWeight === 'bold') {
|
|
3643
|
+
return true;
|
|
3644
|
+
}
|
|
3645
|
+
else {
|
|
3646
|
+
return false;
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
/**
|
|
3650
|
+
* isItalic method
|
|
3651
|
+
*
|
|
3652
|
+
* @param {Node} node - specifies the node value
|
|
3653
|
+
* @returns {boolean} - returns the boolean value
|
|
3654
|
+
* @hidden
|
|
3655
|
+
* @deprecated
|
|
3656
|
+
*/
|
|
3657
|
+
static isItalic(node) {
|
|
3658
|
+
const validTags = ['em', 'i'];
|
|
3659
|
+
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
3660
|
+
return true;
|
|
3661
|
+
}
|
|
3662
|
+
else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3663
|
+
node.style && node.style.fontStyle === 'italic') {
|
|
3664
|
+
return true;
|
|
3665
|
+
}
|
|
3666
|
+
else {
|
|
3667
|
+
return false;
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
/**
|
|
3671
|
+
* isUnderline method
|
|
3672
|
+
*
|
|
3673
|
+
* @param {Node} node - specifies the node value
|
|
3674
|
+
* @returns {boolean} - returns the boolean value
|
|
3675
|
+
* @hidden
|
|
3676
|
+
* @deprecated
|
|
3677
|
+
*/
|
|
3678
|
+
static isUnderline(node) {
|
|
3679
|
+
const validTags = ['u'];
|
|
3680
|
+
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
3681
|
+
return true;
|
|
3682
|
+
/* eslint-disable */
|
|
3683
|
+
}
|
|
3684
|
+
else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3685
|
+
node.style && (node.style.textDecoration === 'underline' ||
|
|
3686
|
+
node.style.textDecorationLine === 'underline')) {
|
|
3687
|
+
/* eslint-enable */
|
|
3688
|
+
return true;
|
|
3689
|
+
}
|
|
3690
|
+
else {
|
|
3691
|
+
return false;
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
/**
|
|
3695
|
+
* isStrikethrough method
|
|
3696
|
+
*
|
|
3697
|
+
* @param {Node} node - specifies the node value
|
|
3698
|
+
* @returns {boolean} - returns the boolean value
|
|
3699
|
+
* @hidden
|
|
3700
|
+
* @deprecated
|
|
3701
|
+
*/
|
|
3702
|
+
static isStrikethrough(node) {
|
|
3703
|
+
const validTags = ['del', 'strike'];
|
|
3704
|
+
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
3705
|
+
return true;
|
|
3706
|
+
/* eslint-disable */
|
|
3707
|
+
}
|
|
3708
|
+
else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3709
|
+
node.style && (node.style.textDecoration === 'line-through' ||
|
|
3710
|
+
node.style.textDecorationLine === 'line-through')) {
|
|
3711
|
+
/* eslint-enable */
|
|
3712
|
+
return true;
|
|
3713
|
+
}
|
|
3714
|
+
else {
|
|
3715
|
+
return false;
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
/**
|
|
3719
|
+
* isSuperscript method
|
|
3720
|
+
*
|
|
3721
|
+
* @param {Node} node - specifies the node value
|
|
3722
|
+
* @returns {boolean} - returns the boolean value
|
|
3723
|
+
* @hidden
|
|
3724
|
+
* @deprecated
|
|
3725
|
+
*/
|
|
3726
|
+
static isSuperscript(node) {
|
|
3727
|
+
const validTags = ['sup'];
|
|
3728
|
+
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
3729
|
+
return true;
|
|
3730
|
+
}
|
|
3731
|
+
else {
|
|
3732
|
+
return false;
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
/**
|
|
3736
|
+
* isSubscript method
|
|
3737
|
+
*
|
|
3738
|
+
* @param {Node} node - specifies the node value
|
|
3739
|
+
* @returns {boolean} - returns the boolean value
|
|
3740
|
+
* @hidden
|
|
3741
|
+
* @deprecated
|
|
3742
|
+
*/
|
|
3743
|
+
static isSubscript(node) {
|
|
3744
|
+
const validTags = ['sub'];
|
|
3745
|
+
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
3746
|
+
return true;
|
|
3747
|
+
}
|
|
3748
|
+
else {
|
|
3749
|
+
return false;
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
isFontColor(node) {
|
|
3753
|
+
const color = node.style && node.style.color;
|
|
3754
|
+
if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3755
|
+
color !== null && color !== '' && color !== undefined) {
|
|
3756
|
+
return true;
|
|
3757
|
+
}
|
|
3758
|
+
else {
|
|
3759
|
+
return false;
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
isBackgroundColor(node) {
|
|
3763
|
+
const backColor = node.style && node.style.backgroundColor;
|
|
3764
|
+
if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3765
|
+
backColor !== null && backColor !== '' && backColor !== undefined) {
|
|
3766
|
+
return true;
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
return false;
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
isFontSize(node) {
|
|
3773
|
+
const size = node.style && node.style.fontSize;
|
|
3774
|
+
if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3775
|
+
size !== null && size !== '' && size !== undefined) {
|
|
3776
|
+
return true;
|
|
3777
|
+
}
|
|
3778
|
+
else {
|
|
3779
|
+
return false;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
isFontName(node) {
|
|
3783
|
+
const name = node.style && node.style.fontFamily;
|
|
3784
|
+
if (IsFormatted.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
3785
|
+
name !== null && name !== '' && name !== undefined) {
|
|
3786
|
+
return true;
|
|
3787
|
+
}
|
|
3788
|
+
else {
|
|
3789
|
+
return false;
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
// Get Formatted Node
|
|
3794
|
+
IsFormatted.inlineTags = [
|
|
3795
|
+
'a',
|
|
3796
|
+
'abbr',
|
|
3797
|
+
'acronym',
|
|
3798
|
+
'b',
|
|
3799
|
+
'bdo',
|
|
3800
|
+
'big',
|
|
3801
|
+
'cite',
|
|
3802
|
+
'code',
|
|
3803
|
+
'dfn',
|
|
3804
|
+
'em',
|
|
3805
|
+
'font',
|
|
3806
|
+
'i',
|
|
3807
|
+
'kbd',
|
|
3808
|
+
'label',
|
|
3809
|
+
'q',
|
|
3810
|
+
'samp',
|
|
3811
|
+
'small',
|
|
3812
|
+
'span',
|
|
3813
|
+
'strong',
|
|
3814
|
+
'sub',
|
|
3815
|
+
'sup',
|
|
3816
|
+
'tt',
|
|
3817
|
+
'u',
|
|
3818
|
+
'var',
|
|
3819
|
+
'del'
|
|
3820
|
+
];
|
|
3821
|
+
|
|
3822
|
+
/**
|
|
3823
|
+
* Constant values for EditorManager
|
|
3824
|
+
*/
|
|
3825
|
+
/**
|
|
3826
|
+
* Image plugin events
|
|
3827
|
+
*
|
|
3828
|
+
* @hidden
|
|
3829
|
+
*/
|
|
3830
|
+
const IMAGE = 'INSERT-IMAGE';
|
|
3831
|
+
const AUDIO = 'INSERT-AUDIO';
|
|
3832
|
+
const VIDEO = 'INSERT-VIDEO';
|
|
3833
|
+
const TABLE = 'INSERT-TABLE';
|
|
3834
|
+
const LINK = 'INSERT-LINK';
|
|
3835
|
+
const INSERT_ROW = 'INSERT-ROW';
|
|
3836
|
+
const INSERT_COLUMN = 'INSERT-COLUMN';
|
|
3837
|
+
const DELETEROW = 'DELETE-ROW';
|
|
3838
|
+
const DELETECOLUMN = 'DELETE-COLUMN';
|
|
3839
|
+
const REMOVETABLE = 'REMOVE-TABLE';
|
|
3840
|
+
const TABLEHEADER = 'TABLE-HEADER';
|
|
3841
|
+
const TABLE_VERTICAL_ALIGN = 'TABLE_VERTICAL_ALIGN';
|
|
3842
|
+
const TABLE_MERGE = 'TABLE_MERGE';
|
|
3843
|
+
const TABLE_VERTICAL_SPLIT = 'TABLE_VERTICAL_SPLIT';
|
|
3844
|
+
const TABLE_HORIZONTAL_SPLIT = 'TABLE_HORIZONTAL_SPLIT';
|
|
3845
|
+
const TABLE_MOVE = 'TABLE_MOVE';
|
|
3846
|
+
/**
|
|
3847
|
+
* Alignments plugin events
|
|
3848
|
+
*
|
|
3849
|
+
* @hidden
|
|
3850
|
+
*/
|
|
3851
|
+
const ALIGNMENT_TYPE = 'alignment-type';
|
|
3852
|
+
/**
|
|
3853
|
+
* Indents plugin events
|
|
3854
|
+
*
|
|
3855
|
+
* @hidden
|
|
3856
|
+
*/
|
|
3857
|
+
const INDENT_TYPE = 'indent-type';
|
|
3858
|
+
/**
|
|
3859
|
+
* Constant tag names
|
|
3860
|
+
*
|
|
3861
|
+
* @hidden
|
|
3862
|
+
*/
|
|
3863
|
+
const DEFAULT_TAG = 'p';
|
|
3864
|
+
/**
|
|
3865
|
+
* @hidden
|
|
3866
|
+
*/
|
|
3867
|
+
const BLOCK_TAGS = ['address', 'article', 'aside', 'audio', 'blockquote',
|
|
3868
|
+
'canvas', 'details', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer',
|
|
3869
|
+
'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav',
|
|
3870
|
+
'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tbody', 'td', 'tfoot', 'th',
|
|
3871
|
+
'thead', 'tr', 'ul', 'video', 'body'];
|
|
3872
|
+
/**
|
|
3873
|
+
* @hidden
|
|
3874
|
+
*/
|
|
3875
|
+
const IGNORE_BLOCK_TAGS = ['td', 'th'];
|
|
3876
|
+
/**
|
|
3877
|
+
* @hidden
|
|
3878
|
+
*/
|
|
3879
|
+
const TABLE_BLOCK_TAGS = ['table', 'tbody', 'td', 'tfoot', 'th',
|
|
3880
|
+
'thead', 'tr'];
|
|
3881
|
+
/**
|
|
3882
|
+
* Selection plugin events
|
|
3883
|
+
*
|
|
3884
|
+
* @hidden
|
|
3885
|
+
*/
|
|
3886
|
+
const SELECTION_TYPE = 'selection-type';
|
|
3887
|
+
/**
|
|
3888
|
+
* Insert HTML plugin events
|
|
3889
|
+
*
|
|
3890
|
+
* @hidden
|
|
3891
|
+
*/
|
|
3892
|
+
const INSERTHTML_TYPE = 'inserthtml-type';
|
|
3893
|
+
/**
|
|
3894
|
+
* Insert Text plugin events
|
|
3895
|
+
*
|
|
3896
|
+
* @hidden
|
|
3897
|
+
*/
|
|
3898
|
+
const INSERT_TEXT_TYPE = 'insert-text-type';
|
|
3899
|
+
/**
|
|
3900
|
+
* Clear Format HTML plugin events
|
|
3901
|
+
*
|
|
3902
|
+
* @hidden
|
|
3903
|
+
*/
|
|
3904
|
+
const CLEAR_TYPE = 'clear-type';
|
|
3905
|
+
/**
|
|
3906
|
+
* Self closing tags
|
|
3907
|
+
*
|
|
3908
|
+
* @hidden
|
|
3909
|
+
*/
|
|
3910
|
+
const SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
|
|
3911
|
+
/**
|
|
3912
|
+
* Source
|
|
3913
|
+
*
|
|
3914
|
+
* @hidden
|
|
3915
|
+
*/
|
|
3916
|
+
const PASTE_SOURCE = ['word', 'excel', 'onenote'];
|
|
3917
|
+
|
|
3918
|
+
/**
|
|
3919
|
+
* `Selection` module is used to handle RTE Selections.
|
|
3920
|
+
*/
|
|
3921
|
+
class NodeSelection {
|
|
3922
|
+
constructor() {
|
|
3923
|
+
this.startNodeName = [];
|
|
3924
|
+
this.endNodeName = [];
|
|
3925
|
+
}
|
|
3926
|
+
saveInstance(range, body) {
|
|
3927
|
+
this.range = range.cloneRange();
|
|
3928
|
+
this.rootNode = this.documentFromRange(range);
|
|
3929
|
+
this.body = body;
|
|
3930
|
+
this.startContainer = this.getNodeArray(range.startContainer, true);
|
|
3931
|
+
this.endContainer = this.getNodeArray(range.endContainer, false);
|
|
3932
|
+
this.startOffset = range.startOffset;
|
|
3933
|
+
this.endOffset = range.endOffset;
|
|
3934
|
+
this.html = this.body.innerHTML;
|
|
3935
|
+
return this;
|
|
3936
|
+
}
|
|
3937
|
+
documentFromRange(range) {
|
|
3938
|
+
return (9 === range.startContainer.nodeType) ? range.startContainer : range.startContainer.ownerDocument;
|
|
3939
|
+
}
|
|
3940
|
+
getRange(docElement) {
|
|
3941
|
+
const select$$1 = this.get(docElement);
|
|
3942
|
+
const range = select$$1 && select$$1.rangeCount > 0 ? select$$1.getRangeAt(select$$1.rangeCount - 1) : docElement.createRange();
|
|
3943
|
+
return (range.startContainer !== docElement || range.endContainer !== docElement
|
|
3944
|
+
|| range.startOffset || range.endOffset || (range.setStart(docElement.body, 0), range.collapse(!0)), range);
|
|
3945
|
+
}
|
|
3946
|
+
/**
|
|
3947
|
+
* get method
|
|
3948
|
+
*
|
|
3949
|
+
* @param {Document} docElement - specifies the get function
|
|
3950
|
+
* @returns {void}
|
|
3951
|
+
* @hidden
|
|
3952
|
+
* @deprecated
|
|
3953
|
+
*/
|
|
3954
|
+
get(docElement) {
|
|
3955
|
+
return docElement.defaultView.getSelection();
|
|
3956
|
+
}
|
|
3957
|
+
/**
|
|
3958
|
+
* save method
|
|
3959
|
+
*
|
|
3960
|
+
* @param {Range} range - range value.
|
|
3961
|
+
* @param {Document} docElement - specifies the document.
|
|
3962
|
+
* @returns {void}
|
|
3963
|
+
* @hidden
|
|
3964
|
+
* @deprecated
|
|
3965
|
+
*/
|
|
3966
|
+
save(range, docElement) {
|
|
3967
|
+
range = (range) ? range.cloneRange() : this.getRange(docElement);
|
|
3968
|
+
return this.saveInstance(range, docElement.body);
|
|
3969
|
+
}
|
|
3970
|
+
/**
|
|
3971
|
+
* getIndex method
|
|
3972
|
+
*
|
|
3973
|
+
* @param {Node} node - specifies the node value.
|
|
3974
|
+
* @returns {void}
|
|
3975
|
+
* @hidden
|
|
3976
|
+
* @deprecated
|
|
3977
|
+
*/
|
|
3978
|
+
getIndex(node) {
|
|
3979
|
+
let index;
|
|
3980
|
+
let num = 0;
|
|
3981
|
+
node = !node.previousSibling && node.tagName === 'BR' ? node : node.previousSibling;
|
|
3982
|
+
if (node) {
|
|
3983
|
+
for (let type = node.nodeType; node; null) {
|
|
3984
|
+
index = node.nodeType;
|
|
3985
|
+
num++;
|
|
3986
|
+
//eslint-disable-next-line
|
|
3987
|
+
type = index;
|
|
3988
|
+
node = node.previousSibling;
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
return num;
|
|
3992
|
+
}
|
|
3993
|
+
isChildNode(nodeCollection, parentNode) {
|
|
3994
|
+
for (let index = 0; index < parentNode.childNodes.length; index++) {
|
|
3995
|
+
if (nodeCollection.indexOf(parentNode.childNodes[index]) > -1) {
|
|
3996
|
+
return true;
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
return false;
|
|
4000
|
+
}
|
|
4001
|
+
getNode(startNode, endNode, nodeCollection) {
|
|
4002
|
+
if (endNode === startNode &&
|
|
4003
|
+
(startNode.nodeType === 3 || !startNode.firstChild || nodeCollection.indexOf(startNode.firstChild) !== -1
|
|
4004
|
+
|| this.isChildNode(nodeCollection, startNode))) {
|
|
4005
|
+
return null;
|
|
4006
|
+
}
|
|
4007
|
+
if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
|
|
4008
|
+
return null;
|
|
4009
|
+
}
|
|
4010
|
+
if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
|
|
4011
|
+
return startNode.firstChild;
|
|
4012
|
+
}
|
|
4013
|
+
if (startNode.nextSibling) {
|
|
4014
|
+
return startNode.nextSibling;
|
|
4015
|
+
}
|
|
4016
|
+
if (!startNode.parentNode) {
|
|
4017
|
+
return null;
|
|
4018
|
+
}
|
|
4019
|
+
else {
|
|
4020
|
+
return startNode.parentNode;
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
/**
|
|
4024
|
+
* getNodeCollection method
|
|
4025
|
+
*
|
|
4026
|
+
* @param {Range} range -specifies the range.
|
|
4027
|
+
* @returns {void}
|
|
4028
|
+
* @hidden
|
|
4029
|
+
* @deprecated
|
|
4030
|
+
*/
|
|
4031
|
+
getNodeCollection(range) {
|
|
4032
|
+
let startNode = range.startContainer.childNodes[range.startOffset]
|
|
4033
|
+
|| range.startContainer;
|
|
4034
|
+
const endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
|
|
4035
|
+
|| range.endContainer;
|
|
4036
|
+
if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
|
|
4037
|
+
startNode.childNodes.length === 0) {
|
|
4038
|
+
return [startNode];
|
|
4039
|
+
}
|
|
4040
|
+
if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
|
|
4041
|
+
return [startNode.nodeName === 'BR' || startNode.nodeName === '#text' ? startNode : startNode.childNodes[0]];
|
|
4042
|
+
}
|
|
4043
|
+
const nodeCollection = [];
|
|
4044
|
+
do {
|
|
4045
|
+
if (nodeCollection.indexOf(startNode) === -1) {
|
|
4046
|
+
nodeCollection.push(startNode);
|
|
4047
|
+
}
|
|
4048
|
+
startNode = this.getNode(startNode, endNode, nodeCollection);
|
|
4049
|
+
} while (startNode);
|
|
4050
|
+
return nodeCollection;
|
|
4051
|
+
}
|
|
4052
|
+
/**
|
|
4053
|
+
* getParentNodeCollection method
|
|
4054
|
+
*
|
|
4055
|
+
* @param {Range} range - specifies the range value.
|
|
4056
|
+
* @returns {void}
|
|
4057
|
+
* @hidden
|
|
4058
|
+
* @deprecated
|
|
4059
|
+
*/
|
|
4060
|
+
getParentNodeCollection(range) {
|
|
4061
|
+
return this.getParentNodes(this.getNodeCollection(range), range);
|
|
4062
|
+
}
|
|
4063
|
+
/**
|
|
4064
|
+
* getParentNodes method
|
|
4065
|
+
*
|
|
4066
|
+
* @param {Node[]} nodeCollection - specifies the collection of nodes.
|
|
4067
|
+
* @param {Range} range - specifies the range values.
|
|
4068
|
+
* @returns {void}
|
|
4069
|
+
* @hidden
|
|
4070
|
+
* @deprecated
|
|
4071
|
+
*/
|
|
4072
|
+
getParentNodes(nodeCollection, range) {
|
|
4073
|
+
nodeCollection = nodeCollection.reverse();
|
|
4074
|
+
for (let index = 0; index < nodeCollection.length; index++) {
|
|
4075
|
+
if ((nodeCollection.indexOf(nodeCollection[index].parentNode) !== -1)
|
|
4076
|
+
|| (nodeCollection[index].nodeType === 3 &&
|
|
4077
|
+
range.startContainer !== range.endContainer &&
|
|
4078
|
+
range.startContainer.parentNode !== range.endContainer.parentNode)) {
|
|
4079
|
+
nodeCollection.splice(index, 1);
|
|
4080
|
+
index--;
|
|
4081
|
+
}
|
|
4082
|
+
else if (nodeCollection[index].nodeType === 3) {
|
|
4083
|
+
nodeCollection[index] = nodeCollection[index].parentNode;
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
return nodeCollection;
|
|
4087
|
+
}
|
|
4088
|
+
/**
|
|
4089
|
+
* getSelectionNodeCollection method
|
|
4090
|
+
*
|
|
4091
|
+
* @param {Range} range - specifies the range value.
|
|
4092
|
+
* @returns {void}
|
|
4093
|
+
* @hidden
|
|
4094
|
+
* @deprecated
|
|
4095
|
+
*/
|
|
4096
|
+
getSelectionNodeCollection(range) {
|
|
4097
|
+
return this.getSelectionNodes(this.getNodeCollection(range));
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* getSelectionNodeCollection along with BR node method
|
|
4101
|
+
*
|
|
4102
|
+
* @param {Range} range - specifies the range value.
|
|
4103
|
+
* @returns {void}
|
|
4104
|
+
* @hidden
|
|
4105
|
+
* @deprecated
|
|
4106
|
+
*/
|
|
4107
|
+
getSelectionNodeCollectionBr(range) {
|
|
4108
|
+
return this.getSelectionNodesBr(this.getNodeCollection(range));
|
|
4109
|
+
}
|
|
4110
|
+
/**
|
|
4111
|
+
* getParentNodes method
|
|
4112
|
+
*
|
|
4113
|
+
* @param {Node[]} nodeCollection - specifies the collection of nodes.
|
|
4114
|
+
* @returns {void}
|
|
4115
|
+
* @hidden
|
|
4116
|
+
* @deprecated
|
|
4117
|
+
*/
|
|
4118
|
+
getSelectionNodes(nodeCollection) {
|
|
4119
|
+
nodeCollection = nodeCollection.reverse();
|
|
4120
|
+
// eslint-disable-next-line
|
|
4121
|
+
const regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
4122
|
+
for (let index = 0; index < nodeCollection.length; index++) {
|
|
4123
|
+
if (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
|
|
4124
|
+
(nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx)))) {
|
|
4125
|
+
nodeCollection.splice(index, 1);
|
|
4126
|
+
index--;
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
return nodeCollection.reverse();
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
* Get selection text nodes with br method.
|
|
4133
|
+
*
|
|
4134
|
+
* @param {Node[]} nodeCollection - specifies the collection of nodes.
|
|
4135
|
+
* @returns {void}
|
|
4136
|
+
* @hidden
|
|
4137
|
+
* @deprecated
|
|
4138
|
+
*/
|
|
4139
|
+
getSelectionNodesBr(nodeCollection) {
|
|
4140
|
+
nodeCollection = nodeCollection.reverse();
|
|
4141
|
+
// eslint-disable-next-line
|
|
4142
|
+
const regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
4143
|
+
for (let index = 0; index < nodeCollection.length; index++) {
|
|
4144
|
+
if (nodeCollection[index].nodeName !== 'BR' &&
|
|
4145
|
+
(nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
|
|
4146
|
+
(nodeCollection[index].textContent.length === 1 && nodeCollection[index].textContent.match(regEx))))) {
|
|
4147
|
+
nodeCollection.splice(index, 1);
|
|
4148
|
+
index--;
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
return nodeCollection.reverse();
|
|
4152
|
+
}
|
|
4153
|
+
/**
|
|
4154
|
+
* getInsertNodeCollection method
|
|
4155
|
+
*
|
|
4156
|
+
* @param {Range} range - specifies the range value.
|
|
4157
|
+
* @returns {void}
|
|
4158
|
+
* @hidden
|
|
4159
|
+
* @deprecated
|
|
4160
|
+
*/
|
|
4161
|
+
getInsertNodeCollection(range) {
|
|
4162
|
+
return this.getInsertNodes(this.getNodeCollection(range));
|
|
4163
|
+
}
|
|
4164
|
+
/**
|
|
4165
|
+
* getInsertNodes method
|
|
4166
|
+
*
|
|
4167
|
+
* @param {Node[]} nodeCollection - specifies the collection of nodes.
|
|
4168
|
+
* @returns {void}
|
|
4169
|
+
* @hidden
|
|
4170
|
+
* @deprecated
|
|
4171
|
+
*/
|
|
4172
|
+
getInsertNodes(nodeCollection) {
|
|
4173
|
+
nodeCollection = nodeCollection.reverse();
|
|
4174
|
+
for (let index = 0; index < nodeCollection.length; index++) {
|
|
4175
|
+
if ((nodeCollection[index].childNodes.length !== 0 &&
|
|
4176
|
+
nodeCollection[index].nodeType !== 3) ||
|
|
4177
|
+
(nodeCollection[index].nodeType === 3 &&
|
|
4178
|
+
nodeCollection[index].textContent === '')) {
|
|
4179
|
+
nodeCollection.splice(index, 1);
|
|
4180
|
+
index--;
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
return nodeCollection.reverse();
|
|
4184
|
+
}
|
|
4185
|
+
/**
|
|
4186
|
+
* getNodeArray method
|
|
4187
|
+
*
|
|
4188
|
+
* @param {Node} node - specifies the node content.
|
|
4189
|
+
* @param {boolean} isStart - specifies the boolean value.
|
|
4190
|
+
* @param {Document} root - specifies the root document.
|
|
4191
|
+
* @returns {void}
|
|
4192
|
+
* @hidden
|
|
4193
|
+
* @deprecated
|
|
4194
|
+
*/
|
|
4195
|
+
getNodeArray(node, isStart, root) {
|
|
4196
|
+
const array = [];
|
|
4197
|
+
// eslint-disable-next-line
|
|
4198
|
+
((isStart) ? (this.startNodeName = []) : (this.endNodeName = []));
|
|
4199
|
+
for (; node !== (root ? root : this.rootNode); null) {
|
|
4200
|
+
if (isNullOrUndefined(node)) {
|
|
4201
|
+
break;
|
|
4202
|
+
}
|
|
4203
|
+
// eslint-disable-next-line
|
|
4204
|
+
(isStart) ? this.startNodeName.push(node.nodeName.toLowerCase()) : this.endNodeName.push(node.nodeName.toLowerCase());
|
|
4205
|
+
array.push(this.getIndex(node));
|
|
4206
|
+
node = node.parentNode;
|
|
4207
|
+
}
|
|
4208
|
+
return array;
|
|
4209
|
+
}
|
|
4210
|
+
setRangePoint(range, isvalid, num, size) {
|
|
4211
|
+
let node = this.rootNode;
|
|
4212
|
+
let index = num.length;
|
|
4213
|
+
let constant = size;
|
|
4214
|
+
for (; index--; null) {
|
|
4215
|
+
node = node && node.childNodes[num[index]];
|
|
4216
|
+
}
|
|
4217
|
+
if (node && constant >= 0 && node.nodeName !== 'html') {
|
|
4218
|
+
if (node.nodeType === 3 && node.nodeValue.replace(/\u00a0/g, ' ') === ' ') {
|
|
4219
|
+
constant = node.textContent.length;
|
|
4220
|
+
}
|
|
4221
|
+
range[isvalid ? 'setStart' : 'setEnd'](node, constant);
|
|
4222
|
+
}
|
|
4223
|
+
return range;
|
|
4224
|
+
}
|
|
4225
|
+
/**
|
|
4226
|
+
* restore method
|
|
4227
|
+
*
|
|
4228
|
+
* @returns {void}
|
|
4229
|
+
* @hidden
|
|
4230
|
+
* @deprecated
|
|
4231
|
+
*/
|
|
4232
|
+
restore() {
|
|
4233
|
+
let range = this.range.cloneRange();
|
|
4234
|
+
range = this.setRangePoint(range, true, this.startContainer, this.startOffset);
|
|
4235
|
+
range = this.setRangePoint(range, false, this.endContainer, this.endOffset);
|
|
4236
|
+
this.selectRange(this.rootNode, range);
|
|
4237
|
+
return range;
|
|
4238
|
+
}
|
|
4239
|
+
selectRange(docElement, range) {
|
|
4240
|
+
this.setRange(docElement, range);
|
|
4241
|
+
this.save(range, docElement);
|
|
4242
|
+
}
|
|
4243
|
+
/**
|
|
4244
|
+
* setRange method
|
|
4245
|
+
*
|
|
4246
|
+
* @param {Document} docElement - specifies the document.
|
|
4247
|
+
* @param {Range} range - specifies the range.
|
|
4248
|
+
* @returns {void}
|
|
4249
|
+
* @hidden
|
|
4250
|
+
* @deprecated
|
|
4251
|
+
*/
|
|
4252
|
+
setRange(docElement, range) {
|
|
4253
|
+
const selection = this.get(docElement);
|
|
4254
|
+
selection.removeAllRanges();
|
|
4255
|
+
selection.addRange(range);
|
|
4256
|
+
}
|
|
4257
|
+
/**
|
|
4258
|
+
* setSelectionText method
|
|
4259
|
+
*
|
|
4260
|
+
* @param {Document} docElement - specifies the documrent
|
|
4261
|
+
* @param {Node} startNode - specifies the starting node.
|
|
4262
|
+
* @param {Node} endNode - specifies the the end node.
|
|
4263
|
+
* @param {number} startIndex - specifies the starting index.
|
|
4264
|
+
* @param {number} endIndex - specifies the end index.
|
|
4265
|
+
* @returns {void}
|
|
4266
|
+
* @hidden
|
|
4267
|
+
* @deprecated
|
|
4268
|
+
*/
|
|
4269
|
+
setSelectionText(docElement, startNode, endNode, startIndex, endIndex) {
|
|
4270
|
+
const range = docElement.createRange();
|
|
4271
|
+
range.setStart(startNode, startIndex);
|
|
4272
|
+
range.setEnd(endNode, endIndex);
|
|
4273
|
+
this.setRange(docElement, range);
|
|
4274
|
+
}
|
|
4275
|
+
/**
|
|
4276
|
+
* setSelectionContents method
|
|
4277
|
+
*
|
|
4278
|
+
* @param {Document} docElement - specifies the document.
|
|
4279
|
+
* @param {Node} element - specifies the node.
|
|
4280
|
+
* @returns {void}
|
|
4281
|
+
* @hidden
|
|
4282
|
+
* @deprecated
|
|
4283
|
+
*/
|
|
4284
|
+
setSelectionContents(docElement, element) {
|
|
4285
|
+
const range = docElement.createRange();
|
|
4286
|
+
range.selectNode(element);
|
|
4287
|
+
this.setRange(docElement, range);
|
|
4288
|
+
}
|
|
4289
|
+
/**
|
|
4290
|
+
* setSelectionNode method
|
|
4291
|
+
*
|
|
4292
|
+
* @param {Document} docElement - specifies the document.
|
|
4293
|
+
* @param {Node} element - specifies the node.
|
|
4294
|
+
* @returns {void}
|
|
4295
|
+
* @hidden
|
|
4296
|
+
* @deprecated
|
|
4297
|
+
*/
|
|
4298
|
+
setSelectionNode(docElement, element) {
|
|
4299
|
+
const range = docElement.createRange();
|
|
4300
|
+
range.selectNodeContents(element);
|
|
4301
|
+
this.setRange(docElement, range);
|
|
4302
|
+
}
|
|
4303
|
+
/**
|
|
4304
|
+
* getSelectedNodes method
|
|
4305
|
+
*
|
|
4306
|
+
* @param {Document} docElement - specifies the document.
|
|
4307
|
+
* @returns {void}
|
|
4308
|
+
* @hidden
|
|
4309
|
+
* @deprecated
|
|
4310
|
+
*/
|
|
4311
|
+
getSelectedNodes(docElement) {
|
|
4312
|
+
return this.getNodeCollection(this.getRange(docElement));
|
|
4313
|
+
}
|
|
4314
|
+
/**
|
|
4315
|
+
* Clear method
|
|
4316
|
+
*
|
|
4317
|
+
* @param {Document} docElement - specifies the document.
|
|
4318
|
+
* @returns {void}
|
|
4319
|
+
* @hidden
|
|
4320
|
+
* @deprecated
|
|
4321
|
+
*/
|
|
4322
|
+
Clear(docElement) {
|
|
4323
|
+
this.get(docElement).removeAllRanges();
|
|
4324
|
+
}
|
|
4325
|
+
/**
|
|
4326
|
+
* insertParentNode method
|
|
4327
|
+
*
|
|
4328
|
+
* @param {Document} docElement - specifies the document.
|
|
4329
|
+
* @param {Node} newNode - specicfies the new node.
|
|
4330
|
+
* @param {Range} range - specifies the range.
|
|
4331
|
+
* @returns {void}
|
|
4332
|
+
* @hidden
|
|
4333
|
+
* @deprecated
|
|
4334
|
+
*/
|
|
4335
|
+
insertParentNode(docElement, newNode, range) {
|
|
4336
|
+
range.surroundContents(newNode);
|
|
4337
|
+
this.selectRange(docElement, range);
|
|
4338
|
+
}
|
|
4339
|
+
/**
|
|
4340
|
+
* setCursorPoint method
|
|
4341
|
+
*
|
|
4342
|
+
* @param {Document} docElement - specifies the document.
|
|
4343
|
+
* @param {Element} element - specifies the element.
|
|
4344
|
+
* @param {number} point - specifies the point.
|
|
4345
|
+
* @returns {void}
|
|
4346
|
+
* @hidden
|
|
4347
|
+
* @deprecated
|
|
4348
|
+
*/
|
|
4349
|
+
setCursorPoint(docElement, element, point) {
|
|
4350
|
+
const range = docElement.createRange();
|
|
4351
|
+
const selection = docElement.defaultView.getSelection();
|
|
4352
|
+
range.setStart(element, point);
|
|
4353
|
+
range.collapse(true);
|
|
4354
|
+
selection.removeAllRanges();
|
|
4355
|
+
selection.addRange(range);
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
/**
|
|
4360
|
+
* `Selection` module is used to handle RTE Selections.
|
|
4361
|
+
*/
|
|
4362
|
+
|
|
4363
|
+
/**
|
|
4364
|
+
* Defines common util methods used by Rich Text Editor.
|
|
4365
|
+
*/
|
|
4366
|
+
const inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
4367
|
+
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
4368
|
+
'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
|
|
4369
|
+
'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
|
|
4370
|
+
'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
|
|
4371
|
+
/**
|
|
4372
|
+
* @returns {void}
|
|
4373
|
+
* @hidden
|
|
4374
|
+
*/
|
|
4375
|
+
function isIDevice$1() {
|
|
4376
|
+
let result = false;
|
|
4377
|
+
if (Browser.isDevice && Browser.isIos) {
|
|
4378
|
+
result = true;
|
|
4379
|
+
}
|
|
4380
|
+
return result;
|
|
4381
|
+
}
|
|
4382
|
+
/**
|
|
4383
|
+
* @param {Element} editableElement - specifies the editable element.
|
|
4384
|
+
* @param {string} selector - specifies the string values.
|
|
4385
|
+
* @returns {void}
|
|
4386
|
+
* @hidden
|
|
4387
|
+
*/
|
|
4388
|
+
function setEditFrameFocus(editableElement, selector) {
|
|
4389
|
+
if (editableElement.nodeName === 'BODY' && !isNullOrUndefined(selector)) {
|
|
4390
|
+
const iframe = top.window.document.querySelector(selector);
|
|
4391
|
+
if (!isNullOrUndefined(iframe)) {
|
|
4392
|
+
iframe.contentWindow.focus();
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
/**
|
|
4397
|
+
* @param {string} value - specifies the string value
|
|
4398
|
+
* @param {string} enterAction - specifies the enter key action API
|
|
4399
|
+
* @returns {void}
|
|
4400
|
+
* @hidden
|
|
4401
|
+
*/
|
|
4402
|
+
function updateTextNode$1(value, enterAction) {
|
|
4403
|
+
const tempNode = document.createElement('div');
|
|
4404
|
+
tempNode.innerHTML = value;
|
|
4405
|
+
tempNode.setAttribute('class', 'tempDiv');
|
|
4406
|
+
const resultElm = document.createElement('div');
|
|
4407
|
+
const childNodes = tempNode.childNodes;
|
|
4408
|
+
if (childNodes.length > 0) {
|
|
4409
|
+
let isPreviousInlineElem;
|
|
4410
|
+
let previousParent;
|
|
4411
|
+
let paraElm;
|
|
4412
|
+
while (tempNode.firstChild) {
|
|
4413
|
+
if ((tempNode.firstChild.nodeName === '#text' &&
|
|
4414
|
+
(tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
|
|
4415
|
+
inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
|
|
4416
|
+
if (!isPreviousInlineElem) {
|
|
4417
|
+
if (enterAction === 'BR') {
|
|
4418
|
+
resultElm.appendChild(tempNode.firstChild);
|
|
4419
|
+
previousParent = resultElm;
|
|
4420
|
+
}
|
|
4421
|
+
else {
|
|
4422
|
+
paraElm = createElement('p');
|
|
4423
|
+
resultElm.appendChild(paraElm);
|
|
4424
|
+
paraElm.appendChild(tempNode.firstChild);
|
|
4425
|
+
previousParent = paraElm;
|
|
4426
|
+
isPreviousInlineElem = true;
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
else {
|
|
4430
|
+
previousParent.appendChild(tempNode.firstChild);
|
|
4431
|
+
previousParent = paraElm;
|
|
4432
|
+
isPreviousInlineElem = true;
|
|
4433
|
+
}
|
|
4434
|
+
}
|
|
4435
|
+
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
4436
|
+
(tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
|
|
4437
|
+
detach(tempNode.firstChild);
|
|
4438
|
+
}
|
|
4439
|
+
else {
|
|
4440
|
+
resultElm.appendChild(tempNode.firstChild);
|
|
4441
|
+
isPreviousInlineElem = false;
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
const tableElm = resultElm.querySelectorAll('table');
|
|
4445
|
+
for (let i = 0; i < tableElm.length; i++) {
|
|
4446
|
+
if (tableElm[i].classList.length > 0 && !tableElm[i].classList.contains('e-rte-table')) {
|
|
4447
|
+
tableElm[i].classList.add('e-rte-paste-table');
|
|
4448
|
+
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
4449
|
+
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
4450
|
+
continue; // Skiping the removal of the border if the source is from word.
|
|
4451
|
+
}
|
|
4452
|
+
else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
|
|
4453
|
+
tableElm[i].classList.remove('e-rte-paste-excel-table');
|
|
4454
|
+
if (tableElm[i].getAttribute('border') === '0') {
|
|
4455
|
+
tableElm[i].removeAttribute('border');
|
|
4456
|
+
}
|
|
4457
|
+
const tdElm = tableElm[i].querySelectorAll('td');
|
|
4458
|
+
for (let j = 0; j < tdElm.length; j++) {
|
|
4459
|
+
if (tdElm[j].style.borderLeft === 'none') {
|
|
4460
|
+
tdElm[j].style.removeProperty('border-left');
|
|
4461
|
+
}
|
|
4462
|
+
if (tdElm[j].style.borderRight === 'none') {
|
|
4463
|
+
tdElm[j].style.removeProperty('border-right');
|
|
4464
|
+
}
|
|
4465
|
+
if (tdElm[j].style.borderBottom === 'none') {
|
|
4466
|
+
tdElm[j].style.removeProperty('border-bottom');
|
|
4467
|
+
}
|
|
4468
|
+
if (tdElm[j].style.borderTop === 'none') {
|
|
4469
|
+
tdElm[j].style.removeProperty('border-top');
|
|
4470
|
+
}
|
|
4471
|
+
if (tdElm[j].style.border === 'none') {
|
|
4472
|
+
tdElm[j].style.removeProperty('border');
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
4477
|
+
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
4478
|
+
continue;
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
4482
|
+
const imageElm = resultElm.querySelectorAll('img');
|
|
4483
|
+
for (let i = 0; i < imageElm.length; i++) {
|
|
4484
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
4485
|
+
continue; // Should not add the class if the image is Broken.
|
|
4486
|
+
}
|
|
4487
|
+
if (!imageElm[i].classList.contains('e-rte-image')) {
|
|
4488
|
+
imageElm[i].classList.add('e-rte-image');
|
|
4489
|
+
}
|
|
4490
|
+
if (!(imageElm[i].classList.contains('e-imginline') ||
|
|
4491
|
+
imageElm[i].classList.contains('e-imgbreak'))) {
|
|
4492
|
+
imageElm[i].classList.add('e-imginline');
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
return resultElm.innerHTML;
|
|
4497
|
+
}
|
|
4498
|
+
/**
|
|
4499
|
+
* @param {Node} startChildNodes - specifies the node
|
|
4500
|
+
* @returns {void}
|
|
4501
|
+
* @hidden
|
|
4502
|
+
*/
|
|
4503
|
+
function getLastTextNode(startChildNodes) {
|
|
4504
|
+
let finalNode = startChildNodes;
|
|
4505
|
+
do {
|
|
4506
|
+
if (finalNode.childNodes.length > 0) {
|
|
4507
|
+
finalNode = finalNode.childNodes[0];
|
|
4508
|
+
}
|
|
4509
|
+
} while (finalNode.childNodes.length > 0);
|
|
4510
|
+
return finalNode;
|
|
4511
|
+
}
|
|
4512
|
+
/**
|
|
4513
|
+
* @returns {void}
|
|
4514
|
+
* @hidden
|
|
4515
|
+
*/
|
|
4516
|
+
function getDefaultHtmlTbStatus() {
|
|
4517
|
+
return {
|
|
4518
|
+
bold: false,
|
|
4519
|
+
italic: false,
|
|
4520
|
+
subscript: false,
|
|
4521
|
+
superscript: false,
|
|
4522
|
+
strikethrough: false,
|
|
4523
|
+
orderedlist: false,
|
|
4524
|
+
unorderedlist: false,
|
|
4525
|
+
numberFormatList: false,
|
|
4526
|
+
bulletFormatList: false,
|
|
4527
|
+
underline: false,
|
|
4528
|
+
alignments: null,
|
|
4529
|
+
backgroundcolor: null,
|
|
4530
|
+
fontcolor: null,
|
|
4531
|
+
fontname: null,
|
|
4532
|
+
fontsize: null,
|
|
4533
|
+
formats: null,
|
|
4534
|
+
createlink: false,
|
|
4535
|
+
insertcode: false
|
|
4536
|
+
};
|
|
4537
|
+
}
|
|
4538
|
+
/**
|
|
4539
|
+
* @returns {void}
|
|
4540
|
+
* @hidden
|
|
4541
|
+
*/
|
|
4542
|
+
function getDefaultMDTbStatus() {
|
|
4543
|
+
return {
|
|
4544
|
+
bold: false,
|
|
4545
|
+
italic: false,
|
|
4546
|
+
subscript: false,
|
|
4547
|
+
superscript: false,
|
|
4548
|
+
strikethrough: false,
|
|
4549
|
+
orderedlist: false,
|
|
4550
|
+
uppercase: false,
|
|
4551
|
+
lowercase: false,
|
|
4552
|
+
inlinecode: false,
|
|
4553
|
+
unorderedlist: false,
|
|
4554
|
+
formats: null
|
|
4555
|
+
};
|
|
4556
|
+
}
|
|
4557
|
+
/**
|
|
4558
|
+
* @param {Range} range - specifies the range
|
|
4559
|
+
* @returns {void}
|
|
4560
|
+
* @hidden
|
|
4561
|
+
*/
|
|
4562
|
+
function nestedListCleanUp(range) {
|
|
4563
|
+
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
4564
|
+
range.extractContents();
|
|
4565
|
+
while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
|
|
4566
|
+
(range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
|
|
4567
|
+
let emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
|
|
4568
|
+
if (emptyLI.length > 0) {
|
|
4569
|
+
emptyLI.forEach((item) => {
|
|
4570
|
+
item.remove();
|
|
4571
|
+
});
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4574
|
+
let liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
|
|
4575
|
+
if (liElem.length > 0) {
|
|
4576
|
+
liElem.forEach((item) => {
|
|
4577
|
+
if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
|
|
4578
|
+
item.style.listStyleType = "none";
|
|
4579
|
+
}
|
|
4580
|
+
});
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
}
|
|
4584
|
+
|
|
4585
|
+
/**
|
|
4586
|
+
* Update Toolbar Status
|
|
4587
|
+
*
|
|
4588
|
+
* @hidden
|
|
4589
|
+
* @deprecated
|
|
4590
|
+
*/
|
|
4591
|
+
const statusCollection = getDefaultHtmlTbStatus();
|
|
4592
|
+
class ToolbarStatus {
|
|
4593
|
+
/**
|
|
4594
|
+
* get method
|
|
4595
|
+
*
|
|
4596
|
+
* @param {Document} docElement - specifies the document element
|
|
4597
|
+
* @param {Node} rootNode - specifies the content editable element
|
|
4598
|
+
* @param {string[]} formatNode - specifies the format node
|
|
4599
|
+
* @param {string[]} fontSize - specifies the font size
|
|
4600
|
+
* @param {string[]} fontName - specifies the font name.
|
|
4601
|
+
* @param {Node} documentNode - specifies the document node.
|
|
4602
|
+
* @returns {IToolbarStatus} - returns the toolbar status
|
|
4603
|
+
* @hidden
|
|
4604
|
+
* @deprecated
|
|
4605
|
+
*/
|
|
4606
|
+
static get(docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
|
|
4607
|
+
let formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
4608
|
+
const nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
4609
|
+
const nodeSelection = new NodeSelection();
|
|
4610
|
+
const range = nodeSelection.getRange(docElement);
|
|
4611
|
+
const nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
4612
|
+
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
4613
|
+
const nodesLength = nodes.length;
|
|
4614
|
+
let isNodeChanged = false;
|
|
4615
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
4616
|
+
while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
|
|
4617
|
+
nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
|
|
4618
|
+
(this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
|
|
4619
|
+
range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
|
|
4620
|
+
nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
|
|
4621
|
+
nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
|
|
4622
|
+
isNodeChanged = true;
|
|
4623
|
+
}
|
|
4624
|
+
if (isNodeChanged && nodes[index]) {
|
|
4625
|
+
nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
|
|
4626
|
+
isNodeChanged = false;
|
|
4627
|
+
}
|
|
4628
|
+
if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
|
|
4629
|
+
(nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
|
|
4630
|
+
nodes.splice(index, 1);
|
|
4631
|
+
index--;
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
4635
|
+
// eslint-disable-next-line max-len
|
|
4636
|
+
formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], rootNode, formatNode, fontSize, fontName);
|
|
4637
|
+
if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
|
|
4638
|
+
nodeCollection.bold = formatCollection.bold;
|
|
4639
|
+
}
|
|
4640
|
+
if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
|
|
4641
|
+
nodeCollection.insertcode = formatCollection.insertcode;
|
|
4642
|
+
}
|
|
4643
|
+
if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
|
|
4644
|
+
nodeCollection.italic = formatCollection.italic;
|
|
4645
|
+
}
|
|
4646
|
+
if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
|
|
4647
|
+
nodeCollection.underline = formatCollection.underline;
|
|
4648
|
+
}
|
|
4649
|
+
if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
|
|
4650
|
+
nodeCollection.strikethrough = formatCollection.strikethrough;
|
|
4651
|
+
}
|
|
4652
|
+
if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
|
|
4653
|
+
nodeCollection.superscript = formatCollection.superscript;
|
|
4654
|
+
}
|
|
4655
|
+
if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
|
|
4656
|
+
nodeCollection.subscript = formatCollection.subscript;
|
|
4657
|
+
}
|
|
4658
|
+
if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
|
|
4659
|
+
nodeCollection.fontcolor = formatCollection.fontcolor;
|
|
4660
|
+
}
|
|
4661
|
+
if (index === 0 && formatCollection.fontname) {
|
|
4662
|
+
nodeCollection.fontname = formatCollection.fontname;
|
|
4663
|
+
}
|
|
4664
|
+
else {
|
|
4665
|
+
nodeCollection.fontname = formatCollection.fontname === nodeCollection.fontname ? formatCollection.fontname : 'empty';
|
|
4666
|
+
}
|
|
4667
|
+
if (index === 0 && formatCollection.fontsize) {
|
|
4668
|
+
nodeCollection.fontsize = formatCollection.fontsize;
|
|
4669
|
+
}
|
|
4670
|
+
else {
|
|
4671
|
+
nodeCollection.fontsize = formatCollection.fontsize === nodeCollection.fontsize ? formatCollection.fontsize : 'empty';
|
|
4672
|
+
}
|
|
4673
|
+
if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
|
|
4674
|
+
nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
|
|
4675
|
+
}
|
|
4676
|
+
if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
|
|
4677
|
+
nodeCollection.orderedlist = formatCollection.orderedlist;
|
|
4678
|
+
}
|
|
4679
|
+
if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
|
|
4680
|
+
nodeCollection.unorderedlist = formatCollection.unorderedlist;
|
|
4681
|
+
}
|
|
4682
|
+
if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
|
|
4683
|
+
nodeCollection.alignments = formatCollection.alignments;
|
|
4684
|
+
}
|
|
4685
|
+
if (index === 0 && formatCollection.formats) {
|
|
4686
|
+
nodeCollection.formats = formatCollection.formats;
|
|
4687
|
+
}
|
|
4688
|
+
else {
|
|
4689
|
+
nodeCollection.formats = formatCollection.formats === nodeCollection.formats ? formatCollection.formats : 'empty';
|
|
4690
|
+
}
|
|
4691
|
+
if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
|
|
4692
|
+
nodeCollection.createlink = formatCollection.createlink;
|
|
4693
|
+
}
|
|
4694
|
+
if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
|
|
4695
|
+
nodeCollection.numberFormatList = formatCollection.numberFormatList;
|
|
4696
|
+
}
|
|
4697
|
+
if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
|
|
4698
|
+
nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
|
|
4699
|
+
}
|
|
4700
|
+
formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
4701
|
+
}
|
|
4702
|
+
return nodeCollection;
|
|
4703
|
+
}
|
|
4704
|
+
static getImmediateBlockNode(node) {
|
|
4705
|
+
do {
|
|
4706
|
+
node = node.parentNode;
|
|
4707
|
+
} while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
|
|
4708
|
+
return node;
|
|
4709
|
+
}
|
|
4710
|
+
static getFormatParent(docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
|
|
4711
|
+
let isListUpdated = false;
|
|
4712
|
+
let isComplexListUpdated = false;
|
|
4713
|
+
if (targetNode.contains(node) ||
|
|
4714
|
+
(node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
|
|
4715
|
+
do {
|
|
4716
|
+
formatCollection = this.isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName);
|
|
4717
|
+
if (formatCollection.orderedlist || formatCollection.unorderedlist) {
|
|
4718
|
+
isListUpdated = true;
|
|
4719
|
+
}
|
|
4720
|
+
if (formatCollection.bulletFormatList || formatCollection.numberFormatList) {
|
|
4721
|
+
isComplexListUpdated = true;
|
|
4722
|
+
}
|
|
4723
|
+
node = node.parentNode;
|
|
4724
|
+
} while (node && (node !== targetNode));
|
|
4725
|
+
}
|
|
4726
|
+
return formatCollection;
|
|
4727
|
+
}
|
|
4728
|
+
static isFormattedNode(docElement, formatCollection, node, isListUpdated, isComplexListUpdated, formatNode, fontSize, fontName) {
|
|
4729
|
+
if (!formatCollection.bold) {
|
|
4730
|
+
formatCollection.bold = IsFormatted.isBold(node);
|
|
4731
|
+
}
|
|
4732
|
+
if (!formatCollection.italic) {
|
|
4733
|
+
formatCollection.italic = IsFormatted.isItalic(node);
|
|
4734
|
+
}
|
|
4735
|
+
if (!formatCollection.underline) {
|
|
4736
|
+
formatCollection.underline = IsFormatted.isUnderline(node);
|
|
4737
|
+
}
|
|
4738
|
+
if (!formatCollection.strikethrough) {
|
|
4739
|
+
formatCollection.strikethrough = IsFormatted.isStrikethrough(node);
|
|
4740
|
+
}
|
|
4741
|
+
if (!formatCollection.superscript) {
|
|
4742
|
+
formatCollection.superscript = IsFormatted.isSuperscript(node);
|
|
4743
|
+
}
|
|
4744
|
+
if (!formatCollection.subscript) {
|
|
4745
|
+
formatCollection.subscript = IsFormatted.isSubscript(node);
|
|
4746
|
+
}
|
|
4747
|
+
if (!formatCollection.fontcolor) {
|
|
4748
|
+
formatCollection.fontcolor = this.isFontColor(docElement, node);
|
|
4749
|
+
}
|
|
4750
|
+
if (!formatCollection.fontname) {
|
|
4751
|
+
formatCollection.fontname = this.isFontName(docElement, node, fontName);
|
|
4752
|
+
}
|
|
4753
|
+
if (!formatCollection.fontsize) {
|
|
4754
|
+
formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
|
|
4755
|
+
}
|
|
4756
|
+
if (!formatCollection.backgroundcolor) {
|
|
4757
|
+
formatCollection.backgroundcolor = this.isBackgroundColor(node);
|
|
4758
|
+
}
|
|
4759
|
+
if (!formatCollection.orderedlist && !isListUpdated) {
|
|
4760
|
+
formatCollection.orderedlist = this.isOrderedList(node);
|
|
4761
|
+
}
|
|
4762
|
+
if (!formatCollection.unorderedlist && !isListUpdated) {
|
|
4763
|
+
formatCollection.unorderedlist = this.isUnorderedList(node);
|
|
4764
|
+
}
|
|
4765
|
+
if (!formatCollection.alignments) {
|
|
4766
|
+
formatCollection.alignments = this.isAlignment(node);
|
|
4767
|
+
}
|
|
4768
|
+
if (!formatCollection.formats) {
|
|
4769
|
+
formatCollection.formats = this.isFormats(node, formatNode);
|
|
4770
|
+
if (formatCollection.formats === 'pre') {
|
|
4771
|
+
formatCollection.insertcode = true;
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
if (!formatCollection.createlink) {
|
|
4775
|
+
formatCollection.createlink = this.isLink(node);
|
|
4776
|
+
}
|
|
4777
|
+
if (!formatCollection.numberFormatList && !isComplexListUpdated) {
|
|
4778
|
+
formatCollection.numberFormatList = this.isNumberFormatList(node);
|
|
4779
|
+
}
|
|
4780
|
+
if (!formatCollection.bulletFormatList && !isComplexListUpdated) {
|
|
4781
|
+
formatCollection.bulletFormatList = this.isBulletFormatList(node);
|
|
4782
|
+
}
|
|
4783
|
+
return formatCollection;
|
|
4784
|
+
}
|
|
4785
|
+
static isFontColor(docElement, node) {
|
|
4786
|
+
let color = node.style && node.style.color;
|
|
4787
|
+
if ((color === null || color === undefined || color === '') && node.nodeType !== 3) {
|
|
4788
|
+
color = this.getComputedStyle(docElement, node, 'color');
|
|
4789
|
+
}
|
|
4790
|
+
if (color !== null && color !== '' && color !== undefined) {
|
|
4791
|
+
return color;
|
|
4792
|
+
}
|
|
4793
|
+
else {
|
|
4794
|
+
return null;
|
|
4795
|
+
}
|
|
4796
|
+
}
|
|
4797
|
+
static isLink(node) {
|
|
4798
|
+
if (node.nodeName.toLocaleLowerCase() === 'a') {
|
|
4799
|
+
return true;
|
|
4800
|
+
}
|
|
4801
|
+
else {
|
|
4802
|
+
return false;
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
static isBackgroundColor(node) {
|
|
4806
|
+
const backColor = node.style && node.style.backgroundColor;
|
|
4807
|
+
if (backColor !== null && backColor !== '' && backColor !== undefined) {
|
|
4808
|
+
return backColor;
|
|
4809
|
+
}
|
|
4810
|
+
else {
|
|
4811
|
+
return null;
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
static isFontSize(docElement, node, fontSize) {
|
|
4815
|
+
let size = node.style && node.style.fontSize;
|
|
4816
|
+
if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
|
|
4817
|
+
node.parentElement.classList.contains('e-content')) {
|
|
4818
|
+
size = this.getComputedStyle(docElement, node, 'font-size');
|
|
4819
|
+
}
|
|
4820
|
+
if ((size !== null && size !== '' && size !== undefined)
|
|
4821
|
+
&& (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
|
|
4822
|
+
return size;
|
|
4823
|
+
}
|
|
4824
|
+
else {
|
|
4825
|
+
return null;
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
static isFontName(docElement, node, fontName) {
|
|
4829
|
+
let name = node.style && node.style.fontFamily;
|
|
4830
|
+
if ((name === null || name === undefined || name === '') && node.nodeType !== 3) {
|
|
4831
|
+
name = this.getComputedStyle(docElement, node, 'font-family');
|
|
4832
|
+
}
|
|
4833
|
+
let index = null;
|
|
4834
|
+
if ((name !== null && name !== '' && name !== undefined)
|
|
4835
|
+
&& (fontName === null || fontName === undefined || (fontName.filter((value, pos) => {
|
|
4836
|
+
// eslint-disable-next-line
|
|
4837
|
+
const pattern = new RegExp(name, 'i');
|
|
4838
|
+
if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
|
|
4839
|
+
(value.split(',')[0] && !isNullOrUndefined(value.split(',')[0].trim().match(pattern)) &&
|
|
4840
|
+
value.split(',')[0].trim() === value.split(',')[0].trim().match(pattern)[0])) {
|
|
4841
|
+
index = pos;
|
|
4842
|
+
}
|
|
4843
|
+
}) && (index !== null)))) {
|
|
4844
|
+
// eslint-disable-next-line
|
|
4845
|
+
return (index !== null) ? fontName[index] : name.replace(/"/g, '');
|
|
4846
|
+
}
|
|
4847
|
+
else {
|
|
4848
|
+
return null;
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
static isOrderedList(node) {
|
|
4852
|
+
if (node.nodeName.toLocaleLowerCase() === 'ol') {
|
|
4853
|
+
return true;
|
|
4854
|
+
}
|
|
4855
|
+
else {
|
|
4856
|
+
return false;
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
static isUnorderedList(node) {
|
|
4860
|
+
if (node.nodeName.toLocaleLowerCase() === 'ul') {
|
|
4861
|
+
return true;
|
|
4862
|
+
}
|
|
4863
|
+
else {
|
|
4864
|
+
return false;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
static isAlignment(node) {
|
|
4868
|
+
const align = node.style && node.style.textAlign;
|
|
4869
|
+
if (align === 'left') {
|
|
4870
|
+
return 'justifyleft';
|
|
4871
|
+
}
|
|
4872
|
+
else if (align === 'center') {
|
|
4873
|
+
return 'justifycenter';
|
|
4874
|
+
}
|
|
4875
|
+
else if (align === 'right') {
|
|
4876
|
+
return 'justifyright';
|
|
4877
|
+
}
|
|
4878
|
+
else if (align === 'justify') {
|
|
4879
|
+
return 'justifyfull';
|
|
4880
|
+
}
|
|
4881
|
+
else {
|
|
4882
|
+
return null;
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
static isFormats(node, formatNode) {
|
|
4886
|
+
if (((formatNode === undefined || formatNode === null)
|
|
4887
|
+
&& BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) > -1)
|
|
4888
|
+
|| (formatNode !== null && formatNode !== undefined
|
|
4889
|
+
&& formatNode.indexOf(node.nodeName.toLocaleLowerCase()) > -1)) {
|
|
4890
|
+
return node.nodeName.toLocaleLowerCase();
|
|
4891
|
+
}
|
|
4892
|
+
else {
|
|
4893
|
+
return null;
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
static getComputedStyle(docElement, node, prop) {
|
|
4897
|
+
return docElement.defaultView.getComputedStyle(node, null).getPropertyValue(prop);
|
|
4898
|
+
}
|
|
4899
|
+
static isNumberFormatList(node) {
|
|
4900
|
+
const list = node.style && node.style.listStyleType;
|
|
4901
|
+
if (list === 'lower-alpha') {
|
|
4902
|
+
return 'Lower Alpha';
|
|
4903
|
+
}
|
|
4904
|
+
else if (list === 'number') {
|
|
4905
|
+
return 'Number';
|
|
4906
|
+
}
|
|
4907
|
+
else if (list === 'upper-alpha') {
|
|
4908
|
+
return 'Upper Alpha';
|
|
4909
|
+
}
|
|
4910
|
+
else if (list === 'lower-roman') {
|
|
4911
|
+
return 'Lower Roman';
|
|
4912
|
+
}
|
|
4913
|
+
else if (list === 'upper-roman') {
|
|
4914
|
+
return 'Upper Roman';
|
|
4915
|
+
}
|
|
4916
|
+
else if (list === 'lower-greek') {
|
|
4917
|
+
return 'Lower Greek';
|
|
4918
|
+
}
|
|
4919
|
+
else if (list === 'none') {
|
|
4920
|
+
return 'None';
|
|
4921
|
+
}
|
|
4922
|
+
else if (this.isOrderedList(node)) {
|
|
4923
|
+
return true;
|
|
4924
|
+
}
|
|
4925
|
+
else {
|
|
4926
|
+
return null;
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
static isBulletFormatList(node) {
|
|
4930
|
+
const list = node.style && node.style.listStyleType;
|
|
4931
|
+
if (list === 'circle') {
|
|
4932
|
+
return 'Circle';
|
|
4933
|
+
}
|
|
4934
|
+
else if (list === 'square') {
|
|
4935
|
+
return 'Square';
|
|
4936
|
+
}
|
|
4937
|
+
else if (list === 'none') {
|
|
4938
|
+
return 'None';
|
|
4939
|
+
}
|
|
4940
|
+
else if (list === 'disc') {
|
|
4941
|
+
return 'Disc';
|
|
4942
|
+
}
|
|
4943
|
+
else if (this.isUnorderedList(node)) {
|
|
4944
|
+
return true;
|
|
4945
|
+
}
|
|
4946
|
+
else {
|
|
4947
|
+
return null;
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
|
|
3594
4952
|
/**
|
|
3595
4953
|
* `Toolbar renderer` module is used to render toolbar in RichTextEditor.
|
|
3596
4954
|
*
|
|
@@ -3648,7 +5006,7 @@ class ToolbarRenderer {
|
|
|
3648
5006
|
}
|
|
3649
5007
|
}
|
|
3650
5008
|
dropDownSelected(args) {
|
|
3651
|
-
this.parent.notify(dropDownSelect, args);
|
|
5009
|
+
this.parent.notify(dropDownSelect, { element: args.element, item: args.item, originalEvent: args.event });
|
|
3652
5010
|
this.destroyTooltip();
|
|
3653
5011
|
}
|
|
3654
5012
|
beforeDropDownItemRender(args) {
|
|
@@ -3672,6 +5030,9 @@ class ToolbarRenderer {
|
|
|
3672
5030
|
break;
|
|
3673
5031
|
}
|
|
3674
5032
|
}
|
|
5033
|
+
if (args.target.querySelector('.e-active')) {
|
|
5034
|
+
args.cancel = true;
|
|
5035
|
+
}
|
|
3675
5036
|
}
|
|
3676
5037
|
dropDownOpen(args) {
|
|
3677
5038
|
if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1 && !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-merge')) &&
|
|
@@ -3692,19 +5053,6 @@ class ToolbarRenderer {
|
|
|
3692
5053
|
addClass([listEle[1], listEle[2]], 'e-disabled');
|
|
3693
5054
|
}
|
|
3694
5055
|
}
|
|
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
5056
|
this.parent.notify(selectionSave, args);
|
|
3709
5057
|
}
|
|
3710
5058
|
dropDownClose(args) {
|
|
@@ -3849,11 +5197,22 @@ class ToolbarRenderer {
|
|
|
3849
5197
|
}
|
|
3850
5198
|
//Formats preselect
|
|
3851
5199
|
if (args.items[0].command === 'Formats' || args.items[0].command === 'Font') {
|
|
5200
|
+
const fontName = [];
|
|
5201
|
+
const formats = [];
|
|
5202
|
+
this.parent.format.types.forEach((item) => {
|
|
5203
|
+
formats.push(item.value.toLocaleLowerCase());
|
|
5204
|
+
});
|
|
5205
|
+
this.parent.fontFamily.items.forEach((item) => {
|
|
5206
|
+
fontName.push(item.value);
|
|
5207
|
+
});
|
|
5208
|
+
const toolbarStatus = ToolbarStatus.get(this.parent.contentModule.getDocument(), this.parent.contentModule.getEditPanel(), formats, null, fontName);
|
|
3852
5209
|
for (let index = 0; index < args.element.childNodes.length; index++) {
|
|
3853
5210
|
const divNode = this.parent.createElement('div');
|
|
3854
5211
|
divNode.innerHTML = dropDown.content.trim();
|
|
3855
|
-
if (divNode.textContent.trim() !== ''
|
|
3856
|
-
&& args.element.childNodes[index].textContent.trim() === divNode.textContent.trim())
|
|
5212
|
+
if ((divNode.textContent.trim() !== ''
|
|
5213
|
+
&& args.element.childNodes[index].textContent.trim() === divNode.textContent.trim()) ||
|
|
5214
|
+
((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))
|
|
5215
|
+
|| (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
5216
|
if (!args.element.childNodes[index].classList.contains('e-active')) {
|
|
3858
5217
|
addClass([args.element.childNodes[index]], 'e-active');
|
|
3859
5218
|
}
|
|
@@ -4037,6 +5396,8 @@ class ToolbarRenderer {
|
|
|
4037
5396
|
target: colorPicker.element.parentElement, cssClass: css,
|
|
4038
5397
|
enablePersistence: this.parent.enablePersistence, enableRtl: this.parent.enableRtl,
|
|
4039
5398
|
beforeOpen: (dropDownArgs) => {
|
|
5399
|
+
colorPicker.inline = true;
|
|
5400
|
+
colorPicker.dataBind();
|
|
4040
5401
|
if (proxy.parent.readonly || !proxy.parent.enabled) {
|
|
4041
5402
|
dropDownArgs.cancel = true;
|
|
4042
5403
|
return;
|
|
@@ -4174,18 +5535,14 @@ class ToolbarRenderer {
|
|
|
4174
5535
|
const colorPicker = new ColorPicker({
|
|
4175
5536
|
enablePersistence: this.parent.enablePersistence,
|
|
4176
5537
|
enableRtl: this.parent.enableRtl,
|
|
4177
|
-
inline:
|
|
4178
|
-
value:
|
|
4179
|
-
cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass + ' ' + 'e-rte-picker-init',
|
|
5538
|
+
inline: false,
|
|
5539
|
+
value: '#fff',
|
|
4180
5540
|
created: () => {
|
|
4181
5541
|
const value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
|
|
4182
|
-
colorPicker.
|
|
4183
|
-
colorPicker.value = value;
|
|
5542
|
+
colorPicker.setProperties({ value: value });
|
|
4184
5543
|
},
|
|
4185
5544
|
mode: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.mode : proxy.parent.fontColor.mode),
|
|
4186
5545
|
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
5546
|
beforeTileRender: (args) => {
|
|
4190
5547
|
args.element.classList.add(CLS_COLOR_PALETTE);
|
|
4191
5548
|
args.element.classList.add(CLS_CUSTOM_TILE);
|
|
@@ -4230,6 +5587,10 @@ class ToolbarRenderer {
|
|
|
4230
5587
|
}
|
|
4231
5588
|
});
|
|
4232
5589
|
colorPicker.isStringTemplate = true;
|
|
5590
|
+
colorPicker.columns = (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns;
|
|
5591
|
+
colorPicker.presetColors = (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode :
|
|
5592
|
+
this.parent.fontColor.colorCode;
|
|
5593
|
+
colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
|
|
4233
5594
|
colorPicker.createElement = this.parent.createElement;
|
|
4234
5595
|
colorPicker.appendTo(document.getElementById(args.target));
|
|
4235
5596
|
return colorPicker;
|
|
@@ -4427,15 +5788,16 @@ class BaseToolbar {
|
|
|
4427
5788
|
for (let num = 0; num < items.length; num++) {
|
|
4428
5789
|
const tooltipText = items[num].tooltipText;
|
|
4429
5790
|
let shortCutKey;
|
|
5791
|
+
const isMacDev = window.navigator.platform.toLocaleLowerCase().includes('mac');
|
|
4430
5792
|
if (windowKeys[`${tooltipText}`]) {
|
|
4431
|
-
shortCutKey =
|
|
5793
|
+
shortCutKey = isMacDev ? windowKeys[`${tooltipText}`].replace('Ctrl+', '⌘').replace('Shift+', '⇧').replace('Alt+', '⌥') : windowKeys[`${tooltipText}`];
|
|
4432
5794
|
}
|
|
4433
5795
|
else {
|
|
4434
5796
|
shortCutKey = tooltipText;
|
|
4435
5797
|
}
|
|
4436
5798
|
if (shortCutKey) {
|
|
4437
5799
|
if (!(items[num].command === "Images" && items[num].subCommand === "InsertLink")) {
|
|
4438
|
-
items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
|
|
5800
|
+
items[num].tooltipText = (tooltipText !== shortCutKey) ? (isMacDev) ? shortCutKey : tooltipText + ' (' + shortCutKey + ')' : tooltipText;
|
|
4439
5801
|
}
|
|
4440
5802
|
}
|
|
4441
5803
|
}
|
|
@@ -4485,28 +5847,10 @@ class DropDownButtons {
|
|
|
4485
5847
|
if (item.cssClass) {
|
|
4486
5848
|
addClass([args.element], item.cssClass);
|
|
4487
5849
|
}
|
|
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
5850
|
if (item.command === 'Alignments' || item.subCommand === 'JustifyLeft'
|
|
4492
5851
|
|| item.subCommand === 'JustifyRight' || item.subCommand === 'JustifyCenter') {
|
|
4493
5852
|
args.element.setAttribute('title', getTooltipText(item.subCommand.toLocaleLowerCase(), this.locator));
|
|
4494
5853
|
}
|
|
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
5854
|
}
|
|
4511
5855
|
dropdownContent(width, type, content) {
|
|
4512
5856
|
return ('<span style="display: inline-flex;' + 'width:' + ((type === 'quick') ? 'auto' : width) + '" >' +
|
|
@@ -4807,7 +6151,7 @@ class DropDownButtons {
|
|
|
4807
6151
|
if (targetElement.classList.contains(CLS_DROPDOWN_BTN)) {
|
|
4808
6152
|
return;
|
|
4809
6153
|
}
|
|
4810
|
-
this.
|
|
6154
|
+
this.tableCellDropDown = this.toolbarRenderer.renderDropDownButton({
|
|
4811
6155
|
iconCss: 'e-table-cell e-icons',
|
|
4812
6156
|
cssClass: CLS_DROPDOWN_POPUP + ' ' + CLS_DROPDOWN_ITEMS + ' ' + CLS_QUICK_DROPDOWN,
|
|
4813
6157
|
itemName: 'TableCell',
|
|
@@ -4915,6 +6259,10 @@ class DropDownButtons {
|
|
|
4915
6259
|
this.removeDropDownClasses(this.tableColumnsDropDown.element);
|
|
4916
6260
|
this.tableColumnsDropDown.destroy();
|
|
4917
6261
|
}
|
|
6262
|
+
if (this.tableCellDropDown) {
|
|
6263
|
+
this.removeDropDownClasses(this.tableCellDropDown.element);
|
|
6264
|
+
this.tableCellDropDown.destroy();
|
|
6265
|
+
}
|
|
4918
6266
|
if (this.tableCellVerticalAlignDropDown) {
|
|
4919
6267
|
this.removeDropDownClasses(this.tableCellVerticalAlignDropDown.element);
|
|
4920
6268
|
this.tableCellVerticalAlignDropDown.destroy();
|
|
@@ -4968,7 +6316,7 @@ class DropDownButtons {
|
|
|
4968
6316
|
const dropDownObj = [
|
|
4969
6317
|
this.formatDropDown, this.fontNameDropDown, this.fontSizeDropDown, this.alignDropDown, this.imageAlignDropDown,
|
|
4970
6318
|
this.displayDropDown, this.numberFormatListDropDown, this.bulletFormatListDropDown, this.tableRowsDropDown,
|
|
4971
|
-
this.tableColumnsDropDown, this.tableCellVerticalAlignDropDown
|
|
6319
|
+
this.tableColumnsDropDown, this.tableCellDropDown, this.tableCellVerticalAlignDropDown
|
|
4972
6320
|
];
|
|
4973
6321
|
for (let i = 0; i < dropDownObj.length; i++) {
|
|
4974
6322
|
this.updateCss(dropDownObj[i], e);
|
|
@@ -4986,7 +6334,7 @@ class DropDownButtons {
|
|
|
4986
6334
|
this.parent.on(bindCssClass, this.setCssClass, this);
|
|
4987
6335
|
}
|
|
4988
6336
|
onIframeMouseDown() {
|
|
4989
|
-
if (this.parent.getToolbarElement().querySelectorAll('.e-rte-dropdown-btn[aria-expanded="true"]').length > 0) {
|
|
6337
|
+
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
6338
|
dispatchEvent(document, 'mousedown');
|
|
4991
6339
|
}
|
|
4992
6340
|
}
|
|
@@ -6356,26 +7704,19 @@ class BaseQuickToolbar {
|
|
|
6356
7704
|
}
|
|
6357
7705
|
target = isAligned ? e.target : target;
|
|
6358
7706
|
let targetOffsetLeft;
|
|
6359
|
-
let currentOffsetWidth;
|
|
6360
7707
|
if (!isNullOrUndefined(closest(target, 'table'))) {
|
|
6361
7708
|
targetOffsetLeft = target.offsetLeft;
|
|
6362
|
-
let parentTable = closest(target, '
|
|
6363
|
-
let checkOffSetParentWidth = false;
|
|
6364
|
-
if (!isNullOrUndefined(closest(parentTable, 'TD'))) {
|
|
6365
|
-
checkOffSetParentWidth = true;
|
|
6366
|
-
}
|
|
7709
|
+
let parentTable = closest(target.parentElement, 'td');
|
|
6367
7710
|
while (!isNullOrUndefined(parentTable)) {
|
|
6368
7711
|
targetOffsetLeft += parentTable.offsetLeft;
|
|
6369
|
-
currentOffsetWidth = checkOffSetParentWidth ? parentTable.offsetWidth : target.offsetWidth;
|
|
6370
7712
|
parentTable = closest(parentTable.parentElement, 'table');
|
|
6371
7713
|
}
|
|
6372
7714
|
}
|
|
6373
7715
|
else {
|
|
6374
|
-
currentOffsetWidth = target.offsetWidth;
|
|
6375
7716
|
targetOffsetLeft = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft;
|
|
6376
7717
|
}
|
|
6377
|
-
if (
|
|
6378
|
-
x = (
|
|
7718
|
+
if (target.offsetWidth > e.popWidth) {
|
|
7719
|
+
x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + targetOffsetLeft;
|
|
6379
7720
|
}
|
|
6380
7721
|
else {
|
|
6381
7722
|
x = e.parentData.left + targetOffsetLeft;
|
|
@@ -6514,6 +7855,7 @@ class BaseQuickToolbar {
|
|
|
6514
7855
|
target: '#' + this.element.id + ' [title]',
|
|
6515
7856
|
openDelay: 400,
|
|
6516
7857
|
showTipPointer: true,
|
|
7858
|
+
beforeRender: this.tooltipBeforeRender.bind(this),
|
|
6517
7859
|
windowCollision: true,
|
|
6518
7860
|
position: 'BottomCenter',
|
|
6519
7861
|
cssClass: this.parent.getCssClass()
|
|
@@ -6574,6 +7916,11 @@ class BaseQuickToolbar {
|
|
|
6574
7916
|
}
|
|
6575
7917
|
});
|
|
6576
7918
|
}
|
|
7919
|
+
tooltipBeforeRender(args) {
|
|
7920
|
+
if (args.target.querySelector('.e-active')) {
|
|
7921
|
+
args.cancel = true;
|
|
7922
|
+
}
|
|
7923
|
+
}
|
|
6577
7924
|
/**
|
|
6578
7925
|
* hidePopup method
|
|
6579
7926
|
*
|
|
@@ -6606,9 +7953,6 @@ class BaseQuickToolbar {
|
|
|
6606
7953
|
this.parent.enableToolbarItem(this.parent.toolbarSettings.items);
|
|
6607
7954
|
}
|
|
6608
7955
|
}
|
|
6609
|
-
if (this.parent.showTooltip && !isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
|
|
6610
|
-
this.parent.notify(destroyTooltip, { args: event });
|
|
6611
|
-
}
|
|
6612
7956
|
this.removeEleFromDOM();
|
|
6613
7957
|
this.isRendered = false;
|
|
6614
7958
|
}
|
|
@@ -6817,6 +8161,7 @@ class PopupRenderer {
|
|
|
6817
8161
|
*/
|
|
6818
8162
|
class QuickToolbar {
|
|
6819
8163
|
constructor(parent, locator) {
|
|
8164
|
+
this.debounceTimeout = 1000;
|
|
6820
8165
|
this.parent = parent;
|
|
6821
8166
|
this.locator = locator;
|
|
6822
8167
|
this.renderFactory = this.locator.getService('rendererFactory');
|
|
@@ -7007,7 +8352,7 @@ class QuickToolbar {
|
|
|
7007
8352
|
clearTimeout(this.deBouncer);
|
|
7008
8353
|
this.deBouncer = window.setTimeout(() => {
|
|
7009
8354
|
this.showInlineQTBar(x, y, target);
|
|
7010
|
-
},
|
|
8355
|
+
}, this.debounceTimeout);
|
|
7011
8356
|
}
|
|
7012
8357
|
mouseUpHandler(e) {
|
|
7013
8358
|
if (this.parent.inlineMode.enable && (!Browser.isDevice || isIDevice())) {
|
|
@@ -7057,7 +8402,7 @@ class QuickToolbar {
|
|
|
7057
8402
|
this.offsetY = pageYOffset(args, this.parent.element, this.parent.iframeSettings.enable);
|
|
7058
8403
|
const range = this.parent.getRange();
|
|
7059
8404
|
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')) ||
|
|
8405
|
+
(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
8406
|
(this.parent.getRange().startOffset === this.parent.getRange().endOffset)) {
|
|
7062
8407
|
return;
|
|
7063
8408
|
}
|
|
@@ -7065,6 +8410,15 @@ class QuickToolbar {
|
|
|
7065
8410
|
this.textQTBar.showPopup(this.offsetX, this.offsetY, target, 'text');
|
|
7066
8411
|
}
|
|
7067
8412
|
}
|
|
8413
|
+
isEmbedVidElem(target) {
|
|
8414
|
+
if ((target && target.nodeType !== 3 && target.nodeName !== 'BR' && (target.classList && target.classList.contains(CLS_VID_CLICK_ELEM))) ||
|
|
8415
|
+
(target && target.nodeName === 'IFRAME')) {
|
|
8416
|
+
return true;
|
|
8417
|
+
}
|
|
8418
|
+
else {
|
|
8419
|
+
return false;
|
|
8420
|
+
}
|
|
8421
|
+
}
|
|
7068
8422
|
keyDownHandler(e) {
|
|
7069
8423
|
const preventHide = e.args.altKey;
|
|
7070
8424
|
if (this.parent.inlineMode.enable && e.args.metaKey && e.args.keyCode === 65) {
|
|
@@ -7119,7 +8473,7 @@ class QuickToolbar {
|
|
|
7119
8473
|
clearTimeout(this.deBouncer);
|
|
7120
8474
|
this.deBouncer = window.setTimeout(() => {
|
|
7121
8475
|
this.onSelectionChange(e);
|
|
7122
|
-
},
|
|
8476
|
+
}, this.debounceTimeout);
|
|
7123
8477
|
}
|
|
7124
8478
|
onSelectionChange(e) {
|
|
7125
8479
|
if (!isNullOrUndefined(select('.' + CLS_INLINE_POP, document.body))) {
|
|
@@ -7755,228 +9109,6 @@ class MarkdownSelection {
|
|
|
7755
9109
|
}
|
|
7756
9110
|
}
|
|
7757
9111
|
|
|
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
9112
|
/**
|
|
7981
9113
|
* MarkdownToolbarStatus module for refresh the toolbar status
|
|
7982
9114
|
*/
|
|
@@ -8353,7 +9485,8 @@ class Formatter {
|
|
|
8353
9485
|
this.saveData();
|
|
8354
9486
|
}
|
|
8355
9487
|
self.isBlur = false;
|
|
8356
|
-
|
|
9488
|
+
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")));
|
|
9489
|
+
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
9490
|
self.contentModule.getEditPanel().focus();
|
|
8358
9491
|
}
|
|
8359
9492
|
if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
|
|
@@ -8395,7 +9528,8 @@ class Formatter {
|
|
|
8395
9528
|
event: e, callBack: () => {
|
|
8396
9529
|
self.notify(contentChanged, {});
|
|
8397
9530
|
this.enableUndo(self);
|
|
8398
|
-
}
|
|
9531
|
+
},
|
|
9532
|
+
enterAction: self.enterKey
|
|
8399
9533
|
});
|
|
8400
9534
|
}
|
|
8401
9535
|
/**
|
|
@@ -10446,844 +11580,303 @@ class MarkdownFormatter extends Formatter {
|
|
|
10446
11580
|
this.updateFormatter(this.element, document, options.options);
|
|
10447
11581
|
}
|
|
10448
11582
|
}
|
|
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
|
-
}
|
|
11583
|
+
initialize() {
|
|
11584
|
+
this.keyConfig = markdownKeyConfig;
|
|
11585
|
+
this.formatTags = markdownFormatTags;
|
|
11586
|
+
this.listTags = markdownListsTags;
|
|
11587
|
+
this.selectionTags = markdownSelectionTags;
|
|
10946
11588
|
}
|
|
10947
11589
|
/**
|
|
10948
|
-
*
|
|
11590
|
+
* Update the formatter of RichTextEditor
|
|
10949
11591
|
*
|
|
10950
|
-
* @param
|
|
11592
|
+
* @param {Element} editElement - specifies the edit element.
|
|
11593
|
+
* @param {Document} doc - specifies the document.
|
|
11594
|
+
* @param {number} options - specifies the options
|
|
10951
11595
|
* @returns {void}
|
|
10952
11596
|
* @hidden
|
|
10953
11597
|
* @deprecated
|
|
10954
11598
|
*/
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
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]];
|
|
11599
|
+
updateFormatter(editElement, doc, options) {
|
|
11600
|
+
if (editElement) {
|
|
11601
|
+
this.editorManager = new MarkdownParser({
|
|
11602
|
+
element: editElement,
|
|
11603
|
+
formatTags: this.formatTags,
|
|
11604
|
+
listTags: this.listTags,
|
|
11605
|
+
selectionTags: this.selectionTags,
|
|
11606
|
+
options: options
|
|
11607
|
+
});
|
|
10966
11608
|
}
|
|
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
11609
|
}
|
|
11610
|
+
}
|
|
11611
|
+
|
|
11612
|
+
/**
|
|
11613
|
+
* Markdown module is used to render Rich Text Editor as Markdown editor content
|
|
11614
|
+
*
|
|
11615
|
+
* @hidden
|
|
11616
|
+
* @deprecated
|
|
11617
|
+
*/
|
|
11618
|
+
class MarkdownRender {
|
|
10976
11619
|
/**
|
|
10977
|
-
*
|
|
11620
|
+
* Constructor for content renderer module
|
|
10978
11621
|
*
|
|
10979
|
-
* @param {
|
|
10980
|
-
* @returns {void}
|
|
10981
|
-
* @hidden
|
|
10982
|
-
* @deprecated
|
|
11622
|
+
* @param {IRichTextEditor} parent - specifies the parent.
|
|
10983
11623
|
*/
|
|
10984
|
-
|
|
10985
|
-
|
|
11624
|
+
constructor(parent) {
|
|
11625
|
+
this.parent = parent;
|
|
10986
11626
|
}
|
|
10987
11627
|
/**
|
|
10988
|
-
*
|
|
11628
|
+
* The function is used to render Rich Text Editor content div
|
|
10989
11629
|
*
|
|
10990
|
-
* @param {Node[]} nodeCollection - specifies the collection of nodes.
|
|
10991
|
-
* @param {Range} range - specifies the range values.
|
|
10992
11630
|
* @returns {void}
|
|
10993
11631
|
* @hidden
|
|
10994
11632
|
* @deprecated
|
|
10995
11633
|
*/
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
nodeCollection[index] = nodeCollection[index].parentNode;
|
|
11008
|
-
}
|
|
11009
|
-
}
|
|
11010
|
-
return nodeCollection;
|
|
11634
|
+
renderPanel() {
|
|
11635
|
+
const rteObj = this.parent;
|
|
11636
|
+
const div = this.parent.createElement('div', { id: this.parent.getID() + '_view', className: 'e-rte-content' });
|
|
11637
|
+
this.editableElement = this.parent.createElement('textarea', {
|
|
11638
|
+
className: 'e-content',
|
|
11639
|
+
id: this.parent.getID() + '_editable-content',
|
|
11640
|
+
attrs: { 'aria-labelledby': this.parent.getID() + '_view' }
|
|
11641
|
+
});
|
|
11642
|
+
div.appendChild(this.editableElement);
|
|
11643
|
+
this.setPanel(div);
|
|
11644
|
+
rteObj.element.appendChild(div);
|
|
11011
11645
|
}
|
|
11012
11646
|
/**
|
|
11013
|
-
*
|
|
11647
|
+
* Get the content div element of RichTextEditor
|
|
11014
11648
|
*
|
|
11015
|
-
* @
|
|
11016
|
-
* @returns {void}
|
|
11649
|
+
* @returns {Element} - specifies the element
|
|
11017
11650
|
* @hidden
|
|
11018
11651
|
* @deprecated
|
|
11019
11652
|
*/
|
|
11020
|
-
|
|
11021
|
-
return this.
|
|
11653
|
+
getPanel() {
|
|
11654
|
+
return this.contentPanel;
|
|
11022
11655
|
}
|
|
11023
11656
|
/**
|
|
11024
|
-
*
|
|
11657
|
+
* Get the editable element of RichTextEditor
|
|
11025
11658
|
*
|
|
11026
|
-
* @
|
|
11027
|
-
* @returns {void}
|
|
11659
|
+
* @returns {Element} - specifies the element
|
|
11028
11660
|
* @hidden
|
|
11029
11661
|
* @deprecated
|
|
11030
11662
|
*/
|
|
11031
|
-
|
|
11032
|
-
return this.
|
|
11663
|
+
getEditPanel() {
|
|
11664
|
+
return this.editableElement;
|
|
11033
11665
|
}
|
|
11034
11666
|
/**
|
|
11035
|
-
*
|
|
11667
|
+
* Returns the text content as string.
|
|
11036
11668
|
*
|
|
11037
|
-
* @
|
|
11038
|
-
* @returns {void}
|
|
11039
|
-
* @hidden
|
|
11040
|
-
* @deprecated
|
|
11669
|
+
* @returns {string} - specifies the string values.
|
|
11041
11670
|
*/
|
|
11042
|
-
|
|
11043
|
-
|
|
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();
|
|
11671
|
+
getText() {
|
|
11672
|
+
return this.getEditPanel().value;
|
|
11054
11673
|
}
|
|
11055
11674
|
/**
|
|
11056
|
-
*
|
|
11675
|
+
* Set the content div element of RichTextEditor
|
|
11057
11676
|
*
|
|
11058
|
-
* @param
|
|
11677
|
+
* @param {Element} panel - specifies the element.
|
|
11059
11678
|
* @returns {void}
|
|
11060
11679
|
* @hidden
|
|
11061
11680
|
* @deprecated
|
|
11062
11681
|
*/
|
|
11063
|
-
|
|
11064
|
-
|
|
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();
|
|
11682
|
+
setPanel(panel) {
|
|
11683
|
+
this.contentPanel = panel;
|
|
11076
11684
|
}
|
|
11077
11685
|
/**
|
|
11078
|
-
*
|
|
11686
|
+
* Get the document of RichTextEditor
|
|
11079
11687
|
*
|
|
11080
|
-
* @param {Range} range - specifies the range value.
|
|
11081
11688
|
* @returns {void}
|
|
11082
11689
|
* @hidden
|
|
11083
11690
|
* @deprecated
|
|
11084
11691
|
*/
|
|
11085
|
-
|
|
11086
|
-
return this.
|
|
11692
|
+
getDocument() {
|
|
11693
|
+
return this.getEditPanel().ownerDocument;
|
|
11694
|
+
}
|
|
11695
|
+
}
|
|
11696
|
+
|
|
11697
|
+
/**
|
|
11698
|
+
* `MarkdownEditor` module is used to markdown editor
|
|
11699
|
+
*/
|
|
11700
|
+
class MarkdownEditor {
|
|
11701
|
+
constructor(parent, serviceLocator) {
|
|
11702
|
+
this.parent = parent;
|
|
11703
|
+
this.locator = serviceLocator;
|
|
11704
|
+
this.renderFactory = this.locator.getService('rendererFactory');
|
|
11705
|
+
this.addEventListener();
|
|
11087
11706
|
}
|
|
11088
11707
|
/**
|
|
11089
|
-
*
|
|
11708
|
+
* Destroys the Markdown.
|
|
11090
11709
|
*
|
|
11091
|
-
* @
|
|
11710
|
+
* @function destroy
|
|
11092
11711
|
* @returns {void}
|
|
11093
11712
|
* @hidden
|
|
11094
11713
|
* @deprecated
|
|
11095
11714
|
*/
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
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
|
-
}
|
|
11715
|
+
destroy() {
|
|
11716
|
+
if (isNullOrUndefined(this.parent)) {
|
|
11717
|
+
return;
|
|
11106
11718
|
}
|
|
11107
|
-
|
|
11719
|
+
this.removeEventListener();
|
|
11108
11720
|
}
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
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;
|
|
11721
|
+
moduleDestroy() {
|
|
11722
|
+
this.parent = null;
|
|
11723
|
+
this.toolbarUpdate.parent = null;
|
|
11724
|
+
}
|
|
11725
|
+
addEventListener() {
|
|
11726
|
+
if (this.parent.isDestroyed) {
|
|
11727
|
+
return;
|
|
11131
11728
|
}
|
|
11132
|
-
|
|
11729
|
+
this.saveSelection = new MarkdownSelection();
|
|
11730
|
+
this.parent.on(initialLoad, this.instantiateRenderer, this);
|
|
11731
|
+
this.parent.on(initialEnd, this.render, this);
|
|
11732
|
+
this.parent.on(modelChanged, this.onPropertyChanged, this);
|
|
11733
|
+
this.parent.on(markdownToolbarClick, this.onToolbarClick, this);
|
|
11734
|
+
this.parent.on(destroy, this.destroy, this);
|
|
11735
|
+
this.parent.on(selectAll$1, this.selectAll, this);
|
|
11736
|
+
this.parent.on(getSelectedHtml, this.getSelectedHtml, this);
|
|
11737
|
+
this.parent.on(selectionSave, this.onSelectionSave, this);
|
|
11738
|
+
this.parent.on(selectionRestore, this.onSelectionRestore, this);
|
|
11739
|
+
this.parent.on(readOnlyMode, this.updateReadOnly, this);
|
|
11740
|
+
this.parent.on(moduleDestroy, this.moduleDestroy, this);
|
|
11133
11741
|
}
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
for (; index--; null) {
|
|
11139
|
-
node = node && node.childNodes[num[index]];
|
|
11742
|
+
updateReadOnly() {
|
|
11743
|
+
if (this.parent.readonly) {
|
|
11744
|
+
this.parent.contentModule.getEditPanel().setAttribute('readonly', 'readonly');
|
|
11745
|
+
addClass([this.parent.element], CLS_RTE_READONLY);
|
|
11140
11746
|
}
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
}
|
|
11145
|
-
range[isvalid ? 'setStart' : 'setEnd'](node, constant);
|
|
11747
|
+
else {
|
|
11748
|
+
this.parent.contentModule.getEditPanel().removeAttribute('readonly');
|
|
11749
|
+
removeClass([this.parent.element], CLS_RTE_READONLY);
|
|
11146
11750
|
}
|
|
11147
|
-
return range;
|
|
11148
11751
|
}
|
|
11149
|
-
|
|
11150
|
-
|
|
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;
|
|
11752
|
+
onSelectionSave() {
|
|
11753
|
+
const textArea = this.parent.contentModule.getEditPanel();
|
|
11754
|
+
this.saveSelection.save(textArea.selectionStart, textArea.selectionEnd);
|
|
11162
11755
|
}
|
|
11163
|
-
|
|
11164
|
-
|
|
11165
|
-
this.
|
|
11756
|
+
// eslint-disable-next-line
|
|
11757
|
+
onSelectionRestore(e) {
|
|
11758
|
+
this.contentRenderer.getEditPanel().focus();
|
|
11759
|
+
const textArea = this.parent.contentModule.getEditPanel();
|
|
11760
|
+
this.saveSelection.restore(textArea);
|
|
11166
11761
|
}
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11762
|
+
onToolbarClick(args) {
|
|
11763
|
+
const item = args.item;
|
|
11764
|
+
const textArea = this.parent.contentModule.getEditPanel();
|
|
11765
|
+
if (item.command !== 'Formats') {
|
|
11766
|
+
textArea.focus();
|
|
11767
|
+
}
|
|
11768
|
+
const startOffset = textArea.selectionStart;
|
|
11769
|
+
const endOffset = textArea.selectionEnd;
|
|
11770
|
+
const text = textArea.value.substring(startOffset, endOffset);
|
|
11771
|
+
switch (item.subCommand) {
|
|
11772
|
+
case 'Maximize':
|
|
11773
|
+
this.parent.notify(enableFullScreen, { args: args });
|
|
11774
|
+
break;
|
|
11775
|
+
case 'Minimize':
|
|
11776
|
+
this.parent.notify(disableFullScreen, { args: args });
|
|
11777
|
+
break;
|
|
11778
|
+
case 'CreateLink':
|
|
11779
|
+
this.parent.notify(insertLink, { member: 'link', args: args, text: text, module: 'Markdown' });
|
|
11780
|
+
break;
|
|
11781
|
+
case 'Image':
|
|
11782
|
+
this.parent.notify(insertImage, { member: 'image', args: args, text: text, module: 'Markdown' });
|
|
11783
|
+
break;
|
|
11784
|
+
case 'CreateTable': {
|
|
11785
|
+
const tableConstant = {
|
|
11786
|
+
'headingText': this.parent.localeObj.getConstant('TableHeadingText'),
|
|
11787
|
+
'colText': this.parent.localeObj.getConstant('TableColText')
|
|
11788
|
+
};
|
|
11789
|
+
this.parent.formatter.process(this.parent, args, args.originalEvent, tableConstant);
|
|
11790
|
+
break;
|
|
11791
|
+
}
|
|
11792
|
+
default:
|
|
11793
|
+
this.parent.formatter.process(this.parent, args, args.originalEvent, null);
|
|
11794
|
+
break;
|
|
11795
|
+
}
|
|
11180
11796
|
}
|
|
11181
|
-
|
|
11182
|
-
|
|
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);
|
|
11797
|
+
instantiateRenderer() {
|
|
11798
|
+
this.renderFactory.addRenderer(RenderType.Content, new MarkdownRender(this.parent));
|
|
11198
11799
|
}
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
this.
|
|
11800
|
+
removeEventListener() {
|
|
11801
|
+
if (this.parent.isDestroyed) {
|
|
11802
|
+
return;
|
|
11803
|
+
}
|
|
11804
|
+
this.parent.off(initialEnd, this.render);
|
|
11805
|
+
this.parent.off(modelChanged, this.onPropertyChanged);
|
|
11806
|
+
this.parent.off(destroy, this.destroy);
|
|
11807
|
+
this.parent.off(markdownToolbarClick, this.onToolbarClick);
|
|
11808
|
+
this.parent.off(initialLoad, this.instantiateRenderer);
|
|
11809
|
+
this.parent.off(selectAll$1, this.selectAll);
|
|
11810
|
+
this.parent.off(getSelectedHtml, this.getSelectedHtml);
|
|
11811
|
+
this.parent.off(selectionSave, this.onSelectionSave);
|
|
11812
|
+
this.parent.off(selectionRestore, this.onSelectionRestore);
|
|
11813
|
+
this.parent.off(readOnlyMode, this.updateReadOnly);
|
|
11814
|
+
this.parent.off(moduleDestroy, this.moduleDestroy);
|
|
11212
11815
|
}
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11816
|
+
render() {
|
|
11817
|
+
this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
|
|
11818
|
+
const editElement = this.contentRenderer.getEditPanel();
|
|
11819
|
+
const option = { undoRedoSteps: this.parent.undoRedoSteps, undoRedoTimer: this.parent.undoRedoTimer };
|
|
11820
|
+
if (isNullOrUndefined(this.parent.formatter)) {
|
|
11821
|
+
this.parent.formatter = new MarkdownFormatter({
|
|
11822
|
+
element: editElement,
|
|
11823
|
+
options: option
|
|
11824
|
+
});
|
|
11825
|
+
}
|
|
11826
|
+
else {
|
|
11827
|
+
this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
|
|
11828
|
+
}
|
|
11829
|
+
if (this.parent.toolbarSettings.enable) {
|
|
11830
|
+
this.toolbarUpdate = new MarkdownToolbarStatus(this.parent);
|
|
11831
|
+
}
|
|
11832
|
+
this.parent.notify(bindOnEnd, {});
|
|
11226
11833
|
}
|
|
11227
11834
|
/**
|
|
11228
|
-
*
|
|
11835
|
+
* Called internally if any of the property value changed.
|
|
11229
11836
|
*
|
|
11230
|
-
* @param {
|
|
11837
|
+
* @param {RichTextEditorModel} e - specifies the editor model
|
|
11231
11838
|
* @returns {void}
|
|
11232
11839
|
* @hidden
|
|
11233
11840
|
* @deprecated
|
|
11234
11841
|
*/
|
|
11235
|
-
|
|
11236
|
-
|
|
11842
|
+
onPropertyChanged(e) {
|
|
11843
|
+
// On property code change here
|
|
11844
|
+
if (!isNullOrUndefined(e.newProp.formatter)) {
|
|
11845
|
+
const editElement = this.contentRenderer.getEditPanel();
|
|
11846
|
+
const option = { undoRedoSteps: this.parent.undoRedoSteps,
|
|
11847
|
+
undoRedoTimer: this.parent.undoRedoTimer };
|
|
11848
|
+
this.parent.formatter.updateFormatter(editElement, this.contentRenderer.getDocument(), option);
|
|
11849
|
+
}
|
|
11237
11850
|
}
|
|
11238
11851
|
/**
|
|
11239
|
-
*
|
|
11852
|
+
* For internal use only - Get the module name.
|
|
11240
11853
|
*
|
|
11241
|
-
* @param {Document} docElement - specifies the document.
|
|
11242
11854
|
* @returns {void}
|
|
11243
|
-
* @hidden
|
|
11244
|
-
* @deprecated
|
|
11245
11855
|
*/
|
|
11246
|
-
|
|
11247
|
-
|
|
11856
|
+
getModuleName() {
|
|
11857
|
+
return 'markdownEditor';
|
|
11248
11858
|
}
|
|
11249
11859
|
/**
|
|
11250
|
-
*
|
|
11860
|
+
* For selecting all content in RTE
|
|
11251
11861
|
*
|
|
11252
|
-
* @param {Document} docElement - specifies the document.
|
|
11253
|
-
* @param {Node} newNode - specicfies the new node.
|
|
11254
|
-
* @param {Range} range - specifies the range.
|
|
11255
11862
|
* @returns {void}
|
|
11256
|
-
* @
|
|
11257
|
-
* @deprecated
|
|
11863
|
+
* @private
|
|
11258
11864
|
*/
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
this.selectRange(docElement, range);
|
|
11865
|
+
selectAll() {
|
|
11866
|
+
this.parent.formatter.editorManager.markdownSelection.setSelection(this.parent.contentModule.getEditPanel(), 0, this.parent.contentModule.getEditPanel().value.length);
|
|
11262
11867
|
}
|
|
11263
11868
|
/**
|
|
11264
|
-
*
|
|
11869
|
+
* For get a selected text in RTE
|
|
11265
11870
|
*
|
|
11266
|
-
* @param {
|
|
11267
|
-
* @param {Element} element - specifies the element.
|
|
11268
|
-
* @param {number} point - specifies the point.
|
|
11871
|
+
* @param {NotifyArgs} e - specifies the arguments.
|
|
11269
11872
|
* @returns {void}
|
|
11270
|
-
* @
|
|
11271
|
-
* @deprecated
|
|
11873
|
+
* @private
|
|
11272
11874
|
*/
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
const selection = docElement.defaultView.getSelection();
|
|
11276
|
-
range.setStart(element, point);
|
|
11277
|
-
range.collapse(true);
|
|
11278
|
-
selection.removeAllRanges();
|
|
11279
|
-
selection.addRange(range);
|
|
11875
|
+
getSelectedHtml(e) {
|
|
11876
|
+
e.callBack(this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()));
|
|
11280
11877
|
}
|
|
11281
11878
|
}
|
|
11282
11879
|
|
|
11283
|
-
/**
|
|
11284
|
-
* `Selection` module is used to handle RTE Selections.
|
|
11285
|
-
*/
|
|
11286
|
-
|
|
11287
11880
|
const markerClassName = {
|
|
11288
11881
|
startSelection: 'e-editor-select-start',
|
|
11289
11882
|
endSelection: 'e-editor-select-end'
|
|
@@ -12409,11 +13002,17 @@ class Lists {
|
|
|
12409
13002
|
removeList(range, e) {
|
|
12410
13003
|
let startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
|
|
12411
13004
|
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);
|
|
13005
|
+
const parentList = (range.startContainer.nodeName === '#text') ? range.startContainer.parentElement.closest('li') : range.startContainer.closest('li');
|
|
13006
|
+
let fullContent = '';
|
|
13007
|
+
if (!isNullOrUndefined(parentList) && !isNullOrUndefined(parentList.childNodes)) {
|
|
13008
|
+
parentList.childNodes.forEach((e) => {
|
|
13009
|
+
fullContent = fullContent + e.textContent;
|
|
13010
|
+
});
|
|
13011
|
+
}
|
|
12412
13012
|
startNode = startNode.nodeName === 'BR' ? startNode.parentElement : startNode;
|
|
12413
13013
|
endNode = endNode.nodeName === 'BR' ? endNode.parentElement : endNode;
|
|
12414
13014
|
startNode = startNode.nodeName !== 'LI' && !isNullOrUndefined(startNode.closest('LI')) ? startNode.closest('LI') : startNode;
|
|
12415
13015
|
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
13016
|
if (((range.commonAncestorContainer.nodeName === 'OL' || range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'LI') &&
|
|
12418
13017
|
isNullOrUndefined(endNode.nextElementSibling) && endNode.textContent.length === range.endOffset &&
|
|
12419
13018
|
isNullOrUndefined(startNode.previousElementSibling) && range.startOffset === 0) ||
|
|
@@ -12430,10 +13029,23 @@ class Lists {
|
|
|
12430
13029
|
}
|
|
12431
13030
|
e.event.preventDefault();
|
|
12432
13031
|
}
|
|
12433
|
-
else if (!isNullOrUndefined(parentList) &&
|
|
13032
|
+
else if (!isNullOrUndefined(parentList) && !range.collapsed && parentList.textContent === fullContent) {
|
|
12434
13033
|
range.deleteContents();
|
|
12435
|
-
this.parent.editableElement.querySelectorAll('li
|
|
12436
|
-
|
|
13034
|
+
this.parent.editableElement.querySelectorAll('li').forEach((li) => {
|
|
13035
|
+
if (!li.firstChild || li.textContent.trim() === '') {
|
|
13036
|
+
li.parentNode.removeChild(li);
|
|
13037
|
+
}
|
|
13038
|
+
});
|
|
13039
|
+
this.parent.editableElement.querySelectorAll('ol').forEach((ol) => {
|
|
13040
|
+
if (!ol.firstChild || ol.textContent.trim() === '') {
|
|
13041
|
+
ol.parentNode.removeChild(ol);
|
|
13042
|
+
}
|
|
13043
|
+
});
|
|
13044
|
+
this.parent.editableElement.querySelectorAll('ul').forEach((ul) => {
|
|
13045
|
+
if (!ul.firstChild || ul.textContent.trim() === '') {
|
|
13046
|
+
ul.parentNode.removeChild(ul);
|
|
13047
|
+
}
|
|
13048
|
+
});
|
|
12437
13049
|
e.event.preventDefault();
|
|
12438
13050
|
}
|
|
12439
13051
|
}
|
|
@@ -12830,6 +13442,10 @@ class Lists {
|
|
|
12830
13442
|
}
|
|
12831
13443
|
else {
|
|
12832
13444
|
this.checkLists(elements, type, item);
|
|
13445
|
+
let marginLeftAttribute = '';
|
|
13446
|
+
if (elements[0].style.marginLeft !== '') {
|
|
13447
|
+
marginLeftAttribute = ' style = "margin-left: ' + elements[0].style.marginLeft + ';"';
|
|
13448
|
+
}
|
|
12833
13449
|
for (let i = 0; i < elements.length; i++) {
|
|
12834
13450
|
if (!isNullOrUndefined(item) && !isNullOrUndefined(item.listStyle)) {
|
|
12835
13451
|
if (item.listStyle === 'listImage') {
|
|
@@ -12840,6 +13456,9 @@ class Lists {
|
|
|
12840
13456
|
setStyleAttribute(elements[i], { 'list-style-type': item.listStyle.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() });
|
|
12841
13457
|
}
|
|
12842
13458
|
}
|
|
13459
|
+
let elemAtt;
|
|
13460
|
+
elements[i].style.removeProperty('margin-left');
|
|
13461
|
+
elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|
|
12843
13462
|
if (elements[i].getAttribute('contenteditable') === 'true'
|
|
12844
13463
|
&& elements[i].childNodes.length === 1 && elements[i].childNodes[0].nodeName === 'TABLE') {
|
|
12845
13464
|
const listEle = document.createElement(type);
|
|
@@ -12848,8 +13467,7 @@ class Lists {
|
|
|
12848
13467
|
}
|
|
12849
13468
|
else if ('LI' !== elements[i].tagName && isNullOrUndefined(item) &&
|
|
12850
13469
|
elements[i].nodeName === 'BLOCKQUOTE') {
|
|
12851
|
-
const
|
|
12852
|
-
const openTag = '<' + type + '>';
|
|
13470
|
+
const openTag = '<' + type + marginLeftAttribute + '>';
|
|
12853
13471
|
const closeTag = '</' + type + '>';
|
|
12854
13472
|
const newTag = 'li' + elemAtt;
|
|
12855
13473
|
const replaceHTML = elements[i].innerHTML;
|
|
@@ -12858,8 +13476,7 @@ class Lists {
|
|
|
12858
13476
|
elements[i].innerHTML = collectionString;
|
|
12859
13477
|
}
|
|
12860
13478
|
else if ('LI' !== elements[i].tagName && isNullOrUndefined(item)) {
|
|
12861
|
-
const
|
|
12862
|
-
const openTag = '<' + type + '>';
|
|
13479
|
+
const openTag = '<' + type + marginLeftAttribute + '>';
|
|
12863
13480
|
const closeTag = '</' + type + '>';
|
|
12864
13481
|
const newTag = 'li' + elemAtt;
|
|
12865
13482
|
const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
|
|
@@ -12870,8 +13487,8 @@ class Lists {
|
|
|
12870
13487
|
}
|
|
12871
13488
|
else if (!isNullOrUndefined(item) && 'LI' !== elements[i].tagName) {
|
|
12872
13489
|
// eslint-disable-next-line
|
|
12873
|
-
const
|
|
12874
|
-
const openTag = '<' + type +
|
|
13490
|
+
const currentElemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|
|
13491
|
+
const openTag = '<' + type + currentElemAtt + '>';
|
|
12875
13492
|
const closeTag = '</' + type + '>';
|
|
12876
13493
|
const newTag = 'li';
|
|
12877
13494
|
const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
|
|
@@ -13064,19 +13681,19 @@ class Lists {
|
|
|
13064
13681
|
if (DEFAULT_TAG && 0 === element.querySelectorAll(BLOCK_TAGS.join(', ')).length) {
|
|
13065
13682
|
const wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
|
|
13066
13683
|
' class="' + className + ' e-rte-wrap-inner"';
|
|
13067
|
-
|
|
13684
|
+
let parentElement = parentNode;
|
|
13068
13685
|
if (elements.length === parentElement.querySelectorAll('li').length) {
|
|
13069
13686
|
if (!isNullOrUndefined(parentElement.style.listStyleType)) {
|
|
13070
|
-
parentNode.style.removeProperty(
|
|
13687
|
+
parentNode.style.removeProperty("list-style-type");
|
|
13071
13688
|
}
|
|
13072
13689
|
if (!isNullOrUndefined(parentElement.style.listStyleImage)) {
|
|
13073
|
-
parentNode.style.removeProperty(
|
|
13690
|
+
parentNode.style.removeProperty("list-style-image");
|
|
13074
13691
|
}
|
|
13075
13692
|
if (parentElement.style.length === 0) {
|
|
13076
|
-
parentNode.removeAttribute(
|
|
13693
|
+
parentNode.removeAttribute("style");
|
|
13077
13694
|
}
|
|
13078
13695
|
}
|
|
13079
|
-
const wrapper = '<' + DEFAULT_TAG + wrapperclass + '></' + DEFAULT_TAG + '>';
|
|
13696
|
+
const wrapper = '<' + DEFAULT_TAG + wrapperclass + this.domNode.attributes(element) + '></' + DEFAULT_TAG + '>';
|
|
13080
13697
|
if (e.enterAction !== 'BR') {
|
|
13081
13698
|
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
|
|
13082
13699
|
}
|
|
@@ -13384,8 +14001,11 @@ class NodeCutter {
|
|
|
13384
14001
|
this.position = 1;
|
|
13385
14002
|
}
|
|
13386
14003
|
else {
|
|
13387
|
-
|
|
14004
|
+
let startOffset = this.GetCursorStart(indexes, range.startOffset, true);
|
|
13388
14005
|
this.position = range.startOffset - startOffset;
|
|
14006
|
+
if (startOffset !== 0 && str[startOffset] && str[startOffset] === ' ') {
|
|
14007
|
+
startOffset = startOffset + 1;
|
|
14008
|
+
}
|
|
13389
14009
|
cursorRange.setStart(range.startContainer, startOffset);
|
|
13390
14010
|
cursorRange.setEnd(range.startContainer, this.GetCursorStart(indexes, range.startOffset, false));
|
|
13391
14011
|
}
|
|
@@ -13465,6 +14085,12 @@ class Formats {
|
|
|
13465
14085
|
}
|
|
13466
14086
|
}
|
|
13467
14087
|
}
|
|
14088
|
+
if (e.enterAction !== 'BR' && !isNullOrUndefined(range.startContainer) && !isNullOrUndefined(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains("e-content") && range.startContainer.parentElement.isContentEditable) {
|
|
14089
|
+
let pTag = createElement(e.enterAction);
|
|
14090
|
+
range.startContainer.parentElement.insertBefore(pTag, range.startContainer);
|
|
14091
|
+
pTag.appendChild(range.startContainer);
|
|
14092
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, pTag, 1);
|
|
14093
|
+
}
|
|
13468
14094
|
}
|
|
13469
14095
|
getBlockParent(node, endNode) {
|
|
13470
14096
|
let currentParent;
|
|
@@ -14074,7 +14700,7 @@ class InsertHtml {
|
|
|
14074
14700
|
range.deleteContents();
|
|
14075
14701
|
range.setStart(startContainerParent, startIndex);
|
|
14076
14702
|
range.setEnd(startContainerParent, startIndex);
|
|
14077
|
-
if (!isNullOrUndefined(lasNode)) {
|
|
14703
|
+
if (!isNullOrUndefined(lasNode) && lasNode !== editNode) {
|
|
14078
14704
|
detach(lasNode);
|
|
14079
14705
|
}
|
|
14080
14706
|
// eslint-disable-next-line
|
|
@@ -14241,7 +14867,7 @@ class InsertHtml {
|
|
|
14241
14867
|
if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
14242
14868
|
blockNode = range.startContainer;
|
|
14243
14869
|
}
|
|
14244
|
-
if (blockNode.closest('LI') && node && node.firstElementChild &&
|
|
14870
|
+
if (blockNode.closest('LI') && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
|
|
14245
14871
|
((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
|
|
14246
14872
|
let liNode;
|
|
14247
14873
|
while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
|
|
@@ -14271,7 +14897,7 @@ class InsertHtml {
|
|
|
14271
14897
|
}
|
|
14272
14898
|
}
|
|
14273
14899
|
else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
14274
|
-
(currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
|
|
14900
|
+
(currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
|
|
14275
14901
|
currentNode.parentElement.textContent.trim().length > 0) {
|
|
14276
14902
|
splitedElm = currentNode;
|
|
14277
14903
|
if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
|
|
@@ -14280,6 +14906,12 @@ class InsertHtml {
|
|
|
14280
14906
|
}
|
|
14281
14907
|
if (!range.collapsed) {
|
|
14282
14908
|
range.deleteContents();
|
|
14909
|
+
const value = range.startContainer;
|
|
14910
|
+
if (!isNullOrUndefined(value) && value.nodeName === 'LI' && !isNullOrUndefined(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
|
|
14911
|
+
value.parentElement.querySelectorAll('li').forEach((item) => {
|
|
14912
|
+
item.remove();
|
|
14913
|
+
});
|
|
14914
|
+
}
|
|
14283
14915
|
}
|
|
14284
14916
|
range.insertNode(node);
|
|
14285
14917
|
this.contentsDeleted = true;
|
|
@@ -14471,7 +15103,8 @@ class LinkCommand {
|
|
|
14471
15103
|
}
|
|
14472
15104
|
if (!isNullOrUndefined(e.item.text) && e.item.text !== '') {
|
|
14473
15105
|
linkText = anchorEle.innerText;
|
|
14474
|
-
anchorEle.innerText = e.item.text
|
|
15106
|
+
anchorEle.firstChild.nodeName === '#text' ? anchorEle.innerText = e.item.text :
|
|
15107
|
+
anchorEle.firstChild.innerText = e.item.text;
|
|
14475
15108
|
}
|
|
14476
15109
|
if (!isNullOrUndefined(e.item.target)) {
|
|
14477
15110
|
anchorEle.setAttribute('target', e.item.target);
|
|
@@ -14487,7 +15120,8 @@ class LinkCommand {
|
|
|
14487
15120
|
}
|
|
14488
15121
|
else {
|
|
14489
15122
|
const startIndex = e.item.action === 'Paste' ? anchorEle.childNodes[0].textContent.length : 0;
|
|
14490
|
-
|
|
15123
|
+
const endIndex = anchorEle.firstChild.nodeName === '#text' ? anchorEle.childNodes[0].textContent.length : anchorEle.childNodes.length;
|
|
15124
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, anchorEle.childNodes[0], anchorEle.childNodes[0], startIndex, endIndex);
|
|
14491
15125
|
}
|
|
14492
15126
|
}
|
|
14493
15127
|
else {
|
|
@@ -14907,7 +15541,7 @@ class Indents {
|
|
|
14907
15541
|
isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
|
|
14908
15542
|
}
|
|
14909
15543
|
else {
|
|
14910
|
-
indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
|
|
15544
|
+
indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px' || marginLeftOrRight === '0in') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
|
|
14911
15545
|
isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
|
|
14912
15546
|
/* eslint-enable */
|
|
14913
15547
|
}
|
|
@@ -15417,7 +16051,7 @@ class AudioCommand {
|
|
|
15417
16051
|
isReplaced = true;
|
|
15418
16052
|
}
|
|
15419
16053
|
else {
|
|
15420
|
-
wrapElement = createElement('span', { className: CLASS_AUDIO_WRAP, attrs: { contentEditable: 'false', title: e.item.fileName } });
|
|
16054
|
+
wrapElement = createElement('span', { className: CLASS_AUDIO_WRAP, attrs: { contentEditable: 'false', title: ((!isNullOrUndefined(e.item.title)) ? e.item.title : (!isNullOrUndefined(e.item.fileName) ? e.item.fileName : '')) } });
|
|
15421
16055
|
const audElement = createElement('audio', { className: CLASS_AUDIO + ' ' + CLASS_AUDIO_INLINE, attrs: { controls: '' } });
|
|
15422
16056
|
const sourceElement = createElement('source');
|
|
15423
16057
|
const clickElement = createElement('span', { className: CLASS_CLICK_ELEM });
|
|
@@ -15611,7 +16245,7 @@ class VideoCommand {
|
|
|
15611
16245
|
}
|
|
15612
16246
|
else {
|
|
15613
16247
|
if (!e.item.isEmbedUrl) {
|
|
15614
|
-
wrapElement = createElement('span', { className: CLASS_VIDEO_WRAP, attrs: { contentEditable: 'false', title: e.item.fileName } });
|
|
16248
|
+
wrapElement = createElement('span', { className: CLASS_VIDEO_WRAP, attrs: { contentEditable: 'false', title: ((!isNullOrUndefined(e.item.title)) ? e.item.title : (!isNullOrUndefined(e.item.fileName) ? e.item.fileName : '')) } });
|
|
15615
16249
|
vidElement = createElement('video', { className: CLASS_VIDEO + ' ' + CLASS_VIDEO_INLINE, attrs: { controls: '' } });
|
|
15616
16250
|
sourceElement = createElement('source');
|
|
15617
16251
|
this.setStyle(sourceElement, e, vidElement);
|
|
@@ -16470,28 +17104,23 @@ class TableCommand {
|
|
|
16470
17104
|
const newCell = this.activeCell.cloneNode(true);
|
|
16471
17105
|
newCell.removeAttribute('class');
|
|
16472
17106
|
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
17107
|
const activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
|
|
16483
17108
|
const correspondingColumns = this.getCorrespondingColumns();
|
|
16484
|
-
const activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10);
|
|
17109
|
+
const activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10) || 1;
|
|
16485
17110
|
if (activeCellcolSpan > 1) {
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
17111
|
+
const colSpan = Math.ceil(activeCellcolSpan / 2);
|
|
17112
|
+
const getColSizes = this.getColSizes(this.curTable);
|
|
17113
|
+
const activeCellUpdatedWidth = this.getSplitColWidth(activeCellIndex[1], activeCellIndex[1] + colSpan - 1, getColSizes);
|
|
17114
|
+
let newCellWidth = this.getSplitColWidth(activeCellIndex[1] + colSpan, activeCellIndex[1] + activeCellcolSpan - 1, getColSizes);
|
|
17115
|
+
const activeCellWidth = this.convertPixelToPercentage(this.activeCell.offsetWidth, this.curTable.offsetWidth);
|
|
17116
|
+
newCellWidth = (activeCellWidth - activeCellUpdatedWidth) < newCellWidth ? (activeCellWidth - activeCellUpdatedWidth) : newCellWidth;
|
|
17117
|
+
1 < colSpan ? this.activeCell.setAttribute('colspan', colSpan.toString()) : this.activeCell.removeAttribute('colspan');
|
|
17118
|
+
1 < activeCellcolSpan - colSpan ? newCell.setAttribute('colspan', (activeCellcolSpan - colSpan).toString()) : newCell.removeAttribute('colspan');
|
|
17119
|
+
this.activeCell.style.width = activeCellUpdatedWidth + '%';
|
|
17120
|
+
newCell.style.width = newCellWidth + '%';
|
|
16493
17121
|
}
|
|
16494
17122
|
else {
|
|
17123
|
+
let avgWidth = parseFloat(this.activeCell.style.width) / 2;
|
|
16495
17124
|
for (let i = 0; i <= allRows.length - 1; i++) {
|
|
16496
17125
|
if (0 === i || correspondingColumns[i][activeCellIndex[1]] !== correspondingColumns[i - 1][activeCellIndex[1]]) {
|
|
16497
17126
|
const currentCell = correspondingColumns[i][activeCellIndex[1]];
|
|
@@ -16501,9 +17130,9 @@ class TableCommand {
|
|
|
16501
17130
|
}
|
|
16502
17131
|
}
|
|
16503
17132
|
}
|
|
17133
|
+
this.activeCell.style.width = avgWidth + '%';
|
|
17134
|
+
newCell.style.width = avgWidth + '%';
|
|
16504
17135
|
}
|
|
16505
|
-
this.activeCell.style.width = avgWidth + '%';
|
|
16506
|
-
newCell.style.width = avgWidth + '%';
|
|
16507
17136
|
this.activeCell.parentNode.insertBefore(newCell, this.activeCell.nextSibling);
|
|
16508
17137
|
if (e.callBack) {
|
|
16509
17138
|
e.callBack({
|
|
@@ -16515,6 +17144,54 @@ class TableCommand {
|
|
|
16515
17144
|
});
|
|
16516
17145
|
}
|
|
16517
17146
|
}
|
|
17147
|
+
getSplitColWidth(startIndex, endInex, sizes) {
|
|
17148
|
+
let width = 0;
|
|
17149
|
+
for (let i = startIndex; i <= endInex; i++) {
|
|
17150
|
+
width += sizes[i];
|
|
17151
|
+
}
|
|
17152
|
+
return this.convertPixelToPercentage(width, this.curTable.offsetWidth);
|
|
17153
|
+
}
|
|
17154
|
+
getColSizes(curTable) {
|
|
17155
|
+
const cellColl = curTable.rows[0].cells;
|
|
17156
|
+
let cellCount = 0;
|
|
17157
|
+
for (let cell = 0; cell < cellColl.length; cell++) {
|
|
17158
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
17159
|
+
}
|
|
17160
|
+
const sizes = new Array(cellCount);
|
|
17161
|
+
const rowSpanCells = new Map();
|
|
17162
|
+
for (let i = 0; i < curTable.rows.length; i++) {
|
|
17163
|
+
let currentColIndex = 0;
|
|
17164
|
+
for (let k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
17165
|
+
for (let l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
|
|
17166
|
+
const key = `${i + l}${currentColIndex}`;
|
|
17167
|
+
rowSpanCells.set(key, curTable.rows[i].cells[k]);
|
|
17168
|
+
}
|
|
17169
|
+
const cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
17170
|
+
if (cellIndex > currentColIndex) {
|
|
17171
|
+
currentColIndex = cellIndex;
|
|
17172
|
+
}
|
|
17173
|
+
const width = curTable.rows[i].cells[k].offsetWidth;
|
|
17174
|
+
if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
|
|
17175
|
+
sizes[currentColIndex] = width;
|
|
17176
|
+
}
|
|
17177
|
+
currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
|
|
17178
|
+
}
|
|
17179
|
+
}
|
|
17180
|
+
return sizes;
|
|
17181
|
+
}
|
|
17182
|
+
getCellIndex(rowSpanCells, rowIndex, colIndex) {
|
|
17183
|
+
const cellKey = `${rowIndex}${colIndex}`;
|
|
17184
|
+
const spannedCell = rowSpanCells.get(cellKey);
|
|
17185
|
+
if (spannedCell) {
|
|
17186
|
+
return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
|
|
17187
|
+
}
|
|
17188
|
+
else {
|
|
17189
|
+
return colIndex;
|
|
17190
|
+
}
|
|
17191
|
+
}
|
|
17192
|
+
convertPixelToPercentage(value, offsetValue) {
|
|
17193
|
+
return (value / offsetValue) * 100;
|
|
17194
|
+
}
|
|
16518
17195
|
getCorrespondingColumns() {
|
|
16519
17196
|
const elementArray = [];
|
|
16520
17197
|
// eslint-disable-next-line
|
|
@@ -16677,256 +17354,6 @@ class TableCommand {
|
|
|
16677
17354
|
class MinMax {
|
|
16678
17355
|
}
|
|
16679
17356
|
|
|
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
17357
|
/**
|
|
16931
17358
|
* `Selection` module is used to handle RTE Selections.
|
|
16932
17359
|
*/
|
|
@@ -17294,6 +17721,10 @@ class SelectionCommands {
|
|
|
17294
17721
|
liElement.style.fontStyle = 'normal';
|
|
17295
17722
|
}
|
|
17296
17723
|
}
|
|
17724
|
+
else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
17725
|
+
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
17726
|
+
SelectionCommands.conCatenateTextNode(liElement, format, '', 'normal');
|
|
17727
|
+
}
|
|
17297
17728
|
}
|
|
17298
17729
|
if (child[0] && !isFontStyle) {
|
|
17299
17730
|
let nodeTraverse = child[index] ? child[index] : child[0];
|
|
@@ -17352,6 +17783,10 @@ class SelectionCommands {
|
|
|
17352
17783
|
liElement.style.fontFamily = value;
|
|
17353
17784
|
}
|
|
17354
17785
|
}
|
|
17786
|
+
if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
17787
|
+
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
17788
|
+
SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
|
|
17789
|
+
}
|
|
17355
17790
|
if (child[num].textContent === startText) {
|
|
17356
17791
|
if (num === 0) {
|
|
17357
17792
|
range.setStartBefore(child[num]);
|
|
@@ -17459,7 +17894,7 @@ class SelectionCommands {
|
|
|
17459
17894
|
parentElement = parentElement.parentElement;
|
|
17460
17895
|
liElement = parentElement;
|
|
17461
17896
|
}
|
|
17462
|
-
if (format === 'fontcolor' || format === 'fontname') {
|
|
17897
|
+
if (format === 'fontcolor' || format === 'fontname' || format === 'fontsize') {
|
|
17463
17898
|
const parentElem = nodes[index].parentElement;
|
|
17464
17899
|
if (!isNullOrUndefined(parentElem) && parentElem.childNodes) {
|
|
17465
17900
|
for (let i = 0; i < parentElem.childNodes.length; i++) {
|
|
@@ -17479,6 +17914,9 @@ class SelectionCommands {
|
|
|
17479
17914
|
case 'fontname':
|
|
17480
17915
|
liElement.style.fontFamily = value;
|
|
17481
17916
|
break;
|
|
17917
|
+
case 'fontsize':
|
|
17918
|
+
liElement.style.fontSize = value;
|
|
17919
|
+
break;
|
|
17482
17920
|
default:
|
|
17483
17921
|
break;
|
|
17484
17922
|
}
|
|
@@ -17494,6 +17932,9 @@ class SelectionCommands {
|
|
|
17494
17932
|
case 'fontname':
|
|
17495
17933
|
childElement.style.fontFamily = 'initial';
|
|
17496
17934
|
break;
|
|
17935
|
+
case 'fontsize':
|
|
17936
|
+
childElement.style.fontSize = 'initial';
|
|
17937
|
+
break;
|
|
17497
17938
|
default:
|
|
17498
17939
|
break;
|
|
17499
17940
|
}
|
|
@@ -17553,6 +17994,10 @@ class SelectionCommands {
|
|
|
17553
17994
|
}
|
|
17554
17995
|
nodeList[0] = currentFormatNode;
|
|
17555
17996
|
this.applyStyles(nodeList, 0, element);
|
|
17997
|
+
if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
17998
|
+
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
17999
|
+
SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format, value);
|
|
18000
|
+
}
|
|
17556
18001
|
}
|
|
17557
18002
|
else {
|
|
17558
18003
|
nodes[index] = this.applyStyles(nodes, index, element);
|
|
@@ -17573,6 +18018,10 @@ class SelectionCommands {
|
|
|
17573
18018
|
liElement.style.fontStyle = 'italic';
|
|
17574
18019
|
}
|
|
17575
18020
|
}
|
|
18021
|
+
else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li'
|
|
18022
|
+
&& liElement.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
18023
|
+
SelectionCommands.conCatenateTextNode(liElement, format, liElement.textContent, format);
|
|
18024
|
+
}
|
|
17576
18025
|
}
|
|
17577
18026
|
}
|
|
17578
18027
|
}
|
|
@@ -17776,7 +18225,9 @@ class SelectionCommands {
|
|
|
17776
18225
|
}
|
|
17777
18226
|
const blockChildNodes = parent.parentElement.childNodes;
|
|
17778
18227
|
for (let k = 0; k < blockChildNodes.length; k++) {
|
|
17779
|
-
if (blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0)
|
|
18228
|
+
if ((blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) &&
|
|
18229
|
+
blockChildNodes[k].textContent.charCodeAt(0) !== 160) {
|
|
18230
|
+
// 160 is the char code for
|
|
17780
18231
|
detach(blockChildNodes[k]);
|
|
17781
18232
|
}
|
|
17782
18233
|
}
|
|
@@ -17812,6 +18263,64 @@ class SelectionCommands {
|
|
|
17812
18263
|
}
|
|
17813
18264
|
return result;
|
|
17814
18265
|
}
|
|
18266
|
+
static conCatenateTextNode(liElement, format, value, formatStr, constVal) {
|
|
18267
|
+
let result = '';
|
|
18268
|
+
switch (format) {
|
|
18269
|
+
case 'bold':
|
|
18270
|
+
liElement.querySelectorAll('strong').forEach(function (e) {
|
|
18271
|
+
result = result + e.textContent;
|
|
18272
|
+
});
|
|
18273
|
+
if (result === value) {
|
|
18274
|
+
liElement.style.fontWeight = formatStr;
|
|
18275
|
+
}
|
|
18276
|
+
break;
|
|
18277
|
+
case 'italic':
|
|
18278
|
+
liElement.querySelectorAll('em').forEach(function (e) {
|
|
18279
|
+
result = result + e.textContent;
|
|
18280
|
+
});
|
|
18281
|
+
if (result === value) {
|
|
18282
|
+
liElement.style.fontStyle = formatStr;
|
|
18283
|
+
}
|
|
18284
|
+
break;
|
|
18285
|
+
case 'fontcolor':
|
|
18286
|
+
let colorStyle = '';
|
|
18287
|
+
liElement.querySelectorAll('span').forEach(function (span) {
|
|
18288
|
+
colorStyle = span.style.color;
|
|
18289
|
+
if (colorStyle === constVal) {
|
|
18290
|
+
result = result + span.textContent;
|
|
18291
|
+
}
|
|
18292
|
+
});
|
|
18293
|
+
if (result === value) {
|
|
18294
|
+
liElement.style.color = colorStyle;
|
|
18295
|
+
liElement.style.textDecoration = 'inherit';
|
|
18296
|
+
}
|
|
18297
|
+
break;
|
|
18298
|
+
case 'fontsize':
|
|
18299
|
+
let fontSize = '';
|
|
18300
|
+
liElement.querySelectorAll('span').forEach(function (span) {
|
|
18301
|
+
fontSize = span.style.getPropertyValue('font-size');
|
|
18302
|
+
if (fontSize === constVal) {
|
|
18303
|
+
result = result + span.textContent;
|
|
18304
|
+
}
|
|
18305
|
+
});
|
|
18306
|
+
if (result === value) {
|
|
18307
|
+
liElement.style.fontSize = fontSize;
|
|
18308
|
+
}
|
|
18309
|
+
break;
|
|
18310
|
+
case 'fontname':
|
|
18311
|
+
let fontFamily = '';
|
|
18312
|
+
liElement.querySelectorAll('span').forEach(function (span) {
|
|
18313
|
+
fontFamily = span.style.getPropertyValue('font-family');
|
|
18314
|
+
if (fontFamily === constVal) {
|
|
18315
|
+
result = result + span.textContent;
|
|
18316
|
+
}
|
|
18317
|
+
});
|
|
18318
|
+
if (result === value) {
|
|
18319
|
+
liElement.style.fontFamily = fontFamily;
|
|
18320
|
+
}
|
|
18321
|
+
break;
|
|
18322
|
+
}
|
|
18323
|
+
}
|
|
17815
18324
|
}
|
|
17816
18325
|
SelectionCommands.enterAction = 'P';
|
|
17817
18326
|
|
|
@@ -19556,373 +20065,6 @@ class InsertTextExec {
|
|
|
19556
20065
|
}
|
|
19557
20066
|
}
|
|
19558
20067
|
|
|
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
20068
|
class EmojiPickerAction {
|
|
19927
20069
|
constructor(parent) {
|
|
19928
20070
|
this.parent = parent;
|
|
@@ -21830,12 +21972,17 @@ class HtmlEditor {
|
|
|
21830
21972
|
}
|
|
21831
21973
|
let lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
|
|
21832
21974
|
while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
|
|
21833
|
-
lastNode.nodeName !== 'BR') {
|
|
21975
|
+
lastNode.nodeName !== 'BR' && !isNullOrUndefined(lastNode.lastChild)) {
|
|
21834
21976
|
lastNode = lastNode.lastChild;
|
|
21835
21977
|
}
|
|
21836
|
-
|
|
21837
|
-
|
|
21838
|
-
|
|
21978
|
+
if (lastNode.nodeName === 'IMG') {
|
|
21979
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastNode.parentElement, lastNode.parentElement.childNodes.length);
|
|
21980
|
+
}
|
|
21981
|
+
else {
|
|
21982
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
|
|
21983
|
+
// eslint-disable-next-line
|
|
21984
|
+
lastNode, lastNode.textContent.length);
|
|
21985
|
+
}
|
|
21839
21986
|
if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
21840
21987
|
detach(this.oldRangeElement.querySelector('BR'));
|
|
21841
21988
|
}
|
|
@@ -22735,6 +22882,7 @@ class PasteCleanup {
|
|
|
22735
22882
|
popupClose(popupObj, uploadObj, imgElem, e) {
|
|
22736
22883
|
this.parent.inputElement.contentEditable = 'true';
|
|
22737
22884
|
e.element = imgElem;
|
|
22885
|
+
e.requestType = UploadRequest.Pasted;
|
|
22738
22886
|
this.parent.trigger(imageUploadSuccess, e, (e) => {
|
|
22739
22887
|
if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
|
|
22740
22888
|
const url = this.parent.insertImageSettings.path + e.file.name;
|
|
@@ -23041,21 +23189,6 @@ class PasteCleanup {
|
|
|
23041
23189
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
|
|
23042
23190
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
23043
23191
|
this.parent.formatter.onSuccess(this.parent, args);
|
|
23044
|
-
if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem) &&
|
|
23045
|
-
returnArgs.imgElem.length > 0) {
|
|
23046
|
-
const pasteContent = returnArgs.elements;
|
|
23047
|
-
const imageContent = returnArgs.imgElem;
|
|
23048
|
-
const lastElementChild = this.findLastElement(pasteContent[pasteContent.length - 1]);
|
|
23049
|
-
const isImageAtLast = !isNullOrUndefined(lastElementChild) ? lastElementChild.nodeName === 'IMG' : false;
|
|
23050
|
-
if (isImageAtLast || pasteContent[pasteContent.length - 1] === imageContent[imageContent.length - 1]) {
|
|
23051
|
-
this.parent.notify(insertCompleted, {
|
|
23052
|
-
args: args.event,
|
|
23053
|
-
type: 'Images',
|
|
23054
|
-
isNotify: true,
|
|
23055
|
-
elements: imageContent[imageContent.length - 1]
|
|
23056
|
-
});
|
|
23057
|
-
}
|
|
23058
|
-
}
|
|
23059
23192
|
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
23060
23193
|
this.removeTempClass();
|
|
23061
23194
|
this.parent.notify(toolbarRefresh, {});
|
|
@@ -23452,16 +23585,6 @@ class PasteCleanup {
|
|
|
23452
23585
|
}
|
|
23453
23586
|
return clipBoardElem;
|
|
23454
23587
|
}
|
|
23455
|
-
findLastElement(element) {
|
|
23456
|
-
if (!isNullOrUndefined(element) && !isNullOrUndefined(element.lastElementChild)) {
|
|
23457
|
-
let lastChild = element.lastElementChild;
|
|
23458
|
-
while (lastChild && lastChild.lastElementChild) {
|
|
23459
|
-
lastChild = lastChild.lastElementChild;
|
|
23460
|
-
}
|
|
23461
|
-
return lastChild;
|
|
23462
|
-
}
|
|
23463
|
-
return null;
|
|
23464
|
-
}
|
|
23465
23588
|
processPictureElement(clipBoardElem) {
|
|
23466
23589
|
const pictureElems = clipBoardElem.querySelectorAll('picture');
|
|
23467
23590
|
for (let i = 0; i < pictureElems.length; i++) {
|
|
@@ -24144,6 +24267,9 @@ class FormatPainter {
|
|
|
24144
24267
|
if ((originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste')) {
|
|
24145
24268
|
originalEvent.stopPropagation();
|
|
24146
24269
|
}
|
|
24270
|
+
if (Browser.userAgent.indexOf('Firefox') !== -1) {
|
|
24271
|
+
originalEvent.preventDefault();
|
|
24272
|
+
}
|
|
24147
24273
|
this.actionHandler(event, 'keyBoard');
|
|
24148
24274
|
}
|
|
24149
24275
|
}
|
|
@@ -24887,7 +25013,7 @@ class EmojiPicker {
|
|
|
24887
25013
|
}
|
|
24888
25014
|
}
|
|
24889
25015
|
}
|
|
24890
|
-
if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':')) {
|
|
25016
|
+
if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':' && value !== ': :')) {
|
|
24891
25017
|
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
25018
|
noEmojiObj.style.margin = '55px';
|
|
24893
25019
|
emojipickerAll.appendChild(noEmojiObj);
|
|
@@ -27113,7 +27239,7 @@ class Image$1 {
|
|
|
27113
27239
|
this.uploadObj.remove();
|
|
27114
27240
|
}
|
|
27115
27241
|
this.parent.isBlur = false;
|
|
27116
|
-
if (event && event.event.returnValue) {
|
|
27242
|
+
if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
|
|
27117
27243
|
if (this.parent.editorMode === 'HTML') {
|
|
27118
27244
|
selection.restore();
|
|
27119
27245
|
}
|
|
@@ -27232,6 +27358,9 @@ class Image$1 {
|
|
|
27232
27358
|
removeClass([items[i]], 'e-resize');
|
|
27233
27359
|
}
|
|
27234
27360
|
}
|
|
27361
|
+
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
27362
|
+
this.dialogObj.hide();
|
|
27363
|
+
}
|
|
27235
27364
|
}
|
|
27236
27365
|
removeResizeEle() {
|
|
27237
27366
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
@@ -27505,6 +27634,7 @@ class Image$1 {
|
|
|
27505
27634
|
}
|
|
27506
27635
|
},
|
|
27507
27636
|
success: (e) => {
|
|
27637
|
+
e.requestType = UploadRequest.Uploaded;
|
|
27508
27638
|
this.parent.trigger(imageUploadSuccess, e, (e) => {
|
|
27509
27639
|
if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
|
|
27510
27640
|
const url = this.parent.insertImageSettings.path + e.file.name;
|
|
@@ -27944,6 +28074,7 @@ class Image$1 {
|
|
|
27944
28074
|
imageElement.style.opacity = '1';
|
|
27945
28075
|
imageElement.classList.add(CLS_IMG_FOCUS);
|
|
27946
28076
|
e.element = imageElement;
|
|
28077
|
+
e.requestType = UploadRequest.Dropped;
|
|
27947
28078
|
this.parent.trigger(imageUploadSuccess, e, (e) => {
|
|
27948
28079
|
if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
|
|
27949
28080
|
const url = this.parent.insertImageSettings.path + e.file.name;
|
|
@@ -28070,6 +28201,7 @@ class Audio {
|
|
|
28070
28201
|
this.parent.on(editAreaClick, this.editAreaClickHandler, this);
|
|
28071
28202
|
this.parent.on(insertCompleted, this.showAudioQuickToolbar, this);
|
|
28072
28203
|
this.parent.on(destroy, this.removeEventListener, this);
|
|
28204
|
+
this.parent.on(iframeMouseDown, this.closeDialog, this);
|
|
28073
28205
|
}
|
|
28074
28206
|
removeEventListener() {
|
|
28075
28207
|
if (this.parent.isDestroyed) {
|
|
@@ -28088,6 +28220,7 @@ class Audio {
|
|
|
28088
28220
|
this.parent.off(editAreaClick, this.editAreaClickHandler);
|
|
28089
28221
|
this.parent.off(insertCompleted, this.showAudioQuickToolbar);
|
|
28090
28222
|
this.parent.off(destroy, this.removeEventListener);
|
|
28223
|
+
this.parent.off(iframeMouseDown, this.closeDialog);
|
|
28091
28224
|
if (!isNullOrUndefined(this.contentModule)) {
|
|
28092
28225
|
EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
|
|
28093
28226
|
EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
|
|
@@ -28336,7 +28469,7 @@ class Audio {
|
|
|
28336
28469
|
this.parent.formatter.saveData();
|
|
28337
28470
|
}
|
|
28338
28471
|
e.selection.restore();
|
|
28339
|
-
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
28472
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
|
|
28340
28473
|
selectNode: e.selectNode,
|
|
28341
28474
|
subCommand: e.args.item.subCommand
|
|
28342
28475
|
});
|
|
@@ -28432,6 +28565,9 @@ class Audio {
|
|
|
28432
28565
|
this.prevSelectedAudEle.style.outline = '';
|
|
28433
28566
|
}
|
|
28434
28567
|
}
|
|
28568
|
+
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
28569
|
+
this.dialogObj.hide();
|
|
28570
|
+
}
|
|
28435
28571
|
}
|
|
28436
28572
|
alignmentSelect(e) {
|
|
28437
28573
|
const item = e.item;
|
|
@@ -28464,7 +28600,7 @@ class Audio {
|
|
|
28464
28600
|
}
|
|
28465
28601
|
const subCommand = (e.args.item) ?
|
|
28466
28602
|
e.args.item.subCommand : 'Break';
|
|
28467
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
28603
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
28468
28604
|
}
|
|
28469
28605
|
inline(e) {
|
|
28470
28606
|
if (e.selectNode[0].nodeName !== 'AUDIO') {
|
|
@@ -28472,7 +28608,7 @@ class Audio {
|
|
|
28472
28608
|
}
|
|
28473
28609
|
const subCommand = (e.args.item) ?
|
|
28474
28610
|
e.args.item.subCommand : 'Inline';
|
|
28475
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
28611
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
28476
28612
|
}
|
|
28477
28613
|
editAreaClickHandler(e) {
|
|
28478
28614
|
if (this.parent.readonly) {
|
|
@@ -28610,7 +28746,7 @@ class Audio {
|
|
|
28610
28746
|
this.uploadObj.removing();
|
|
28611
28747
|
}
|
|
28612
28748
|
this.parent.isBlur = false;
|
|
28613
|
-
if (event && event.event.returnValue) {
|
|
28749
|
+
if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
|
|
28614
28750
|
if (this.parent.editorMode === 'HTML') {
|
|
28615
28751
|
selection.restore();
|
|
28616
28752
|
}
|
|
@@ -29696,7 +29832,7 @@ class Video {
|
|
|
29696
29832
|
this.parent.formatter.saveData();
|
|
29697
29833
|
}
|
|
29698
29834
|
e.selection.restore();
|
|
29699
|
-
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
29835
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, {
|
|
29700
29836
|
selectNode: e.selectNode,
|
|
29701
29837
|
subCommand: e.args.item.subCommand
|
|
29702
29838
|
});
|
|
@@ -29786,6 +29922,9 @@ class Video {
|
|
|
29786
29922
|
this.prevSelectedVidEle.style.outline = '';
|
|
29787
29923
|
}
|
|
29788
29924
|
}
|
|
29925
|
+
if (this.parent.inlineMode.enable && target && this.dialogObj && !closest(target, '#' + this.dialogObj.element.id)) {
|
|
29926
|
+
this.dialogObj.hide();
|
|
29927
|
+
}
|
|
29789
29928
|
}
|
|
29790
29929
|
removeResizeEle() {
|
|
29791
29930
|
EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
|
|
@@ -29803,7 +29942,7 @@ class Video {
|
|
|
29803
29942
|
}
|
|
29804
29943
|
const subCommand = (e.args.item) ?
|
|
29805
29944
|
e.args.item.subCommand : 'Break';
|
|
29806
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
29945
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
29807
29946
|
}
|
|
29808
29947
|
inline(e) {
|
|
29809
29948
|
if (e.selectNode[0].nodeName !== 'VIDEO' && !this.isEmbedVidElem(e.selectNode[0])) {
|
|
@@ -29811,12 +29950,12 @@ class Video {
|
|
|
29811
29950
|
}
|
|
29812
29951
|
const subCommand = (e.args.item) ?
|
|
29813
29952
|
e.args.item.subCommand : 'Inline';
|
|
29814
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
29953
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
29815
29954
|
}
|
|
29816
29955
|
alignVideo(e, type) {
|
|
29817
29956
|
const subCommand = (e.args.item) ?
|
|
29818
29957
|
e.args.item.subCommand : type;
|
|
29819
|
-
this.parent.formatter.process(this.parent, e.args, e.args, { selectNode: e.selectNode, subCommand: subCommand });
|
|
29958
|
+
this.parent.formatter.process(this.parent, e.args, e.args.originalEvent, { selectNode: e.selectNode, subCommand: subCommand });
|
|
29820
29959
|
}
|
|
29821
29960
|
editAreaClickHandler(e) {
|
|
29822
29961
|
if (this.parent.readonly) {
|
|
@@ -29958,7 +30097,7 @@ class Video {
|
|
|
29958
30097
|
this.uploadObj.removing();
|
|
29959
30098
|
}
|
|
29960
30099
|
this.parent.isBlur = false;
|
|
29961
|
-
if (event && event.event.returnValue) {
|
|
30100
|
+
if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
|
|
29962
30101
|
if (this.parent.editorMode === 'HTML') {
|
|
29963
30102
|
selection.restore();
|
|
29964
30103
|
}
|
|
@@ -30049,21 +30188,26 @@ class Video {
|
|
|
30049
30188
|
}
|
|
30050
30189
|
}
|
|
30051
30190
|
});
|
|
30052
|
-
if (e.selectNode &&
|
|
30053
|
-
e.selectNode[0].nodeName
|
|
30054
|
-
|
|
30055
|
-
e.selectNode[0].
|
|
30056
|
-
|
|
30057
|
-
|
|
30058
|
-
|
|
30059
|
-
|
|
30191
|
+
if (e.selectNode && e.selectNode[0] && (e.selectNode[0].nodeName === 'VIDEO' || this.isEmbedVidElem(e.selectNode[0]))) {
|
|
30192
|
+
if (e.selectNode[0].nodeName === 'VIDEO') {
|
|
30193
|
+
const regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
|
|
30194
|
+
const sourceElement = e.selectNode[0].querySelector('source');
|
|
30195
|
+
this.inputUrl.value = sourceElement && sourceElement.src && sourceElement.src.match(regex) ? sourceElement.src : '';
|
|
30196
|
+
}
|
|
30197
|
+
else {
|
|
30198
|
+
this.embedInputUrl.value = e.selectNode[0].nodeName === 'IFRAME' ? e.selectNode[0].outerHTML
|
|
30199
|
+
: e.selectNode[0].querySelector('iframe').outerHTML;
|
|
30200
|
+
}
|
|
30060
30201
|
}
|
|
30202
|
+
const isWebUrl = this.inputUrl.value ? true : false;
|
|
30061
30203
|
const embedUrlBtn = new RadioButton({
|
|
30062
30204
|
label: this.i10n.getConstant('embeddedCode'),
|
|
30063
|
-
checked:
|
|
30205
|
+
checked: !isWebUrl,
|
|
30064
30206
|
name: 'URL',
|
|
30065
30207
|
created: () => {
|
|
30066
|
-
|
|
30208
|
+
if (!isWebUrl) {
|
|
30209
|
+
urlContent.appendChild(this.embedInputUrl);
|
|
30210
|
+
}
|
|
30067
30211
|
},
|
|
30068
30212
|
change: () => {
|
|
30069
30213
|
urlContent.innerHTML = '';
|
|
@@ -30073,7 +30217,13 @@ class Video {
|
|
|
30073
30217
|
embedUrlBtn.appendTo(videoUrl.querySelector('#embedURL'));
|
|
30074
30218
|
const webUrlBtn = new RadioButton({
|
|
30075
30219
|
label: this.i10n.getConstant('webUrl'),
|
|
30220
|
+
checked: isWebUrl,
|
|
30076
30221
|
name: 'URL',
|
|
30222
|
+
created: () => {
|
|
30223
|
+
if (isWebUrl) {
|
|
30224
|
+
urlContent.appendChild(this.inputUrl);
|
|
30225
|
+
}
|
|
30226
|
+
},
|
|
30077
30227
|
change: () => {
|
|
30078
30228
|
urlContent.innerHTML = '';
|
|
30079
30229
|
urlContent.appendChild(this.inputUrl);
|
|
@@ -31229,13 +31379,14 @@ class Table {
|
|
|
31229
31379
|
}
|
|
31230
31380
|
const target = e.target || e.targetTouches[0].target;
|
|
31231
31381
|
const closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
|
|
31232
|
-
|
|
31382
|
+
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;
|
|
31383
|
+
if (!isResizing && !isNullOrUndefined(this.curTable) && !isNullOrUndefined(closestTable) && closestTable !== this.curTable &&
|
|
31233
31384
|
this.parent.contentModule.getEditPanel().contains(closestTable)) {
|
|
31234
31385
|
this.removeResizeElement();
|
|
31235
31386
|
this.removeHelper(e);
|
|
31236
31387
|
this.cancelResizeAction();
|
|
31237
31388
|
}
|
|
31238
|
-
if (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH') {
|
|
31389
|
+
if (!isResizing && (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH')) {
|
|
31239
31390
|
this.curTable = (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable))
|
|
31240
31391
|
&& (target.nodeName === 'TD' || target.nodeName === 'TH') ?
|
|
31241
31392
|
closestTable : target;
|
|
@@ -31380,7 +31531,6 @@ class Table {
|
|
|
31380
31531
|
e.preventDefault();
|
|
31381
31532
|
this.parent.preventDefaultResize(e);
|
|
31382
31533
|
removeClass(this.curTable.querySelectorAll('td,th'), CLS_TABLE_SEL);
|
|
31383
|
-
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
31384
31534
|
this.pageX = this.getPointX(e);
|
|
31385
31535
|
this.pageY = this.getPointY(e);
|
|
31386
31536
|
this.resizeBtnInit();
|
|
@@ -31639,7 +31789,8 @@ class Table {
|
|
|
31639
31789
|
const width = parseFloat(this.curTable.style.width);
|
|
31640
31790
|
currentMarginLeft = 100 - width;
|
|
31641
31791
|
}
|
|
31642
|
-
|
|
31792
|
+
// For table pasted from word, Margin left can be anything so we are avoiding the below process.
|
|
31793
|
+
if (!this.curTable.classList.contains('e-rte-paste-table') && currentMarginLeft && currentMarginLeft < 1) {
|
|
31643
31794
|
this.curTable.style.marginLeft = null;
|
|
31644
31795
|
this.curTable.style.width = '100%';
|
|
31645
31796
|
return;
|
|
@@ -31802,7 +31953,13 @@ class Table {
|
|
|
31802
31953
|
tableTrPercentage[i] = percentage;
|
|
31803
31954
|
}
|
|
31804
31955
|
for (let i = 0; i < currentTableTrElement.length; i++) {
|
|
31805
|
-
currentTableTrElement[i].
|
|
31956
|
+
if (currentTableTrElement[i].parentElement.nodeName === 'THEAD') {
|
|
31957
|
+
currentTableTrElement[i].parentElement.style.height = tableTrPercentage[i] + '%';
|
|
31958
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
31959
|
+
}
|
|
31960
|
+
else {
|
|
31961
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
31962
|
+
}
|
|
31806
31963
|
}
|
|
31807
31964
|
const args = { event: e, requestType: 'table' };
|
|
31808
31965
|
this.parent.trigger(resizeStop, args);
|
|
@@ -31951,6 +32108,9 @@ class Table {
|
|
|
31951
32108
|
if (this.popupObj) {
|
|
31952
32109
|
this.popupObj.hide();
|
|
31953
32110
|
}
|
|
32111
|
+
if (this.parent.inlineMode.enable && this.editdlgObj) {
|
|
32112
|
+
this.editdlgObj.hide();
|
|
32113
|
+
}
|
|
31954
32114
|
}
|
|
31955
32115
|
docClick(e) {
|
|
31956
32116
|
const target = e.args.target;
|
|
@@ -33090,6 +33250,17 @@ class EnterKeyAction {
|
|
|
33090
33250
|
this.getRangeNode();
|
|
33091
33251
|
let isTableEnter = true;
|
|
33092
33252
|
this.formatTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'];
|
|
33253
|
+
const isCursorAtTableEnd = this.range.collapsed && (this.range.startContainer.nodeType === 1) &&
|
|
33254
|
+
this.range.startContainer.isContentEditable &&
|
|
33255
|
+
this.range.startContainer.childNodes[this.range.startOffset - 1] &&
|
|
33256
|
+
this.range.startContainer.childNodes[this.range.startOffset - 1].nodeName === 'TABLE';
|
|
33257
|
+
const isCursorAtTableStart = this.range.collapsed && (this.range.startContainer.nodeType === 1) &&
|
|
33258
|
+
this.range.startContainer.isContentEditable && this.range.startContainer.childNodes[this.range.startOffset] &&
|
|
33259
|
+
this.range.startContainer.childNodes[this.range.startOffset].nodeName === 'TABLE';
|
|
33260
|
+
if (isCursorAtTableEnd || isCursorAtTableStart) {
|
|
33261
|
+
this.handleCursorAtTableSide(e, isCursorAtTableStart, isCursorAtTableEnd);
|
|
33262
|
+
return;
|
|
33263
|
+
}
|
|
33093
33264
|
if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
|
|
33094
33265
|
isTableEnter = false;
|
|
33095
33266
|
let curElement = this.startNode;
|
|
@@ -33098,7 +33269,7 @@ class EnterKeyAction {
|
|
|
33098
33269
|
curElement = curElement.parentElement;
|
|
33099
33270
|
blockElement = curElement;
|
|
33100
33271
|
}
|
|
33101
|
-
isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
33272
|
+
isTableEnter = blockElement.tagName === 'TH' || blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
33102
33273
|
}
|
|
33103
33274
|
if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
|
|
33104
33275
|
if (isNullOrUndefined(this.startNode.closest('LI, UL, OL')) && isNullOrUndefined(this.endNode.closest('LI, UL, OL')) &&
|
|
@@ -33113,6 +33284,9 @@ class EnterKeyAction {
|
|
|
33113
33284
|
};
|
|
33114
33285
|
this.parent.trigger(actionBegin, actionBeginArgs, (actionBeginArgs) => {
|
|
33115
33286
|
if (!actionBeginArgs.cancel) {
|
|
33287
|
+
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
33288
|
+
this.parent.formatter.saveData();
|
|
33289
|
+
}
|
|
33116
33290
|
if (!(this.range.startOffset === this.range.endOffset && this.range.startContainer === this.range.endContainer)) {
|
|
33117
33291
|
if (!(this.range.startContainer.nodeName === 'SPAN' && (this.range.startContainer.classList.contains('e-video-wrap') ||
|
|
33118
33292
|
this.range.startContainer.classList.contains('e-audio-wrap')))) {
|
|
@@ -33544,6 +33718,40 @@ class EnterKeyAction {
|
|
|
33544
33718
|
}
|
|
33545
33719
|
return insertElem;
|
|
33546
33720
|
}
|
|
33721
|
+
handleCursorAtTableSide(e, isStart, isEnd) {
|
|
33722
|
+
if (this.parent.enterKey !== 'BR') {
|
|
33723
|
+
const shiftKey = e.args.shiftKey;
|
|
33724
|
+
const actionBeginArgs = {
|
|
33725
|
+
cancel: false,
|
|
33726
|
+
name: actionBegin,
|
|
33727
|
+
requestType: shiftKey ? 'ShiftEnterAction' : 'EnterAction',
|
|
33728
|
+
originalEvent: e.args
|
|
33729
|
+
};
|
|
33730
|
+
this.parent.trigger(actionBegin, actionBeginArgs, (actionBeginArgs) => {
|
|
33731
|
+
if (!actionBeginArgs.cancel) {
|
|
33732
|
+
const newElement = this.parent.createElement(this.parent.enterKey);
|
|
33733
|
+
newElement.innerHTML = '<br>';
|
|
33734
|
+
let tableElement;
|
|
33735
|
+
if (isStart) {
|
|
33736
|
+
tableElement = this.range.startContainer.childNodes[this.range.startOffset];
|
|
33737
|
+
tableElement.parentElement.insertBefore(newElement, tableElement);
|
|
33738
|
+
}
|
|
33739
|
+
if (isEnd) {
|
|
33740
|
+
tableElement = this.range.startContainer.childNodes[this.range.startOffset - 1];
|
|
33741
|
+
if (!isNullOrUndefined(tableElement.nextSibling)) {
|
|
33742
|
+
tableElement.parentElement.insertBefore(newElement, tableElement.nextSibling);
|
|
33743
|
+
}
|
|
33744
|
+
else if (isNullOrUndefined(tableElement.nextSibling)) {
|
|
33745
|
+
tableElement.parentElement.appendChild(newElement);
|
|
33746
|
+
}
|
|
33747
|
+
}
|
|
33748
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElement, 0);
|
|
33749
|
+
e.args.preventDefault();
|
|
33750
|
+
this.parent.trigger(actionComplete, { requestType: shiftKey ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
|
|
33751
|
+
}
|
|
33752
|
+
});
|
|
33753
|
+
}
|
|
33754
|
+
}
|
|
33547
33755
|
}
|
|
33548
33756
|
|
|
33549
33757
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -34247,8 +34455,8 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
34247
34455
|
!(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which == 67))) {
|
|
34248
34456
|
this.formatter.saveData();
|
|
34249
34457
|
}
|
|
34250
|
-
|
|
34251
|
-
|
|
34458
|
+
const keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
|
|
34459
|
+
if (keyboardEventAction.indexOf(e.action) === -1 &&
|
|
34252
34460
|
(!e.target || !(e.target.classList.contains('e-mention') && !isNullOrUndefined(document.querySelector('#' + e.target.id + '_popup.e-popup-open')) && e.code === 'Tab')) &&
|
|
34253
34461
|
(e.action && e.action !== 'paste' && e.action !== 'space'
|
|
34254
34462
|
|| e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
|
|
@@ -35900,9 +36108,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
35900
36108
|
autoResize() {
|
|
35901
36109
|
if (this.height === 'auto') {
|
|
35902
36110
|
if (this.editorMode === 'Markdown') {
|
|
35903
|
-
|
|
35904
|
-
this.setAutoHeight(this.inputElement);
|
|
35905
|
-
}, 0);
|
|
36111
|
+
this.setAutoHeight(this.inputElement);
|
|
35906
36112
|
}
|
|
35907
36113
|
else if (this.iframeSettings.enable) {
|
|
35908
36114
|
const iframeElement = this.element.querySelector('#' + this.getID() + '_rte-view');
|
|
@@ -35915,21 +36121,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
35915
36121
|
}
|
|
35916
36122
|
}
|
|
35917
36123
|
setAutoHeight(element) {
|
|
35918
|
-
if (!isNullOrUndefined(element)
|
|
36124
|
+
if (!isNullOrUndefined(element)) {
|
|
35919
36125
|
element.style.height = this.inputElement.scrollHeight + 'px';
|
|
35920
36126
|
element.style.overflow = 'hidden';
|
|
35921
36127
|
}
|
|
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
36128
|
}
|
|
35934
36129
|
wireEvents() {
|
|
35935
36130
|
this.element.addEventListener('focusin', this.onFocusHandler, true);
|
|
@@ -36427,5 +36622,5 @@ RichTextEditor = __decorate$1([
|
|
|
36427
36622
|
* Rich Text Editor component exported items
|
|
36428
36623
|
*/
|
|
36429
36624
|
|
|
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,
|
|
36625
|
+
export { Toolbar$2 as Toolbar, KeyboardEvents$1 as KeyboardEvents, BaseToolbar, BaseQuickToolbar, QuickToolbar, Count, ColorPickerInput, MarkdownToolbarStatus, ExecCommandCallBack, ToolbarAction, MarkdownEditor, HtmlEditor, PasteCleanup, Resize, DropDownButtons, FileManager$1 as FileManager, FullScreen, setAttributes, HtmlToolbarStatus, XhtmlValidation, FormatPainter, EmojiPicker, HTMLFormatter, Formatter, MarkdownFormatter, ContentRender, Render, ToolbarRenderer, Link, Image$1 as Image, Audio, Video, ViewSource, Table, DialogRenderer, IframeContentRender, MarkdownRender, PopupRenderer, RichTextEditor, RenderType, ToolbarType, DialogType, UploadRequest, executeGroup, created, destroyed, tableclass, load, initialLoad, contentChanged, initialEnd, iframeMouseDown, destroy, toolbarClick, toolbarRefresh, refreshBegin, toolbarUpdated, bindOnEnd, renderColorPicker, htmlToolbarClick, markdownToolbarClick, destroyColorPicker, modelChanged, tableModulekeyUp, keyUp, keyDown, mouseUp, toolbarCreated, toolbarRenderComplete, enableFullScreen, disableFullScreen, dropDownSelect, beforeDropDownItemRender, execCommandCallBack, imageToolbarAction, audioToolbarAction, videoToolbarAction, linkToolbarAction, windowResize, resizeStart, onResize, resizeStop, undo, redo, insertLink, unLink, editLink, openLink, actionBegin, actionComplete, updatedToolbarStatus, actionSuccess, updateToolbarItem, insertImage, insertAudio, insertVideo, insertCompleted, imageLeft, imageRight, imageCenter, imageBreak, imageInline, imageLink, imageAlt, imageDelete, audioDelete, videoDelete, imageCaption, imageSize, videoSize, sourceCode, updateSource, toolbarOpen, beforeDropDownOpen, selectionSave, selectionRestore, expandPopupClick, count, contentFocus, contentBlur, mouseDown, sourceCodeMouseDown, editAreaClick, scroll, contentscroll, colorPickerChanged, tableColorPickerChanged, focusChange, selectAll$1 as selectAll, selectRange, getSelectedHtml, renderInlineToolbar, paste, imgModule, rtlMode, createTable, docClick, tableToolbarAction, checkUndo, readOnlyMode, moduleDestroy, pasteClean, enterHandler, beforeDialogOpen, clearDialogObj, dialogOpen, beforeDialogClose, dialogClose, beforeQuickToolbarOpen, quickToolbarOpen, quickToolbarClose, popupHide, imageSelected, imageUploading, imageUploadSuccess, imageUploadFailed, imageRemoving, fileSelected, fileUploading, fileUploadSuccess, fileUploadFailed, fileRemoving, afterImageDelete, afterMediaDelete, drop, xhtmlValidation, beforeImageUpload, beforeFileUpload, resizeInitialized, renderFileManager, beforeImageDrop, dynamicModule, beforePasteCleanup, afterPasteCleanup, updateTbItemsStatus, showLinkDialog, closeLinkDialog, showImageDialog, showAudioDialog, showVideoDialog, closeImageDialog, closeAudioDialog, closeVideoDialog, showTableDialog, closeTableDialog, bindCssClass, formatPainterClick, formatPainterDoubleClick, emojiPicker, destroyTooltip, hidePopup, cleanupResizeElements, afterKeyDown, updateValueOnIdle, documentClickClosedBy, showColorPicker, closeTooltip, blockEmptyNodes, inlineEmptyNodes, supportedUnits, conversionFactors, onHandleFontsizeChange, CLS_RTE, CLS_RTL, CLS_CONTENT, CLS_DISABLED, CLS_SCRIPT_SHEET, CLS_STYLE_SHEET, CLS_TOOLBAR, CLS_TB_FIXED, CLS_TB_FLOAT, CLS_INLINE, CLS_TB_INLINE, CLS_RTE_EXPAND_TB, CLS_FULL_SCREEN, CLS_QUICK_TB, CLS_TEXT_QUICK_TB, CLS_POP, CLS_TB_STATIC, CLS_QUICK_POP, CLS_QUICK_DROPDOWN, CLS_IMAGE_POP, CLS_TEXT_POP, CLS_INLINE_POP, CLS_INLINE_DROPDOWN, CLS_DROPDOWN_POPUP, CLS_DROPDOWN_ICONS, CLS_DROPDOWN_ITEMS, CLS_DROPDOWN_BTN, CLS_RTE_CONTENT, CLS_TB_ITEM, CLS_TB_EXTENDED, CLS_TB_WRAP, CLS_POPUP, CLS_SEPARATOR, CLS_MINIMIZE, CLS_MAXIMIZE, CLS_BACK, CLS_SHOW, CLS_HIDE, CLS_VISIBLE, CLS_FOCUS, CLS_RM_WHITE_SPACE, CLS_IMGRIGHT, CLS_IMGLEFT, CLS_IMGCENTER, CLS_IMGBREAK, CLS_AUDIOBREAK, CLS_CLICKELEM, CLS_VID_CLICK_ELEM, CLS_AUDIOWRAP, CLS_VIDEOWRAP, CLS_VIDEOBREAK, CLS_CAPTION, CLS_RTE_CAPTION, CLS_CAPINLINE, CLS_IMGINLINE, CLS_AUDIOINLINE, CLS_VIDEOINLINE, CLS_COUNT, CLS_WARNING, CLS_ERROR, CLS_ICONS, CLS_ACTIVE, CLS_EXPAND_OPEN, CLS_RTE_ELEMENTS, CLS_TB_BTN, CLS_HR_SEPARATOR, CLS_TB_IOS_FIX, CLS_LIST_PRIMARY_CONTENT, CLS_NUMBERFORMATLIST_TB_BTN, CLS_BULLETFORMATLIST_TB_BTN, CLS_FORMATS_TB_BTN, CLS_FONT_NAME_TB_BTN, CLS_FONT_SIZE_TB_BTN, CLS_ALIGN_TB_BTN, CLS_FONT_COLOR_TARGET, CLS_BACKGROUND_COLOR_TARGET, CLS_COLOR_CONTENT, CLS_FONT_COLOR_DROPDOWN, CLS_BACKGROUND_COLOR_DROPDOWN, CLS_COLOR_PALETTE, CLS_FONT_COLOR_PICKER, CLS_BACKGROUND_COLOR_PICKER, CLS_RTE_READONLY, CLS_TABLE_SEL, CLS_TB_DASH_BOR, CLS_TB_ALT_BOR, CLS_TB_COL_RES, CLS_TB_ROW_RES, CLS_TB_BOX_RES, CLS_RTE_HIDDEN, CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT, CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT, CLS_RTE_RES_HANDLE, CLS_RTE_RES_EAST, CLS_RTE_IMAGE, CLS_RESIZE, CLS_IMG_FOCUS, CLS_AUD_FOCUS, CLS_VID_FOCUS, CLS_RTE_DRAG_IMAGE, CLS_RTE_UPLOAD_POPUP, CLS_POPUP_OPEN, CLS_IMG_RESIZE, CLS_DROPAREA, CLS_IMG_INNER, CLS_UPLOAD_FILES, CLS_RTE_DIALOG_UPLOAD, CLS_RTE_RES_CNT, CLS_CUSTOM_TILE, CLS_NOCOLOR_ITEM, CLS_TABLE, CLS_TABLE_BORDER, CLS_RTE_TABLE_RESIZE, CLS_RTE_FIXED_TB_EXPAND, CLS_RTE_TB_ENABLED, CLS_RTE_RES_WEST, CLS_RTE_SOURCE_CODE_TXTAREA, getIndex, hasClass, getDropDownValue, isIDevice, getFormattedFontSize, pageYOffset, getTooltipText, setToolbarStatus, getCollection, getTBarItemsIndex, updateUndoRedoStatus, dispatchEvent, parseHtml, getTextNodesUnder, toObjectLowerCase, getEditValue, updateTextNode, getDefaultValue, isEditableValueEmpty, decode, sanitizeHelper, convertToBlob, getLocaleFontFormat, updateDropDownFontFormatLocale, ServiceLocator, RendererFactory, EditorManager, IMAGE, AUDIO, VIDEO, TABLE, LINK, INSERT_ROW, INSERT_COLUMN, DELETEROW, DELETECOLUMN, REMOVETABLE, TABLEHEADER, TABLE_VERTICAL_ALIGN, TABLE_MERGE, TABLE_VERTICAL_SPLIT, TABLE_HORIZONTAL_SPLIT, TABLE_MOVE, ALIGNMENT_TYPE, INDENT_TYPE, DEFAULT_TAG, BLOCK_TAGS, IGNORE_BLOCK_TAGS, TABLE_BLOCK_TAGS, SELECTION_TYPE, INSERTHTML_TYPE, INSERT_TEXT_TYPE, CLEAR_TYPE, SELF_CLOSING_TAGS, PASTE_SOURCE, CLASS_IMAGE_RIGHT, CLASS_IMAGE_LEFT, CLASS_IMAGE_CENTER, CLASS_VIDEO_RIGHT, CLASS_VIDEO_LEFT, CLASS_VIDEO_CENTER, CLASS_IMAGE_BREAK, CLASS_AUDIO_BREAK, CLASS_VIDEO_BREAK, CLASS_CAPTION, CLASS_RTE_CAPTION, CLASS_CAPTION_INLINE, CLASS_IMAGE_INLINE, CLASS_AUDIO_INLINE, CLASS_CLICK_ELEM, CLASS_VIDEO_CLICK_ELEM, CLASS_AUDIO, CLASS_VIDEO, CLASS_AUDIO_WRAP, CLASS_VIDEO_WRAP, CLASS_EMBED_VIDEO_WRAP, CLASS_AUDIO_FOCUS, CLASS_VIDEO_FOCUS, CLASS_VIDEO_INLINE, Lists, markerClassName, DOMNode, Alignments, Indents, Formats, LinkCommand, InsertMethods, InsertTextExec, InsertHtmlExec, InsertHtml, IsFormatted, MsWordPaste, NodeCutter, ImageCommand, AudioCommand, VideoCommand, SelectionCommands, SelectionBasedExec, ClearFormatExec, UndoRedoManager, TableCommand, statusCollection, ToolbarStatus, FormatPainterActions, EmojiPickerAction, NodeSelection, MarkdownParser, LISTS_COMMAND, selectionCommand, LINK_COMMAND, CLEAR_COMMAND, MD_TABLE, INSERT_TEXT_COMMAND, ClearFormat, MDLists, MDFormats, MarkdownSelection, UndoRedoCommands, MDSelectionFormats, MDLink, MDTable, markdownFormatTags, markdownSelectionTags, markdownListsTags, htmlKeyConfig, markdownKeyConfig, pasteCleanupGroupingTags, listConversionFilters, selfClosingTags, imageResizeFactor, KEY_DOWN, ACTION, FORMAT_TYPE, KEY_DOWN_HANDLER, LIST_TYPE, KEY_UP_HANDLER, KEY_UP, MODEL_CHANGED_PLUGIN, MODEL_CHANGED, MS_WORD_CLEANUP_PLUGIN, MS_WORD_CLEANUP, ON_BEGIN, SPACE_ACTION, FORMAT_PAINTER_ACTIONS, EMOJI_PICKER_ACTIONS, MOUSE_DOWN };
|
|
36431
36626
|
//# sourceMappingURL=ej2-richtexteditor.es2015.js.map
|