@syncfusion/ej2-richtexteditor 20.4.52 → 21.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -2
- 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 +1623 -639
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +1638 -646
- 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 +13 -13
- package/src/common/config.js +3 -1
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/util.d.ts +2 -1
- package/src/common/util.js +15 -6
- package/src/editor-manager/base/editor-manager.d.ts +2 -0
- package/src/editor-manager/base/editor-manager.js +6 -1
- package/src/editor-manager/base/enum.d.ts +14 -0
- package/src/editor-manager/base/interface.d.ts +34 -0
- package/src/editor-manager/plugin/clearformat.js +13 -4
- package/src/editor-manager/plugin/format-painter-actions.d.ts +63 -0
- package/src/editor-manager/plugin/format-painter-actions.js +474 -0
- package/src/editor-manager/plugin/image.js +0 -1
- package/src/editor-manager/plugin/inserthtml-exec.js +1 -1
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -1
- package/src/editor-manager/plugin/inserthtml.js +18 -10
- package/src/editor-manager/plugin/isformatted.js +1 -0
- package/src/editor-manager/plugin/link.js +0 -1
- package/src/editor-manager/plugin/lists.js +1 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +57 -19
- package/src/editor-manager/plugin/selection-commands.d.ts +4 -1
- package/src/editor-manager/plugin/selection-commands.js +70 -9
- package/src/editor-manager/plugin/video.js +2 -0
- package/src/editor-manager/plugin.d.ts +1 -0
- package/src/editor-manager/plugin.js +1 -0
- package/src/global.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 +21 -1
- package/src/rich-text-editor/actions/base-toolbar.js +33 -10
- package/src/rich-text-editor/actions/enter-key.js +23 -16
- package/src/rich-text-editor/actions/format-painter.d.ts +24 -0
- package/src/rich-text-editor/actions/format-painter.js +142 -0
- package/src/rich-text-editor/actions/full-screen.js +0 -1
- package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
- package/src/rich-text-editor/actions/html-editor.js +117 -97
- package/src/rich-text-editor/actions/paste-clean-up.js +2 -2
- package/src/rich-text-editor/actions/quick-toolbar.js +8 -1
- package/src/rich-text-editor/actions/toolbar.js +10 -0
- package/src/rich-text-editor/actions.d.ts +1 -0
- package/src/rich-text-editor/actions.js +1 -0
- package/src/rich-text-editor/base/constant.d.ts +10 -0
- package/src/rich-text-editor/base/constant.js +10 -0
- package/src/rich-text-editor/base/enum.d.ts +4 -0
- package/src/rich-text-editor/base/interface.d.ts +30 -3
- package/src/rich-text-editor/base/interface.js +12 -0
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +30 -4
- package/src/rich-text-editor/base/rich-text-editor.d.ts +35 -5
- package/src/rich-text-editor/base/rich-text-editor.js +46 -10
- package/src/rich-text-editor/base/util.js +2 -0
- package/src/rich-text-editor/formatter/formatter.js +22 -13
- package/src/rich-text-editor/formatter/html-formatter.d.ts +5 -3
- package/src/rich-text-editor/formatter/html-formatter.js +7 -5
- package/src/rich-text-editor/models/default-locale.js +4 -2
- package/src/rich-text-editor/models/items.d.ts +3 -0
- package/src/rich-text-editor/models/items.js +32 -0
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +29 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +24 -1
- package/src/rich-text-editor/models/toolbar-settings.js +20 -0
- package/src/rich-text-editor/renderer/audio-module.js +6 -3
- package/src/rich-text-editor/renderer/image-module.js +11 -6
- package/src/rich-text-editor/renderer/link-module.js +2 -1
- package/src/rich-text-editor/renderer/table-module.js +18 -6
- package/src/rich-text-editor/renderer/toolbar-renderer.js +10 -1
- package/src/rich-text-editor/renderer/video-module.js +8 -5
- package/src/rich-text-editor/renderer/view-source.js +1 -1
- package/styles/bootstrap-dark.css +31 -1
- package/styles/bootstrap.css +31 -1
- package/styles/bootstrap4.css +31 -1
- package/styles/bootstrap5-dark.css +32 -2
- package/styles/bootstrap5.css +32 -2
- package/styles/fabric-dark.css +31 -1
- package/styles/fabric.css +31 -1
- package/styles/fluent-dark.css +34 -4
- package/styles/fluent.css +34 -4
- package/styles/highcontrast-light.css +31 -1
- package/styles/highcontrast.css +31 -1
- package/styles/material-dark.css +31 -1
- package/styles/material.css +31 -1
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +25 -1
- package/styles/rich-text-editor/_bootstrap-definition.scss +25 -1
- package/styles/rich-text-editor/_bootstrap4-definition.scss +25 -1
- package/styles/rich-text-editor/_bootstrap5-definition.scss +28 -5
- package/styles/rich-text-editor/_fabric-dark-definition.scss +25 -1
- package/styles/rich-text-editor/_fabric-definition.scss +25 -1
- package/styles/rich-text-editor/_fluent-definition.scss +30 -7
- package/styles/rich-text-editor/_fusionnew-definition.scss +26 -3
- package/styles/rich-text-editor/_highcontrast-definition.scss +25 -1
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +25 -1
- package/styles/rich-text-editor/_layout.scss +47 -15
- package/styles/rich-text-editor/_material-dark-definition.scss +26 -1
- package/styles/rich-text-editor/_material-definition.scss +25 -1
- package/styles/rich-text-editor/_tailwind-definition.scss +28 -5
- package/styles/rich-text-editor/_theme.scss +54 -6
- package/styles/rich-text-editor/bootstrap-dark.css +31 -1
- package/styles/rich-text-editor/bootstrap.css +31 -1
- package/styles/rich-text-editor/bootstrap4.css +31 -1
- package/styles/rich-text-editor/bootstrap5-dark.css +32 -2
- package/styles/rich-text-editor/bootstrap5.css +32 -2
- package/styles/rich-text-editor/fabric-dark.css +31 -1
- package/styles/rich-text-editor/fabric.css +31 -1
- package/styles/rich-text-editor/fluent-dark.css +34 -4
- package/styles/rich-text-editor/fluent.css +34 -4
- package/styles/rich-text-editor/highcontrast-light.css +31 -1
- package/styles/rich-text-editor/highcontrast.css +31 -1
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +8 -0
- package/styles/rich-text-editor/icons/_bootstrap.scss +8 -0
- package/styles/rich-text-editor/icons/_bootstrap4.scss +8 -0
- package/styles/rich-text-editor/icons/_bootstrap5.scss +8 -0
- package/styles/rich-text-editor/icons/_fabric-dark.scss +8 -0
- package/styles/rich-text-editor/icons/_fabric.scss +8 -0
- package/styles/rich-text-editor/icons/_fluent.scss +8 -0
- package/styles/rich-text-editor/icons/_fusionnew.scss +8 -0
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +8 -0
- package/styles/rich-text-editor/icons/_highcontrast.scss +8 -0
- package/styles/rich-text-editor/icons/_material-dark.scss +8 -0
- package/styles/rich-text-editor/icons/_material.scss +8 -0
- package/styles/rich-text-editor/icons/_material3.scss +8 -0
- package/styles/rich-text-editor/icons/_tailwind.scss +8 -0
- package/styles/rich-text-editor/material-dark.css +31 -1
- package/styles/rich-text-editor/material.css +31 -1
- package/styles/rich-text-editor/tailwind-dark.css +31 -1
- package/styles/rich-text-editor/tailwind.css +31 -1
- package/styles/tailwind-dark.css +31 -1
- package/styles/tailwind.css +31 -1
- package/GitLeaksReport.json +0 -1
- package/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
- package/styles/rich-text-editor/_material3-definition.scss +0 -196
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ajax, Base, Browser, ChildProperty, Complex, Component, Event, EventHandler, KeyboardEvents, L10n, NotifyPropertyChanges, Observer, Property, SanitizeHtmlHelper, Touch, addClass, append, attributes, closest, compile, createElement, debounce, detach, extend, formatUnit, getEnumValue, getInstance, getUniqueID, isNullOrUndefined, prepend, print, removeClass, select, selectAll, setStyleAttribute } from '@syncfusion/ej2-base';
|
|
2
2
|
import { Toolbar } from '@syncfusion/ej2-navigations';
|
|
3
3
|
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
4
|
-
import { Dialog, Popup, getScrollableParent, isCollide } from '@syncfusion/ej2-popups';
|
|
4
|
+
import { Dialog, Popup, Tooltip, getScrollableParent, isCollide } from '@syncfusion/ej2-popups';
|
|
5
5
|
import { ColorPicker, NumericTextBox, TextBox, Uploader } from '@syncfusion/ej2-inputs';
|
|
6
6
|
import { Button, CheckBox, RadioButton } from '@syncfusion/ej2-buttons';
|
|
7
7
|
import { AjaxSettings, ContextMenu, ContextMenuSettings, DetailsView, DetailsViewSettings, FileManager, NavigationPane, NavigationPaneSettings, SearchSettings, Toolbar as Toolbar$1, ToolbarSettings, UploadSettings } from '@syncfusion/ej2-filemanager';
|
|
@@ -719,6 +719,16 @@ const closeTableDialog = 'closeTableDialog';
|
|
|
719
719
|
* @deprecated
|
|
720
720
|
*/
|
|
721
721
|
const bindCssClass = 'closeTableDialog';
|
|
722
|
+
/**
|
|
723
|
+
* @hidden
|
|
724
|
+
* @deprecated
|
|
725
|
+
*/
|
|
726
|
+
const formatPainterClick = 'formatPainterClick';
|
|
727
|
+
/**
|
|
728
|
+
* @hidden
|
|
729
|
+
* @deprecated
|
|
730
|
+
*/
|
|
731
|
+
const formatPainterDoubleClick = 'formatPainterDoubleClick';
|
|
722
732
|
/**
|
|
723
733
|
* @hidden
|
|
724
734
|
* @deprecated
|
|
@@ -1953,6 +1963,13 @@ let tools = {
|
|
|
1953
1963
|
'tooltip': 'Styles',
|
|
1954
1964
|
'command': 'Table',
|
|
1955
1965
|
'subCommand': 'Styles'
|
|
1966
|
+
},
|
|
1967
|
+
'formatpainter': {
|
|
1968
|
+
'id': 'FormatPainter',
|
|
1969
|
+
'icon': 'e-rte-format-painter',
|
|
1970
|
+
'tooltip': 'Format Painter',
|
|
1971
|
+
'command': 'FormatPainter',
|
|
1972
|
+
'subCommand': 'FormatPainter'
|
|
1956
1973
|
}
|
|
1957
1974
|
};
|
|
1958
1975
|
let alignmentLocale = [
|
|
@@ -2142,6 +2159,31 @@ function updateDropDownLocale(self) {
|
|
|
2142
2159
|
TableStyleItems[i].text = getLocale(self, tableStyleLocale, TableStyleItems[i]);
|
|
2143
2160
|
});
|
|
2144
2161
|
}
|
|
2162
|
+
let windowKeys = {
|
|
2163
|
+
'Insert Link': 'Ctrl + K',
|
|
2164
|
+
'Insert Image': 'Ctrl + Shift + I',
|
|
2165
|
+
'Create Table': 'Ctrl + Shift + E',
|
|
2166
|
+
'Undo': 'Ctrl + Z',
|
|
2167
|
+
'Redo': 'Ctrl + Y',
|
|
2168
|
+
'Copy': 'Ctrl + C',
|
|
2169
|
+
'Cut': 'Ctrl + X',
|
|
2170
|
+
'Paste': 'Ctrl + V',
|
|
2171
|
+
'Bold': 'Ctrl + B',
|
|
2172
|
+
'Italic': 'Ctrl + I',
|
|
2173
|
+
'Underline': 'Ctrl + U',
|
|
2174
|
+
'Strikethrough': 'Ctrl + Shift + S',
|
|
2175
|
+
'Upper Case': 'Ctrl + Shift + U',
|
|
2176
|
+
'Lower Case': 'Ctrl + Shift + L',
|
|
2177
|
+
'Superscript': 'Ctrl + Shift + =',
|
|
2178
|
+
'Subscript': 'Ctrl + =',
|
|
2179
|
+
'Source Code': 'Ctrl + Shift + H',
|
|
2180
|
+
'Maximize': 'Ctrl + Shift + F',
|
|
2181
|
+
'Minimize': 'Esc',
|
|
2182
|
+
'Clear Format': 'Ctrl + Shift + R',
|
|
2183
|
+
'Numbered List': 'Ctrl + Shift + O',
|
|
2184
|
+
'Bulleted List': 'Ctrl + Alt + O',
|
|
2185
|
+
'Format Painter': 'Ctrl + Shift + C, Ctrl + Shift + V'
|
|
2186
|
+
};
|
|
2145
2187
|
|
|
2146
2188
|
/* eslint-disable */
|
|
2147
2189
|
/**
|
|
@@ -2335,7 +2377,8 @@ let defaultLocale = {
|
|
|
2335
2377
|
'bulletFormatListCircle': 'Circle',
|
|
2336
2378
|
'bulletFormatListSquare': 'Square',
|
|
2337
2379
|
'numberFormatListNone': 'None',
|
|
2338
|
-
'bulletFormatListNone': 'None'
|
|
2380
|
+
'bulletFormatListNone': 'None',
|
|
2381
|
+
'formatPainter': 'Format Painter'
|
|
2339
2382
|
};
|
|
2340
2383
|
let toolsLocale = {
|
|
2341
2384
|
'alignments': 'alignments',
|
|
@@ -2422,7 +2465,8 @@ let toolsLocale = {
|
|
|
2422
2465
|
'alignbottom': 'AlignBottom',
|
|
2423
2466
|
'insertrowbefore': 'insertRowBefore',
|
|
2424
2467
|
'insertrowafter': 'insertRowAfter',
|
|
2425
|
-
'deleterow': 'deleteRow'
|
|
2468
|
+
'deleterow': 'deleteRow',
|
|
2469
|
+
'formatpainter': 'formatPainter'
|
|
2426
2470
|
};
|
|
2427
2471
|
let fontNameLocale = [
|
|
2428
2472
|
{ locale: 'fontNameSegoeUI', value: 'Segoe UI' },
|
|
@@ -2964,6 +3008,8 @@ function decode(value) {
|
|
|
2964
3008
|
function sanitizeHelper(value, parent) {
|
|
2965
3009
|
if (parent.enableHtmlSanitizer) {
|
|
2966
3010
|
const item = SanitizeHtmlHelper.beforeSanitize();
|
|
3011
|
+
if (item.selectors.tags[2] && item.selectors.tags[2].indexOf('iframe') > -1)
|
|
3012
|
+
item.selectors.tags[2] = 'iframe:not(.e-rte-embed-url)';
|
|
2967
3013
|
const beforeEvent = {
|
|
2968
3014
|
cancel: false,
|
|
2969
3015
|
helper: null
|
|
@@ -3144,6 +3190,14 @@ class ToolbarRenderer {
|
|
|
3144
3190
|
args.rteToolbarObj.toolbarObj.isStringTemplate = true;
|
|
3145
3191
|
args.rteToolbarObj.toolbarObj.createElement = this.parent.createElement;
|
|
3146
3192
|
args.rteToolbarObj.toolbarObj.appendTo(args.target);
|
|
3193
|
+
if (this.parent.showTooltip) {
|
|
3194
|
+
const tooltip = new Tooltip({
|
|
3195
|
+
target: '#' + this.parent.getID() + '_toolbar_wrapper [title]',
|
|
3196
|
+
showTipPointer: true,
|
|
3197
|
+
cssClass: this.parent.cssClass
|
|
3198
|
+
});
|
|
3199
|
+
tooltip.appendTo(args.target);
|
|
3200
|
+
}
|
|
3147
3201
|
}
|
|
3148
3202
|
/**
|
|
3149
3203
|
* renderDropDownButton method
|
|
@@ -3249,6 +3303,7 @@ class ToolbarRenderer {
|
|
|
3249
3303
|
dropDown.createElement = proxy.parent.createElement;
|
|
3250
3304
|
dropDown.appendTo(args.element);
|
|
3251
3305
|
args.element.tabIndex = -1;
|
|
3306
|
+
args.element.setAttribute('role', 'button');
|
|
3252
3307
|
const popupElement = document.getElementById(dropDown.element.id + '-popup');
|
|
3253
3308
|
popupElement.setAttribute('aria-owns', this.parent.getID());
|
|
3254
3309
|
if (args.element.childElementCount === 1) {
|
|
@@ -3694,13 +3749,23 @@ class BaseToolbar {
|
|
|
3694
3749
|
case '-':
|
|
3695
3750
|
return { type: 'Separator', cssClass: CLS_HR_SEPARATOR };
|
|
3696
3751
|
default:
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3752
|
+
if (this.parent.showTooltip) {
|
|
3753
|
+
return {
|
|
3754
|
+
id: this.parent.getID() + '_' + container + '_' + this.tools[itemStr.toLocaleLowerCase()].id,
|
|
3755
|
+
prefixIcon: this.tools[itemStr.toLocaleLowerCase()].icon,
|
|
3756
|
+
tooltipText: getTooltipText(itemStr, this.locator),
|
|
3757
|
+
command: this.tools[itemStr.toLocaleLowerCase()].command,
|
|
3758
|
+
subCommand: this.tools[itemStr.toLocaleLowerCase()].subCommand
|
|
3759
|
+
};
|
|
3760
|
+
}
|
|
3761
|
+
else {
|
|
3762
|
+
return {
|
|
3763
|
+
id: this.parent.getID() + '_' + container + '_' + this.tools[itemStr.toLocaleLowerCase()].id,
|
|
3764
|
+
prefixIcon: this.tools[itemStr.toLocaleLowerCase()].icon,
|
|
3765
|
+
command: this.tools[itemStr.toLocaleLowerCase()].command,
|
|
3766
|
+
subCommand: this.tools[itemStr.toLocaleLowerCase()].subCommand
|
|
3767
|
+
};
|
|
3768
|
+
}
|
|
3704
3769
|
}
|
|
3705
3770
|
}
|
|
3706
3771
|
}
|
|
@@ -3742,6 +3807,19 @@ class BaseToolbar {
|
|
|
3742
3807
|
items.push(item);
|
|
3743
3808
|
}
|
|
3744
3809
|
}
|
|
3810
|
+
for (let num = 0; num < items.length; num++) {
|
|
3811
|
+
const tooltipText = items[num].tooltipText;
|
|
3812
|
+
let shortCutKey;
|
|
3813
|
+
if (windowKeys[`${tooltipText}`]) {
|
|
3814
|
+
shortCutKey = Browser.isDevice && isIDevice() ? windowKeys[`${tooltipText}`].replace('Ctrl', 'Cmd') : windowKeys[`${tooltipText}`];
|
|
3815
|
+
}
|
|
3816
|
+
else {
|
|
3817
|
+
shortCutKey = tooltipText;
|
|
3818
|
+
}
|
|
3819
|
+
if (shortCutKey) {
|
|
3820
|
+
items[num].tooltipText = (tooltipText !== shortCutKey) ? tooltipText + ' (' + shortCutKey + ')' : tooltipText;
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3745
3823
|
return items;
|
|
3746
3824
|
}
|
|
3747
3825
|
getToolbarOptions(args) {
|
|
@@ -4740,7 +4818,7 @@ class Toolbar$2 {
|
|
|
4740
4818
|
* @deprecated
|
|
4741
4819
|
*/
|
|
4742
4820
|
updateItem(args) {
|
|
4743
|
-
|
|
4821
|
+
const item = this.tools[args.updateItem.toLocaleLowerCase()];
|
|
4744
4822
|
if (this.parent.locale !== 'en-US') {
|
|
4745
4823
|
item.tooltip = getTooltipText(args.updateItem.toLocaleLowerCase(), this.locator);
|
|
4746
4824
|
}
|
|
@@ -4753,6 +4831,7 @@ class Toolbar$2 {
|
|
|
4753
4831
|
args.baseToolbar.toolbarObj.items[index].tooltipText = item.tooltip;
|
|
4754
4832
|
args.baseToolbar.toolbarObj.items[index].subCommand = item.subCommand;
|
|
4755
4833
|
args.baseToolbar.toolbarObj.dataBind();
|
|
4834
|
+
args.baseToolbar.toolbarObj.refreshOverflow();
|
|
4756
4835
|
}
|
|
4757
4836
|
else {
|
|
4758
4837
|
this.addTBarItem(args, 0);
|
|
@@ -4893,7 +4972,11 @@ class Toolbar$2 {
|
|
|
4893
4972
|
* @deprecated
|
|
4894
4973
|
*/
|
|
4895
4974
|
refreshToolbarOverflow() {
|
|
4975
|
+
this.parent.element.classList.remove(CLS_RTL);
|
|
4896
4976
|
this.baseToolbar.toolbarObj.refreshOverflow();
|
|
4977
|
+
if (this.parent.enableRtl) {
|
|
4978
|
+
this.parent.element.classList.add(CLS_RTL);
|
|
4979
|
+
}
|
|
4897
4980
|
}
|
|
4898
4981
|
isToolbarDestroyed() {
|
|
4899
4982
|
return this.baseToolbar.toolbarObj && !this.baseToolbar.toolbarObj.isDestroyed;
|
|
@@ -4992,6 +5075,11 @@ class Toolbar$2 {
|
|
|
4992
5075
|
toolbarClickHandler(e) {
|
|
4993
5076
|
const trg = closest(e.originalEvent.target, '.e-hor-nav');
|
|
4994
5077
|
if (trg && this.parent.toolbarSettings.type === ToolbarType.Expand && !isNullOrUndefined(trg)) {
|
|
5078
|
+
let extendedTbar = this.tbElement.querySelector('.e-toolbar-extended');
|
|
5079
|
+
if (!isNullOrUndefined(extendedTbar)) {
|
|
5080
|
+
setStyleAttribute(extendedTbar, { maxHeight: '', display: 'block' });
|
|
5081
|
+
setStyleAttribute(extendedTbar, { maxHeight: extendedTbar.offsetHeight + 'px', display: '' });
|
|
5082
|
+
}
|
|
4995
5083
|
if (!trg.classList.contains('e-nav-active')) {
|
|
4996
5084
|
removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
|
|
4997
5085
|
this.parent.setContentHeight('toolbar', false);
|
|
@@ -5647,7 +5735,9 @@ class BaseQuickToolbar {
|
|
|
5647
5735
|
let x;
|
|
5648
5736
|
let y;
|
|
5649
5737
|
const imgWrapper = closest(e.target, '.e-img-caption');
|
|
5650
|
-
const
|
|
5738
|
+
const isAligned = (e.target.classList.contains('e-imginline') ||
|
|
5739
|
+
e.target.classList.contains('e-imgbreak')) ? false : true;
|
|
5740
|
+
let target = !isNullOrUndefined(imgWrapper) ? imgWrapper : e.target;
|
|
5651
5741
|
addClass([this.toolbarElement], [CLS_RM_WHITE_SPACE]);
|
|
5652
5742
|
const targetOffsetTop = target.offsetTop;
|
|
5653
5743
|
const parentOffsetTop = window.pageYOffset + e.parentData.top;
|
|
@@ -5660,6 +5750,7 @@ class BaseQuickToolbar {
|
|
|
5660
5750
|
else {
|
|
5661
5751
|
y = e.y;
|
|
5662
5752
|
}
|
|
5753
|
+
target = isAligned ? e.target : target;
|
|
5663
5754
|
if (target.offsetWidth > e.popWidth) {
|
|
5664
5755
|
x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + target.offsetLeft;
|
|
5665
5756
|
}
|
|
@@ -5790,6 +5881,13 @@ class BaseQuickToolbar {
|
|
|
5790
5881
|
this.parent.enableToolbarItem(['Undo', 'Redo']);
|
|
5791
5882
|
}
|
|
5792
5883
|
append([this.element], document.body);
|
|
5884
|
+
if (this.parent.showTooltip) {
|
|
5885
|
+
this.tooltip = new Tooltip({
|
|
5886
|
+
target: '#' + this.element.id + ' [title]',
|
|
5887
|
+
showTipPointer: true
|
|
5888
|
+
});
|
|
5889
|
+
this.tooltip.appendTo(this.element);
|
|
5890
|
+
}
|
|
5793
5891
|
this.popupObj.position.X = x + 20;
|
|
5794
5892
|
this.popupObj.position.Y = y + 20;
|
|
5795
5893
|
this.popupObj.dataBind();
|
|
@@ -5856,6 +5954,16 @@ class BaseQuickToolbar {
|
|
|
5856
5954
|
if (Browser.isDevice && !isIDevice()) {
|
|
5857
5955
|
removeClass([this.parent.getToolbar()], [CLS_HIDE]);
|
|
5858
5956
|
}
|
|
5957
|
+
if (!isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
|
|
5958
|
+
if (!isNullOrUndefined(document.querySelector('#' + this.element.id + ' [data-tooltip-id]'))) {
|
|
5959
|
+
let tooltipTargetEle = document.querySelector('#' + this.element.id + ' [data-tooltip-id]');
|
|
5960
|
+
let dataContent = tooltipTargetEle.getAttribute('data-content');
|
|
5961
|
+
tooltipTargetEle.removeAttribute('data-content');
|
|
5962
|
+
tooltipTargetEle.setAttribute('title', dataContent);
|
|
5963
|
+
tooltipTargetEle.removeAttribute('data-tooltip-id');
|
|
5964
|
+
}
|
|
5965
|
+
this.tooltip.destroy();
|
|
5966
|
+
}
|
|
5859
5967
|
if (!isNullOrUndefined(this.parent.getToolbar()) && !this.parent.inlineMode.enable) {
|
|
5860
5968
|
if (isNullOrUndefined(viewSourcePanel) || viewSourcePanel.style.display === 'none') {
|
|
5861
5969
|
this.parent.enableToolbarItem(this.parent.toolbarSettings.items);
|
|
@@ -6297,10 +6405,17 @@ class QuickToolbar {
|
|
|
6297
6405
|
}
|
|
6298
6406
|
keyUpHandler(e) {
|
|
6299
6407
|
if (this.parent.inlineMode.enable && !Browser.isDevice) {
|
|
6408
|
+
const args = e.args;
|
|
6300
6409
|
if (this.parent.inlineMode.onSelection) {
|
|
6410
|
+
if (this.parent.getSelection().length > 0) {
|
|
6411
|
+
if ((args.ctrlKey && args.keyCode === 65) || (args.shiftKey && (args.keyCode === 33 || args.keyCode === 34 ||
|
|
6412
|
+
args.keyCode === 35 || args.keyCode === 36 || args.keyCode === 37 || args.keyCode === 38 ||
|
|
6413
|
+
args.keyCode === 39 || args.keyCode === 40))) {
|
|
6414
|
+
this.showInlineQTBar(this.offsetX, this.offsetY, args.target);
|
|
6415
|
+
}
|
|
6416
|
+
}
|
|
6301
6417
|
return;
|
|
6302
6418
|
}
|
|
6303
|
-
const args = e.args;
|
|
6304
6419
|
this.deBounce(this.offsetX, this.offsetY, args.target);
|
|
6305
6420
|
}
|
|
6306
6421
|
}
|
|
@@ -6950,10 +7065,11 @@ function setEditFrameFocus(editableElement, selector) {
|
|
|
6950
7065
|
}
|
|
6951
7066
|
/**
|
|
6952
7067
|
* @param {string} value - specifies the string value
|
|
7068
|
+
* @param {string} enterAction - specifies the enter key action API
|
|
6953
7069
|
* @returns {void}
|
|
6954
7070
|
* @hidden
|
|
6955
7071
|
*/
|
|
6956
|
-
function updateTextNode$1(value) {
|
|
7072
|
+
function updateTextNode$1(value, enterAction) {
|
|
6957
7073
|
const tempNode = document.createElement('div');
|
|
6958
7074
|
tempNode.innerHTML = value;
|
|
6959
7075
|
tempNode.setAttribute('class', 'tempDiv');
|
|
@@ -6968,15 +7084,23 @@ function updateTextNode$1(value) {
|
|
|
6968
7084
|
(tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
|
|
6969
7085
|
inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
|
|
6970
7086
|
if (!isPreviousInlineElem) {
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
7087
|
+
if (enterAction === 'BR') {
|
|
7088
|
+
resultElm.appendChild(tempNode.firstChild);
|
|
7089
|
+
previousParent = resultElm;
|
|
7090
|
+
}
|
|
7091
|
+
else {
|
|
7092
|
+
paraElm = createElement('p');
|
|
7093
|
+
resultElm.appendChild(paraElm);
|
|
7094
|
+
paraElm.appendChild(tempNode.firstChild);
|
|
7095
|
+
previousParent = paraElm;
|
|
7096
|
+
isPreviousInlineElem = true;
|
|
7097
|
+
}
|
|
6974
7098
|
}
|
|
6975
7099
|
else {
|
|
6976
7100
|
previousParent.appendChild(tempNode.firstChild);
|
|
7101
|
+
previousParent = paraElm;
|
|
7102
|
+
isPreviousInlineElem = true;
|
|
6977
7103
|
}
|
|
6978
|
-
previousParent = paraElm;
|
|
6979
|
-
isPreviousInlineElem = true;
|
|
6980
7104
|
}
|
|
6981
7105
|
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
6982
7106
|
(tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
|
|
@@ -7313,6 +7437,12 @@ const ON_BEGIN = 'onBegin';
|
|
|
7313
7437
|
* @hidden
|
|
7314
7438
|
*/
|
|
7315
7439
|
const SPACE_ACTION = 'actionBegin';
|
|
7440
|
+
/**
|
|
7441
|
+
* Format painter event constant
|
|
7442
|
+
*
|
|
7443
|
+
* @hidden
|
|
7444
|
+
*/
|
|
7445
|
+
const FORMAT_PAINTER_ACTIONS = 'format_painter_actions';
|
|
7316
7446
|
|
|
7317
7447
|
/**
|
|
7318
7448
|
* Formatter
|
|
@@ -7336,8 +7466,14 @@ class Formatter {
|
|
|
7336
7466
|
const selection = self.contentModule.getDocument().getSelection();
|
|
7337
7467
|
const range = (selection.rangeCount > 0) ? selection.getRangeAt(selection.rangeCount - 1) : null;
|
|
7338
7468
|
let saveSelection;
|
|
7469
|
+
const isKeyboardVideoInsert = (!isNullOrUndefined(value) && !isNullOrUndefined(value.cssClass) &&
|
|
7470
|
+
value.cssClass !== 'e-video-inline');
|
|
7339
7471
|
if (self.editorMode === 'HTML') {
|
|
7340
|
-
|
|
7472
|
+
if (!isNullOrUndefined(args) && !isKeyboardVideoInsert) {
|
|
7473
|
+
if (isNullOrUndefined(args.name) || (!isNullOrUndefined(args.name) && args.name !== 'showDialog')) {
|
|
7474
|
+
saveSelection = this.editorManager.nodeSelection.save(range, self.contentModule.getDocument());
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7341
7477
|
}
|
|
7342
7478
|
if (!isNullOrUndefined(args)
|
|
7343
7479
|
&& args.item.command
|
|
@@ -7413,18 +7549,21 @@ class Formatter {
|
|
|
7413
7549
|
&& args.item.command !== 'Font')
|
|
7414
7550
|
|| ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
|
|
7415
7551
|
|| ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
|
|
7416
|
-
&& args.name === 'colorPickerChanged'))) {
|
|
7552
|
+
&& args.name === 'colorPickerChanged') || args.item.subCommand === 'FormatPainter')) {
|
|
7417
7553
|
extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
|
|
7418
7554
|
self.trigger(actionBegin, args, (actionBeginArgs) => {
|
|
7419
7555
|
if (!actionBeginArgs.cancel) {
|
|
7556
|
+
const formatPainterCopyAction = !isNullOrUndefined(actionBeginArgs.name) && actionBeginArgs.name === 'format-copy';
|
|
7420
7557
|
if (this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
|
|
7421
|
-
&& actionBeginArgs.item.command !== 'Images') {
|
|
7558
|
+
&& actionBeginArgs.item.command !== 'Images' && !formatPainterCopyAction) {
|
|
7422
7559
|
this.saveData();
|
|
7423
7560
|
}
|
|
7424
7561
|
self.isBlur = false;
|
|
7425
7562
|
self.contentModule.getEditPanel().focus();
|
|
7426
|
-
if (self.editorMode === 'HTML') {
|
|
7427
|
-
|
|
7563
|
+
if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
|
|
7564
|
+
if (isNullOrUndefined(args.selectType) || (!isNullOrUndefined(args.selectType) && args.selectType !== 'showDialog')) {
|
|
7565
|
+
saveSelection.restore();
|
|
7566
|
+
}
|
|
7428
7567
|
}
|
|
7429
7568
|
const command = actionBeginArgs.item.subCommand.toLocaleLowerCase();
|
|
7430
7569
|
if (command === 'paste' || command === 'cut' || command === 'copy') {
|
|
@@ -8693,7 +8832,9 @@ const htmlKeyConfig = {
|
|
|
8693
8832
|
'space': '32',
|
|
8694
8833
|
'enter': '13',
|
|
8695
8834
|
'tab': 'tab',
|
|
8696
|
-
'delete': '46'
|
|
8835
|
+
'delete': '46',
|
|
8836
|
+
'format-copy': 'ctrl+shift+c',
|
|
8837
|
+
'format-paste': 'ctrl+shift+v'
|
|
8697
8838
|
};
|
|
8698
8839
|
/**
|
|
8699
8840
|
* Default markdown key config for adapter
|
|
@@ -11220,7 +11361,7 @@ class Lists {
|
|
|
11220
11361
|
this.parent.domNode.insertAfter(insertTag, startNodeParent);
|
|
11221
11362
|
e.event.preventDefault();
|
|
11222
11363
|
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, insertTag, 0);
|
|
11223
|
-
if (startNodeParent.textContent === '') {
|
|
11364
|
+
if (startNodeParent.textContent === '' && (startNodeParent.querySelectorAll('audio,video').length === 0)) {
|
|
11224
11365
|
detach(startNodeParent);
|
|
11225
11366
|
}
|
|
11226
11367
|
else {
|
|
@@ -12621,7 +12762,7 @@ class Formats {
|
|
|
12621
12762
|
* @deprecated
|
|
12622
12763
|
*/
|
|
12623
12764
|
class InsertHtml {
|
|
12624
|
-
static Insert(docElement, insertNode, editNode, isExternal) {
|
|
12765
|
+
static Insert(docElement, insertNode, editNode, isExternal, enterAction) {
|
|
12625
12766
|
let node;
|
|
12626
12767
|
if (typeof insertNode === 'string') {
|
|
12627
12768
|
const divNode = document.createElement('div');
|
|
@@ -12643,7 +12784,8 @@ class InsertHtml {
|
|
|
12643
12784
|
const nodeCutter = new NodeCutter();
|
|
12644
12785
|
let range = nodeSelection.getRange(docElement);
|
|
12645
12786
|
if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
|
|
12646
|
-
range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
|
|
12787
|
+
range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
|
|
12788
|
+
(editNode.children[0].tagName === 'P' || (editNode.children[0].tagName === 'BR'))) {
|
|
12647
12789
|
nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
|
|
12648
12790
|
range = nodeSelection.getRange(docElement);
|
|
12649
12791
|
}
|
|
@@ -12660,7 +12802,7 @@ class InsertHtml {
|
|
|
12660
12802
|
const closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
|
|
12661
12803
|
if (isExternal || (!isNullOrUndefined(node) && !isNullOrUndefined(node.classList) &&
|
|
12662
12804
|
node.classList.contains('pasteContent'))) {
|
|
12663
|
-
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode);
|
|
12805
|
+
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
|
|
12664
12806
|
return;
|
|
12665
12807
|
}
|
|
12666
12808
|
if (editNode !== range.startContainer && ((!isCollapsed && !(closestParentNode.nodeType === Node.ELEMENT_NODE &&
|
|
@@ -12774,7 +12916,7 @@ class InsertHtml {
|
|
|
12774
12916
|
}
|
|
12775
12917
|
}
|
|
12776
12918
|
}
|
|
12777
|
-
static pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode) {
|
|
12919
|
+
static pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
|
|
12778
12920
|
const isCursor = range.startOffset === range.endOffset &&
|
|
12779
12921
|
range.startContainer === range.endContainer;
|
|
12780
12922
|
if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
|
|
@@ -12828,7 +12970,9 @@ class InsertHtml {
|
|
|
12828
12970
|
}
|
|
12829
12971
|
else {
|
|
12830
12972
|
range.deleteContents();
|
|
12831
|
-
|
|
12973
|
+
if (!isNullOrUndefined(lasNode)) {
|
|
12974
|
+
detach(lasNode);
|
|
12975
|
+
}
|
|
12832
12976
|
// eslint-disable-next-line
|
|
12833
12977
|
!isNullOrUndefined(sibNode) ? sibNode.parentNode.appendChild(fragment) : editNode.appendChild(fragment);
|
|
12834
12978
|
}
|
|
@@ -12884,7 +13028,12 @@ class InsertHtml {
|
|
|
12884
13028
|
const firstParaElm = createElement('p');
|
|
12885
13029
|
node.parentElement.insertBefore(firstParaElm, node);
|
|
12886
13030
|
}
|
|
12887
|
-
node.previousElementSibling.
|
|
13031
|
+
if (node.previousElementSibling.nodeName === 'BR') {
|
|
13032
|
+
node.parentElement.insertBefore(node.firstChild, node);
|
|
13033
|
+
}
|
|
13034
|
+
else {
|
|
13035
|
+
node.previousElementSibling.appendChild(node.firstChild);
|
|
13036
|
+
}
|
|
12888
13037
|
}
|
|
12889
13038
|
else {
|
|
12890
13039
|
lastSelectionNode = node.firstChild;
|
|
@@ -12916,7 +13065,7 @@ class InsertHtml {
|
|
|
12916
13065
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
12917
13066
|
}
|
|
12918
13067
|
else {
|
|
12919
|
-
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
13068
|
+
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
12920
13069
|
}
|
|
12921
13070
|
}
|
|
12922
13071
|
static placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
@@ -13009,7 +13158,7 @@ class InsertHtml {
|
|
|
13009
13158
|
detach(currentNode.nextSibling);
|
|
13010
13159
|
}
|
|
13011
13160
|
}
|
|
13012
|
-
else if ((currentNode.nodeName === '#text' || currentNode.nodeName ===
|
|
13161
|
+
else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
13013
13162
|
(currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
|
|
13014
13163
|
currentNode.parentElement.textContent.trim().length > 0) {
|
|
13015
13164
|
splitedElm = currentNode;
|
|
@@ -13031,9 +13180,9 @@ class InsertHtml {
|
|
|
13031
13180
|
}
|
|
13032
13181
|
}
|
|
13033
13182
|
}
|
|
13034
|
-
static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
13183
|
+
static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction) {
|
|
13035
13184
|
lastSelectionNode.classList.add('lastNode');
|
|
13036
|
-
editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
|
|
13185
|
+
editNode.innerHTML = updateTextNode$1(editNode.innerHTML, enterAction);
|
|
13037
13186
|
lastSelectionNode = editNode.querySelector('.lastNode');
|
|
13038
13187
|
if (!isNullOrUndefined(lastSelectionNode)) {
|
|
13039
13188
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -13359,7 +13508,6 @@ class LinkCommand {
|
|
|
13359
13508
|
return arr.join(' ') + ' ';
|
|
13360
13509
|
}
|
|
13361
13510
|
openLink(e) {
|
|
13362
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
13363
13511
|
document.defaultView.open(e.item.url, e.item.target);
|
|
13364
13512
|
this.callBack(e);
|
|
13365
13513
|
}
|
|
@@ -13823,7 +13971,6 @@ class ImageCommand {
|
|
|
13823
13971
|
this.callBack(e);
|
|
13824
13972
|
}
|
|
13825
13973
|
openImageLink(e) {
|
|
13826
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
13827
13974
|
document.defaultView.open(e.item.url, e.item.target);
|
|
13828
13975
|
this.callBack(e);
|
|
13829
13976
|
}
|
|
@@ -14293,6 +14440,8 @@ class VideoCommand {
|
|
|
14293
14440
|
: (Browser.isIE ? selectedNode : !e.item.isEmbedUrl ? selectedNode.lastElementChild : selectedNode.querySelector('iframe'));
|
|
14294
14441
|
videoElm.addEventListener(videoElm.tagName !== 'IFRAME' ? 'loadeddata' : 'load', () => {
|
|
14295
14442
|
if (e.value !== 'VideoReplace' || !isReplaced) {
|
|
14443
|
+
if (e.item.isEmbedUrl && videoElm)
|
|
14444
|
+
videoElm.classList.add('e-rte-embed-url');
|
|
14296
14445
|
e.callBack({
|
|
14297
14446
|
requestType: 'Videos',
|
|
14298
14447
|
editorMode: 'HTML',
|
|
@@ -15525,6 +15674,7 @@ IsFormatted.inlineTags = [
|
|
|
15525
15674
|
'code',
|
|
15526
15675
|
'dfn',
|
|
15527
15676
|
'em',
|
|
15677
|
+
'font',
|
|
15528
15678
|
'i',
|
|
15529
15679
|
'kbd',
|
|
15530
15680
|
'label',
|
|
@@ -15554,15 +15704,16 @@ class SelectionCommands {
|
|
|
15554
15704
|
* @param {string} enterAction - specifies the enter key action
|
|
15555
15705
|
* @param {string} value - specifies the string value
|
|
15556
15706
|
* @param {string} selector - specifies the string
|
|
15707
|
+
* @param {FormatPainterValue} painterValues specifies the element created and last child
|
|
15557
15708
|
* @returns {void}
|
|
15558
15709
|
* @hidden
|
|
15559
15710
|
* @deprecated
|
|
15560
15711
|
*/
|
|
15561
|
-
static applyFormat(docElement, format, endNode, enterAction, value, selector) {
|
|
15712
|
+
static applyFormat(docElement, format, endNode, enterAction, value, selector, painterValues) {
|
|
15562
15713
|
this.enterAction = enterAction;
|
|
15563
15714
|
const validFormats = ['bold', 'italic', 'underline', 'strikethrough', 'superscript',
|
|
15564
15715
|
'subscript', 'uppercase', 'lowercase', 'fontcolor', 'fontname', 'fontsize', 'backgroundcolor'];
|
|
15565
|
-
if (validFormats.indexOf(format) > -1) {
|
|
15716
|
+
if (validFormats.indexOf(format) > -1 || value === 'formatPainter') {
|
|
15566
15717
|
if (format === 'backgroundcolor' && value === '') {
|
|
15567
15718
|
value = 'transparent';
|
|
15568
15719
|
}
|
|
@@ -15638,8 +15789,10 @@ class SelectionCommands {
|
|
|
15638
15789
|
if (formatNode !== null && (!isFormat || isFontStyle)) {
|
|
15639
15790
|
nodes[index] = this.removeFormat(nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domSelection, endNode, domNode);
|
|
15640
15791
|
}
|
|
15641
|
-
else if (range.startContainer.parentElement !== endNode ||
|
|
15642
|
-
|
|
15792
|
+
else if (range.startContainer.parentElement !== endNode ||
|
|
15793
|
+
(range.commonAncestorContainer !== endNode && range.startContainer.parentElement === endNode)
|
|
15794
|
+
|| (range.commonAncestorContainer === endNode || nodes.length === 1)) {
|
|
15795
|
+
nodes[index] = this.insertFormat(docElement, nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, painterValues, domNode, endNode);
|
|
15643
15796
|
}
|
|
15644
15797
|
domSelection = this.applySelection(nodes, domSelection, nodeCutter, index, isCollapsed);
|
|
15645
15798
|
}
|
|
@@ -15935,7 +16088,7 @@ class SelectionCommands {
|
|
|
15935
16088
|
}
|
|
15936
16089
|
return nodes[index];
|
|
15937
16090
|
}
|
|
15938
|
-
static insertFormat(docElement, nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domNode, endNode) {
|
|
16091
|
+
static insertFormat(docElement, nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, painterValues, domNode, endNode) {
|
|
15939
16092
|
let rootElementNode;
|
|
15940
16093
|
if (!isCursor) {
|
|
15941
16094
|
if ((formatNode === null && isFormat) || isFontStyle) {
|
|
@@ -15962,11 +16115,11 @@ class SelectionCommands {
|
|
|
15962
16115
|
}
|
|
15963
16116
|
else if (!(isFontStyle === true && value === '')) {
|
|
15964
16117
|
const element = this.GetFormatNode(format, value);
|
|
15965
|
-
if (format === 'fontsize' || format === 'fontcolor' || format === 'fontname' || format === 'backgroundcolor') {
|
|
16118
|
+
if (value === 'formatPainter' || format === 'fontsize' || format === 'fontcolor' || format === 'fontname' || format === 'backgroundcolor') {
|
|
15966
16119
|
if (format !== 'fontname' && format !== 'backgroundcolor') {
|
|
15967
16120
|
let liElement = nodes[index].parentElement;
|
|
15968
16121
|
let parentElement = nodes[index].parentElement;
|
|
15969
|
-
while (!isNullOrUndefined(parentElement) && parentElement.tagName.toLowerCase() !== 'li'
|
|
16122
|
+
while (!isNullOrUndefined(parentElement) && parentElement.tagName.toLowerCase() !== 'li') {
|
|
15970
16123
|
parentElement = parentElement.parentElement;
|
|
15971
16124
|
liElement = parentElement;
|
|
15972
16125
|
}
|
|
@@ -15981,11 +16134,11 @@ class SelectionCommands {
|
|
|
15981
16134
|
}
|
|
15982
16135
|
}
|
|
15983
16136
|
}
|
|
15984
|
-
if (rootElementNode && rootElementNode.nodeType !== 3) {
|
|
16137
|
+
if (rootElementNode && rootElementNode.nodeType !== 3 && rootElementNode.nodeName !== 'A') {
|
|
15985
16138
|
const save = new NodeSelection();
|
|
15986
16139
|
save.save(range, docElement);
|
|
15987
16140
|
domNode.setMarker(save);
|
|
15988
|
-
|
|
16141
|
+
const cloneNode = rootElementNode.cloneNode(true);
|
|
15989
16142
|
element.appendChild(cloneNode);
|
|
15990
16143
|
domNode.replaceWith(rootElementNode, element.outerHTML);
|
|
15991
16144
|
const currentStartNode = endNode.querySelector('.e-editor-select-start');
|
|
@@ -16001,7 +16154,12 @@ class SelectionCommands {
|
|
|
16001
16154
|
domNode.saveMarker(save, null);
|
|
16002
16155
|
}
|
|
16003
16156
|
else {
|
|
16004
|
-
|
|
16157
|
+
if (value === 'formatPainter') {
|
|
16158
|
+
return this.insertFormatPainterElem(nodes, index, range, nodeCutter, painterValues, domNode);
|
|
16159
|
+
}
|
|
16160
|
+
else {
|
|
16161
|
+
nodes[index] = this.applyStyles(nodes, index, element);
|
|
16162
|
+
}
|
|
16005
16163
|
}
|
|
16006
16164
|
if (format === 'fontsize') {
|
|
16007
16165
|
const bg = closest(nodes[index].parentElement, 'span[style*=' + 'background-color' + ']');
|
|
@@ -16132,6 +16290,59 @@ class SelectionCommands {
|
|
|
16132
16290
|
ele.setAttribute('style', styles);
|
|
16133
16291
|
}
|
|
16134
16292
|
}
|
|
16293
|
+
// Below function is used to insert the element created by the format painter plugin.
|
|
16294
|
+
static insertFormatPainterElem(nodes, index, range, nodeCutter, painterValues, domNode) {
|
|
16295
|
+
let parent = nodes[index].parentElement;
|
|
16296
|
+
if (!domNode.isBlockNode(parent)) {
|
|
16297
|
+
// The below code is used to remove the already present inline style from the text node.
|
|
16298
|
+
while (parent.textContent.trim() === parent.parentElement.textContent.trim() && !domNode.isBlockNode(parent.parentElement)) {
|
|
16299
|
+
parent = parent.parentElement;
|
|
16300
|
+
}
|
|
16301
|
+
if (parent.textContent.trim() !== nodes[index].textContent.trim()) {
|
|
16302
|
+
nodeCutter.SplitNode(range, parent, true);
|
|
16303
|
+
const childELemList = nodes[index].parentElement.childNodes;
|
|
16304
|
+
for (let i = 0; i < childELemList.length; i++) {
|
|
16305
|
+
if (childELemList[i].textContent.trim() === nodes[i].textContent.trim()) {
|
|
16306
|
+
parent.parentNode.insertBefore(childELemList[i], parent);
|
|
16307
|
+
break;
|
|
16308
|
+
}
|
|
16309
|
+
}
|
|
16310
|
+
const blockChildNodes = parent.parentElement.childNodes;
|
|
16311
|
+
for (let k = 0; k < blockChildNodes.length; k++) {
|
|
16312
|
+
if (blockChildNodes[k].textContent.trim() === '' || blockChildNodes[k].textContent.length === 0) {
|
|
16313
|
+
detach(blockChildNodes[k]);
|
|
16314
|
+
}
|
|
16315
|
+
}
|
|
16316
|
+
}
|
|
16317
|
+
else {
|
|
16318
|
+
InsertMethods.unwrap(parent);
|
|
16319
|
+
}
|
|
16320
|
+
}
|
|
16321
|
+
const elem = painterValues.element;
|
|
16322
|
+
if (!isNullOrUndefined(elem)) {
|
|
16323
|
+
// Step 1: Cloning the element that is created by format painter.
|
|
16324
|
+
// Step 2: Finding the last child of the nested elememt using the paintervalues.lastchild nodename
|
|
16325
|
+
// Step 3: Assigning the nodes[index] text content to the last child element.
|
|
16326
|
+
// Step 4: Wrapping the cloned element with the nodes[index]
|
|
16327
|
+
const clonedElement = elem.cloneNode(true);
|
|
16328
|
+
const elemList = clonedElement.querySelectorAll(painterValues.lastChild.nodeName);
|
|
16329
|
+
let lastElement;
|
|
16330
|
+
if (elemList.length > 0) {
|
|
16331
|
+
lastElement = elemList[elemList.length - 1];
|
|
16332
|
+
}
|
|
16333
|
+
else {
|
|
16334
|
+
if (!isNullOrUndefined(clonedElement) && clonedElement.nodeName === painterValues.lastChild.nodeName) {
|
|
16335
|
+
lastElement = clonedElement;
|
|
16336
|
+
}
|
|
16337
|
+
}
|
|
16338
|
+
lastElement.textContent = nodes[index].textContent;
|
|
16339
|
+
const lastChild = lastElement.childNodes[0];
|
|
16340
|
+
nodes[index] = InsertMethods.Wrap(nodes[index], clonedElement);
|
|
16341
|
+
nodes[index].textContent = '';
|
|
16342
|
+
nodes[index] = lastChild;
|
|
16343
|
+
}
|
|
16344
|
+
return nodes[index];
|
|
16345
|
+
}
|
|
16135
16346
|
}
|
|
16136
16347
|
SelectionCommands.enterAction = 'P';
|
|
16137
16348
|
|
|
@@ -16205,7 +16416,7 @@ class InsertHtmlExec {
|
|
|
16205
16416
|
this.parent.observer.on(INSERTHTML_TYPE, this.applyHtml, this);
|
|
16206
16417
|
}
|
|
16207
16418
|
applyHtml(e) {
|
|
16208
|
-
InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true);
|
|
16419
|
+
InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true, e.enterAction);
|
|
16209
16420
|
if (e.subCommand === 'pasteCleanup') {
|
|
16210
16421
|
const pastedElements = this.parent.editableElement.querySelectorAll('.pasteContent_RTE');
|
|
16211
16422
|
const allPastedElements = [].slice.call(pastedElements);
|
|
@@ -16253,12 +16464,18 @@ class ClearFormat$1 {
|
|
|
16253
16464
|
const nodeSelection = new NodeSelection();
|
|
16254
16465
|
const nodeCutter = new NodeCutter();
|
|
16255
16466
|
let range = nodeSelection.getRange(docElement);
|
|
16256
|
-
const
|
|
16257
|
-
|
|
16467
|
+
const nodes = range.collapsed ? nodeSelection.getSelectionNodeCollection(range) :
|
|
16468
|
+
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
16258
16469
|
const save = nodeSelection.save(range, docElement);
|
|
16470
|
+
let cursorRange = false;
|
|
16471
|
+
if (range.collapsed) {
|
|
16472
|
+
cursorRange = true;
|
|
16473
|
+
range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
|
|
16474
|
+
}
|
|
16475
|
+
const isCollapsed = range.collapsed;
|
|
16259
16476
|
if (!isCollapsed) {
|
|
16260
16477
|
let preNode;
|
|
16261
|
-
if (nodes[0].nodeName === 'BR' && closest(nodes[0], 'table')) {
|
|
16478
|
+
if (nodes.length > 0 && nodes[0].nodeName === 'BR' && closest(nodes[0], 'table')) {
|
|
16262
16479
|
preNode = nodeCutter.GetSpliceNode(range, closest(nodes[0], 'table'));
|
|
16263
16480
|
}
|
|
16264
16481
|
else {
|
|
@@ -16268,7 +16485,7 @@ class ClearFormat$1 {
|
|
|
16268
16485
|
nodeSelection.setSelectionContents(docElement, preNode);
|
|
16269
16486
|
range = nodeSelection.getRange(docElement);
|
|
16270
16487
|
}
|
|
16271
|
-
else {
|
|
16488
|
+
else if (nodes.length > 1) {
|
|
16272
16489
|
let i = 1;
|
|
16273
16490
|
let lastText = nodes[nodes.length - i];
|
|
16274
16491
|
while (nodes.length <= i && nodes[nodes.length - i].nodeName === 'BR') {
|
|
@@ -16293,6 +16510,9 @@ class ClearFormat$1 {
|
|
|
16293
16510
|
}
|
|
16294
16511
|
this.reSelection(docElement, save, exactNodes);
|
|
16295
16512
|
}
|
|
16513
|
+
if (cursorRange) {
|
|
16514
|
+
nodeSelection.setCursorPoint(docElement, range.endContainer, range.endOffset);
|
|
16515
|
+
}
|
|
16296
16516
|
}
|
|
16297
16517
|
static reSelection(docElement, save, exactNodes) {
|
|
16298
16518
|
const selectionNodes = save.getInsertNodes(exactNodes);
|
|
@@ -16798,7 +17018,7 @@ class MsWordPaste {
|
|
|
16798
17018
|
if (pattern4.test(tempHTMLContent)) {
|
|
16799
17019
|
this.addTableBorderClass(elm);
|
|
16800
17020
|
}
|
|
16801
|
-
// Removing the margin for list items
|
|
17021
|
+
// Removing the margin for list items
|
|
16802
17022
|
const liChildren = elm.querySelectorAll('li');
|
|
16803
17023
|
if (liChildren.length > 0) {
|
|
16804
17024
|
for (let i = 0; i < liChildren.length; i++) {
|
|
@@ -17096,6 +17316,29 @@ class MsWordPaste {
|
|
|
17096
17316
|
}
|
|
17097
17317
|
fromClass = false;
|
|
17098
17318
|
}
|
|
17319
|
+
let listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
17320
|
+
for (let i = 0; i < listClass.length; i++) {
|
|
17321
|
+
if (keys.indexOf('li.' + listClass[i]) > -1) {
|
|
17322
|
+
let olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
|
|
17323
|
+
for (let j = 0; j < olULElems.length; j++) {
|
|
17324
|
+
const styleProperty = olULElems[j].getAttribute('style');
|
|
17325
|
+
if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
|
|
17326
|
+
const valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
|
|
17327
|
+
for (let k = 0; k < valueSplit.length; k++) {
|
|
17328
|
+
if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
|
|
17329
|
+
if (!isNullOrUndefined(valueSplit[k].split(':')[1]) &&
|
|
17330
|
+
valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
|
|
17331
|
+
olULElems[j].style.marginLeft.indexOf('in') >= 0) {
|
|
17332
|
+
let classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
|
|
17333
|
+
let inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
|
|
17334
|
+
olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
|
|
17335
|
+
}
|
|
17336
|
+
}
|
|
17337
|
+
}
|
|
17338
|
+
}
|
|
17339
|
+
}
|
|
17340
|
+
}
|
|
17341
|
+
}
|
|
17099
17342
|
}
|
|
17100
17343
|
}
|
|
17101
17344
|
filterStyles(elm, wordPasteStyleConfig) {
|
|
@@ -17216,22 +17459,29 @@ class MsWordPaste {
|
|
|
17216
17459
|
let type;
|
|
17217
17460
|
let listStyleType;
|
|
17218
17461
|
let startAttr;
|
|
17462
|
+
let styleMarginLeft;
|
|
17219
17463
|
if (!isNullOrUndefined(this.listContents[0])) {
|
|
17220
17464
|
type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
|
|
17221
17465
|
listStyleType = this.getlistStyleType(this.listContents[0], type);
|
|
17222
|
-
if (type === 'ol' && listNodes[i - 1] === null) {
|
|
17466
|
+
if (type === 'ol' && (i === 0 || listNodes[i - 1] === null)) {
|
|
17223
17467
|
const startString = this.listContents[0].split('.')[0];
|
|
17224
|
-
const listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
|
|
17468
|
+
const listTypes = ['A', 'a', 'I', 'i', 'α', '1', '1-']; // Add '1-' for rare list type.
|
|
17225
17469
|
if (listTypes.indexOf(startString) === -1) {
|
|
17226
17470
|
if (listStyleType === 'decimal') {
|
|
17227
17471
|
// Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
|
|
17228
|
-
if (!isNaN(parseInt(startString))) {
|
|
17229
|
-
startAttr = parseInt(startString);
|
|
17472
|
+
if (!isNaN(parseInt(startString, 10))) {
|
|
17473
|
+
startAttr = parseInt(startString, 10);
|
|
17230
17474
|
}
|
|
17231
17475
|
}
|
|
17232
|
-
else if (listStyleType === 'upper-alpha'
|
|
17233
|
-
startAttr =
|
|
17476
|
+
else if (listStyleType === 'upper-alpha') {
|
|
17477
|
+
startAttr = (startString.split('.')[0].charCodeAt(0) - 64);
|
|
17234
17478
|
}
|
|
17479
|
+
else if (listStyleType === 'lower-alpha') {
|
|
17480
|
+
startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
|
|
17481
|
+
}
|
|
17482
|
+
}
|
|
17483
|
+
if (listNodes[i].style.marginLeft !== '') {
|
|
17484
|
+
styleMarginLeft = listNodes[i].style.marginLeft;
|
|
17235
17485
|
}
|
|
17236
17486
|
}
|
|
17237
17487
|
const tempNode = [];
|
|
@@ -17250,7 +17500,7 @@ class MsWordPaste {
|
|
|
17250
17500
|
}
|
|
17251
17501
|
}
|
|
17252
17502
|
collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
|
|
17253
|
-
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
|
|
17503
|
+
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft });
|
|
17254
17504
|
}
|
|
17255
17505
|
}
|
|
17256
17506
|
stNode = listNodes.shift();
|
|
@@ -17276,23 +17526,30 @@ class MsWordPaste {
|
|
|
17276
17526
|
}
|
|
17277
17527
|
getlistStyleType(listContent, type) {
|
|
17278
17528
|
let currentListClass;
|
|
17529
|
+
let upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
|
|
17530
|
+
'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
|
|
17531
|
+
let lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
|
|
17532
|
+
'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
|
|
17533
|
+
let lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
|
|
17534
|
+
'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
|
|
17279
17535
|
if (type === 'ol') {
|
|
17280
|
-
|
|
17281
|
-
|
|
17282
|
-
|
|
17283
|
-
break;
|
|
17284
|
-
case 'a':
|
|
17285
|
-
currentListClass = 'lower-alpha';
|
|
17286
|
-
break;
|
|
17287
|
-
case 'I':
|
|
17536
|
+
let charCode = listContent.split('.')[0].charCodeAt(0);
|
|
17537
|
+
switch (true) {
|
|
17538
|
+
case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
17288
17539
|
currentListClass = 'upper-roman';
|
|
17289
17540
|
break;
|
|
17290
|
-
case '
|
|
17541
|
+
case lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
17291
17542
|
currentListClass = 'lower-roman';
|
|
17292
17543
|
break;
|
|
17293
|
-
case '
|
|
17544
|
+
case lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
17294
17545
|
currentListClass = 'lower-greek';
|
|
17295
17546
|
break;
|
|
17547
|
+
case (charCode > 64 && charCode < 91):
|
|
17548
|
+
currentListClass = 'upper-alpha';
|
|
17549
|
+
break;
|
|
17550
|
+
case (charCode > 96 && charCode < 123):
|
|
17551
|
+
currentListClass = 'lower-alpha';
|
|
17552
|
+
break;
|
|
17296
17553
|
default:
|
|
17297
17554
|
currentListClass = 'decimal';
|
|
17298
17555
|
break;
|
|
@@ -17324,11 +17581,12 @@ class MsWordPaste {
|
|
|
17324
17581
|
const pElement = createElement('p');
|
|
17325
17582
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
17326
17583
|
if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
|
|
17327
|
-
root.appendChild(temp = createElement(collection[index].listType));
|
|
17584
|
+
root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
|
|
17328
17585
|
prevList = createElement('li');
|
|
17329
17586
|
prevList.appendChild(pElement);
|
|
17330
17587
|
temp.appendChild(prevList);
|
|
17331
17588
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
17589
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
17332
17590
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
17333
17591
|
}
|
|
17334
17592
|
else if (collection[index].nestedLevel === pLevel) {
|
|
@@ -17491,353 +17749,130 @@ class InsertTextExec {
|
|
|
17491
17749
|
}
|
|
17492
17750
|
|
|
17493
17751
|
/**
|
|
17494
|
-
*
|
|
17752
|
+
* Update Toolbar Status
|
|
17495
17753
|
*
|
|
17496
17754
|
* @hidden
|
|
17497
17755
|
* @deprecated
|
|
17498
17756
|
*/
|
|
17499
|
-
|
|
17757
|
+
const statusCollection = getDefaultHtmlTbStatus();
|
|
17758
|
+
class ToolbarStatus {
|
|
17500
17759
|
/**
|
|
17501
|
-
*
|
|
17760
|
+
* get method
|
|
17502
17761
|
*
|
|
17762
|
+
* @param {Document} docElement - specifies the document element
|
|
17763
|
+
* @param {Node} targetNode - specifies the target node
|
|
17764
|
+
* @param {string[]} formatNode - specifies the format node
|
|
17765
|
+
* @param {string[]} fontSize - specifies the font size
|
|
17766
|
+
* @param {string[]} fontName - specifies the font name.
|
|
17767
|
+
* @param {Node} documentNode - specifies the document node.
|
|
17768
|
+
* @returns {IToolbarStatus} - returns the toolbar status
|
|
17503
17769
|
* @hidden
|
|
17504
17770
|
* @deprecated
|
|
17505
|
-
* @param {ICommandModel} options - specifies the command Model
|
|
17506
17771
|
*/
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17546
|
-
|
|
17772
|
+
static get(docElement, targetNode, formatNode, fontSize, fontName, documentNode) {
|
|
17773
|
+
let formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17774
|
+
const nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17775
|
+
const nodeSelection = new NodeSelection();
|
|
17776
|
+
const range = nodeSelection.getRange(docElement);
|
|
17777
|
+
const nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
17778
|
+
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
17779
|
+
const nodesLength = nodes.length;
|
|
17780
|
+
let isNodeChanged = false;
|
|
17781
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
17782
|
+
while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
|
|
17783
|
+
nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
|
|
17784
|
+
(this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
|
|
17785
|
+
range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
|
|
17786
|
+
nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
|
|
17787
|
+
nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
|
|
17788
|
+
isNodeChanged = true;
|
|
17789
|
+
}
|
|
17790
|
+
if (isNodeChanged && nodes[index]) {
|
|
17791
|
+
nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
|
|
17792
|
+
isNodeChanged = false;
|
|
17793
|
+
}
|
|
17794
|
+
if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
|
|
17795
|
+
(nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
|
|
17796
|
+
nodes.splice(index, 1);
|
|
17797
|
+
index--;
|
|
17798
|
+
}
|
|
17799
|
+
}
|
|
17800
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
17801
|
+
// eslint-disable-next-line max-len
|
|
17802
|
+
formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
|
|
17803
|
+
if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
|
|
17804
|
+
nodeCollection.bold = formatCollection.bold;
|
|
17805
|
+
}
|
|
17806
|
+
if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
|
|
17807
|
+
nodeCollection.insertcode = formatCollection.insertcode;
|
|
17808
|
+
}
|
|
17809
|
+
if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
|
|
17810
|
+
nodeCollection.italic = formatCollection.italic;
|
|
17811
|
+
}
|
|
17812
|
+
if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
|
|
17813
|
+
nodeCollection.underline = formatCollection.underline;
|
|
17814
|
+
}
|
|
17815
|
+
if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
|
|
17816
|
+
nodeCollection.strikethrough = formatCollection.strikethrough;
|
|
17817
|
+
}
|
|
17818
|
+
if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
|
|
17819
|
+
nodeCollection.superscript = formatCollection.superscript;
|
|
17820
|
+
}
|
|
17821
|
+
if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
|
|
17822
|
+
nodeCollection.subscript = formatCollection.subscript;
|
|
17823
|
+
}
|
|
17824
|
+
if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
|
|
17825
|
+
nodeCollection.fontcolor = formatCollection.fontcolor;
|
|
17826
|
+
}
|
|
17827
|
+
if ((index === 0 && formatCollection.fontname) || !formatCollection.fontname) {
|
|
17828
|
+
nodeCollection.fontname = formatCollection.fontname;
|
|
17829
|
+
}
|
|
17830
|
+
if ((index === 0 && formatCollection.fontsize) || !formatCollection.fontsize) {
|
|
17831
|
+
nodeCollection.fontsize = formatCollection.fontsize;
|
|
17832
|
+
}
|
|
17833
|
+
if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
|
|
17834
|
+
nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
|
|
17835
|
+
}
|
|
17836
|
+
if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
|
|
17837
|
+
nodeCollection.orderedlist = formatCollection.orderedlist;
|
|
17838
|
+
}
|
|
17839
|
+
if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
|
|
17840
|
+
nodeCollection.unorderedlist = formatCollection.unorderedlist;
|
|
17841
|
+
}
|
|
17842
|
+
if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
|
|
17843
|
+
nodeCollection.alignments = formatCollection.alignments;
|
|
17844
|
+
}
|
|
17845
|
+
if ((index === 0 && formatCollection.formats) || !formatCollection.formats) {
|
|
17846
|
+
nodeCollection.formats = formatCollection.formats;
|
|
17847
|
+
}
|
|
17848
|
+
if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
|
|
17849
|
+
nodeCollection.createlink = formatCollection.createlink;
|
|
17850
|
+
}
|
|
17851
|
+
if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
|
|
17852
|
+
nodeCollection.numberFormatList = formatCollection.numberFormatList;
|
|
17853
|
+
}
|
|
17854
|
+
if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
|
|
17855
|
+
nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
|
|
17856
|
+
}
|
|
17857
|
+
formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17858
|
+
}
|
|
17859
|
+
return nodeCollection;
|
|
17547
17860
|
}
|
|
17548
|
-
|
|
17549
|
-
|
|
17861
|
+
static getImmediateBlockNode(node) {
|
|
17862
|
+
do {
|
|
17863
|
+
node = node.parentNode;
|
|
17864
|
+
} while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
|
|
17865
|
+
return node;
|
|
17550
17866
|
}
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
* @param {Event} event - specifies the call back event
|
|
17561
|
-
* @param {Function} callBack - specifies the function
|
|
17562
|
-
* @param {string} text - specifies the string value
|
|
17563
|
-
* @param {T} exeValue - specifies the values to be executed
|
|
17564
|
-
* @param {string} selector - specifies the selector values
|
|
17565
|
-
* @returns {void}
|
|
17566
|
-
* @hidden
|
|
17567
|
-
* @deprecated
|
|
17568
|
-
*/
|
|
17569
|
-
/* eslint-enable */
|
|
17570
|
-
execCommand(command, value, event, callBack, text, exeValue, selector, enterAction) {
|
|
17571
|
-
switch (command.toLowerCase()) {
|
|
17572
|
-
case 'lists':
|
|
17573
|
-
this.observer.notify(LIST_TYPE, { subCommand: value, event: event, callBack: callBack,
|
|
17574
|
-
selector: selector, item: exeValue, enterAction: enterAction });
|
|
17575
|
-
break;
|
|
17576
|
-
case 'formats':
|
|
17577
|
-
this.observer.notify(FORMAT_TYPE, { subCommand: value, event: event, callBack: callBack,
|
|
17578
|
-
selector: selector, exeValue: exeValue, enterAction: enterAction
|
|
17579
|
-
});
|
|
17580
|
-
break;
|
|
17581
|
-
case 'alignments':
|
|
17582
|
-
this.observer.notify(ALIGNMENT_TYPE, {
|
|
17583
|
-
subCommand: value, event: event, callBack: callBack,
|
|
17584
|
-
selector: selector,
|
|
17585
|
-
value: exeValue
|
|
17586
|
-
});
|
|
17587
|
-
break;
|
|
17588
|
-
case 'indents':
|
|
17589
|
-
this.observer.notify(INDENT_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector });
|
|
17590
|
-
break;
|
|
17591
|
-
case 'links':
|
|
17592
|
-
this.observer.notify(LINK, { command: command, value: value, item: exeValue, event: event, callBack: callBack });
|
|
17593
|
-
break;
|
|
17594
|
-
case 'files':
|
|
17595
|
-
this.observer.notify(IMAGE, {
|
|
17596
|
-
command: command, value: 'Image', item: exeValue, event: event, callBack: callBack, selector: selector
|
|
17597
|
-
});
|
|
17598
|
-
break;
|
|
17599
|
-
case 'images':
|
|
17600
|
-
this.observer.notify(IMAGE, {
|
|
17601
|
-
command: command, value: value, item: exeValue, event: event, callBack: callBack, selector: selector
|
|
17602
|
-
});
|
|
17603
|
-
break;
|
|
17604
|
-
case 'audios':
|
|
17605
|
-
this.observer.notify(AUDIO, {
|
|
17606
|
-
command: command, value: value, item: exeValue, event: event, callBack: callBack, selector: selector
|
|
17607
|
-
});
|
|
17608
|
-
break;
|
|
17609
|
-
case 'videos':
|
|
17610
|
-
this.observer.notify(VIDEO, {
|
|
17611
|
-
command: command, value: value, item: exeValue, event: event, callBack: callBack, selector: selector
|
|
17612
|
-
});
|
|
17613
|
-
break;
|
|
17614
|
-
case 'table':
|
|
17615
|
-
switch (value.toString().toLocaleLowerCase()) {
|
|
17616
|
-
case 'createtable':
|
|
17617
|
-
this.observer.notify(TABLE, { item: exeValue, event: event, callBack: callBack, enterAction: enterAction });
|
|
17618
|
-
break;
|
|
17619
|
-
case 'insertrowbefore':
|
|
17620
|
-
case 'insertrowafter':
|
|
17621
|
-
this.observer.notify(INSERT_ROW, { item: exeValue, event: event, callBack: callBack });
|
|
17622
|
-
break;
|
|
17623
|
-
case 'insertcolumnleft':
|
|
17624
|
-
case 'insertcolumnright':
|
|
17625
|
-
this.observer.notify(INSERT_COLUMN, { item: exeValue, event: event, callBack: callBack });
|
|
17626
|
-
break;
|
|
17627
|
-
case 'deleterow':
|
|
17628
|
-
this.observer.notify(DELETEROW, { item: exeValue, event: event, callBack: callBack });
|
|
17629
|
-
break;
|
|
17630
|
-
case 'deletecolumn':
|
|
17631
|
-
this.observer.notify(DELETECOLUMN, { item: exeValue, event: event, callBack: callBack });
|
|
17632
|
-
break;
|
|
17633
|
-
case 'tableremove':
|
|
17634
|
-
this.observer.notify(REMOVETABLE, { item: exeValue, event: event, callBack: callBack });
|
|
17635
|
-
break;
|
|
17636
|
-
case 'tableheader':
|
|
17637
|
-
this.observer.notify(TABLEHEADER, { item: exeValue, event: event, callBack: callBack });
|
|
17638
|
-
break;
|
|
17639
|
-
case 'aligntop':
|
|
17640
|
-
case 'alignmiddle':
|
|
17641
|
-
case 'alignbottom':
|
|
17642
|
-
this.observer.notify(TABLE_VERTICAL_ALIGN, { item: exeValue, event: event, callBack: callBack });
|
|
17643
|
-
break;
|
|
17644
|
-
case 'merge':
|
|
17645
|
-
this.observer.notify(TABLE_MERGE, { item: exeValue, event: event, callBack: callBack });
|
|
17646
|
-
break;
|
|
17647
|
-
case 'horizontalsplit':
|
|
17648
|
-
this.observer.notify(TABLE_HORIZONTAL_SPLIT, { item: exeValue, event: event, callBack: callBack });
|
|
17649
|
-
break;
|
|
17650
|
-
case 'verticalsplit':
|
|
17651
|
-
this.observer.notify(TABLE_VERTICAL_SPLIT, { item: exeValue, event: event, callBack: callBack });
|
|
17652
|
-
break;
|
|
17653
|
-
}
|
|
17654
|
-
break;
|
|
17655
|
-
case 'font':
|
|
17656
|
-
case 'style':
|
|
17657
|
-
case 'effects':
|
|
17658
|
-
case 'casing':
|
|
17659
|
-
this.observer.notify(SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
|
|
17660
|
-
break;
|
|
17661
|
-
case 'inserthtml':
|
|
17662
|
-
this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
17663
|
-
break;
|
|
17664
|
-
case 'inserttext':
|
|
17665
|
-
this.observer.notify(INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
17666
|
-
break;
|
|
17667
|
-
case 'clear':
|
|
17668
|
-
this.observer.notify(CLEAR_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector, enterAction: enterAction });
|
|
17669
|
-
break;
|
|
17670
|
-
case 'actions':
|
|
17671
|
-
this.observer.notify(ACTION, { subCommand: value, event: event, callBack: callBack, selector: selector });
|
|
17672
|
-
break;
|
|
17673
|
-
}
|
|
17674
|
-
}
|
|
17675
|
-
}
|
|
17676
|
-
|
|
17677
|
-
/**
|
|
17678
|
-
* HTML adapter
|
|
17679
|
-
*
|
|
17680
|
-
* @hidden
|
|
17681
|
-
* @deprecated
|
|
17682
|
-
*/
|
|
17683
|
-
class HTMLFormatter extends Formatter {
|
|
17684
|
-
constructor(options) {
|
|
17685
|
-
super();
|
|
17686
|
-
this.initialize();
|
|
17687
|
-
extend(this, this, options, true);
|
|
17688
|
-
if (this.currentDocument && this.element) {
|
|
17689
|
-
this.updateFormatter(this.element, this.currentDocument, options.options);
|
|
17690
|
-
}
|
|
17691
|
-
}
|
|
17692
|
-
initialize() {
|
|
17693
|
-
this.keyConfig = htmlKeyConfig;
|
|
17694
|
-
}
|
|
17695
|
-
/**
|
|
17696
|
-
* Update the formatter of RichTextEditor
|
|
17697
|
-
*
|
|
17698
|
-
* @param {Element} editElement - specifies the edit element.
|
|
17699
|
-
* @param {Document} doc - specifies the doucment
|
|
17700
|
-
* @param {number} options - specifies the options
|
|
17701
|
-
* @returns {void}
|
|
17702
|
-
* @hidden
|
|
17703
|
-
* @deprecated
|
|
17704
|
-
*/
|
|
17705
|
-
updateFormatter(editElement, doc, options) {
|
|
17706
|
-
if (editElement && doc) {
|
|
17707
|
-
this.editorManager = new EditorManager({
|
|
17708
|
-
document: doc,
|
|
17709
|
-
editableElement: editElement,
|
|
17710
|
-
options: options
|
|
17711
|
-
});
|
|
17712
|
-
}
|
|
17713
|
-
}
|
|
17714
|
-
}
|
|
17715
|
-
|
|
17716
|
-
/**
|
|
17717
|
-
* Update Toolbar Status
|
|
17718
|
-
*
|
|
17719
|
-
* @hidden
|
|
17720
|
-
* @deprecated
|
|
17721
|
-
*/
|
|
17722
|
-
const statusCollection = getDefaultHtmlTbStatus();
|
|
17723
|
-
class ToolbarStatus {
|
|
17724
|
-
/**
|
|
17725
|
-
* get method
|
|
17726
|
-
*
|
|
17727
|
-
* @param {Document} docElement - specifies the document element
|
|
17728
|
-
* @param {Node} targetNode - specifies the target node
|
|
17729
|
-
* @param {string[]} formatNode - specifies the format node
|
|
17730
|
-
* @param {string[]} fontSize - specifies the font size
|
|
17731
|
-
* @param {string[]} fontName - specifies the font name.
|
|
17732
|
-
* @param {Node} documentNode - specifies the document node.
|
|
17733
|
-
* @returns {IToolbarStatus} - returns the toolbar status
|
|
17734
|
-
* @hidden
|
|
17735
|
-
* @deprecated
|
|
17736
|
-
*/
|
|
17737
|
-
static get(docElement, targetNode, formatNode, fontSize, fontName, documentNode) {
|
|
17738
|
-
let formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17739
|
-
const nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17740
|
-
const nodeSelection = new NodeSelection();
|
|
17741
|
-
const range = nodeSelection.getRange(docElement);
|
|
17742
|
-
const nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
17743
|
-
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
17744
|
-
const nodesLength = nodes.length;
|
|
17745
|
-
let isNodeChanged = false;
|
|
17746
|
-
for (let index = 0; index < nodes.length; index++) {
|
|
17747
|
-
while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
|
|
17748
|
-
nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
|
|
17749
|
-
(this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
|
|
17750
|
-
range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
|
|
17751
|
-
nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
|
|
17752
|
-
nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
|
|
17753
|
-
isNodeChanged = true;
|
|
17754
|
-
}
|
|
17755
|
-
if (isNodeChanged && nodes[index]) {
|
|
17756
|
-
nodeSelection.setCursorPoint(docElement, nodes[index], nodes[index].textContent.length);
|
|
17757
|
-
isNodeChanged = false;
|
|
17758
|
-
}
|
|
17759
|
-
if ((nodes[index].nodeName !== 'BR' && nodes[index].nodeType !== 3) ||
|
|
17760
|
-
(nodesLength > 1 && nodes[index].nodeType === 3 && nodes[index].textContent.trim() === '')) {
|
|
17761
|
-
nodes.splice(index, 1);
|
|
17762
|
-
index--;
|
|
17763
|
-
}
|
|
17764
|
-
}
|
|
17765
|
-
for (let index = 0; index < nodes.length; index++) {
|
|
17766
|
-
// eslint-disable-next-line max-len
|
|
17767
|
-
formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
|
|
17768
|
-
if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
|
|
17769
|
-
nodeCollection.bold = formatCollection.bold;
|
|
17770
|
-
}
|
|
17771
|
-
if ((index === 0 && formatCollection.insertcode) || !formatCollection.insertcode) {
|
|
17772
|
-
nodeCollection.insertcode = formatCollection.insertcode;
|
|
17773
|
-
}
|
|
17774
|
-
if ((index === 0 && formatCollection.italic) || !formatCollection.italic) {
|
|
17775
|
-
nodeCollection.italic = formatCollection.italic;
|
|
17776
|
-
}
|
|
17777
|
-
if ((index === 0 && formatCollection.underline) || !formatCollection.underline) {
|
|
17778
|
-
nodeCollection.underline = formatCollection.underline;
|
|
17779
|
-
}
|
|
17780
|
-
if ((index === 0 && formatCollection.strikethrough) || !formatCollection.strikethrough) {
|
|
17781
|
-
nodeCollection.strikethrough = formatCollection.strikethrough;
|
|
17782
|
-
}
|
|
17783
|
-
if ((index === 0 && formatCollection.superscript) || !formatCollection.superscript) {
|
|
17784
|
-
nodeCollection.superscript = formatCollection.superscript;
|
|
17785
|
-
}
|
|
17786
|
-
if ((index === 0 && formatCollection.subscript) || !formatCollection.subscript) {
|
|
17787
|
-
nodeCollection.subscript = formatCollection.subscript;
|
|
17788
|
-
}
|
|
17789
|
-
if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
|
|
17790
|
-
nodeCollection.fontcolor = formatCollection.fontcolor;
|
|
17791
|
-
}
|
|
17792
|
-
if ((index === 0 && formatCollection.fontname) || !formatCollection.fontname) {
|
|
17793
|
-
nodeCollection.fontname = formatCollection.fontname;
|
|
17794
|
-
}
|
|
17795
|
-
if ((index === 0 && formatCollection.fontsize) || !formatCollection.fontsize) {
|
|
17796
|
-
nodeCollection.fontsize = formatCollection.fontsize;
|
|
17797
|
-
}
|
|
17798
|
-
if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
|
|
17799
|
-
nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
|
|
17800
|
-
}
|
|
17801
|
-
if ((index === 0 && formatCollection.orderedlist) || !formatCollection.orderedlist) {
|
|
17802
|
-
nodeCollection.orderedlist = formatCollection.orderedlist;
|
|
17803
|
-
}
|
|
17804
|
-
if ((index === 0 && formatCollection.unorderedlist) || !formatCollection.unorderedlist) {
|
|
17805
|
-
nodeCollection.unorderedlist = formatCollection.unorderedlist;
|
|
17806
|
-
}
|
|
17807
|
-
if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
|
|
17808
|
-
nodeCollection.alignments = formatCollection.alignments;
|
|
17809
|
-
}
|
|
17810
|
-
if ((index === 0 && formatCollection.formats) || !formatCollection.formats) {
|
|
17811
|
-
nodeCollection.formats = formatCollection.formats;
|
|
17812
|
-
}
|
|
17813
|
-
if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
|
|
17814
|
-
nodeCollection.createlink = formatCollection.createlink;
|
|
17815
|
-
}
|
|
17816
|
-
if ((index === 0 && formatCollection.numberFormatList) || !formatCollection.numberFormatList) {
|
|
17817
|
-
nodeCollection.numberFormatList = formatCollection.numberFormatList;
|
|
17818
|
-
}
|
|
17819
|
-
if ((index === 0 && formatCollection.bulletFormatList) || !formatCollection.bulletFormatList) {
|
|
17820
|
-
nodeCollection.bulletFormatList = formatCollection.bulletFormatList;
|
|
17821
|
-
}
|
|
17822
|
-
formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17823
|
-
}
|
|
17824
|
-
return nodeCollection;
|
|
17825
|
-
}
|
|
17826
|
-
static getImmediateBlockNode(node) {
|
|
17827
|
-
do {
|
|
17828
|
-
node = node.parentNode;
|
|
17829
|
-
} while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
|
|
17830
|
-
return node;
|
|
17831
|
-
}
|
|
17832
|
-
static getFormatParent(docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
|
|
17833
|
-
if (targetNode.contains(node) ||
|
|
17834
|
-
(node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
|
|
17835
|
-
do {
|
|
17836
|
-
formatCollection = this.isFormattedNode(docElement, formatCollection, node, formatNode, fontSize, fontName);
|
|
17837
|
-
node = node.parentNode;
|
|
17838
|
-
} while (node && (node !== targetNode));
|
|
17839
|
-
}
|
|
17840
|
-
return formatCollection;
|
|
17867
|
+
static getFormatParent(docElement, formatCollection, node, targetNode, formatNode, fontSize, fontName) {
|
|
17868
|
+
if (targetNode.contains(node) ||
|
|
17869
|
+
(node.nodeType === 3 && targetNode.nodeType !== 3 && targetNode.contains(node.parentNode))) {
|
|
17870
|
+
do {
|
|
17871
|
+
formatCollection = this.isFormattedNode(docElement, formatCollection, node, formatNode, fontSize, fontName);
|
|
17872
|
+
node = node.parentNode;
|
|
17873
|
+
} while (node && (node !== targetNode));
|
|
17874
|
+
}
|
|
17875
|
+
return formatCollection;
|
|
17841
17876
|
}
|
|
17842
17877
|
static isFormattedNode(docElement, formatCollection, node, formatNode, fontSize, fontName) {
|
|
17843
17878
|
if (!formatCollection.bold) {
|
|
@@ -17958,100 +17993,803 @@ class ToolbarStatus {
|
|
|
17958
17993
|
return (index !== null) ? fontName[index] : name.replace(/"/g, '');
|
|
17959
17994
|
}
|
|
17960
17995
|
else {
|
|
17961
|
-
return null;
|
|
17996
|
+
return null;
|
|
17997
|
+
}
|
|
17998
|
+
}
|
|
17999
|
+
static isOrderedList(node) {
|
|
18000
|
+
if (node.nodeName.toLocaleLowerCase() === 'ol') {
|
|
18001
|
+
return true;
|
|
18002
|
+
}
|
|
18003
|
+
else {
|
|
18004
|
+
return false;
|
|
18005
|
+
}
|
|
18006
|
+
}
|
|
18007
|
+
static isUnorderedList(node) {
|
|
18008
|
+
if (node.nodeName.toLocaleLowerCase() === 'ul') {
|
|
18009
|
+
return true;
|
|
18010
|
+
}
|
|
18011
|
+
else {
|
|
18012
|
+
return false;
|
|
18013
|
+
}
|
|
18014
|
+
}
|
|
18015
|
+
static isAlignment(node) {
|
|
18016
|
+
const align = node.style && node.style.textAlign;
|
|
18017
|
+
if (align === 'left') {
|
|
18018
|
+
return 'justifyleft';
|
|
18019
|
+
}
|
|
18020
|
+
else if (align === 'center') {
|
|
18021
|
+
return 'justifycenter';
|
|
18022
|
+
}
|
|
18023
|
+
else if (align === 'right') {
|
|
18024
|
+
return 'justifyright';
|
|
18025
|
+
}
|
|
18026
|
+
else if (align === 'justify') {
|
|
18027
|
+
return 'justifyfull';
|
|
18028
|
+
}
|
|
18029
|
+
else {
|
|
18030
|
+
return null;
|
|
18031
|
+
}
|
|
18032
|
+
}
|
|
18033
|
+
static isFormats(node, formatNode) {
|
|
18034
|
+
if (((formatNode === undefined || formatNode === null)
|
|
18035
|
+
&& BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) > -1)
|
|
18036
|
+
|| (formatNode !== null && formatNode !== undefined
|
|
18037
|
+
&& formatNode.indexOf(node.nodeName.toLocaleLowerCase()) > -1)) {
|
|
18038
|
+
return node.nodeName.toLocaleLowerCase();
|
|
18039
|
+
}
|
|
18040
|
+
else {
|
|
18041
|
+
return null;
|
|
18042
|
+
}
|
|
18043
|
+
}
|
|
18044
|
+
static getComputedStyle(docElement, node, prop) {
|
|
18045
|
+
return docElement.defaultView.getComputedStyle(node, null).getPropertyValue(prop);
|
|
18046
|
+
}
|
|
18047
|
+
static isNumberFormatList(node) {
|
|
18048
|
+
const list = node.style && node.style.listStyleType;
|
|
18049
|
+
if (list === 'lower-alpha') {
|
|
18050
|
+
return 'Lower Alpha';
|
|
18051
|
+
}
|
|
18052
|
+
else if (list === 'number') {
|
|
18053
|
+
return 'Number';
|
|
18054
|
+
}
|
|
18055
|
+
else if (list === 'upper-alpha') {
|
|
18056
|
+
return 'Upper Alpha';
|
|
18057
|
+
}
|
|
18058
|
+
else if (list === 'lower-roman') {
|
|
18059
|
+
return 'Lower Roman';
|
|
18060
|
+
}
|
|
18061
|
+
else if (list === 'upper-roman') {
|
|
18062
|
+
return 'Upper Roman';
|
|
18063
|
+
}
|
|
18064
|
+
else if (list === 'lower-greek') {
|
|
18065
|
+
return 'Lower Greek';
|
|
18066
|
+
}
|
|
18067
|
+
else if (list === 'none') {
|
|
18068
|
+
return 'None';
|
|
18069
|
+
}
|
|
18070
|
+
else {
|
|
18071
|
+
return null;
|
|
18072
|
+
}
|
|
18073
|
+
}
|
|
18074
|
+
static isBulletFormatList(node) {
|
|
18075
|
+
const list = node.style && node.style.listStyleType;
|
|
18076
|
+
if (list === 'circle') {
|
|
18077
|
+
return 'Circle';
|
|
18078
|
+
}
|
|
18079
|
+
else if (list === 'square') {
|
|
18080
|
+
return 'Square';
|
|
18081
|
+
}
|
|
18082
|
+
else if (list === 'none') {
|
|
18083
|
+
return 'None';
|
|
18084
|
+
}
|
|
18085
|
+
else if (list === 'disc') {
|
|
18086
|
+
return 'Disc';
|
|
18087
|
+
}
|
|
18088
|
+
else {
|
|
18089
|
+
return null;
|
|
18090
|
+
}
|
|
18091
|
+
}
|
|
18092
|
+
}
|
|
18093
|
+
|
|
18094
|
+
/**
|
|
18095
|
+
* Base export
|
|
18096
|
+
*/
|
|
18097
|
+
|
|
18098
|
+
class FormatPainterActions {
|
|
18099
|
+
constructor(parent, options) {
|
|
18100
|
+
this.parent = parent;
|
|
18101
|
+
this.settings = options;
|
|
18102
|
+
this.addEventListener();
|
|
18103
|
+
this.setDeniedFormats();
|
|
18104
|
+
}
|
|
18105
|
+
addEventListener() {
|
|
18106
|
+
this.parent.observer.on(FORMAT_PAINTER_ACTIONS, this.actionHandler, this);
|
|
18107
|
+
}
|
|
18108
|
+
actionHandler(args) {
|
|
18109
|
+
if (!isNullOrUndefined(args) && !isNullOrUndefined(args.item) && !isNullOrUndefined(args.item.formatPainterAction)) {
|
|
18110
|
+
switch (args.item.formatPainterAction) {
|
|
18111
|
+
case 'format-copy':
|
|
18112
|
+
this.copyAction();
|
|
18113
|
+
break;
|
|
18114
|
+
case 'format-paste':
|
|
18115
|
+
this.pasteAction();
|
|
18116
|
+
break;
|
|
18117
|
+
case 'escape':
|
|
18118
|
+
this.escapeAction();
|
|
18119
|
+
break;
|
|
18120
|
+
}
|
|
18121
|
+
}
|
|
18122
|
+
}
|
|
18123
|
+
generateElement() {
|
|
18124
|
+
const copyCollection = this.copyCollection.slice(); // To clone without reversing the collcection array
|
|
18125
|
+
copyCollection.reverse();
|
|
18126
|
+
const length = copyCollection.length;
|
|
18127
|
+
const elemCollection = createElement('div', { className: 'e-format-paste-wrapper' });
|
|
18128
|
+
let lastAppendChild;
|
|
18129
|
+
for (let i = 0; i < length; i++) {
|
|
18130
|
+
const { attrs, className, styles, tagName } = copyCollection[i];
|
|
18131
|
+
const elem = createElement(tagName);
|
|
18132
|
+
if (className !== '') {
|
|
18133
|
+
elem.className = className;
|
|
18134
|
+
}
|
|
18135
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
18136
|
+
const property = attrs[i].name;
|
|
18137
|
+
const value = attrs[i].value;
|
|
18138
|
+
elem.setAttribute(property, value);
|
|
18139
|
+
}
|
|
18140
|
+
for (let i = 0; i < styles.length; i++) {
|
|
18141
|
+
const property = styles[i].property;
|
|
18142
|
+
const value = styles[i].value;
|
|
18143
|
+
const priority = styles[i].priority;
|
|
18144
|
+
elem.style.setProperty(property, value, priority);
|
|
18145
|
+
}
|
|
18146
|
+
if (elemCollection.childElementCount === 0) {
|
|
18147
|
+
elemCollection.append(elem);
|
|
18148
|
+
lastAppendChild = elem;
|
|
18149
|
+
}
|
|
18150
|
+
else {
|
|
18151
|
+
lastAppendChild.append(elem);
|
|
18152
|
+
lastAppendChild = elem;
|
|
18153
|
+
}
|
|
18154
|
+
}
|
|
18155
|
+
const elemChild = this.removeDeniedFormats(elemCollection);
|
|
18156
|
+
let currentElem = elemChild;
|
|
18157
|
+
while (currentElem) {
|
|
18158
|
+
if (currentElem.firstChild === null) {
|
|
18159
|
+
lastAppendChild = currentElem;
|
|
18160
|
+
currentElem = undefined;
|
|
18161
|
+
}
|
|
18162
|
+
else {
|
|
18163
|
+
currentElem = currentElem.firstChild;
|
|
18164
|
+
}
|
|
18165
|
+
}
|
|
18166
|
+
this.newElem = elemChild;
|
|
18167
|
+
this.newElemLastChild = lastAppendChild;
|
|
18168
|
+
}
|
|
18169
|
+
pasteAction() {
|
|
18170
|
+
if (isNullOrUndefined(this.copyCollection) || this.copyCollection.length === 0) {
|
|
18171
|
+
this.paintPlainTextFormat();
|
|
18172
|
+
return;
|
|
18173
|
+
}
|
|
18174
|
+
this.insertFormatNode(this.newElem, this.newElemLastChild);
|
|
18175
|
+
this.parent.undoRedoManager.saveData();
|
|
18176
|
+
}
|
|
18177
|
+
removeDeniedFormats(parentElement) {
|
|
18178
|
+
if (!isNullOrUndefined(this.deniedFormatsCollection) && this.deniedFormatsCollection.length > 0) {
|
|
18179
|
+
const deniedPropArray = this.deniedFormatsCollection;
|
|
18180
|
+
const length = deniedPropArray.length;
|
|
18181
|
+
for (let i = 0; i < length; i++) {
|
|
18182
|
+
const tag = deniedPropArray[i].tag;
|
|
18183
|
+
if (deniedPropArray[i].tag) {
|
|
18184
|
+
const elementsList = parentElement.querySelectorAll(tag);
|
|
18185
|
+
for (let j = 0; j < elementsList.length; j++) {
|
|
18186
|
+
if (deniedPropArray[i].classes.length > 0) {
|
|
18187
|
+
const classes = deniedPropArray[i].classes;
|
|
18188
|
+
const classLength = classes.length;
|
|
18189
|
+
for (let k = 0; k < classLength; k++) {
|
|
18190
|
+
if (elementsList[j].classList.contains(classes[k])) {
|
|
18191
|
+
removeClass([elementsList[j]], classes[k]);
|
|
18192
|
+
}
|
|
18193
|
+
}
|
|
18194
|
+
if (elementsList[j].classList.length === 0) {
|
|
18195
|
+
elementsList[j].removeAttribute('class');
|
|
18196
|
+
}
|
|
18197
|
+
}
|
|
18198
|
+
if (deniedPropArray[i].styles.length > 0) {
|
|
18199
|
+
const styles = deniedPropArray[i].styles;
|
|
18200
|
+
const styleLength = styles.length;
|
|
18201
|
+
for (let k = 0; k < styleLength; k++) {
|
|
18202
|
+
elementsList[j].style.removeProperty(styles[k]);
|
|
18203
|
+
}
|
|
18204
|
+
if (elementsList[j].style.length === 0) {
|
|
18205
|
+
elementsList[j].removeAttribute('style');
|
|
18206
|
+
}
|
|
18207
|
+
}
|
|
18208
|
+
if (deniedPropArray[i].attributes.length > 0) {
|
|
18209
|
+
const attributes$$1 = deniedPropArray[i].attributes;
|
|
18210
|
+
const attributeLength = attributes$$1.length;
|
|
18211
|
+
for (let k = 0; k < attributeLength; k++) {
|
|
18212
|
+
elementsList[j].removeAttribute(attributes$$1[k]);
|
|
18213
|
+
}
|
|
18214
|
+
}
|
|
18215
|
+
}
|
|
18216
|
+
}
|
|
18217
|
+
}
|
|
18218
|
+
}
|
|
18219
|
+
return parentElement.firstElementChild;
|
|
18220
|
+
}
|
|
18221
|
+
copyAction() {
|
|
18222
|
+
const copyCollection = [];
|
|
18223
|
+
const range = this.parent.nodeSelection.getRange(document);
|
|
18224
|
+
let parentElem = range.startContainer.parentElement;
|
|
18225
|
+
let currentContext = this.findCurrentContext(parentElem);
|
|
18226
|
+
const allowedRulesArray = this.settings.allowedFormats.split(';');
|
|
18227
|
+
for (let i = 0; i < allowedRulesArray.length; i++) {
|
|
18228
|
+
allowedRulesArray[i] = allowedRulesArray[i].trim();
|
|
18229
|
+
}
|
|
18230
|
+
const [rangeParentElem, context] = this.getRangeParentElem(currentContext, range);
|
|
18231
|
+
if (currentContext === null) {
|
|
18232
|
+
currentContext = context;
|
|
18233
|
+
}
|
|
18234
|
+
if (!isNullOrUndefined(currentContext) && this.settings.allowedContext.indexOf(currentContext) > -1) {
|
|
18235
|
+
if (range.startContainer.nodeName === '#text') {
|
|
18236
|
+
parentElem = range.startContainer.parentElement;
|
|
18237
|
+
}
|
|
18238
|
+
const lastElement = parentElem;
|
|
18239
|
+
do {
|
|
18240
|
+
if (allowedRulesArray.indexOf(parentElem.nodeName.toLowerCase()) > -1) {
|
|
18241
|
+
const allAttributes = parentElem.attributes;
|
|
18242
|
+
const attribute = [];
|
|
18243
|
+
for (let i = 0; i < allAttributes.length; i++) {
|
|
18244
|
+
if (allAttributes[i].name !== 'class' && allAttributes[i].name !== 'style') {
|
|
18245
|
+
attribute.push(allAttributes[i]);
|
|
18246
|
+
}
|
|
18247
|
+
}
|
|
18248
|
+
const classes = parentElem.className;
|
|
18249
|
+
const allStyles = parentElem.style;
|
|
18250
|
+
const styleProp = [];
|
|
18251
|
+
for (let i = 0; i < allStyles.length; i++) {
|
|
18252
|
+
const property = allStyles[i];
|
|
18253
|
+
const value = allStyles.getPropertyValue(property);
|
|
18254
|
+
const priority = allStyles.getPropertyPriority(property);
|
|
18255
|
+
styleProp.push({ property: property, value: value, priority: priority });
|
|
18256
|
+
}
|
|
18257
|
+
copyCollection.push({
|
|
18258
|
+
attrs: attribute, className: classes, styles: styleProp, tagName: parentElem.nodeName
|
|
18259
|
+
});
|
|
18260
|
+
}
|
|
18261
|
+
if (rangeParentElem === parentElem) {
|
|
18262
|
+
parentElem = undefined;
|
|
18263
|
+
}
|
|
18264
|
+
else if (!isNullOrUndefined(parentElem.parentElement)) {
|
|
18265
|
+
parentElem = parentElem.parentElement;
|
|
18266
|
+
}
|
|
18267
|
+
if (lastElement === parentElem) {
|
|
18268
|
+
break;
|
|
18269
|
+
}
|
|
18270
|
+
} while (!isNullOrUndefined(parentElem) || parentElem === this.parent.editableElement);
|
|
18271
|
+
this.copyCollection = copyCollection;
|
|
18272
|
+
}
|
|
18273
|
+
this.generateElement();
|
|
18274
|
+
}
|
|
18275
|
+
getRangeParentElem(currentContext, range) {
|
|
18276
|
+
let startContainer = range.startContainer;
|
|
18277
|
+
let rangeParentELem;
|
|
18278
|
+
if (startContainer.nodeType === 3) {
|
|
18279
|
+
startContainer = startContainer.parentElement;
|
|
18280
|
+
}
|
|
18281
|
+
switch (currentContext) {
|
|
18282
|
+
case 'Table':
|
|
18283
|
+
rangeParentELem = closest(startContainer, 'td');
|
|
18284
|
+
if (isNullOrUndefined(rangeParentELem)) {
|
|
18285
|
+
rangeParentELem = closest(startContainer, 'th');
|
|
18286
|
+
}
|
|
18287
|
+
break;
|
|
18288
|
+
case 'List':
|
|
18289
|
+
rangeParentELem = closest(startContainer, 'li');
|
|
18290
|
+
break;
|
|
18291
|
+
case 'Text':
|
|
18292
|
+
rangeParentELem = closest(startContainer, 'p');
|
|
18293
|
+
break;
|
|
18294
|
+
}
|
|
18295
|
+
if (isNullOrUndefined(rangeParentELem)) {
|
|
18296
|
+
const nearBlockParentName = this.getNearestBlockParentElement(range);
|
|
18297
|
+
if (!isNullOrUndefined(nearBlockParentName) && nearBlockParentName !== 'UL' &&
|
|
18298
|
+
nearBlockParentName !== 'OL' && nearBlockParentName !== 'LI') {
|
|
18299
|
+
rangeParentELem = closest(startContainer, nearBlockParentName);
|
|
18300
|
+
currentContext = 'Text';
|
|
18301
|
+
}
|
|
18302
|
+
}
|
|
18303
|
+
if (currentContext === 'List') {
|
|
18304
|
+
rangeParentELem = rangeParentELem.parentElement;
|
|
18305
|
+
}
|
|
18306
|
+
return [rangeParentELem, currentContext];
|
|
18307
|
+
}
|
|
18308
|
+
getNearestBlockParentElement(range) {
|
|
18309
|
+
let node = range.commonAncestorContainer;
|
|
18310
|
+
if (node.nodeType === 3) {
|
|
18311
|
+
node = node.parentNode;
|
|
18312
|
+
}
|
|
18313
|
+
// iterate untill the content editable div
|
|
18314
|
+
while (node && node !== this.parent.editableElement) {
|
|
18315
|
+
// If true return the block node name.
|
|
18316
|
+
if (!isNullOrUndefined(node) && this.isBlockElement(node)) {
|
|
18317
|
+
return node.nodeName;
|
|
18318
|
+
}
|
|
18319
|
+
// if false re assign node to parent node
|
|
18320
|
+
node = node.parentNode;
|
|
18321
|
+
}
|
|
18322
|
+
return null;
|
|
18323
|
+
}
|
|
18324
|
+
isBlockElement(node) {
|
|
18325
|
+
const blockTags = ['P', 'DIV', 'UL', 'OL', 'LI', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6',
|
|
18326
|
+
'ADDRESS', 'ARTICLE', 'ASIDE', 'BLOCKQUOTE', 'FIGCAPTION', 'FIGURE', 'FOOTER', 'HEADER',
|
|
18327
|
+
'HR', 'MAIN', 'NAV', 'SECTION', 'SUMMARY', 'PRE'];
|
|
18328
|
+
return blockTags.indexOf(node.nodeName) > -1;
|
|
18329
|
+
}
|
|
18330
|
+
escapeAction() {
|
|
18331
|
+
this.copyCollection = [];
|
|
18332
|
+
}
|
|
18333
|
+
paintPlainTextFormat() {
|
|
18334
|
+
const range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
18335
|
+
const domSelection = this.parent.nodeSelection;
|
|
18336
|
+
const nodes = range.collapsed ? domSelection.getSelectionNodeCollection(range) :
|
|
18337
|
+
domSelection.getSelectionNodeCollectionBr(range);
|
|
18338
|
+
let isInValid;
|
|
18339
|
+
if (nodes.length > 1) {
|
|
18340
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
18341
|
+
isInValid = this.validateELementTag(nodes[i]);
|
|
18342
|
+
}
|
|
18343
|
+
}
|
|
18344
|
+
else {
|
|
18345
|
+
isInValid = this.validateELementTag(range.startContainer) && this.validateELementTag(range.endContainer);
|
|
17962
18346
|
}
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
if (node.nodeName.toLocaleLowerCase() === 'ol') {
|
|
17966
|
-
return true;
|
|
18347
|
+
if (!isInValid) {
|
|
18348
|
+
this.parent.execCommand('Clear', 'ClearFormat', null, null);
|
|
17967
18349
|
}
|
|
17968
|
-
|
|
17969
|
-
|
|
18350
|
+
}
|
|
18351
|
+
validateELementTag(node) {
|
|
18352
|
+
const INVALID_TAGS = ['A', 'AUDIO', 'IMG', 'VIDEO', 'IFRAME'];
|
|
18353
|
+
if (node.nodeType === 3) {
|
|
18354
|
+
node = node.parentElement;
|
|
17970
18355
|
}
|
|
18356
|
+
return INVALID_TAGS.indexOf(node.tagName) > -1;
|
|
17971
18357
|
}
|
|
17972
|
-
|
|
17973
|
-
if (
|
|
17974
|
-
return
|
|
18358
|
+
findCurrentContext(parentElem) {
|
|
18359
|
+
if (closest(parentElem, 'td') || closest(parentElem, 'tr') || closest(parentElem, 'tbody')) {
|
|
18360
|
+
return 'Table';
|
|
17975
18361
|
}
|
|
17976
|
-
else {
|
|
17977
|
-
return
|
|
18362
|
+
else if (closest(parentElem, 'li')) {
|
|
18363
|
+
return 'List';
|
|
18364
|
+
}
|
|
18365
|
+
else if (closest(parentElem, 'p')) {
|
|
18366
|
+
return 'Text';
|
|
17978
18367
|
}
|
|
18368
|
+
return null;
|
|
17979
18369
|
}
|
|
17980
|
-
|
|
17981
|
-
const
|
|
17982
|
-
|
|
17983
|
-
|
|
18370
|
+
insertFormatNode(elem, lastChild) {
|
|
18371
|
+
const endNode = this.parent.editableElement;
|
|
18372
|
+
const docElement = this.parent.currentDocument;
|
|
18373
|
+
const domSelection = this.parent.nodeSelection;
|
|
18374
|
+
const clonedElem = elem.cloneNode(true);
|
|
18375
|
+
let childElem = clonedElem.firstChild;
|
|
18376
|
+
let inlineElement;
|
|
18377
|
+
while (childElem) {
|
|
18378
|
+
if (this.isBlockElement(childElem)) {
|
|
18379
|
+
childElem = childElem.firstChild;
|
|
18380
|
+
}
|
|
18381
|
+
else {
|
|
18382
|
+
inlineElement = childElem.parentNode.removeChild(childElem);
|
|
18383
|
+
break;
|
|
18384
|
+
}
|
|
17984
18385
|
}
|
|
17985
|
-
|
|
17986
|
-
|
|
18386
|
+
const formatValues = {
|
|
18387
|
+
element: inlineElement,
|
|
18388
|
+
lastChild: lastChild
|
|
18389
|
+
};
|
|
18390
|
+
SelectionCommands.applyFormat(docElement, null, endNode, 'P', 'formatPainter', null, formatValues);
|
|
18391
|
+
let isFullNodeSelected;
|
|
18392
|
+
const range = this.parent.nodeSelection.getRange(docElement);
|
|
18393
|
+
const isCollapsed = range.collapsed;
|
|
18394
|
+
const nodes = range.collapsed ? domSelection.getSelectionNodeCollection(range) :
|
|
18395
|
+
domSelection.getSelectionNodeCollectionBr(range);
|
|
18396
|
+
if (nodes.length === 1) {
|
|
18397
|
+
while (!this.isBlockElement(nodes[0])) {
|
|
18398
|
+
nodes[0] = nodes[0].parentElement;
|
|
18399
|
+
}
|
|
18400
|
+
isFullNodeSelected = nodes[0].textContent.trim() === range.commonAncestorContainer.wholeText.trim();
|
|
17987
18401
|
}
|
|
17988
|
-
|
|
17989
|
-
|
|
18402
|
+
if (this.isBlockElement(elem) && isCollapsed || nodes.length > 1 || isFullNodeSelected) {
|
|
18403
|
+
this.insertBlockNode(elem, range, docElement, endNode, nodes);
|
|
17990
18404
|
}
|
|
17991
|
-
|
|
17992
|
-
|
|
18405
|
+
}
|
|
18406
|
+
insertBlockNode(element, range, docElement, endNode, nodes) {
|
|
18407
|
+
const domSelection = this.parent.nodeSelection;
|
|
18408
|
+
let listElement; // To clone to multiple list elements
|
|
18409
|
+
let cloneListParentNode;
|
|
18410
|
+
if (element.nodeName === 'UL' || element.nodeName === 'OL') {
|
|
18411
|
+
cloneListParentNode = element.cloneNode(true);
|
|
18412
|
+
listElement = cloneListParentNode.firstChild;
|
|
18413
|
+
}
|
|
18414
|
+
const textNode = range.startContainer; // To set cursor position
|
|
18415
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
18416
|
+
const lastTextNode = nodes[index];
|
|
18417
|
+
if (nodes[index].nodeType === 3) {
|
|
18418
|
+
nodes[index] = nodes[index].parentElement;
|
|
18419
|
+
}
|
|
18420
|
+
while (!this.isBlockElement(nodes[index])) {
|
|
18421
|
+
nodes[index] = nodes[index].parentElement;
|
|
18422
|
+
}
|
|
18423
|
+
let cloneParentNode;
|
|
18424
|
+
if (!isNullOrUndefined(cloneListParentNode)) {
|
|
18425
|
+
cloneParentNode = listElement.cloneNode(true);
|
|
18426
|
+
}
|
|
18427
|
+
else {
|
|
18428
|
+
cloneParentNode = element.cloneNode(true);
|
|
18429
|
+
}
|
|
18430
|
+
// Appending all the child elements
|
|
18431
|
+
while (nodes[index].firstChild) {
|
|
18432
|
+
if (cloneParentNode.nodeName === 'LI') {
|
|
18433
|
+
cloneParentNode.appendChild(nodes[index].firstChild);
|
|
18434
|
+
}
|
|
18435
|
+
else {
|
|
18436
|
+
// Except list nodes other block nodes replaced here
|
|
18437
|
+
if (nodes[index].nodeType === 3) {
|
|
18438
|
+
cloneParentNode.appendChild(nodes[index].firstChild);
|
|
18439
|
+
}
|
|
18440
|
+
else {
|
|
18441
|
+
cloneParentNode.innerHTML = nodes[index].innerHTML;
|
|
18442
|
+
nodes[index].innerHTML = '';
|
|
18443
|
+
}
|
|
18444
|
+
nodes[index] = nodes[index].parentNode.replaceChild(cloneParentNode, nodes[index]);
|
|
18445
|
+
}
|
|
18446
|
+
}
|
|
18447
|
+
if (cloneParentNode.nodeName === 'LI') {
|
|
18448
|
+
// Appending the li nodes to the ol or ul node
|
|
18449
|
+
cloneListParentNode.append(cloneParentNode);
|
|
18450
|
+
if (index === 0) {
|
|
18451
|
+
const nodeName = nodes[index].nodeName;
|
|
18452
|
+
nodes[index] = nodes[index].parentNode.replaceChild(cloneListParentNode, nodes[index]);
|
|
18453
|
+
const parent = nodeName === 'LI' ? cloneListParentNode.parentElement
|
|
18454
|
+
: cloneListParentNode;
|
|
18455
|
+
// Splicing and then inserting the node to previous element sibling of the Listparent.parent
|
|
18456
|
+
this.parent.nodeCutter.SplitNode(range, parent, true);
|
|
18457
|
+
if (!isNullOrUndefined(parent.previousElementSibling)) {
|
|
18458
|
+
parent.parentNode.insertBefore(cloneListParentNode, parent.nextElementSibling);
|
|
18459
|
+
}
|
|
18460
|
+
else {
|
|
18461
|
+
parent.parentElement.insertBefore(cloneListParentNode, parent);
|
|
18462
|
+
}
|
|
18463
|
+
}
|
|
18464
|
+
detach(nodes[index]);
|
|
18465
|
+
}
|
|
18466
|
+
/**Removing the inserted block node in list and appending to previous element sibling */
|
|
18467
|
+
if (cloneParentNode.nodeName !== 'LI' && (cloneParentNode.parentElement.nodeName === 'OL' ||
|
|
18468
|
+
cloneParentNode.parentElement.nodeName === 'UL')) {
|
|
18469
|
+
const parent = cloneParentNode.parentElement;
|
|
18470
|
+
// Cutting single ul or ol to two ul or ol based on the range
|
|
18471
|
+
this.parent.nodeCutter.SplitNode(range, parent, true);
|
|
18472
|
+
if (!isNullOrUndefined(parent.previousElementSibling)) {
|
|
18473
|
+
parent.previousElementSibling.after(cloneParentNode);
|
|
18474
|
+
}
|
|
18475
|
+
else {
|
|
18476
|
+
parent.parentElement.prepend(cloneParentNode);
|
|
18477
|
+
}
|
|
18478
|
+
}
|
|
18479
|
+
nodes[index] = lastTextNode;
|
|
18480
|
+
}
|
|
18481
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
18482
|
+
!isNullOrUndefined(listElement) ? detach(listElement) : false;
|
|
18483
|
+
this.cleanEmptyLists();
|
|
18484
|
+
if (nodes.length > 1) {
|
|
18485
|
+
const startSelectNode = nodes[0];
|
|
18486
|
+
const endSelectNode = nodes[nodes.length - 1];
|
|
18487
|
+
domSelection.setSelectionText(docElement, startSelectNode, endSelectNode, 0, endSelectNode.textContent.length);
|
|
17993
18488
|
}
|
|
17994
18489
|
else {
|
|
17995
|
-
|
|
18490
|
+
domSelection.setCursorPoint(docElement, textNode, textNode.textContent.length);
|
|
18491
|
+
}
|
|
18492
|
+
}
|
|
18493
|
+
cleanEmptyLists() {
|
|
18494
|
+
const listElem = this.parent.editableElement.querySelectorAll('ol, ul');
|
|
18495
|
+
for (let i = 0; i < listElem.length; i++) {
|
|
18496
|
+
if (listElem[i].textContent.trim() === '') {
|
|
18497
|
+
detach(listElem[i]);
|
|
18498
|
+
}
|
|
18499
|
+
}
|
|
18500
|
+
}
|
|
18501
|
+
setDeniedFormats() {
|
|
18502
|
+
const deniedFormatsCollection = [];
|
|
18503
|
+
if (isNullOrUndefined(this.settings) || isNullOrUndefined(this.settings.deniedFormats)) {
|
|
18504
|
+
return;
|
|
18505
|
+
}
|
|
18506
|
+
const deniedFormats = this.settings.deniedFormats.split(';');
|
|
18507
|
+
const length = deniedFormats.length;
|
|
18508
|
+
for (let i = 0; i < length; i++) {
|
|
18509
|
+
const formatString = deniedFormats[i];
|
|
18510
|
+
if (formatString !== '') {
|
|
18511
|
+
formatString.trim();
|
|
18512
|
+
const collection = this.makeDeniedFormatsCollection(formatString);
|
|
18513
|
+
if (!isNullOrUndefined(collection)) {
|
|
18514
|
+
deniedFormatsCollection.push(collection);
|
|
18515
|
+
}
|
|
18516
|
+
}
|
|
18517
|
+
}
|
|
18518
|
+
this.deniedFormatsCollection = deniedFormatsCollection;
|
|
18519
|
+
}
|
|
18520
|
+
makeDeniedFormatsCollection(value) {
|
|
18521
|
+
const openParenIndex = value.indexOf('(');
|
|
18522
|
+
const closeParenIndex = value.indexOf(')');
|
|
18523
|
+
const openBracketIndex = value.indexOf('[');
|
|
18524
|
+
const closeBracketIndex = value.indexOf(']');
|
|
18525
|
+
const openBraceIndex = value.indexOf('{');
|
|
18526
|
+
const closeBraceIndex = value.indexOf('}');
|
|
18527
|
+
let classes = [];
|
|
18528
|
+
let attributes$$1 = '';
|
|
18529
|
+
let styles = '';
|
|
18530
|
+
let tagName = '';
|
|
18531
|
+
let classList = [];
|
|
18532
|
+
let attributesList = [];
|
|
18533
|
+
let stylesList = [];
|
|
18534
|
+
if (openParenIndex > -1 && closeParenIndex > -1) {
|
|
18535
|
+
classes = value.substring(openParenIndex + 1, closeParenIndex).split(' ');
|
|
18536
|
+
classList = classes[0].split(')')[0].split(',');
|
|
18537
|
+
}
|
|
18538
|
+
if (openBracketIndex > -1 && closeBracketIndex > -1) {
|
|
18539
|
+
attributes$$1 = value.substring(openBracketIndex + 1, closeBracketIndex);
|
|
18540
|
+
attributesList = attributes$$1.split(',');
|
|
18541
|
+
}
|
|
18542
|
+
if (openBraceIndex > -1 && closeBraceIndex > -1) {
|
|
18543
|
+
styles = value.substring(openBraceIndex + 1, closeBraceIndex);
|
|
18544
|
+
stylesList = styles.split(',');
|
|
18545
|
+
}
|
|
18546
|
+
let openIndexArray = [openParenIndex, openBracketIndex, openBraceIndex];
|
|
18547
|
+
openIndexArray = openIndexArray.filter((index) => index > -1);
|
|
18548
|
+
const len = openIndexArray.length;
|
|
18549
|
+
let min;
|
|
18550
|
+
if (len === 1) {
|
|
18551
|
+
min = openIndexArray[0];
|
|
18552
|
+
}
|
|
18553
|
+
else if (len === 2) {
|
|
18554
|
+
min = Math.min(openIndexArray[0], openIndexArray[1]);
|
|
18555
|
+
}
|
|
18556
|
+
else if (len === 3) {
|
|
18557
|
+
min = Math.min(openIndexArray[0], openIndexArray[1], openIndexArray[2]);
|
|
18558
|
+
}
|
|
18559
|
+
tagName = value.substring(0, min);
|
|
18560
|
+
tagName.trim();
|
|
18561
|
+
return ({
|
|
18562
|
+
tag: tagName, styles: stylesList, classes: classList,
|
|
18563
|
+
attributes: attributesList
|
|
18564
|
+
});
|
|
18565
|
+
}
|
|
18566
|
+
}
|
|
18567
|
+
|
|
18568
|
+
/**
|
|
18569
|
+
* EditorManager internal component
|
|
18570
|
+
*
|
|
18571
|
+
* @hidden
|
|
18572
|
+
* @deprecated
|
|
18573
|
+
*/
|
|
18574
|
+
class EditorManager {
|
|
18575
|
+
/**
|
|
18576
|
+
* Constructor for creating the component
|
|
18577
|
+
*
|
|
18578
|
+
* @hidden
|
|
18579
|
+
* @deprecated
|
|
18580
|
+
* @param {ICommandModel} options - specifies the command Model
|
|
18581
|
+
*/
|
|
18582
|
+
constructor(options) {
|
|
18583
|
+
this.currentDocument = options.document;
|
|
18584
|
+
this.editableElement = options.editableElement;
|
|
18585
|
+
this.nodeSelection = new NodeSelection();
|
|
18586
|
+
this.nodeCutter = new NodeCutter();
|
|
18587
|
+
this.domNode = new DOMNode(this.editableElement, this.currentDocument);
|
|
18588
|
+
this.observer = new Observer(this);
|
|
18589
|
+
this.listObj = new Lists(this);
|
|
18590
|
+
this.formatObj = new Formats(this);
|
|
18591
|
+
this.alignmentObj = new Alignments(this);
|
|
18592
|
+
this.indentsObj = new Indents(this);
|
|
18593
|
+
this.linkObj = new LinkCommand(this);
|
|
18594
|
+
this.imgObj = new ImageCommand(this);
|
|
18595
|
+
this.audioObj = new AudioCommand(this);
|
|
18596
|
+
this.videoObj = new VideoCommand(this);
|
|
18597
|
+
this.selectionObj = new SelectionBasedExec(this);
|
|
18598
|
+
this.inserthtmlObj = new InsertHtmlExec(this);
|
|
18599
|
+
this.insertTextObj = new InsertTextExec(this);
|
|
18600
|
+
this.clearObj = new ClearFormatExec(this);
|
|
18601
|
+
this.tableObj = new TableCommand(this);
|
|
18602
|
+
this.undoRedoManager = new UndoRedoManager(this, options.options);
|
|
18603
|
+
this.msWordPaste = new MsWordPaste(this);
|
|
18604
|
+
this.formatPaintetrObj = new FormatPainterActions(this, options.formatPainterSettings);
|
|
18605
|
+
this.wireEvents();
|
|
18606
|
+
}
|
|
18607
|
+
wireEvents() {
|
|
18608
|
+
this.observer.on(KEY_DOWN, this.editorKeyDown, this);
|
|
18609
|
+
this.observer.on(KEY_UP, this.editorKeyUp, this);
|
|
18610
|
+
this.observer.on(KEY_UP, this.editorKeyUp, this);
|
|
18611
|
+
this.observer.on(MODEL_CHANGED, this.onPropertyChanged, this);
|
|
18612
|
+
this.observer.on(MS_WORD_CLEANUP, this.onWordPaste, this);
|
|
18613
|
+
this.observer.on(ON_BEGIN, this.onBegin, this);
|
|
18614
|
+
}
|
|
18615
|
+
onWordPaste(e) {
|
|
18616
|
+
this.observer.notify(MS_WORD_CLEANUP_PLUGIN, e);
|
|
18617
|
+
}
|
|
18618
|
+
onPropertyChanged(props) {
|
|
18619
|
+
this.observer.notify(MODEL_CHANGED_PLUGIN, props);
|
|
18620
|
+
}
|
|
18621
|
+
editorKeyDown(e) {
|
|
18622
|
+
this.observer.notify(KEY_DOWN_HANDLER, e);
|
|
18623
|
+
}
|
|
18624
|
+
editorKeyUp(e) {
|
|
18625
|
+
this.observer.notify(KEY_UP_HANDLER, e);
|
|
18626
|
+
}
|
|
18627
|
+
onBegin(e) {
|
|
18628
|
+
this.observer.notify(SPACE_ACTION, e);
|
|
18629
|
+
}
|
|
18630
|
+
/* eslint-disable */
|
|
18631
|
+
/**
|
|
18632
|
+
* execCommand
|
|
18633
|
+
*
|
|
18634
|
+
* @param {ExecCommand} command - specifies the execution command
|
|
18635
|
+
* @param {T} value - specifes the value.
|
|
18636
|
+
* @param {Event} event - specifies the call back event
|
|
18637
|
+
* @param {Function} callBack - specifies the function
|
|
18638
|
+
* @param {string} text - specifies the string value
|
|
18639
|
+
* @param {T} exeValue - specifies the values to be executed
|
|
18640
|
+
* @param {string} selector - specifies the selector values
|
|
18641
|
+
* @returns {void}
|
|
18642
|
+
* @hidden
|
|
18643
|
+
* @deprecated
|
|
18644
|
+
*/
|
|
18645
|
+
/* eslint-enable */
|
|
18646
|
+
execCommand(command, value, event, callBack, text, exeValue, selector, enterAction) {
|
|
18647
|
+
switch (command.toLowerCase()) {
|
|
18648
|
+
case 'lists':
|
|
18649
|
+
this.observer.notify(LIST_TYPE, { subCommand: value, event: event, callBack: callBack,
|
|
18650
|
+
selector: selector, item: exeValue, enterAction: enterAction });
|
|
18651
|
+
break;
|
|
18652
|
+
case 'formats':
|
|
18653
|
+
this.observer.notify(FORMAT_TYPE, { subCommand: value, event: event, callBack: callBack,
|
|
18654
|
+
selector: selector, exeValue: exeValue, enterAction: enterAction
|
|
18655
|
+
});
|
|
18656
|
+
break;
|
|
18657
|
+
case 'alignments':
|
|
18658
|
+
this.observer.notify(ALIGNMENT_TYPE, {
|
|
18659
|
+
subCommand: value, event: event, callBack: callBack,
|
|
18660
|
+
selector: selector,
|
|
18661
|
+
value: exeValue
|
|
18662
|
+
});
|
|
18663
|
+
break;
|
|
18664
|
+
case 'indents':
|
|
18665
|
+
this.observer.notify(INDENT_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector });
|
|
18666
|
+
break;
|
|
18667
|
+
case 'links':
|
|
18668
|
+
this.observer.notify(LINK, { command: command, value: value, item: exeValue, event: event, callBack: callBack });
|
|
18669
|
+
break;
|
|
18670
|
+
case 'files':
|
|
18671
|
+
this.observer.notify(IMAGE, {
|
|
18672
|
+
command: command, value: 'Image', item: exeValue, event: event, callBack: callBack, selector: selector
|
|
18673
|
+
});
|
|
18674
|
+
break;
|
|
18675
|
+
case 'images':
|
|
18676
|
+
this.observer.notify(IMAGE, {
|
|
18677
|
+
command: command, value: value, item: exeValue, event: event, callBack: callBack, selector: selector
|
|
18678
|
+
});
|
|
18679
|
+
break;
|
|
18680
|
+
case 'audios':
|
|
18681
|
+
this.observer.notify(AUDIO, {
|
|
18682
|
+
command: command, value: value, item: exeValue, event: event, callBack: callBack, selector: selector
|
|
18683
|
+
});
|
|
18684
|
+
break;
|
|
18685
|
+
case 'videos':
|
|
18686
|
+
this.observer.notify(VIDEO, {
|
|
18687
|
+
command: command, value: value, item: exeValue, event: event, callBack: callBack, selector: selector
|
|
18688
|
+
});
|
|
18689
|
+
break;
|
|
18690
|
+
case 'table':
|
|
18691
|
+
switch (value.toString().toLocaleLowerCase()) {
|
|
18692
|
+
case 'createtable':
|
|
18693
|
+
this.observer.notify(TABLE, { item: exeValue, event: event, callBack: callBack, enterAction: enterAction });
|
|
18694
|
+
break;
|
|
18695
|
+
case 'insertrowbefore':
|
|
18696
|
+
case 'insertrowafter':
|
|
18697
|
+
this.observer.notify(INSERT_ROW, { item: exeValue, event: event, callBack: callBack });
|
|
18698
|
+
break;
|
|
18699
|
+
case 'insertcolumnleft':
|
|
18700
|
+
case 'insertcolumnright':
|
|
18701
|
+
this.observer.notify(INSERT_COLUMN, { item: exeValue, event: event, callBack: callBack });
|
|
18702
|
+
break;
|
|
18703
|
+
case 'deleterow':
|
|
18704
|
+
this.observer.notify(DELETEROW, { item: exeValue, event: event, callBack: callBack });
|
|
18705
|
+
break;
|
|
18706
|
+
case 'deletecolumn':
|
|
18707
|
+
this.observer.notify(DELETECOLUMN, { item: exeValue, event: event, callBack: callBack });
|
|
18708
|
+
break;
|
|
18709
|
+
case 'tableremove':
|
|
18710
|
+
this.observer.notify(REMOVETABLE, { item: exeValue, event: event, callBack: callBack });
|
|
18711
|
+
break;
|
|
18712
|
+
case 'tableheader':
|
|
18713
|
+
this.observer.notify(TABLEHEADER, { item: exeValue, event: event, callBack: callBack });
|
|
18714
|
+
break;
|
|
18715
|
+
case 'aligntop':
|
|
18716
|
+
case 'alignmiddle':
|
|
18717
|
+
case 'alignbottom':
|
|
18718
|
+
this.observer.notify(TABLE_VERTICAL_ALIGN, { item: exeValue, event: event, callBack: callBack });
|
|
18719
|
+
break;
|
|
18720
|
+
case 'merge':
|
|
18721
|
+
this.observer.notify(TABLE_MERGE, { item: exeValue, event: event, callBack: callBack });
|
|
18722
|
+
break;
|
|
18723
|
+
case 'horizontalsplit':
|
|
18724
|
+
this.observer.notify(TABLE_HORIZONTAL_SPLIT, { item: exeValue, event: event, callBack: callBack });
|
|
18725
|
+
break;
|
|
18726
|
+
case 'verticalsplit':
|
|
18727
|
+
this.observer.notify(TABLE_VERTICAL_SPLIT, { item: exeValue, event: event, callBack: callBack });
|
|
18728
|
+
break;
|
|
18729
|
+
}
|
|
18730
|
+
break;
|
|
18731
|
+
case 'font':
|
|
18732
|
+
case 'style':
|
|
18733
|
+
case 'effects':
|
|
18734
|
+
case 'casing':
|
|
18735
|
+
this.observer.notify(SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
|
|
18736
|
+
break;
|
|
18737
|
+
case 'inserthtml':
|
|
18738
|
+
this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text, enterAction: enterAction });
|
|
18739
|
+
break;
|
|
18740
|
+
case 'inserttext':
|
|
18741
|
+
this.observer.notify(INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
18742
|
+
break;
|
|
18743
|
+
case 'clear':
|
|
18744
|
+
this.observer.notify(CLEAR_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector, enterAction: enterAction });
|
|
18745
|
+
break;
|
|
18746
|
+
case 'actions':
|
|
18747
|
+
this.observer.notify(ACTION, { subCommand: value, event: event, callBack: callBack, selector: selector });
|
|
18748
|
+
break;
|
|
18749
|
+
case 'formatpainter':
|
|
18750
|
+
this.observer.notify(FORMAT_PAINTER_ACTIONS, { item: exeValue, subCommand: value, event: event, callBack: callBack });
|
|
18751
|
+
break;
|
|
17996
18752
|
}
|
|
17997
18753
|
}
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
|
|
18754
|
+
}
|
|
18755
|
+
|
|
18756
|
+
/**
|
|
18757
|
+
* HTML adapter
|
|
18758
|
+
*
|
|
18759
|
+
* @hidden
|
|
18760
|
+
* @deprecated
|
|
18761
|
+
*/
|
|
18762
|
+
class HTMLFormatter extends Formatter {
|
|
18763
|
+
constructor(options) {
|
|
18764
|
+
super();
|
|
18765
|
+
this.initialize();
|
|
18766
|
+
extend(this, this, options, true);
|
|
18767
|
+
if (this.currentDocument && this.element) {
|
|
18768
|
+
this.updateFormatter(this.element, this.currentDocument, options.options, options.formatPainterSettings);
|
|
18007
18769
|
}
|
|
18008
18770
|
}
|
|
18009
|
-
|
|
18010
|
-
|
|
18011
|
-
}
|
|
18012
|
-
static isNumberFormatList(node) {
|
|
18013
|
-
const list = node.style && node.style.listStyleType;
|
|
18014
|
-
if (list === 'lower-alpha') {
|
|
18015
|
-
return 'Lower Alpha';
|
|
18016
|
-
}
|
|
18017
|
-
else if (list === 'number') {
|
|
18018
|
-
return 'Number';
|
|
18019
|
-
}
|
|
18020
|
-
else if (list === 'upper-alpha') {
|
|
18021
|
-
return 'Upper Alpha';
|
|
18022
|
-
}
|
|
18023
|
-
else if (list === 'lower-roman') {
|
|
18024
|
-
return 'Lower Roman';
|
|
18025
|
-
}
|
|
18026
|
-
else if (list === 'upper-roman') {
|
|
18027
|
-
return 'Upper Roman';
|
|
18028
|
-
}
|
|
18029
|
-
else if (list === 'lower-greek') {
|
|
18030
|
-
return 'Lower Greek';
|
|
18031
|
-
}
|
|
18032
|
-
else if (list === 'none') {
|
|
18033
|
-
return 'None';
|
|
18034
|
-
}
|
|
18035
|
-
else {
|
|
18036
|
-
return null;
|
|
18037
|
-
}
|
|
18771
|
+
initialize() {
|
|
18772
|
+
this.keyConfig = htmlKeyConfig;
|
|
18038
18773
|
}
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18774
|
+
/**
|
|
18775
|
+
* Update the formatter of RichTextEditor
|
|
18776
|
+
*
|
|
18777
|
+
* @param {Element} editElement - specifies the edit element.
|
|
18778
|
+
* @param {Document} doc - specifies the doucment
|
|
18779
|
+
* @param {number} options - specifies the options
|
|
18780
|
+
* @param {FormatPainterSettingsModel} formatPainterSettings - specifies the format painter settings
|
|
18781
|
+
* @returns {void}
|
|
18782
|
+
* @hidden
|
|
18783
|
+
* @deprecated
|
|
18784
|
+
*/
|
|
18785
|
+
updateFormatter(editElement, doc, options, formatPainterSettings) {
|
|
18786
|
+
if (editElement && doc) {
|
|
18787
|
+
this.editorManager = new EditorManager({
|
|
18788
|
+
document: doc,
|
|
18789
|
+
editableElement: editElement,
|
|
18790
|
+
options: options,
|
|
18791
|
+
formatPainterSettings: formatPainterSettings
|
|
18792
|
+
});
|
|
18055
18793
|
}
|
|
18056
18794
|
}
|
|
18057
18795
|
}
|
|
@@ -19078,112 +19816,130 @@ class HtmlEditor {
|
|
|
19078
19816
|
let selectParentEle;
|
|
19079
19817
|
const item = args.item;
|
|
19080
19818
|
const closestElement = closest(args.originalEvent.target, '.e-rte-quick-popup');
|
|
19081
|
-
if (
|
|
19082
|
-
if (
|
|
19083
|
-
item.subCommand === '
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
selectNodeEle = this.nodeSelectionObj.getNodeCollection(range);
|
|
19090
|
-
selectParentEle = this.nodeSelectionObj.getParentNodeCollection(range);
|
|
19091
|
-
}
|
|
19092
|
-
if (item.command === 'Images') {
|
|
19093
|
-
this.parent.notify(imageToolbarAction, {
|
|
19094
|
-
member: 'image', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19095
|
-
});
|
|
19096
|
-
}
|
|
19097
|
-
if (item.command === 'Audios') {
|
|
19098
|
-
this.parent.notify(audioToolbarAction, {
|
|
19099
|
-
member: 'audio', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19100
|
-
});
|
|
19101
|
-
}
|
|
19102
|
-
if (item.command === 'Videos') {
|
|
19103
|
-
this.parent.notify(videoToolbarAction, {
|
|
19104
|
-
member: 'video', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19105
|
-
});
|
|
19106
|
-
}
|
|
19107
|
-
if (item.command === 'Links') {
|
|
19108
|
-
this.parent.notify(linkToolbarAction, {
|
|
19109
|
-
member: 'link', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19110
|
-
});
|
|
19111
|
-
}
|
|
19112
|
-
if (item.command === 'Table') {
|
|
19113
|
-
this.parent.notify(tableToolbarAction, {
|
|
19114
|
-
member: 'table', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19115
|
-
});
|
|
19116
|
-
}
|
|
19117
|
-
}
|
|
19118
|
-
else {
|
|
19119
|
-
const linkDialog = document.getElementById(this.parent.getID() + '_rtelink');
|
|
19120
|
-
const imageDialog = document.getElementById(this.parent.getID() + '_image');
|
|
19121
|
-
if (!(item.subCommand === 'SourceCode' || item.subCommand === 'Preview' ||
|
|
19122
|
-
item.subCommand === 'FontColor' || item.subCommand === 'BackgroundColor')) {
|
|
19123
|
-
const range = this.nodeSelectionObj.getRange(this.parent.contentModule.getDocument());
|
|
19124
|
-
if (isNullOrUndefined(linkDialog) && isNullOrUndefined(imageDialog)) {
|
|
19819
|
+
if (item.command !== 'FormatPainter') {
|
|
19820
|
+
if (closestElement && !closestElement.classList.contains('e-rte-inline-popup')) {
|
|
19821
|
+
if (!(item.subCommand === 'SourceCode' || item.subCommand === 'Preview' ||
|
|
19822
|
+
item.subCommand === 'FontColor' || item.subCommand === 'BackgroundColor')) {
|
|
19823
|
+
if (isIDevice$1() && item.command === 'Images') {
|
|
19824
|
+
this.nodeSelectionObj.restore();
|
|
19825
|
+
}
|
|
19826
|
+
const range = this.nodeSelectionObj.getRange(this.parent.contentModule.getDocument());
|
|
19125
19827
|
save = this.nodeSelectionObj.save(range, this.parent.contentModule.getDocument());
|
|
19828
|
+
selectNodeEle = this.nodeSelectionObj.getNodeCollection(range);
|
|
19829
|
+
selectParentEle = this.nodeSelectionObj.getParentNodeCollection(range);
|
|
19126
19830
|
}
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
}
|
|
19130
|
-
switch (item.subCommand) {
|
|
19131
|
-
case 'Maximize':
|
|
19132
|
-
this.parent.notify(enableFullScreen, { args: args });
|
|
19133
|
-
break;
|
|
19134
|
-
case 'Minimize':
|
|
19135
|
-
this.parent.notify(disableFullScreen, { args: args });
|
|
19136
|
-
break;
|
|
19137
|
-
case 'CreateLink':
|
|
19138
|
-
this.parent.notify(insertLink, {
|
|
19139
|
-
member: 'link', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19140
|
-
});
|
|
19141
|
-
break;
|
|
19142
|
-
case 'RemoveLink':
|
|
19143
|
-
this.parent.notify(unLink, {
|
|
19144
|
-
member: 'link', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19145
|
-
});
|
|
19146
|
-
break;
|
|
19147
|
-
case 'Print':
|
|
19148
|
-
this.parent.print();
|
|
19149
|
-
break;
|
|
19150
|
-
case 'Image':
|
|
19151
|
-
this.parent.notify(insertImage, {
|
|
19831
|
+
if (item.command === 'Images') {
|
|
19832
|
+
this.parent.notify(imageToolbarAction, {
|
|
19152
19833
|
member: 'image', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19153
19834
|
});
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
this.parent.notify(
|
|
19835
|
+
}
|
|
19836
|
+
if (item.command === 'Audios') {
|
|
19837
|
+
this.parent.notify(audioToolbarAction, {
|
|
19157
19838
|
member: 'audio', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19158
19839
|
});
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
this.parent.notify(
|
|
19840
|
+
}
|
|
19841
|
+
if (item.command === 'Videos') {
|
|
19842
|
+
this.parent.notify(videoToolbarAction, {
|
|
19162
19843
|
member: 'video', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19163
19844
|
});
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
this.parent.notify(
|
|
19167
|
-
member: '
|
|
19845
|
+
}
|
|
19846
|
+
if (item.command === 'Links') {
|
|
19847
|
+
this.parent.notify(linkToolbarAction, {
|
|
19848
|
+
member: 'link', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19168
19849
|
});
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
this.parent.notify(
|
|
19172
|
-
|
|
19173
|
-
case 'Preview':
|
|
19174
|
-
this.parent.notify(updateSource, { member: 'updateSource', args: args });
|
|
19175
|
-
break;
|
|
19176
|
-
case 'FontColor':
|
|
19177
|
-
case 'BackgroundColor':
|
|
19178
|
-
break;
|
|
19179
|
-
case 'File':
|
|
19180
|
-
this.parent.notify(renderFileManager, {
|
|
19181
|
-
member: 'fileManager', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19850
|
+
}
|
|
19851
|
+
if (item.command === 'Table') {
|
|
19852
|
+
this.parent.notify(tableToolbarAction, {
|
|
19853
|
+
member: 'table', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19182
19854
|
});
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19855
|
+
}
|
|
19856
|
+
}
|
|
19857
|
+
else {
|
|
19858
|
+
const linkDialog = document.getElementById(this.parent.getID() + '_rtelink');
|
|
19859
|
+
const imageDialog = document.getElementById(this.parent.getID() + '_image');
|
|
19860
|
+
if (!(item.subCommand === 'SourceCode' || item.subCommand === 'Preview' ||
|
|
19861
|
+
item.subCommand === 'FontColor' || item.subCommand === 'BackgroundColor')) {
|
|
19862
|
+
const range = this.nodeSelectionObj.getRange(this.parent.contentModule.getDocument());
|
|
19863
|
+
if (isNullOrUndefined(linkDialog) && isNullOrUndefined(imageDialog)) {
|
|
19864
|
+
save = this.nodeSelectionObj.save(range, this.parent.contentModule.getDocument());
|
|
19865
|
+
}
|
|
19866
|
+
selectNodeEle = this.nodeSelectionObj.getNodeCollection(range);
|
|
19867
|
+
selectParentEle = this.nodeSelectionObj.getParentNodeCollection(range);
|
|
19868
|
+
}
|
|
19869
|
+
switch (item.subCommand) {
|
|
19870
|
+
case 'Maximize':
|
|
19871
|
+
this.parent.notify(enableFullScreen, { args: args });
|
|
19872
|
+
break;
|
|
19873
|
+
case 'Minimize':
|
|
19874
|
+
this.parent.notify(disableFullScreen, { args: args });
|
|
19875
|
+
break;
|
|
19876
|
+
case 'CreateLink':
|
|
19877
|
+
this.parent.notify(insertLink, {
|
|
19878
|
+
member: 'link', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19879
|
+
});
|
|
19880
|
+
break;
|
|
19881
|
+
case 'RemoveLink':
|
|
19882
|
+
this.parent.notify(unLink, {
|
|
19883
|
+
member: 'link', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19884
|
+
});
|
|
19885
|
+
break;
|
|
19886
|
+
case 'Print':
|
|
19887
|
+
this.parent.print();
|
|
19888
|
+
break;
|
|
19889
|
+
case 'Image':
|
|
19890
|
+
this.parent.notify(insertImage, {
|
|
19891
|
+
member: 'image', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19892
|
+
});
|
|
19893
|
+
break;
|
|
19894
|
+
case 'Audio':
|
|
19895
|
+
this.parent.notify(insertAudio, {
|
|
19896
|
+
member: 'audio', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19897
|
+
});
|
|
19898
|
+
break;
|
|
19899
|
+
case 'Video':
|
|
19900
|
+
this.parent.notify(insertVideo, {
|
|
19901
|
+
member: 'video', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19902
|
+
});
|
|
19903
|
+
break;
|
|
19904
|
+
case 'CreateTable':
|
|
19905
|
+
this.parent.notify(createTable, {
|
|
19906
|
+
member: 'table', args: args, selection: save
|
|
19907
|
+
});
|
|
19908
|
+
break;
|
|
19909
|
+
case 'SourceCode':
|
|
19910
|
+
this.parent.notify(sourceCode, { member: 'viewSource', args: args });
|
|
19911
|
+
break;
|
|
19912
|
+
case 'Preview':
|
|
19913
|
+
this.parent.notify(updateSource, { member: 'updateSource', args: args });
|
|
19914
|
+
break;
|
|
19915
|
+
case 'FontColor':
|
|
19916
|
+
case 'BackgroundColor':
|
|
19917
|
+
break;
|
|
19918
|
+
case 'File':
|
|
19919
|
+
this.parent.notify(renderFileManager, {
|
|
19920
|
+
member: 'fileManager', args: args, selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
19921
|
+
});
|
|
19922
|
+
break;
|
|
19923
|
+
default:
|
|
19924
|
+
this.parent.formatter.process(this.parent, args, args.originalEvent, null);
|
|
19925
|
+
break;
|
|
19926
|
+
}
|
|
19927
|
+
}
|
|
19928
|
+
}
|
|
19929
|
+
else {
|
|
19930
|
+
if (args.originalEvent.detail === 1) {
|
|
19931
|
+
clearTimeout(this.clickTimeout);
|
|
19932
|
+
this.clickTimeout = setTimeout(() => {
|
|
19933
|
+
this.parent.notify(formatPainterClick, {
|
|
19934
|
+
member: 'formatPainter', args: args
|
|
19935
|
+
});
|
|
19936
|
+
}, 200);
|
|
19937
|
+
}
|
|
19938
|
+
else {
|
|
19939
|
+
clearTimeout(this.clickTimeout);
|
|
19940
|
+
this.parent.notify(formatPainterDoubleClick, {
|
|
19941
|
+
member: 'formatPainter', args: args
|
|
19942
|
+
});
|
|
19187
19943
|
}
|
|
19188
19944
|
}
|
|
19189
19945
|
}
|
|
@@ -19226,7 +19982,8 @@ class HtmlEditor {
|
|
|
19226
19982
|
const formatterClass = new HTMLFormatter({
|
|
19227
19983
|
currentDocument: this.contentRenderer.getDocument(),
|
|
19228
19984
|
element: editElement,
|
|
19229
|
-
options: option
|
|
19985
|
+
options: option,
|
|
19986
|
+
formatPainterSettings: this.parent.formatPainterSettings
|
|
19230
19987
|
});
|
|
19231
19988
|
this.parent.setProperties({ formatter: formatterClass }, true);
|
|
19232
19989
|
}
|
|
@@ -19945,7 +20702,7 @@ class PasteCleanup {
|
|
|
19945
20702
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
|
|
19946
20703
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
19947
20704
|
this.parent.formatter.onSuccess(this.parent, args);
|
|
19948
|
-
}, clipBoardElem);
|
|
20705
|
+
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
19949
20706
|
this.removeTempClass();
|
|
19950
20707
|
this.parent.notify(toolbarRefresh, {});
|
|
19951
20708
|
this.imgUploading(this.parent.inputElement);
|
|
@@ -20014,7 +20771,7 @@ class PasteCleanup {
|
|
|
20014
20771
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
|
|
20015
20772
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
20016
20773
|
this.parent.formatter.onSuccess(this.parent, args);
|
|
20017
|
-
}, clipBoardElem);
|
|
20774
|
+
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
20018
20775
|
this.removeTempClass();
|
|
20019
20776
|
}
|
|
20020
20777
|
else {
|
|
@@ -20707,7 +21464,6 @@ class FullScreen {
|
|
|
20707
21464
|
this.parent.toolbarModule.addFixedTBarClass();
|
|
20708
21465
|
}
|
|
20709
21466
|
}
|
|
20710
|
-
this.parent.refreshUI();
|
|
20711
21467
|
this.parent.trigger(actionComplete, { requestType: 'Minimize', targetItem: 'Minimize', args: event });
|
|
20712
21468
|
}
|
|
20713
21469
|
});
|
|
@@ -20827,6 +21583,145 @@ function setAttributes(htmlAttributes, rte, isFrame, initial) {
|
|
|
20827
21583
|
}
|
|
20828
21584
|
}
|
|
20829
21585
|
|
|
21586
|
+
class FormatPainter {
|
|
21587
|
+
constructor(parent) {
|
|
21588
|
+
this.isSticky = false;
|
|
21589
|
+
this.isActive = false;
|
|
21590
|
+
this.parent = parent;
|
|
21591
|
+
this.addEventListener();
|
|
21592
|
+
}
|
|
21593
|
+
addEventListener() {
|
|
21594
|
+
this.parent.on(formatPainterClick, this.toolbarClick, this);
|
|
21595
|
+
this.parent.on(formatPainterDoubleClick, this.toolbarDoubleClick, this);
|
|
21596
|
+
this.parent.on(editAreaClick, this.editAreaClick, this);
|
|
21597
|
+
this.parent.on(keyDown, this.onKeyDown, this);
|
|
21598
|
+
this.parent.on(destroy, this.destroy, this);
|
|
21599
|
+
}
|
|
21600
|
+
toolbarClick(args) {
|
|
21601
|
+
this.isActive = true;
|
|
21602
|
+
this.parent.focusIn();
|
|
21603
|
+
this.actionHandler(args, 'click');
|
|
21604
|
+
}
|
|
21605
|
+
toolbarDoubleClick(args) {
|
|
21606
|
+
this.isActive = true;
|
|
21607
|
+
this.isSticky = true;
|
|
21608
|
+
this.parent.focusIn();
|
|
21609
|
+
this.actionHandler(args, 'dbClick');
|
|
21610
|
+
}
|
|
21611
|
+
onKeyDown(event) {
|
|
21612
|
+
const originalEvent = event.args;
|
|
21613
|
+
if ((originalEvent.ctrlKey && originalEvent.shiftKey && (originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste'))
|
|
21614
|
+
|| (originalEvent.action === 'escape' && (this.previousAction === 'format-copy' || this.previousAction === 'format-paste'))) {
|
|
21615
|
+
if (!isNullOrUndefined(originalEvent.key) && originalEvent.key.toLowerCase() === 'c') {
|
|
21616
|
+
originalEvent.preventDefault();
|
|
21617
|
+
}
|
|
21618
|
+
if (!isNullOrUndefined(originalEvent.key) && originalEvent.key.toLowerCase() === 'v' &&
|
|
21619
|
+
this.previousAction === 'format-copy' || this.previousAction === 'format-paste' || this.isSticky) {
|
|
21620
|
+
originalEvent.preventDefault();
|
|
21621
|
+
}
|
|
21622
|
+
this.actionHandler(event, 'keyBoard');
|
|
21623
|
+
}
|
|
21624
|
+
}
|
|
21625
|
+
actionHandler(event, type) {
|
|
21626
|
+
let action;
|
|
21627
|
+
let isKeyboard = false;
|
|
21628
|
+
let originalEvent;
|
|
21629
|
+
let args;
|
|
21630
|
+
let item;
|
|
21631
|
+
switch (type) {
|
|
21632
|
+
case 'dbClick':
|
|
21633
|
+
args = event.args;
|
|
21634
|
+
item = args.item;
|
|
21635
|
+
originalEvent = event.args.originalEvent;
|
|
21636
|
+
action = 'format-copy';
|
|
21637
|
+
break;
|
|
21638
|
+
case 'keyBoard':
|
|
21639
|
+
args = null;
|
|
21640
|
+
originalEvent = event.args;
|
|
21641
|
+
isKeyboard = true;
|
|
21642
|
+
action = event.args.action;
|
|
21643
|
+
if (action === 'escape') {
|
|
21644
|
+
this.isSticky = false;
|
|
21645
|
+
this.isActive = false;
|
|
21646
|
+
}
|
|
21647
|
+
break;
|
|
21648
|
+
case 'click':
|
|
21649
|
+
args = event.args;
|
|
21650
|
+
item = args.item;
|
|
21651
|
+
originalEvent = event.args.originalEvent;
|
|
21652
|
+
action = 'format-copy';
|
|
21653
|
+
break;
|
|
21654
|
+
case 'docClick':
|
|
21655
|
+
originalEvent = event;
|
|
21656
|
+
action = 'format-paste';
|
|
21657
|
+
break;
|
|
21658
|
+
}
|
|
21659
|
+
this.updateCursor(isKeyboard);
|
|
21660
|
+
const enable = type === 'docClick' || action === 'escape' ? false : true;
|
|
21661
|
+
this.updateToolbarBtn(enable);
|
|
21662
|
+
if (isNullOrUndefined(item)) {
|
|
21663
|
+
item = {
|
|
21664
|
+
command: 'FormatPainter',
|
|
21665
|
+
subCommand: 'FormatPainter'
|
|
21666
|
+
};
|
|
21667
|
+
}
|
|
21668
|
+
const actionBeginArgs = {
|
|
21669
|
+
requestType: 'FormatPainter', originalEvent: originalEvent, name: action, item: item
|
|
21670
|
+
};
|
|
21671
|
+
const value = {
|
|
21672
|
+
formatPainterAction: action
|
|
21673
|
+
};
|
|
21674
|
+
this.parent.formatter.process(this.parent, actionBeginArgs, originalEvent, value);
|
|
21675
|
+
this.previousAction = action;
|
|
21676
|
+
}
|
|
21677
|
+
updateCursor(isKeyboard) {
|
|
21678
|
+
if (!this.parent.inputElement.classList.contains('e-rte-cursor-brush') && !isKeyboard) {
|
|
21679
|
+
addClass([this.parent.inputElement], 'e-rte-cursor-brush');
|
|
21680
|
+
}
|
|
21681
|
+
else if (!this.isSticky) {
|
|
21682
|
+
removeClass([this.parent.inputElement], 'e-rte-cursor-brush');
|
|
21683
|
+
}
|
|
21684
|
+
}
|
|
21685
|
+
updateToolbarBtn(enable) {
|
|
21686
|
+
const toolbarBtn = this.parent.element.querySelector('.e-rte-format-painter').parentElement.parentElement;
|
|
21687
|
+
if (enable) {
|
|
21688
|
+
addClass([toolbarBtn], 'e-active');
|
|
21689
|
+
}
|
|
21690
|
+
else if (!this.isSticky) {
|
|
21691
|
+
removeClass([toolbarBtn], 'e-active');
|
|
21692
|
+
}
|
|
21693
|
+
}
|
|
21694
|
+
editAreaClick(args) {
|
|
21695
|
+
if (this.isActive) {
|
|
21696
|
+
if (!this.isSticky) {
|
|
21697
|
+
this.isActive = false;
|
|
21698
|
+
}
|
|
21699
|
+
this.actionHandler(args, 'docClick');
|
|
21700
|
+
this.updateToolbarBtn(false);
|
|
21701
|
+
}
|
|
21702
|
+
}
|
|
21703
|
+
destroy() {
|
|
21704
|
+
/**Removeeventlistener */
|
|
21705
|
+
if (this.parent.isDestroyed) {
|
|
21706
|
+
return;
|
|
21707
|
+
}
|
|
21708
|
+
this.parent.off(formatPainterClick, this.toolbarClick);
|
|
21709
|
+
this.parent.off(editAreaClick, this.editAreaClick);
|
|
21710
|
+
this.parent.off(formatPainterDoubleClick, this.toolbarDoubleClick);
|
|
21711
|
+
this.parent.off(keyDown, this.onKeyDown);
|
|
21712
|
+
this.parent.off(destroy, this.destroy);
|
|
21713
|
+
}
|
|
21714
|
+
/**
|
|
21715
|
+
* For internal use only - Get the module name.
|
|
21716
|
+
*
|
|
21717
|
+
* @returns {void}
|
|
21718
|
+
* @hidden
|
|
21719
|
+
*/
|
|
21720
|
+
getModuleName() {
|
|
21721
|
+
return 'formatPainter';
|
|
21722
|
+
}
|
|
21723
|
+
}
|
|
21724
|
+
|
|
20830
21725
|
/**
|
|
20831
21726
|
* Action export
|
|
20832
21727
|
*/
|
|
@@ -21124,7 +22019,8 @@ class Link {
|
|
|
21124
22019
|
const eventArgs = {
|
|
21125
22020
|
args: event ? event.args : {
|
|
21126
22021
|
item: { command: 'Links', subCommand: 'CreateLink' },
|
|
21127
|
-
originalEvent: undefined
|
|
22022
|
+
originalEvent: undefined,
|
|
22023
|
+
name: !isInternal ? 'showDialog' : null
|
|
21128
22024
|
},
|
|
21129
22025
|
selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
|
|
21130
22026
|
};
|
|
@@ -21840,7 +22736,8 @@ class Image {
|
|
|
21840
22736
|
img.setAttribute('width', (img.width + this.mouseX).toString());
|
|
21841
22737
|
}
|
|
21842
22738
|
else {
|
|
21843
|
-
img.
|
|
22739
|
+
const currentWidth = img.offsetWidth === 0 ? img.width + this.mouseX + parseInt(img.style.outlineWidth.split('p')[0]) : img.offsetWidth + this.mouseX;
|
|
22740
|
+
img.setAttribute('width', (currentWidth).toString());
|
|
21844
22741
|
}
|
|
21845
22742
|
}
|
|
21846
22743
|
}
|
|
@@ -21922,7 +22819,7 @@ class Image {
|
|
|
21922
22819
|
const pageX = this.getPointX(e);
|
|
21923
22820
|
const pageY = this.getPointY(e);
|
|
21924
22821
|
const mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
|
|
21925
|
-
const mouseY = (this.resizeBtnStat.
|
|
22822
|
+
const mouseY = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageY - this.pageY) : (pageY - this.pageY);
|
|
21926
22823
|
const width = parseInt(this.imgDupPos.width, 10) + mouseX;
|
|
21927
22824
|
const height = parseInt(this.imgDupPos.height, 10) + mouseY;
|
|
21928
22825
|
this.mouseX = mouseX;
|
|
@@ -22093,8 +22990,9 @@ class Image {
|
|
|
22093
22990
|
}
|
|
22094
22991
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
22095
22992
|
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
22096
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
|
|
22993
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
22097
22994
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
22995
|
+
}
|
|
22098
22996
|
originalEvent.preventDefault();
|
|
22099
22997
|
const event = {
|
|
22100
22998
|
selectNode: selectNodeEle, selection: save, selectParent: selectParentEle,
|
|
@@ -22153,8 +23051,9 @@ class Image {
|
|
|
22153
23051
|
}
|
|
22154
23052
|
break;
|
|
22155
23053
|
case 'insert-image':
|
|
22156
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
|
|
23054
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
22157
23055
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
23056
|
+
}
|
|
22158
23057
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
22159
23058
|
originalEvent.preventDefault();
|
|
22160
23059
|
break;
|
|
@@ -22180,7 +23079,8 @@ class Image {
|
|
|
22180
23079
|
this.insertImage({
|
|
22181
23080
|
args: {
|
|
22182
23081
|
item: { command: 'Images', subCommand: 'Image' },
|
|
22183
|
-
originalEvent: event
|
|
23082
|
+
originalEvent: event,
|
|
23083
|
+
name: !isInternal ? 'showDialog' : null
|
|
22184
23084
|
},
|
|
22185
23085
|
selectNode: selectNodeEle,
|
|
22186
23086
|
selection: save,
|
|
@@ -22191,7 +23091,8 @@ class Image {
|
|
|
22191
23091
|
this.insertImage({
|
|
22192
23092
|
args: {
|
|
22193
23093
|
item: { command: 'Images', subCommand: 'Image' },
|
|
22194
|
-
originalEvent: event
|
|
23094
|
+
originalEvent: event,
|
|
23095
|
+
name: !isInternal ? 'showDialog' : null
|
|
22195
23096
|
},
|
|
22196
23097
|
member: 'image',
|
|
22197
23098
|
text: this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()),
|
|
@@ -23941,8 +24842,9 @@ class Audio {
|
|
|
23941
24842
|
}
|
|
23942
24843
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
23943
24844
|
if (selectNodeEle && this.isAudioElem(selectNodeEle[0]) && selectNodeEle.length < 1) {
|
|
23944
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
|
|
24845
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
23945
24846
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
24847
|
+
}
|
|
23946
24848
|
originalEvent.preventDefault();
|
|
23947
24849
|
const event = {
|
|
23948
24850
|
selectNode: selectNodeEle, selection: save, selectParent: selectParentEle,
|
|
@@ -23991,8 +24893,9 @@ class Audio {
|
|
|
23991
24893
|
}
|
|
23992
24894
|
break;
|
|
23993
24895
|
case 'insert-audio':
|
|
23994
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
|
|
24896
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
23995
24897
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
24898
|
+
}
|
|
23996
24899
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
23997
24900
|
originalEvent.preventDefault();
|
|
23998
24901
|
break;
|
|
@@ -24018,7 +24921,8 @@ class Audio {
|
|
|
24018
24921
|
this.insertAudio({
|
|
24019
24922
|
args: {
|
|
24020
24923
|
item: { command: 'Audios', subCommand: 'Audio' },
|
|
24021
|
-
originalEvent: event
|
|
24924
|
+
originalEvent: event,
|
|
24925
|
+
name: !isInternal ? 'showDialog' : null
|
|
24022
24926
|
},
|
|
24023
24927
|
selectNode: selectNodeEle,
|
|
24024
24928
|
selection: save,
|
|
@@ -25034,7 +25938,7 @@ class Video {
|
|
|
25034
25938
|
const height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
|
|
25035
25939
|
if (width > height) {
|
|
25036
25940
|
vid.style.minWidth = this.parent.insertVideoSettings.minWidth === 0 ? '140px' : formatUnit(this.parent.insertVideoSettings.minWidth);
|
|
25037
|
-
vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '
|
|
25941
|
+
vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '60px' : formatUnit(this.parent.insertVideoSettings.minHeight);
|
|
25038
25942
|
if (this.parent.insertVideoSettings.resizeByPercent) {
|
|
25039
25943
|
if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
|
|
25040
25944
|
const percentageValue = this.pixToPerc((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement));
|
|
@@ -25245,8 +26149,9 @@ class Video {
|
|
|
25245
26149
|
}
|
|
25246
26150
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
25247
26151
|
if (selectNodeEle && (selectNodeEle[0].nodeName === 'VIDEO' || this.isEmbedVidElem(selectNodeEle[0])) && selectNodeEle.length < 1) {
|
|
25248
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
|
|
26152
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
25249
26153
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
26154
|
+
}
|
|
25250
26155
|
originalEvent.preventDefault();
|
|
25251
26156
|
const event = {
|
|
25252
26157
|
selectNode: selectNodeEle, selection: save, selectParent: selectParentEle,
|
|
@@ -25299,8 +26204,9 @@ class Video {
|
|
|
25299
26204
|
}
|
|
25300
26205
|
break;
|
|
25301
26206
|
case 'insert-video':
|
|
25302
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
|
|
26207
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
25303
26208
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
26209
|
+
}
|
|
25304
26210
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
25305
26211
|
originalEvent.preventDefault();
|
|
25306
26212
|
break;
|
|
@@ -25326,7 +26232,8 @@ class Video {
|
|
|
25326
26232
|
this.insertVideo({
|
|
25327
26233
|
args: {
|
|
25328
26234
|
item: { command: 'Videos', subCommand: 'Video' },
|
|
25329
|
-
originalEvent: event
|
|
26235
|
+
originalEvent: event,
|
|
26236
|
+
name: !isInternal ? 'showDialog' : null
|
|
25330
26237
|
},
|
|
25331
26238
|
selectNode: selectNodeEle,
|
|
25332
26239
|
selection: save,
|
|
@@ -25574,7 +26481,7 @@ class Video {
|
|
|
25574
26481
|
}
|
|
25575
26482
|
}
|
|
25576
26483
|
showVideoQuickToolbar(e) {
|
|
25577
|
-
if (e.type !== 'Videos' || e.args.detail === 2 || isNullOrUndefined(this.parent.quickToolbarModule)
|
|
26484
|
+
if (e.type !== 'Videos' || (!isNullOrUndefined(e.args) && e.args.detail === 2) || isNullOrUndefined(this.parent.quickToolbarModule)
|
|
25578
26485
|
|| isNullOrUndefined(this.parent.quickToolbarModule.videoQTBar) || isNullOrUndefined(e.args)) {
|
|
25579
26486
|
return;
|
|
25580
26487
|
}
|
|
@@ -26122,7 +27029,7 @@ class ViewSource {
|
|
|
26122
27029
|
break;
|
|
26123
27030
|
case 'toolbar-focus':
|
|
26124
27031
|
if (this.parent.toolbarSettings.enable) {
|
|
26125
|
-
const selector = '.e-toolbar-item[
|
|
27032
|
+
const selector = '.e-toolbar-item[title] [tabindex]';
|
|
26126
27033
|
this.parent.toolbarModule.baseToolbar.toolbarObj.element.querySelector(selector).focus();
|
|
26127
27034
|
}
|
|
26128
27035
|
break;
|
|
@@ -26491,8 +27398,9 @@ class Table {
|
|
|
26491
27398
|
if ((event.keyCode === 8 || event.keyCode === 46) ||
|
|
26492
27399
|
(event.ctrlKey && event.keyCode === 88)) {
|
|
26493
27400
|
if (ele && ele.tagName === 'TBODY') {
|
|
26494
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) && this.contentModule)
|
|
27401
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) && this.contentModule) {
|
|
26495
27402
|
selection = this.parent.formatter.editorManager.nodeSelection.save(range, this.contentModule.getDocument());
|
|
27403
|
+
}
|
|
26496
27404
|
event.preventDefault();
|
|
26497
27405
|
proxy.removeTable(selection, event, true);
|
|
26498
27406
|
}
|
|
@@ -26506,8 +27414,9 @@ class Table {
|
|
|
26506
27414
|
ele = !isNullOrUndefined(closestTd) && this.parent.inputElement.contains(closestTd) ? closestTd : ele;
|
|
26507
27415
|
}
|
|
26508
27416
|
if (ele && (ele.tagName === 'TD' || ele.tagName === 'TH')) {
|
|
26509
|
-
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) && this.contentModule)
|
|
27417
|
+
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) && this.contentModule) {
|
|
26510
27418
|
selection = this.parent.formatter.editorManager.nodeSelection.save(range, this.contentModule.getDocument());
|
|
27419
|
+
}
|
|
26511
27420
|
switch (event.keyCode) {
|
|
26512
27421
|
case 9:
|
|
26513
27422
|
case 37:
|
|
@@ -26550,7 +27459,8 @@ class Table {
|
|
|
26550
27459
|
item: {
|
|
26551
27460
|
command: 'Table',
|
|
26552
27461
|
subCommand: 'CreateTable'
|
|
26553
|
-
}
|
|
27462
|
+
},
|
|
27463
|
+
name: !isInternal ? 'showDialog' : null
|
|
26554
27464
|
};
|
|
26555
27465
|
this.insertTableDialog({ self: this, args: args, selection: selection });
|
|
26556
27466
|
}
|
|
@@ -26775,9 +27685,18 @@ class Table {
|
|
|
26775
27685
|
const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
|
|
26776
27686
|
this.parent.formatter.editorManager.nodeSelection.save(range, this.contentModule.getDocument());
|
|
26777
27687
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
27688
|
+
let pageX;
|
|
27689
|
+
let pageY;
|
|
27690
|
+
if (Browser.isDevice && e.args.touches) {
|
|
27691
|
+
pageX = e.args.changedTouches[0].pageX;
|
|
27692
|
+
pageY = e.args.changedTouches[0].pageY;
|
|
27693
|
+
}
|
|
27694
|
+
else {
|
|
27695
|
+
pageX = (this.parent.iframeSettings.enable) ? window.pageXOffset
|
|
27696
|
+
+ this.parent.element.getBoundingClientRect().left + args.clientX : args.pageX;
|
|
27697
|
+
pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
|
|
27698
|
+
this.parent.element.getBoundingClientRect().top + args.clientY : args.pageY;
|
|
27699
|
+
}
|
|
26781
27700
|
this.quickToolObj.tableQTBar.showPopup(pageX, pageY, target);
|
|
26782
27701
|
this.parent.formatter.editorManager.nodeSelection.restore();
|
|
26783
27702
|
}
|
|
@@ -27990,6 +28909,18 @@ const executeGroup = {
|
|
|
27990
28909
|
'removeFormat': {
|
|
27991
28910
|
command: 'Clear',
|
|
27992
28911
|
subCommand: 'ClearFormat'
|
|
28912
|
+
},
|
|
28913
|
+
'copyFormatPainter': {
|
|
28914
|
+
command: 'FormatPainter',
|
|
28915
|
+
value: 'format-copy'
|
|
28916
|
+
},
|
|
28917
|
+
'applyFormatPainter': {
|
|
28918
|
+
command: 'FormatPainter',
|
|
28919
|
+
value: 'format-paste'
|
|
28920
|
+
},
|
|
28921
|
+
'escapeFormatPainter': {
|
|
28922
|
+
command: 'FormatPainter',
|
|
28923
|
+
value: 'escape'
|
|
27993
28924
|
}
|
|
27994
28925
|
};
|
|
27995
28926
|
|
|
@@ -28241,6 +29172,20 @@ __decorate$2([
|
|
|
28241
29172
|
__decorate$2([
|
|
28242
29173
|
Property(['TableHeader', 'TableRows', 'TableColumns', 'BackgroundColor', '-', 'TableRemove', 'Alignments', 'TableCellVerticalAlign', 'Styles'])
|
|
28243
29174
|
], QuickToolbarSettings.prototype, "table", void 0);
|
|
29175
|
+
/**
|
|
29176
|
+
* Configure the format painter settings of the Rich Text Editor.
|
|
29177
|
+
*/
|
|
29178
|
+
class FormatPainterSettings extends ChildProperty {
|
|
29179
|
+
}
|
|
29180
|
+
__decorate$2([
|
|
29181
|
+
Property(['Text', 'List', 'Table'])
|
|
29182
|
+
], FormatPainterSettings.prototype, "allowedContext", void 0);
|
|
29183
|
+
__decorate$2([
|
|
29184
|
+
Property('b; em; font; sub; sup; kbd; i; s; u; code; strong; span; p; div; h1; h2; h3; h4; h5; h6; blockquote; table; thead; tbody; tr; td; th; ol; ul; li; pre;')
|
|
29185
|
+
], FormatPainterSettings.prototype, "allowedFormats", void 0);
|
|
29186
|
+
__decorate$2([
|
|
29187
|
+
Property(null)
|
|
29188
|
+
], FormatPainterSettings.prototype, "deniedFormats", void 0);
|
|
28244
29189
|
/**
|
|
28245
29190
|
* Configures the Paste Cleanup settings of the RichTextEditor.
|
|
28246
29191
|
*/
|
|
@@ -28459,7 +29404,7 @@ class EnterKeyAction {
|
|
|
28459
29404
|
isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
28460
29405
|
}
|
|
28461
29406
|
if (e.args.which === 13 && e.args.code === 'Enter') {
|
|
28462
|
-
if (isNullOrUndefined(this.startNode.closest('LI,UL,OL')) && isNullOrUndefined(this.endNode.closest('LI,UL,OL')) && isTableEnter &&
|
|
29407
|
+
if (isNullOrUndefined(this.startNode.closest('LI, UL, OL')) && isNullOrUndefined(this.endNode.closest('LI, UL, OL')) && isTableEnter &&
|
|
28463
29408
|
isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
|
|
28464
29409
|
const shiftKey = e.args.shiftKey;
|
|
28465
29410
|
const actionBeginArgs = {
|
|
@@ -28529,13 +29474,17 @@ class EnterKeyAction {
|
|
|
28529
29474
|
}
|
|
28530
29475
|
if (this.range.startContainer === this.range.endContainer &&
|
|
28531
29476
|
this.range.startOffset === this.range.endOffset && this.range.startContainer === this.parent.inputElement) {
|
|
28532
|
-
if (!isNullOrUndefined(this.range.startContainer.childNodes[this.range.startOffset]) &&
|
|
28533
|
-
!isNullOrUndefined(this.range.startContainer.childNodes[this.range.startOffset].previousElementSibling) &&
|
|
28534
|
-
this.range.startContainer.childNodes[this.range.startOffset].previousElementSibling.nodeName === 'TABLE') {
|
|
28535
|
-
this.parent.tableModule.removeResizeElement();
|
|
28536
|
-
}
|
|
28537
29477
|
if (!(this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
|
|
28538
|
-
|
|
29478
|
+
if (isNullOrUndefined(this.range.startContainer.childNodes[this.range.startOffset])) {
|
|
29479
|
+
let currentLastElem = this.range.startContainer.childNodes[this.range.startOffset - 1];
|
|
29480
|
+
while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
|
|
29481
|
+
currentLastElem = currentLastElem.lastChild;
|
|
29482
|
+
}
|
|
29483
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentLastElem, (currentLastElem.nodeName === 'BR' ? 0 : currentLastElem.textContent.length));
|
|
29484
|
+
}
|
|
29485
|
+
else {
|
|
29486
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.range.startContainer.childNodes[this.range.startOffset], 0);
|
|
29487
|
+
}
|
|
28539
29488
|
}
|
|
28540
29489
|
this.getRangeNode();
|
|
28541
29490
|
}
|
|
@@ -28560,7 +29509,7 @@ class EnterKeyAction {
|
|
|
28560
29509
|
let isFocusedFirst = false;
|
|
28561
29510
|
if (this.range.startOffset !== 0 && this.range.endOffset !== 0 &&
|
|
28562
29511
|
this.range.startContainer === this.range.endContainer && !(!isNullOrUndefined(nearBlockNode.childNodes[0])
|
|
28563
|
-
&& nearBlockNode.childNodes[0].nodeName === 'IMG' && nearBlockNode.querySelectorAll('img,audio,video').length > 0)) {
|
|
29512
|
+
&& nearBlockNode.childNodes[0].nodeName === 'IMG' && nearBlockNode.querySelectorAll('img, audio, video').length > 0)) {
|
|
28564
29513
|
const startNodeText = this.range.startContainer.textContent;
|
|
28565
29514
|
const splitFirstText = startNodeText.substring(0, this.range.startOffset);
|
|
28566
29515
|
// eslint-disable-next-line max-len
|
|
@@ -28581,8 +29530,8 @@ class EnterKeyAction {
|
|
|
28581
29530
|
(this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
28582
29531
|
let isNearBlockLengthZero;
|
|
28583
29532
|
let newElem;
|
|
28584
|
-
if (!isNullOrUndefined(this.range.startContainer.childNodes) && this.range.startContainer.textContent.length === 0
|
|
28585
|
-
(this.range.startContainer.querySelectorAll('img,audio,video').length > 0 ||
|
|
29533
|
+
if (!isNullOrUndefined(this.range.startContainer.childNodes) && this.range.startContainer.textContent.length === 0
|
|
29534
|
+
&& (this.range.startContainer.querySelectorAll('img, audio, video').length > 0 ||
|
|
28586
29535
|
this.range.startContainer.nodeName === 'IMG' || this.range.startContainer.nodeName === 'TABLE')) {
|
|
28587
29536
|
newElem = this.createInsertElement(shiftKey);
|
|
28588
29537
|
isMediaNode = true;
|
|
@@ -28591,7 +29540,7 @@ class EnterKeyAction {
|
|
|
28591
29540
|
else {
|
|
28592
29541
|
if ((nearBlockNode.textContent.trim().length !== 0 ||
|
|
28593
29542
|
nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
28594
|
-
(nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img,audio,video').length > 0))) {
|
|
29543
|
+
(nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img, audio, video').length > 0))) {
|
|
28595
29544
|
if ((this.range.startOffset === this.range.endOffset && this.range.startOffset !== 0)) {
|
|
28596
29545
|
newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
|
|
28597
29546
|
}
|
|
@@ -28655,7 +29604,7 @@ class EnterKeyAction {
|
|
|
28655
29604
|
this.range.startContainer.classList.contains('e-audio-wrap'))) {
|
|
28656
29605
|
if (nearBlockNode.textContent.trim().length > 0) {
|
|
28657
29606
|
const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
|
|
28658
|
-
|
|
29607
|
+
const audioVideoElem = !isNullOrUndefined(newElem.previousSibling.querySelector('.e-video-wrap')) ?
|
|
28659
29608
|
newElem.previousSibling.querySelector('.e-video-wrap') : newElem.previousSibling.querySelector('.e-audio-wrap');
|
|
28660
29609
|
let isBRInserted = false;
|
|
28661
29610
|
let lastNode = audioVideoElem.previousSibling;
|
|
@@ -28677,7 +29626,7 @@ class EnterKeyAction {
|
|
|
28677
29626
|
}
|
|
28678
29627
|
else {
|
|
28679
29628
|
const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
|
|
28680
|
-
|
|
29629
|
+
const focusElem = newElem.previousSibling;
|
|
28681
29630
|
while (!isNullOrUndefined(focusElem.firstChild)) {
|
|
28682
29631
|
detach(focusElem.firstChild);
|
|
28683
29632
|
}
|
|
@@ -28757,11 +29706,13 @@ class EnterKeyAction {
|
|
|
28757
29706
|
}
|
|
28758
29707
|
const isLastNodeLength = this.range.startContainer === currentParentLastChild ?
|
|
28759
29708
|
this.range.startContainer.textContent.length : currentParent.textContent.length;
|
|
29709
|
+
const isImageElement = (this.range.startContainer.nodeName === 'IMG' || (this.range.startContainer.childNodes.length > 0
|
|
29710
|
+
&& this.range.startContainer.childNodes[this.range.startOffset].nodeName === 'IMG'));
|
|
28760
29711
|
if (currentParent !== this.parent.inputElement &&
|
|
28761
29712
|
this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
|
|
28762
29713
|
this.range.startOffset === this.range.endOffset &&
|
|
28763
29714
|
(this.range.startOffset === isLastNodeLength ||
|
|
28764
|
-
(currentParent.textContent.trim().length === 0 &&
|
|
29715
|
+
(currentParent.textContent.trim().length === 0 && isImageElement))) {
|
|
28765
29716
|
let focusBRElem = this.parent.createElement('br');
|
|
28766
29717
|
if (this.range.startOffset === 0 && this.range.startContainer.nodeName === 'TABLE') {
|
|
28767
29718
|
this.range.startContainer.parentElement.insertBefore(focusBRElem, this.range.startContainer);
|
|
@@ -28770,10 +29721,11 @@ class EnterKeyAction {
|
|
|
28770
29721
|
if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
|
|
28771
29722
|
this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
|
|
28772
29723
|
}
|
|
28773
|
-
else if (this.range.startOffset === 0 && this.range.endOffset === 0 &&
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
focusBRElem
|
|
29724
|
+
else if (this.range.startOffset === 0 && this.range.endOffset === 0 && isImageElement) {
|
|
29725
|
+
const imageElement = this.range.startContainer.nodeName === 'IMG' ? this.range.startContainer :
|
|
29726
|
+
this.range.startContainer.childNodes[this.range.startOffset];
|
|
29727
|
+
currentParent.insertBefore(focusBRElem, imageElement);
|
|
29728
|
+
focusBRElem = imageElement;
|
|
28777
29729
|
}
|
|
28778
29730
|
else {
|
|
28779
29731
|
const lineBreakBRElem = this.parent.createElement('br');
|
|
@@ -28948,6 +29900,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
28948
29900
|
member: 'video',
|
|
28949
29901
|
args: [this, this.serviceLocator]
|
|
28950
29902
|
});
|
|
29903
|
+
modules.push({
|
|
29904
|
+
member: 'formatPainter',
|
|
29905
|
+
args: [this]
|
|
29906
|
+
});
|
|
28951
29907
|
}
|
|
28952
29908
|
if (this.fileManagerSettings.enable) {
|
|
28953
29909
|
modules.push({ member: 'fileManager', args: [this, this.serviceLocator] });
|
|
@@ -29017,7 +29973,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
29017
29973
|
this.setContainer();
|
|
29018
29974
|
this.persistData();
|
|
29019
29975
|
setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
|
|
29020
|
-
attributes(this.element, { role: 'application' });
|
|
29976
|
+
attributes(this.element, { role: 'application', 'aria-label': 'Rich Text Editor' });
|
|
29021
29977
|
}
|
|
29022
29978
|
persistData() {
|
|
29023
29979
|
if (this.enablePersistence && this.originalElement.tagName === 'TEXTAREA') {
|
|
@@ -29158,6 +30114,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
29158
30114
|
*/
|
|
29159
30115
|
executeCommand(commandName, value, option) {
|
|
29160
30116
|
value = this.htmlPurifier(commandName, value);
|
|
30117
|
+
let internalValue;
|
|
29161
30118
|
if (this.editorMode === 'HTML') {
|
|
29162
30119
|
const range = this.getRange();
|
|
29163
30120
|
if (this.iframeSettings.enable) {
|
|
@@ -29204,7 +30161,16 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
29204
30161
|
return;
|
|
29205
30162
|
}
|
|
29206
30163
|
}
|
|
29207
|
-
|
|
30164
|
+
internalValue = value;
|
|
30165
|
+
if (tool.command === 'FormatPainter') {
|
|
30166
|
+
if (!isNullOrUndefined(value)) {
|
|
30167
|
+
this.formatPainterSettings = value;
|
|
30168
|
+
}
|
|
30169
|
+
internalValue = {
|
|
30170
|
+
formatPainterAction: tool.value
|
|
30171
|
+
};
|
|
30172
|
+
}
|
|
30173
|
+
this.formatter.editorManager.execCommand(tool.command, tool.subCommand ? tool.subCommand : (internalValue ? internalValue : tool.value), null, null, (internalValue ? internalValue : tool.value), (internalValue ? internalValue : tool.value));
|
|
29208
30174
|
if (option && option.undo) {
|
|
29209
30175
|
this.formatter.saveData();
|
|
29210
30176
|
this.formatter.enableUndo(this);
|
|
@@ -29461,11 +30427,13 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
29461
30427
|
const endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
|
|
29462
30428
|
range.endContainer;
|
|
29463
30429
|
const closestLI = closest(endNode, 'LI');
|
|
30430
|
+
let isDetached = false;
|
|
29464
30431
|
if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
|
|
29465
30432
|
!range.collapsed && isNullOrUndefined(endNode.nextElementSibling)) {
|
|
29466
30433
|
for (let i = 0; i < closestLI.childNodes.length; i++) {
|
|
29467
30434
|
if (closestLI.childNodes[i].nodeName === '#text' && closestLI.childNodes[i].textContent.trim().length === 0) {
|
|
29468
30435
|
detach(closestLI.childNodes[i]);
|
|
30436
|
+
isDetached = true;
|
|
29469
30437
|
i--;
|
|
29470
30438
|
}
|
|
29471
30439
|
}
|
|
@@ -29473,7 +30441,11 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
29473
30441
|
while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
|
|
29474
30442
|
currentLastElem = currentLastElem.lastChild;
|
|
29475
30443
|
}
|
|
29476
|
-
|
|
30444
|
+
if (isDetached) {
|
|
30445
|
+
let currentLast = currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ?
|
|
30446
|
+
currentLastElem.previousSibling : currentLastElem;
|
|
30447
|
+
this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLast : currentStartContainer, currentLast, currentStartOffset, (currentLast.nodeName === 'BR' ? 0 : currentLast.textContent.length));
|
|
30448
|
+
}
|
|
29477
30449
|
}
|
|
29478
30450
|
}
|
|
29479
30451
|
/**
|
|
@@ -29537,14 +30509,21 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
29537
30509
|
this.formatter.saveData();
|
|
29538
30510
|
}
|
|
29539
30511
|
if (e.action !== 'insert-link' &&
|
|
30512
|
+
e.action !== 'format-copy' && e.action !== 'format-paste' &&
|
|
29540
30513
|
(e.action && e.action !== 'paste' && e.action !== 'space'
|
|
29541
30514
|
|| e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
|
|
29542
|
-
|
|
30515
|
+
let FormatPainterEscapeAction = false;
|
|
30516
|
+
if (!isNullOrUndefined(this.formatPainterModule)) {
|
|
30517
|
+
FormatPainterEscapeAction = this.formatPainterModule.previousAction === 'escape';
|
|
30518
|
+
}
|
|
30519
|
+
if (!FormatPainterEscapeAction) {
|
|
30520
|
+
this.formatter.process(this, null, e);
|
|
30521
|
+
}
|
|
29543
30522
|
switch (e.action) {
|
|
29544
30523
|
case 'toolbar-focus':
|
|
29545
30524
|
if (this.toolbarSettings.enable) {
|
|
29546
30525
|
// eslint-disable-next-line
|
|
29547
|
-
let selector = '.e-toolbar-item[
|
|
30526
|
+
let selector = '.e-toolbar-item[title] [tabindex]';
|
|
29548
30527
|
this.toolbarModule.baseToolbar.toolbarObj.element.querySelector(selector).focus();
|
|
29549
30528
|
}
|
|
29550
30529
|
break;
|
|
@@ -30488,6 +31467,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
30488
31467
|
}
|
|
30489
31468
|
else {
|
|
30490
31469
|
const compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
|
|
31470
|
+
// eslint-disable-next-line
|
|
30491
31471
|
if (typeof this.valueTemplate !== 'string' && this.isReact) {
|
|
30492
31472
|
this.displayTempElem = this.createElement('div');
|
|
30493
31473
|
for (let i = 0; i < compiledTemplate.length; i++) {
|
|
@@ -30527,7 +31507,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
30527
31507
|
}
|
|
30528
31508
|
}
|
|
30529
31509
|
}
|
|
30530
|
-
// eslint-disable-next-line
|
|
31510
|
+
// eslint-disable-next-line
|
|
30531
31511
|
renderTemplates(callBack) {
|
|
30532
31512
|
this.renderReactTemplates(callBack);
|
|
30533
31513
|
}
|
|
@@ -30641,7 +31621,9 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
30641
31621
|
* @public
|
|
30642
31622
|
*/
|
|
30643
31623
|
getHtml() {
|
|
30644
|
-
|
|
31624
|
+
const htmlValue = this.contentModule.getEditPanel().innerHTML;
|
|
31625
|
+
return (this.enableXhtml && (htmlValue === '<p><br></p>' || htmlValue === '<div><br></div>' ||
|
|
31626
|
+
htmlValue === '<br>') ? null : this.serializeValue(htmlValue));
|
|
30645
31627
|
}
|
|
30646
31628
|
/**
|
|
30647
31629
|
* Retrieves the Rich Text Editor's XHTML validated HTML content when `enableXhtml` property is enabled.
|
|
@@ -30892,8 +31874,8 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
30892
31874
|
}
|
|
30893
31875
|
const getTextArea = this.element.querySelector('.e-rte-srctextarea');
|
|
30894
31876
|
if (this.editorMode === 'HTML') {
|
|
30895
|
-
value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>'
|
|
30896
|
-
|
|
31877
|
+
value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
|
|
31878
|
+
this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
|
|
30897
31879
|
this.encode(decode(this.inputElement.innerHTML)) : this.inputElement.innerHTML;
|
|
30898
31880
|
if (getTextArea && getTextArea.style.display === 'block') {
|
|
30899
31881
|
value = getTextArea.value;
|
|
@@ -31243,6 +32225,9 @@ __decorate$1([
|
|
|
31243
32225
|
__decorate$1([
|
|
31244
32226
|
Complex({}, PasteCleanupSettings)
|
|
31245
32227
|
], RichTextEditor.prototype, "pasteCleanupSettings", void 0);
|
|
32228
|
+
__decorate$1([
|
|
32229
|
+
Complex({}, FormatPainterSettings)
|
|
32230
|
+
], RichTextEditor.prototype, "formatPainterSettings", void 0);
|
|
31246
32231
|
__decorate$1([
|
|
31247
32232
|
Complex({}, IFrameSettings)
|
|
31248
32233
|
], RichTextEditor.prototype, "iframeSettings", void 0);
|
|
@@ -31273,6 +32258,9 @@ __decorate$1([
|
|
|
31273
32258
|
__decorate$1([
|
|
31274
32259
|
Property(false)
|
|
31275
32260
|
], RichTextEditor.prototype, "enablePersistence", void 0);
|
|
32261
|
+
__decorate$1([
|
|
32262
|
+
Property(true)
|
|
32263
|
+
], RichTextEditor.prototype, "showTooltip", void 0);
|
|
31276
32264
|
__decorate$1([
|
|
31277
32265
|
Property(false)
|
|
31278
32266
|
], RichTextEditor.prototype, "enableResize", void 0);
|
|
@@ -31511,10 +32499,6 @@ RichTextEditor = __decorate$1([
|
|
|
31511
32499
|
* Base export
|
|
31512
32500
|
*/
|
|
31513
32501
|
|
|
31514
|
-
/**
|
|
31515
|
-
* Base export
|
|
31516
|
-
*/
|
|
31517
|
-
|
|
31518
32502
|
/**
|
|
31519
32503
|
* Export all markdown plugins
|
|
31520
32504
|
*/
|
|
@@ -31531,5 +32515,5 @@ RichTextEditor = __decorate$1([
|
|
|
31531
32515
|
* Rich Text Editor component exported items
|
|
31532
32516
|
*/
|
|
31533
32517
|
|
|
31534
|
-
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, HTMLFormatter, Formatter, MarkdownFormatter, ContentRender, Render, ToolbarRenderer, Link, 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, blockEmptyNodes, inlineEmptyNodes, CLS_RTE, CLS_RTL, CLS_CONTENT, CLS_DISABLED, CLS_SCRIPT_SHEET, CLS_STYLE_SHEET, CLS_TOOLBAR, CLS_TB_FIXED, CLS_TB_FLOAT, CLS_TB_ABS_FLOAT, CLS_INLINE, CLS_TB_INLINE, CLS_RTE_EXPAND_TB, CLS_FULL_SCREEN, CLS_QUICK_TB, CLS_POP, CLS_TB_STATIC, CLS_QUICK_POP, CLS_QUICK_DROPDOWN, CLS_IMAGE_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, 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, 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, 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, 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 };
|
|
32518
|
+
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, HTMLFormatter, Formatter, MarkdownFormatter, ContentRender, Render, ToolbarRenderer, Link, 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, blockEmptyNodes, inlineEmptyNodes, CLS_RTE, CLS_RTL, CLS_CONTENT, CLS_DISABLED, CLS_SCRIPT_SHEET, CLS_STYLE_SHEET, CLS_TOOLBAR, CLS_TB_FIXED, CLS_TB_FLOAT, CLS_TB_ABS_FLOAT, CLS_INLINE, CLS_TB_INLINE, CLS_RTE_EXPAND_TB, CLS_FULL_SCREEN, CLS_QUICK_TB, CLS_POP, CLS_TB_STATIC, CLS_QUICK_POP, CLS_QUICK_DROPDOWN, CLS_IMAGE_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, 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, 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, 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, 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 };
|
|
31535
32519
|
//# sourceMappingURL=ej2-richtexteditor.es2015.js.map
|