@syncfusion/ej2-richtexteditor 23.2.7-52849 → 24.1.41-569781
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/.eslintrc.json +260 -0
- package/CHANGELOG.md +177 -1
- package/dist/ej2-richtexteditor.umd.min.js +1 -1
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +2919 -1147
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +2906 -1133
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/package.json +13 -13
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +12 -1
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/interface.d.ts +12 -0
- package/src/common/types.d.ts +6 -0
- package/src/common/util.d.ts +6 -0
- package/src/common/util.js +61 -20
- package/src/editor-manager/base/constant.d.ts +6 -0
- package/src/editor-manager/base/constant.js +6 -0
- package/src/editor-manager/base/editor-manager.d.ts +5 -0
- package/src/editor-manager/base/editor-manager.js +59 -0
- package/src/editor-manager/base/interface.d.ts +8 -0
- package/src/editor-manager/plugin/audio.js +13 -3
- package/src/editor-manager/plugin/dom-node.d.ts +5 -1
- package/src/editor-manager/plugin/dom-node.js +169 -28
- package/src/editor-manager/plugin/format-painter-actions.d.ts +1 -0
- package/src/editor-manager/plugin/format-painter-actions.js +19 -1
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +38 -3
- package/src/editor-manager/plugin/image.js +38 -15
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +67 -7
- package/src/editor-manager/plugin/link.js +4 -1
- package/src/editor-manager/plugin/lists.js +121 -65
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +3 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +215 -85
- package/src/editor-manager/plugin/nodecutter.js +2 -2
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +165 -3
- package/src/editor-manager/plugin/table.d.ts +0 -1
- package/src/editor-manager/plugin/table.js +33 -30
- package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +20 -10
- package/src/editor-manager/plugin/undo.d.ts +1 -0
- package/src/editor-manager/plugin/undo.js +21 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-quick-toolbar.js +66 -15
- package/src/rich-text-editor/actions/base-toolbar.js +32 -34
- package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
- package/src/rich-text-editor/actions/color-picker.js +13 -3
- package/src/rich-text-editor/actions/count.js +1 -1
- package/src/rich-text-editor/actions/dropdown-buttons.js +25 -4
- package/src/rich-text-editor/actions/emoji-picker.js +15 -6
- package/src/rich-text-editor/actions/enter-key.js +6 -4
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +1 -1
- package/src/rich-text-editor/actions/full-screen.js +5 -4
- package/src/rich-text-editor/actions/html-editor.d.ts +2 -0
- package/src/rich-text-editor/actions/html-editor.js +127 -17
- package/src/rich-text-editor/actions/keyboard.js +3 -1
- package/src/rich-text-editor/actions/markdown-editor.js +3 -1
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +5 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +156 -28
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +7 -0
- package/src/rich-text-editor/actions/quick-toolbar.js +45 -11
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/toolbar.js +35 -96
- package/src/rich-text-editor/base/classes.d.ts +5 -5
- package/src/rich-text-editor/base/classes.js +5 -5
- package/src/rich-text-editor/base/constant.d.ts +46 -1
- package/src/rich-text-editor/base/constant.js +215 -1
- package/src/rich-text-editor/base/interface.d.ts +47 -3
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +3 -3
- package/src/rich-text-editor/base/rich-text-editor.d.ts +16 -4
- package/src/rich-text-editor/base/rich-text-editor.js +196 -100
- package/src/rich-text-editor/base/util.d.ts +4 -0
- package/src/rich-text-editor/base/util.js +57 -5
- package/src/rich-text-editor/formatter/formatter.js +15 -4
- package/src/rich-text-editor/models/default-locale.js +31 -25
- package/src/rich-text-editor/models/items.js +3 -3
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +1 -1
- package/src/rich-text-editor/renderer/audio-module.d.ts +1 -0
- package/src/rich-text-editor/renderer/audio-module.js +13 -0
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +2 -0
- package/src/rich-text-editor/renderer/dialog-renderer.js +22 -2
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
- package/src/rich-text-editor/renderer/image-module.d.ts +9 -1
- package/src/rich-text-editor/renderer/image-module.js +244 -212
- package/src/rich-text-editor/renderer/link-module.js +53 -24
- package/src/rich-text-editor/renderer/table-module.d.ts +10 -1
- package/src/rich-text-editor/renderer/table-module.js +330 -165
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +4 -6
- package/src/rich-text-editor/renderer/toolbar-renderer.js +105 -106
- package/src/rich-text-editor/renderer/video-module.d.ts +3 -0
- package/src/rich-text-editor/renderer/video-module.js +61 -34
- package/src/rich-text-editor/renderer/view-source.d.ts +1 -0
- package/src/rich-text-editor/renderer/view-source.js +15 -5
- package/src/selection/selection.js +3 -0
- package/styles/bootstrap-dark.css +345 -99
- package/styles/bootstrap.css +353 -108
- package/styles/bootstrap4.css +337 -95
- package/styles/bootstrap5-dark.css +343 -96
- package/styles/bootstrap5.css +343 -96
- package/styles/fabric-dark.css +331 -89
- package/styles/fabric.css +332 -90
- package/styles/fluent-dark.css +342 -92
- package/styles/fluent.css +342 -92
- package/styles/highcontrast-light.css +331 -89
- package/styles/highcontrast.css +335 -90
- package/styles/material-dark.css +337 -90
- package/styles/material.css +337 -90
- package/styles/material3-dark.css +347 -99
- package/styles/material3.css +347 -99
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +14 -10
- package/styles/rich-text-editor/_bootstrap-definition.scss +20 -17
- package/styles/rich-text-editor/_bootstrap4-definition.scss +11 -7
- package/styles/rich-text-editor/_bootstrap5-definition.scss +8 -4
- package/styles/rich-text-editor/_fabric-dark-definition.scss +6 -2
- package/styles/rich-text-editor/_fabric-definition.scss +7 -3
- package/styles/rich-text-editor/_fluent-definition.scss +9 -5
- package/styles/rich-text-editor/_fusionnew-definition.scss +7 -3
- package/styles/rich-text-editor/_highcontrast-definition.scss +7 -3
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +6 -2
- package/styles/rich-text-editor/_layout.scss +208 -31
- package/styles/rich-text-editor/_material-dark-definition.scss +6 -2
- package/styles/rich-text-editor/_material-definition.scss +6 -2
- package/styles/rich-text-editor/_material3-definition.scss +16 -12
- package/styles/rich-text-editor/_tailwind-definition.scss +25 -21
- package/styles/rich-text-editor/_theme.scss +93 -24
- package/styles/rich-text-editor/bootstrap-dark.css +345 -99
- package/styles/rich-text-editor/bootstrap.css +353 -108
- package/styles/rich-text-editor/bootstrap4.css +337 -95
- package/styles/rich-text-editor/bootstrap5-dark.css +343 -96
- package/styles/rich-text-editor/bootstrap5.css +343 -96
- package/styles/rich-text-editor/fabric-dark.css +331 -89
- package/styles/rich-text-editor/fabric.css +332 -90
- package/styles/rich-text-editor/fluent-dark.css +342 -92
- package/styles/rich-text-editor/fluent.css +342 -92
- package/styles/rich-text-editor/highcontrast-light.css +331 -89
- package/styles/rich-text-editor/highcontrast.css +335 -90
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap4.scss +4 -4
- package/styles/rich-text-editor/icons/_bootstrap5.scss +4 -4
- package/styles/rich-text-editor/icons/_fabric-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_fabric.scss +4 -4
- package/styles/rich-text-editor/icons/_fluent.scss +4 -4
- package/styles/rich-text-editor/icons/_fusionnew.scss +3 -3
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +4 -4
- package/styles/rich-text-editor/icons/_highcontrast.scss +4 -4
- package/styles/rich-text-editor/icons/_material-dark.scss +4 -4
- package/styles/rich-text-editor/icons/_material.scss +4 -4
- package/styles/rich-text-editor/icons/_material3.scss +4 -4
- package/styles/rich-text-editor/icons/_tailwind.scss +4 -4
- package/styles/rich-text-editor/material-dark.css +337 -90
- package/styles/rich-text-editor/material.css +337 -90
- package/styles/rich-text-editor/material3-dark.css +347 -99
- package/styles/rich-text-editor/material3.css +347 -99
- package/styles/rich-text-editor/tailwind-dark.css +386 -116
- package/styles/rich-text-editor/tailwind.css +386 -116
- package/styles/tailwind-dark.css +386 -116
- package/styles/tailwind.css +386 -116
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
- package/src/global.d.ts +0 -1
|
@@ -14,6 +14,7 @@ import { getTextNodesUnder, sanitizeHelper, getDefaultValue } from '../base/util
|
|
|
14
14
|
import { isIDevice } from '../../common/util';
|
|
15
15
|
import { XhtmlValidation } from './xhtml-validation';
|
|
16
16
|
import { ON_BEGIN } from './../../common/constant';
|
|
17
|
+
import * as CONSTANT from '../base/constant';
|
|
17
18
|
/**
|
|
18
19
|
* `HtmlEditor` module is used to HTML editor
|
|
19
20
|
*/
|
|
@@ -70,6 +71,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
70
71
|
this.parent.on(events.readOnlyMode, this.updateReadOnly, this);
|
|
71
72
|
this.parent.on(events.paste, this.onPaste, this);
|
|
72
73
|
this.parent.on(events.tableclass, this.isTableClassAdded, this);
|
|
74
|
+
this.parent.on(events.onHandleFontsizeChange, this.onHandleFontsizeChange, this);
|
|
73
75
|
};
|
|
74
76
|
HtmlEditor.prototype.updateReadOnly = function () {
|
|
75
77
|
if (this.parent.readonly) {
|
|
@@ -88,7 +90,9 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
88
90
|
};
|
|
89
91
|
HtmlEditor.prototype.onSelectionRestore = function (e) {
|
|
90
92
|
this.parent.isBlur = false;
|
|
91
|
-
this.
|
|
93
|
+
if (isNOU(this.saveSelection) || isNOU(closest(this.saveSelection.range.startContainer.parentElement, ".e-img-caption")) ? true : !(closest(this.saveSelection.range.startContainer.parentElement, ".e-img-caption").getAttribute("contenteditable") == "false")) {
|
|
94
|
+
this.contentRenderer.getEditPanel().focus();
|
|
95
|
+
}
|
|
92
96
|
if (isNullOrUndefined(e.items) || e.items) {
|
|
93
97
|
this.saveSelection.restore();
|
|
94
98
|
}
|
|
@@ -96,11 +100,91 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
96
100
|
HtmlEditor.prototype.isTableClassAdded = function () {
|
|
97
101
|
var tableElement = this.parent.inputElement.querySelectorAll('table');
|
|
98
102
|
for (var i = 0; i < tableElement.length; i++) {
|
|
99
|
-
if (!tableElement[i].classList.contains('e-rte-table')) {
|
|
103
|
+
if (!tableElement[i].classList.contains('e-rte-table') && !tableElement[i].classList.contains('e-rte-paste-table')) {
|
|
100
104
|
tableElement[i].classList.add('e-rte-table');
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
};
|
|
108
|
+
HtmlEditor.prototype.onHandleFontsizeChange = function (e) {
|
|
109
|
+
var keyboardArgs = e.args;
|
|
110
|
+
var args = { name: 'dropDownSelect' };
|
|
111
|
+
args.item = {
|
|
112
|
+
command: 'Font',
|
|
113
|
+
subCommand: 'FontSize'
|
|
114
|
+
};
|
|
115
|
+
var items = this.parent.fontSize.items;
|
|
116
|
+
var activeElem;
|
|
117
|
+
if (this.parent.toolbarModule && this.parent.toolbarModule.dropDownModule &&
|
|
118
|
+
this.parent.toolbarModule.dropDownModule.fontSizeDropDown && !isNOU(this.parent.toolbarModule.dropDownModule.fontSizeDropDown.activeElem[0].textContent) && this.parent.toolbarModule.dropDownModule.fontSizeDropDown.activeElem[0].textContent !== '') {
|
|
119
|
+
activeElem = this.parent.toolbarModule.dropDownModule.fontSizeDropDown.activeElem[0].textContent;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
var fontSizeValue = void 0;
|
|
123
|
+
var selection = this.parent.contentModule.getDocument().getSelection();
|
|
124
|
+
if (selection && selection.focusNode && selection.focusNode.parentElement) {
|
|
125
|
+
fontSizeValue = document.defaultView.getComputedStyle(selection.focusNode.parentElement, null).getPropertyValue('font-size');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
fontSizeValue = this.parent.fontSize.width;
|
|
129
|
+
}
|
|
130
|
+
fontSizeValue = isNOU(fontSizeValue) ? this.parent.fontSize.width : fontSizeValue;
|
|
131
|
+
var actualTxtFontValues = fontSizeValue.match(/^([\d.]+)(\D+)$/);
|
|
132
|
+
var size_1 = parseInt(actualTxtFontValues[1], 10);
|
|
133
|
+
var unit = actualTxtFontValues[2];
|
|
134
|
+
var defaultFontValues = items[0].value.match(/^([\d.]+)(\D+)$/);
|
|
135
|
+
if (defaultFontValues[2] === unit) {
|
|
136
|
+
var index = items.findIndex(function (_a) {
|
|
137
|
+
var value = _a.value;
|
|
138
|
+
return parseInt(value, 10) >= size_1;
|
|
139
|
+
});
|
|
140
|
+
activeElem = items[index].text;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
var convertedSize_1 = this.convertFontSize(size_1, unit, defaultFontValues[2]);
|
|
144
|
+
var index = items.findIndex(function (_a) {
|
|
145
|
+
var value = _a.value;
|
|
146
|
+
return parseInt(value, 10) >= convertedSize_1;
|
|
147
|
+
});
|
|
148
|
+
activeElem = items[index].text;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
var fontIndex = items.findIndex(function (size) { return size.text === activeElem; });
|
|
152
|
+
if (keyboardArgs.action === 'increase-fontsize' && fontIndex !== -1) {
|
|
153
|
+
if (fontIndex >= items.length - 1) {
|
|
154
|
+
var fontValues = items[fontIndex].value.match(/^([\d.]+)(\D+)$/);
|
|
155
|
+
if (fontValues) {
|
|
156
|
+
var size = parseInt(fontValues[1], 10);
|
|
157
|
+
var unit = fontValues[2];
|
|
158
|
+
var roundedSize = size % 10 === 0 ? Math.ceil((size + 1) / 10) * 10 : Math.ceil(size / 10) * 10;
|
|
159
|
+
args.item.value = roundedSize.toLocaleString() + unit;
|
|
160
|
+
args.item.text = roundedSize.toLocaleString() + ' ' + unit;
|
|
161
|
+
}
|
|
162
|
+
this.parent.fontSize.items.push(args.item);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
args.item.value = items[fontIndex + 1].value;
|
|
166
|
+
args.item.text = items[fontIndex + 1].text;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if (keyboardArgs.action === 'decrease-fontsize' && fontIndex !== -1 && fontIndex > 0) {
|
|
170
|
+
args.item.value = items[fontIndex - 1].value;
|
|
171
|
+
args.item.text = items[fontIndex - 1].text;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
if (fontIndex >= 0 && fontIndex < items.length && items[fontIndex]) {
|
|
175
|
+
args.item.value = items[fontIndex].value;
|
|
176
|
+
args.item.text = items[fontIndex].text;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
this.parent.formatter.process(this.parent, args, keyboardArgs);
|
|
180
|
+
};
|
|
181
|
+
HtmlEditor.prototype.convertFontSize = function (value, originalUnit, targetUnit) {
|
|
182
|
+
if (CONSTANT.supportedUnits.indexOf(originalUnit) !== -1 || CONSTANT.supportedUnits.indexOf(targetUnit) !== -1) {
|
|
183
|
+
originalUnit = 'px';
|
|
184
|
+
}
|
|
185
|
+
var convertedValue = value * CONSTANT.conversionFactors[originalUnit][targetUnit];
|
|
186
|
+
return convertedValue;
|
|
187
|
+
};
|
|
104
188
|
HtmlEditor.prototype.onKeyUp = function (e) {
|
|
105
189
|
var args = e.args;
|
|
106
190
|
var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
|
|
@@ -108,9 +192,12 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
108
192
|
var range = this.parent.getRange();
|
|
109
193
|
// eslint-disable-next-line
|
|
110
194
|
var regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
195
|
+
var isEmptyNode = range.startContainer === range.endContainer && range.startOffset === range.endOffset &&
|
|
196
|
+
range.startOffset === 1 && range.startContainer.textContent.length === 1 && range.startContainer.textContent.charCodeAt(0) == 8203 &&
|
|
197
|
+
range.startContainer.textContent.replace(regEx, '').length === 0;
|
|
111
198
|
var pointer;
|
|
112
199
|
var isRootParent = false;
|
|
113
|
-
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
|
|
200
|
+
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
|
|
114
201
|
pointer = range.startOffset;
|
|
115
202
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
116
203
|
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
@@ -222,7 +309,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
222
309
|
e.args.keyCode === 13) {
|
|
223
310
|
this.spaceLink(e.args);
|
|
224
311
|
if (this.parent.editorMode === 'HTML' && !this.parent.readonly) {
|
|
225
|
-
var currentLength = this.parent.getText().trim().length;
|
|
312
|
+
var currentLength = this.parent.getText().trim().replace(/(\r\n|\n|\r|\t)/gm, '').replace(/\u200B/g, '').length;
|
|
226
313
|
var selectionLength = this.parent.getSelection().length;
|
|
227
314
|
var totalLength = (currentLength - selectionLength) + 1;
|
|
228
315
|
if (!(this.parent.maxLength === -1 || totalLength <= this.parent.maxLength) &&
|
|
@@ -232,6 +319,15 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
232
319
|
}
|
|
233
320
|
else {
|
|
234
321
|
this.parent.notify(events.enterHandler, { args: e.args });
|
|
322
|
+
var newRange = this.parent.getRange();
|
|
323
|
+
if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
324
|
+
&& !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
|
|
325
|
+
this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
|
|
326
|
+
}
|
|
327
|
+
else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
328
|
+
&& !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
|
|
329
|
+
newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
330
|
+
}
|
|
235
331
|
}
|
|
236
332
|
}
|
|
237
333
|
}
|
|
@@ -312,11 +408,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
312
408
|
currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
|
|
313
409
|
isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
|
|
314
410
|
}
|
|
411
|
+
var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
412
|
+
var isSelectedPositionNotStart = closest(currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer, 'li') ?
|
|
413
|
+
checkNode.nodeName !== 'li' && isNOU(checkNode.previousSibling) : true;
|
|
315
414
|
if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
|
|
316
415
|
currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
|
|
317
416
|
currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
|
|
318
|
-
isPreviousNotContentEditable) {
|
|
319
|
-
var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
417
|
+
isPreviousNotContentEditable && isSelectedPositionNotStart) {
|
|
320
418
|
if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
|
|
321
419
|
!isNOU(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
|
|
322
420
|
(!isNOU(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
|
|
@@ -327,8 +425,9 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
327
425
|
var liElement = this.getRangeLiNode(currentRange.startContainer);
|
|
328
426
|
if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
|
|
329
427
|
this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
|
|
330
|
-
liElement.previousElementSibling : liElement.previousElementSibling.
|
|
331
|
-
if (!
|
|
428
|
+
liElement.previousElementSibling : liElement.previousElementSibling.lastChild;
|
|
429
|
+
if (!isNOU(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
|
|
430
|
+
isNOU(liElement.lastElementChild.previousSibling) && liElement.lastChild.nodeName !== "#text") {
|
|
332
431
|
this.rangeElement = liElement.lastElementChild;
|
|
333
432
|
isLiElement = true;
|
|
334
433
|
}
|
|
@@ -338,13 +437,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
338
437
|
}
|
|
339
438
|
}
|
|
340
439
|
else if (this.rangeElement === this.parent.inputElement || this.rangeElement.tagName === 'TABLE' ||
|
|
341
|
-
(!
|
|
440
|
+
(!isNOU(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
|
|
342
441
|
return;
|
|
343
442
|
}
|
|
344
443
|
else {
|
|
345
444
|
this.oldRangeElement = this.rangeElement.previousElementSibling;
|
|
346
445
|
}
|
|
347
|
-
if (
|
|
446
|
+
if (isNOU(this.oldRangeElement)) {
|
|
348
447
|
return;
|
|
349
448
|
}
|
|
350
449
|
else {
|
|
@@ -353,7 +452,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
353
452
|
? this.oldRangeElement.lastElementChild.lastElementChild :
|
|
354
453
|
this.oldRangeElement.lastElementChild;
|
|
355
454
|
}
|
|
356
|
-
var lastNode = this.oldRangeElement.lastChild;
|
|
455
|
+
var lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
|
|
357
456
|
while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
|
|
358
457
|
lastNode.nodeName !== 'BR') {
|
|
359
458
|
lastNode = lastNode.lastChild;
|
|
@@ -361,12 +460,17 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
361
460
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
|
|
362
461
|
// eslint-disable-next-line
|
|
363
462
|
lastNode, lastNode.textContent.length);
|
|
364
|
-
if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
463
|
+
if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
365
464
|
detach(this.oldRangeElement.querySelector('BR'));
|
|
366
465
|
}
|
|
367
|
-
if (!
|
|
466
|
+
if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
|
|
368
467
|
while (this.rangeElement.firstChild) {
|
|
369
|
-
this.oldRangeElement.
|
|
468
|
+
if (this.oldRangeElement.nodeName === '#text') {
|
|
469
|
+
this.oldRangeElement.parentElement.appendChild(this.rangeElement.childNodes[0]);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
|
|
473
|
+
}
|
|
370
474
|
}
|
|
371
475
|
// eslint-disable-next-line
|
|
372
476
|
!isLiElement ? detach(this.rangeElement) : detach(this.rangeElement.parentElement);
|
|
@@ -380,7 +484,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
380
484
|
var liElement;
|
|
381
485
|
var rootElement;
|
|
382
486
|
if (e.args.code === 'Delete' && e.args.keyCode === 46 &&
|
|
383
|
-
this.parent.contentModule.getText().trim().length !== 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.parentElement.tagName !== 'TD' &&
|
|
487
|
+
this.parent.contentModule.getText().trim().replace(/(\r\n|\n|\r|\t)/gm, '').replace(/\u200B/g, '').length !== 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.parentElement.tagName !== 'TD' &&
|
|
384
488
|
currentRange.startContainer.parentElement.tagName !== 'TH') {
|
|
385
489
|
this.deleteRangeElement = rootElement = this.getRootBlockNode(currentRange.startContainer);
|
|
386
490
|
if (this.deleteRangeElement.tagName === 'OL' || this.deleteRangeElement.tagName === 'UL') {
|
|
@@ -403,7 +507,11 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
403
507
|
(!isNullOrUndefined(this.deleteRangeElement.nextElementSibling) && this.deleteRangeElement.nextElementSibling.tagName === 'TABLE'))) {
|
|
404
508
|
return;
|
|
405
509
|
}
|
|
406
|
-
|
|
510
|
+
var isImgWithEmptyBlockNode = false;
|
|
511
|
+
if (this.deleteRangeElement.querySelectorAll('img').length > 0 && this.deleteRangeElement.textContent.trim() === '') {
|
|
512
|
+
isImgWithEmptyBlockNode = true;
|
|
513
|
+
}
|
|
514
|
+
if (this.getCaretIndex(currentRange, this.deleteRangeElement) === this.deleteRangeElement.textContent.length && !isImgWithEmptyBlockNode) {
|
|
407
515
|
if (!isNullOrUndefined(liElement)) {
|
|
408
516
|
if (isLiElement || !isNullOrUndefined(liElement.nextElementSibling)) {
|
|
409
517
|
this.deleteOldRangeElement = this.getRangeElement(liElement.nextElementSibling);
|
|
@@ -550,7 +658,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
550
658
|
for (var j = 0; j < splitTextContent.length; j++) {
|
|
551
659
|
if (splitTextContent[j].match(httpRegex) || splitTextContent[j].match(wwwRegex)) {
|
|
552
660
|
resultSplitContent += '<a class="e-rte-anchor" href="' + splitTextContent[j] +
|
|
553
|
-
'" title="' + splitTextContent[j] + '"target="_blank">' + splitTextContent[j] + ' </a>';
|
|
661
|
+
'" title="' + splitTextContent[j] + '" target="_blank"' + ' aria-label="' + this.parent.serviceLocator.getService('rteLocale').getConstant("linkAriaLabel") + '">' + splitTextContent[j] + ' </a>';
|
|
554
662
|
}
|
|
555
663
|
else {
|
|
556
664
|
resultSplitContent += splitTextContent[j] + ' ';
|
|
@@ -602,6 +710,8 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
602
710
|
var selectParentEle;
|
|
603
711
|
var item = args.item;
|
|
604
712
|
var closestElement = closest(args.originalEvent.target, '.e-rte-quick-popup');
|
|
713
|
+
var target = args.originalEvent.target;
|
|
714
|
+
this.parent.notify(events.closeTooltip, { target: target });
|
|
605
715
|
if (item.command !== 'FormatPainter') {
|
|
606
716
|
if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
|
|
607
717
|
if (!(item.subCommand === 'SourceCode' || item.subCommand === 'Preview' ||
|
|
@@ -74,7 +74,9 @@ var MarkdownEditor = /** @class */ (function () {
|
|
|
74
74
|
MarkdownEditor.prototype.onToolbarClick = function (args) {
|
|
75
75
|
var item = args.item;
|
|
76
76
|
var textArea = this.parent.contentModule.getEditPanel();
|
|
77
|
-
|
|
77
|
+
if (item.command !== 'Formats') {
|
|
78
|
+
textArea.focus();
|
|
79
|
+
}
|
|
78
80
|
var startOffset = textArea.selectionStart;
|
|
79
81
|
var endOffset = textArea.selectionEnd;
|
|
80
82
|
var text = textArea.value.substring(startOffset, endOffset);
|
|
@@ -55,6 +55,7 @@ export declare class PasteCleanup {
|
|
|
55
55
|
private updateCss;
|
|
56
56
|
private setCssClass;
|
|
57
57
|
private destroyDialog;
|
|
58
|
+
private docClick;
|
|
58
59
|
private cleanAppleClass;
|
|
59
60
|
private formatting;
|
|
60
61
|
private cropImageHandler;
|
|
@@ -64,6 +65,8 @@ export declare class PasteCleanup {
|
|
|
64
65
|
private removeTempClass;
|
|
65
66
|
private sanitizeHelper;
|
|
66
67
|
private plainFormatting;
|
|
68
|
+
private removingComments;
|
|
69
|
+
private reframeToBrContent;
|
|
67
70
|
private getTextContent;
|
|
68
71
|
private detachInlineElements;
|
|
69
72
|
private findDetachEmptyElem;
|
|
@@ -73,6 +76,8 @@ export declare class PasteCleanup {
|
|
|
73
76
|
private deniedTags;
|
|
74
77
|
private deniedAttributes;
|
|
75
78
|
private allowedStyle;
|
|
79
|
+
private findLastElement;
|
|
80
|
+
private processPictureElement;
|
|
76
81
|
/**
|
|
77
82
|
* For internal use only - Get the module name.
|
|
78
83
|
*
|