@syncfusion/ej2-richtexteditor 23.2.7 → 24.1.41-569421
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 +259 -259
- package/CHANGELOG.md +1953 -1749
- package/README.md +76 -76
- package/dist/ej2-richtexteditor.umd.min.js +1 -10
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +9971 -8025
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +8445 -6498
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/helpers/e2e/index.js +3 -3
- package/helpers/e2e/rte-helper.js +13 -13
- package/license +9 -9
- package/package.json +74 -74
- 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 +19 -7
- 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/classes.d.ts +1 -1
- package/src/editor-manager/base/classes.js +1 -1
- 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 +8 -3
- package/src/editor-manager/base/editor-manager.js +62 -3
- package/src/editor-manager/base/enum.d.ts +2 -2
- package/src/editor-manager/base/interface.d.ts +17 -9
- package/src/editor-manager/base/types.d.ts +1 -1
- package/src/editor-manager/plugin/alignments.d.ts +2 -2
- package/src/editor-manager/plugin/alignments.js +2 -2
- package/src/editor-manager/plugin/audio.d.ts +3 -3
- package/src/editor-manager/plugin/audio.js +16 -6
- package/src/editor-manager/plugin/clearformat-exec.d.ts +2 -2
- package/src/editor-manager/plugin/clearformat-exec.js +2 -2
- package/src/editor-manager/plugin/clearformat.d.ts +1 -1
- package/src/editor-manager/plugin/clearformat.js +1 -1
- package/src/editor-manager/plugin/dom-node.d.ts +39 -35
- package/src/editor-manager/plugin/dom-node.js +203 -62
- package/src/editor-manager/plugin/format-painter-actions.d.ts +2 -1
- package/src/editor-manager/plugin/format-painter-actions.js +20 -2
- package/src/editor-manager/plugin/formats.d.ts +3 -2
- package/src/editor-manager/plugin/formats.js +40 -5
- package/src/editor-manager/plugin/image.d.ts +3 -3
- package/src/editor-manager/plugin/image.js +41 -18
- package/src/editor-manager/plugin/indents.d.ts +2 -2
- package/src/editor-manager/plugin/indents.js +3 -3
- package/src/editor-manager/plugin/insert-methods.d.ts +4 -4
- package/src/editor-manager/plugin/insert-methods.js +4 -4
- package/src/editor-manager/plugin/insert-text.d.ts +2 -2
- package/src/editor-manager/plugin/insert-text.js +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.d.ts +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.js +2 -2
- package/src/editor-manager/plugin/inserthtml.d.ts +3 -2
- package/src/editor-manager/plugin/inserthtml.js +85 -22
- package/src/editor-manager/plugin/isformatted.d.ts +8 -8
- package/src/editor-manager/plugin/isformatted.js +8 -8
- package/src/editor-manager/plugin/link.d.ts +2 -2
- package/src/editor-manager/plugin/link.js +10 -5
- package/src/editor-manager/plugin/lists.d.ts +2 -2
- package/src/editor-manager/plugin/lists.js +161 -72
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +216 -86
- package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
- package/src/editor-manager/plugin/nodecutter.js +11 -8
- package/src/editor-manager/plugin/selection-commands.d.ts +3 -1
- package/src/editor-manager/plugin/selection-commands.js +249 -5
- package/src/editor-manager/plugin/selection-exec.d.ts +2 -2
- package/src/editor-manager/plugin/selection-exec.js +2 -2
- package/src/editor-manager/plugin/table.d.ts +6 -3
- package/src/editor-manager/plugin/table.js +97 -51
- package/src/editor-manager/plugin/toolbar-status.d.ts +4 -4
- package/src/editor-manager/plugin/toolbar-status.js +22 -12
- package/src/editor-manager/plugin/undo.d.ts +7 -6
- package/src/editor-manager/plugin/undo.js +27 -7
- package/src/editor-manager/plugin/video.d.ts +3 -3
- package/src/editor-manager/plugin/video.js +3 -3
- package/src/global.d.ts +1 -0
- package/src/markdown-parser/base/interface.d.ts +10 -10
- package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
- package/src/markdown-parser/base/markdown-parser.js +3 -3
- package/src/markdown-parser/base/types.d.ts +1 -1
- package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
- package/src/markdown-parser/plugin/clearformat.js +2 -2
- package/src/markdown-parser/plugin/formats.d.ts +2 -2
- package/src/markdown-parser/plugin/formats.js +2 -2
- package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
- package/src/markdown-parser/plugin/insert-text.js +2 -2
- package/src/markdown-parser/plugin/link.d.ts +2 -2
- package/src/markdown-parser/plugin/link.js +2 -2
- package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
- package/src/markdown-parser/plugin/markdown-selection.js +14 -14
- package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
- package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
- package/src/markdown-parser/plugin/table.d.ts +3 -3
- package/src/markdown-parser/plugin/table.js +3 -3
- package/src/markdown-parser/plugin/undo.d.ts +6 -6
- package/src/markdown-parser/plugin/undo.js +6 -6
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +13 -12
- package/src/rich-text-editor/actions/base-quick-toolbar.js +70 -23
- package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-toolbar.js +36 -37
- package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
- package/src/rich-text-editor/actions/color-picker.js +15 -5
- package/src/rich-text-editor/actions/count.d.ts +3 -3
- package/src/rich-text-editor/actions/count.js +4 -4
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +3 -2
- package/src/rich-text-editor/actions/dropdown-buttons.js +13 -7
- package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
- package/src/rich-text-editor/actions/emoji-picker.js +17 -8
- package/src/rich-text-editor/actions/enter-key.js +10 -5
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +5 -2
- package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
- package/src/rich-text-editor/actions/full-screen.js +8 -7
- package/src/rich-text-editor/actions/html-editor.d.ts +5 -3
- package/src/rich-text-editor/actions/html-editor.js +134 -22
- package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
- package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
- package/src/rich-text-editor/actions/keyboard.js +23 -21
- package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
- package/src/rich-text-editor/actions/markdown-editor.js +5 -3
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +6 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +157 -29
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +17 -9
- package/src/rich-text-editor/actions/quick-toolbar.js +68 -21
- 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 +16 -16
- package/src/rich-text-editor/actions/toolbar.js +48 -109
- package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
- package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
- package/src/rich-text-editor/base/classes.d.ts +125 -125
- package/src/rich-text-editor/base/classes.js +125 -125
- package/src/rich-text-editor/base/constant.d.ts +195 -150
- package/src/rich-text-editor/base/constant.js +364 -150
- package/src/rich-text-editor/base/enum.d.ts +1 -1
- package/src/rich-text-editor/base/enum.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +96 -52
- package/src/rich-text-editor/base/interface.js +1 -1
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
- package/src/rich-text-editor/base/rich-text-editor.d.ts +76 -64
- package/src/rich-text-editor/base/rich-text-editor.js +247 -160
- package/src/rich-text-editor/base/util.d.ts +1 -1
- package/src/rich-text-editor/base/util.js +23 -5
- package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
- package/src/rich-text-editor/formatter/formatter.js +24 -12
- package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/html-formatter.js +15 -15
- package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
- package/src/rich-text-editor/models/default-locale.js +31 -25
- package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
- package/src/rich-text-editor/models/iframe-settings.js +19 -19
- package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
- package/src/rich-text-editor/models/inline-mode.js +19 -19
- package/src/rich-text-editor/models/items.js +3 -3
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +20 -20
- package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
- package/src/rich-text-editor/renderer/audio-module.js +23 -5
- package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/content-renderer.js +6 -6
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +24 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
- package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
- package/src/rich-text-editor/renderer/image-module.js +265 -221
- package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/link-module.js +54 -25
- package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
- package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
- package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
- package/src/rich-text-editor/renderer/render.d.ts +2 -2
- package/src/rich-text-editor/renderer/render.js +2 -2
- package/src/rich-text-editor/renderer/table-module.d.ts +11 -2
- package/src/rich-text-editor/renderer/table-module.js +344 -169
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +12 -15
- package/src/rich-text-editor/renderer/toolbar-renderer.js +115 -110
- package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/video-module.js +83 -42
- package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
- package/src/rich-text-editor/renderer/view-source.js +21 -11
- package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
- package/src/rich-text-editor/services/renderer-factory.js +3 -3
- package/src/rich-text-editor/services/service-locator.d.ts +3 -3
- package/src/rich-text-editor/services/service-locator.js +3 -3
- package/src/selection/selection.d.ts +22 -22
- package/src/selection/selection.js +25 -22
- package/styles/_all.scss +1 -1
- package/styles/bootstrap-dark.css +353 -103
- package/styles/bootstrap.css +357 -112
- package/styles/bootstrap4.css +338 -96
- package/styles/bootstrap5-dark.css +344 -97
- package/styles/bootstrap5.css +344 -97
- package/styles/fabric-dark.css +332 -90
- package/styles/fabric.css +333 -91
- package/styles/fluent-dark.css +360 -98
- package/styles/fluent.css +360 -98
- package/styles/highcontrast-light.css +332 -90
- package/styles/highcontrast.css +336 -91
- package/styles/material-dark.css +339 -92
- package/styles/material.css +339 -92
- package/styles/material3-dark.css +348 -100
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +348 -100
- package/styles/material3.scss +1 -1
- package/styles/rich-text-editor/_all.scss +2 -2
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
- package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
- package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
- package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
- package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
- package/styles/rich-text-editor/_fabric-definition.scss +261 -257
- package/styles/rich-text-editor/_fluent-definition.scss +267 -263
- package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
- package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
- package/styles/rich-text-editor/_layout.scss +2249 -2072
- package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
- package/styles/rich-text-editor/_material-definition.scss +264 -260
- package/styles/rich-text-editor/_material3-definition.scss +266 -262
- package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
- package/styles/rich-text-editor/_theme.scss +926 -837
- package/styles/rich-text-editor/bootstrap-dark.css +353 -103
- package/styles/rich-text-editor/bootstrap.css +357 -112
- package/styles/rich-text-editor/bootstrap4.css +338 -96
- package/styles/rich-text-editor/bootstrap5-dark.css +344 -97
- package/styles/rich-text-editor/bootstrap5.css +344 -97
- package/styles/rich-text-editor/fabric-dark.css +332 -90
- package/styles/rich-text-editor/fabric.css +333 -91
- package/styles/rich-text-editor/fluent-dark.css +360 -98
- package/styles/rich-text-editor/fluent.css +360 -98
- package/styles/rich-text-editor/highcontrast-light.css +332 -90
- package/styles/rich-text-editor/highcontrast.css +336 -91
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
- package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_fabric.scss +349 -349
- package/styles/rich-text-editor/icons/_fluent.scss +348 -348
- package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
- package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
- package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_material.scss +349 -349
- package/styles/rich-text-editor/icons/_material3.scss +348 -348
- package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
- package/styles/rich-text-editor/material-dark.css +339 -92
- package/styles/rich-text-editor/material.css +339 -92
- package/styles/rich-text-editor/material3-dark.css +348 -100
- package/styles/rich-text-editor/material3-dark.scss +1 -1
- package/styles/rich-text-editor/material3.css +348 -100
- package/styles/rich-text-editor/material3.scss +1 -1
- package/styles/rich-text-editor/tailwind-dark.css +383 -113
- package/styles/rich-text-editor/tailwind.css +383 -113
- package/styles/tailwind-dark.css +383 -113
- package/styles/tailwind.css +383 -113
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
- package/dist/ej2-richtexteditor.min.js +0 -10
- package/dist/global/ej2-richtexteditor.min.js +0 -11
- package/dist/global/ej2-richtexteditor.min.js.map +0 -1
- package/dist/global/index.d.ts +0 -14
- package/tslint.json +0 -111
|
@@ -19,7 +19,7 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
19
19
|
* @function destroy
|
|
20
20
|
* @returns {void}
|
|
21
21
|
* @hidden
|
|
22
|
-
|
|
22
|
+
* @deprecated
|
|
23
23
|
*/
|
|
24
24
|
EmojiPicker.prototype.destroy = function () {
|
|
25
25
|
this.removeEventListener();
|
|
@@ -44,6 +44,9 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
44
44
|
spanElement = this.parent.element.ownerDocument.querySelector('.e-emoji');
|
|
45
45
|
}
|
|
46
46
|
this.divElement = spanElement.closest('div');
|
|
47
|
+
if (!(this.parent.inputElement.contains(this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument()).startContainer))) {
|
|
48
|
+
this.parent.contentModule.getEditPanel().focus();
|
|
49
|
+
}
|
|
47
50
|
var range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
|
|
48
51
|
this.save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
49
52
|
this.clickEvent = args.args;
|
|
@@ -58,10 +61,10 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
58
61
|
}
|
|
59
62
|
this.popDiv = this.parent.createElement('div', { className: 'e-rte-emojipicker-popup', id: this.parent.getID() + '_emojiPicker' });
|
|
60
63
|
if (!isNOU(this.parent.getToolbar()) && !this.parent.inlineMode.enable) {
|
|
61
|
-
this.parent.getToolbar().appendChild(this.popDiv);
|
|
64
|
+
this.parent.getToolbar().parentElement.appendChild(this.popDiv);
|
|
62
65
|
}
|
|
63
66
|
else if (this.parent.inlineMode.enable) {
|
|
64
|
-
this.parent.
|
|
67
|
+
this.parent.element.appendChild(this.popDiv);
|
|
65
68
|
}
|
|
66
69
|
EventHandler.add(this.popDiv, 'keydown', this.onKeyDown, this);
|
|
67
70
|
EventHandler.add(this.popDiv, 'keyup', this.searchFilter, this);
|
|
@@ -635,12 +638,12 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
635
638
|
}
|
|
636
639
|
}
|
|
637
640
|
}
|
|
638
|
-
if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':')) {
|
|
641
|
+
if (noEMoji && !this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') && (inputValue !== '' && value !== ':' && value !== ': :')) {
|
|
639
642
|
noEmojiObj.innerHTML = '<span style="color: rgba(0, 0, 0, 0.75); font-weight: 500; font-size: 16px;">' + this.i10n.getConstant('emojiPickerNoResultFound') + ' 😥 </span>' + '<br>' + '<span style="color: rgba(0, 0, 0, 0.75);"> ' + this.i10n.getConstant('emojiPickerTrySomethingElse') + ' ? </span>';
|
|
640
643
|
noEmojiObj.style.margin = '55px';
|
|
641
644
|
emojipickerAll.appendChild(noEmojiObj);
|
|
642
645
|
}
|
|
643
|
-
else if (!noEMoji && this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') || (inputValue === '' && value === ':')) {
|
|
646
|
+
else if (!noEMoji && this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji') || (inputValue === '' && value === ':') || (inputValue === '' && this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji'))) {
|
|
644
647
|
emojipickerAll.removeChild(this.parent.element.querySelector('.e-rte-emojiSearch-noEmoji'));
|
|
645
648
|
}
|
|
646
649
|
emojipickerAll.appendChild(emojiBtnDiv);
|
|
@@ -683,7 +686,8 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
683
686
|
};
|
|
684
687
|
EmojiPicker.prototype.onkeyPress = function (e) {
|
|
685
688
|
var originalEvent = e.args;
|
|
686
|
-
var selection = this.parent.contentModule.
|
|
689
|
+
var selection = (this.parent.iframeSettings.enable) ? this.parent.contentModule.getPanel().contentWindow.getSelection() :
|
|
690
|
+
this.parent.contentModule.getDocument().getSelection();
|
|
687
691
|
if (selection.rangeCount <= 0) {
|
|
688
692
|
return;
|
|
689
693
|
}
|
|
@@ -703,6 +707,10 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
703
707
|
}
|
|
704
708
|
if (originalEvent.keyCode === 32 && isPrevColon && this.popupObj) {
|
|
705
709
|
removeClass([this.divElement], 'e-active');
|
|
710
|
+
var currentDocument = this.parent.iframeSettings.enable ? this.parent.contentModule.getPanel().ownerDocument : this.parent.contentModule.getDocument();
|
|
711
|
+
if (this.parent.showTooltip && !isNOU(currentDocument.querySelector('.e-tooltip-wrap'))) {
|
|
712
|
+
this.parent.notify(events.destroyTooltip, { args: event });
|
|
713
|
+
}
|
|
706
714
|
this.popupObj.hide();
|
|
707
715
|
}
|
|
708
716
|
if (this.popupObj && (originalEvent.keyCode === 37 || originalEvent.keyCode === 38 || originalEvent.keyCode === 39
|
|
@@ -713,7 +721,8 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
713
721
|
};
|
|
714
722
|
EmojiPicker.prototype.onkeyUp = function (e) {
|
|
715
723
|
var originalEvent = e.args;
|
|
716
|
-
var selection = this.parent.contentModule.
|
|
724
|
+
var selection = (this.parent.iframeSettings.enable) ? this.parent.contentModule.getPanel().contentWindow.getSelection() :
|
|
725
|
+
this.parent.contentModule.getDocument().getSelection();
|
|
717
726
|
if (selection.rangeCount <= 0) {
|
|
718
727
|
return;
|
|
719
728
|
}
|
|
@@ -739,7 +748,7 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
739
748
|
};
|
|
740
749
|
EmojiPicker.prototype.getCoordinates = function () {
|
|
741
750
|
var coordinates;
|
|
742
|
-
var selection = this.parent.contentModule.
|
|
751
|
+
var selection = (this.parent.iframeSettings.enable) ? this.parent.contentModule.getPanel().contentWindow.getSelection() : window.getSelection();
|
|
743
752
|
var range = selection.getRangeAt(0);
|
|
744
753
|
var firstChild;
|
|
745
754
|
if (range.startContainer.nodeName === 'P' || range.startContainer.nodeName === 'DIV') {
|
|
@@ -47,10 +47,11 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
47
47
|
curElement = curElement.parentElement;
|
|
48
48
|
blockElement = curElement;
|
|
49
49
|
}
|
|
50
|
-
isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
50
|
+
isTableEnter = blockElement.tagName === 'TH' || blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
|
|
51
51
|
}
|
|
52
52
|
if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
|
|
53
|
-
if (isNOU(this.startNode.closest('LI, UL, OL')) && isNOU(this.endNode.closest('LI, UL, OL')) &&
|
|
53
|
+
if (isNOU(this.startNode.closest('LI, UL, OL')) && isNOU(this.endNode.closest('LI, UL, OL')) &&
|
|
54
|
+
isNOU(this.startNode.closest('.e-img-inner')) && isTableEnter &&
|
|
54
55
|
isNOU(this.startNode.closest('PRE')) && isNOU(this.endNode.closest('PRE'))) {
|
|
55
56
|
var shiftKey_1 = e.args.shiftKey;
|
|
56
57
|
var actionBeginArgs = {
|
|
@@ -61,6 +62,9 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
61
62
|
};
|
|
62
63
|
this.parent.trigger(events.actionBegin, actionBeginArgs, function (actionBeginArgs) {
|
|
63
64
|
if (!actionBeginArgs.cancel) {
|
|
65
|
+
if (_this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
66
|
+
_this.parent.formatter.saveData();
|
|
67
|
+
}
|
|
64
68
|
if (!(_this.range.startOffset === _this.range.endOffset && _this.range.startContainer === _this.range.endContainer)) {
|
|
65
69
|
if (!(_this.range.startContainer.nodeName === 'SPAN' && (_this.range.startContainer.classList.contains('e-video-wrap') ||
|
|
66
70
|
_this.range.startContainer.classList.contains('e-audio-wrap')))) {
|
|
@@ -236,7 +240,8 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
236
240
|
}
|
|
237
241
|
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
|
|
238
242
|
}
|
|
239
|
-
else if (nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG'
|
|
243
|
+
else if (nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
244
|
+
(nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
|
|
240
245
|
if (!isNOU(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
|
|
241
246
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
|
|
242
247
|
_this.parent.formatter.editorManager.domNode.insertAfter(newElem, nearBlockNode);
|
|
@@ -484,10 +489,10 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
484
489
|
}
|
|
485
490
|
var previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
|
|
486
491
|
var nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
|
|
487
|
-
if (!isNOU(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
|
|
492
|
+
if (!isNOU(previousBlockNode) && previousBlockNode.nodeName !== '#text' && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
|
|
488
493
|
insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
|
|
489
494
|
}
|
|
490
|
-
if (isNOU(previousBlockNode) && !isNOU(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
|
|
495
|
+
if (isNOU(previousBlockNode) && !isNOU(nextBlockNode) && nextBlockNode.nodeName !== '#text' && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
|
|
491
496
|
insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
|
|
492
497
|
}
|
|
493
498
|
return insertElem;
|
|
@@ -78,7 +78,7 @@ var FileManager = /** @class */ (function () {
|
|
|
78
78
|
this.dialogObj.createElement = this.parent.createElement;
|
|
79
79
|
this.dialogObj.appendTo(dlgTarget);
|
|
80
80
|
this.dialogObj.show(Browser.isDevice ? true : false);
|
|
81
|
-
this.setCssClass({ cssClass: this.parent.
|
|
81
|
+
this.setCssClass({ cssClass: this.parent.getCssClass() });
|
|
82
82
|
};
|
|
83
83
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
84
84
|
FileManager.prototype.setCssClass = function (e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass, isNullOrUndefined as isNOU, removeClass } from '@syncfusion/ej2-base';
|
|
1
|
+
import { addClass, Browser, isNullOrUndefined as isNOU, removeClass } from '@syncfusion/ej2-base';
|
|
2
2
|
import * as events from '../base/constant';
|
|
3
3
|
var FormatPainter = /** @class */ (function () {
|
|
4
4
|
function FormatPainter(parent) {
|
|
@@ -38,11 +38,14 @@ var FormatPainter = /** @class */ (function () {
|
|
|
38
38
|
};
|
|
39
39
|
FormatPainter.prototype.onKeyDown = function (event) {
|
|
40
40
|
var originalEvent = event.args;
|
|
41
|
-
if ((originalEvent
|
|
41
|
+
if (!isNOU(originalEvent) && !isNOU(originalEvent.action) && (originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste')
|
|
42
42
|
|| (originalEvent.action === 'escape' && (this.previousAction === 'format-copy' || this.previousAction === 'format-paste'))) {
|
|
43
43
|
if ((originalEvent.action === 'format-copy' || originalEvent.action === 'format-paste')) {
|
|
44
44
|
originalEvent.stopPropagation();
|
|
45
45
|
}
|
|
46
|
+
if (Browser.userAgent.indexOf('Firefox') !== -1) {
|
|
47
|
+
originalEvent.preventDefault();
|
|
48
|
+
}
|
|
46
49
|
this.actionHandler(event, 'keyBoard');
|
|
47
50
|
}
|
|
48
51
|
};
|
|
@@ -13,7 +13,7 @@ export declare class FullScreen {
|
|
|
13
13
|
* @param {MouseEvent} event - specifies the mouse event
|
|
14
14
|
* @returns {void}
|
|
15
15
|
* @hidden
|
|
16
|
-
|
|
16
|
+
* @deprecated
|
|
17
17
|
*/
|
|
18
18
|
showFullScreen(event?: MouseEvent | KeyboardEventArgs): void;
|
|
19
19
|
/**
|
|
@@ -22,7 +22,7 @@ export declare class FullScreen {
|
|
|
22
22
|
* @param {MouseEvent} event - specifies the mouse event
|
|
23
23
|
* @returns {void}
|
|
24
24
|
* @hidden
|
|
25
|
-
|
|
25
|
+
* @deprecated
|
|
26
26
|
*/
|
|
27
27
|
hideFullScreen(event?: MouseEvent | KeyboardEventArgs): void;
|
|
28
28
|
private toggleParentOverflow;
|
|
@@ -34,7 +34,7 @@ export declare class FullScreen {
|
|
|
34
34
|
*
|
|
35
35
|
* @returns {void}
|
|
36
36
|
* @hidden
|
|
37
|
-
|
|
37
|
+
* @deprecated
|
|
38
38
|
*/
|
|
39
39
|
destroy(): void;
|
|
40
40
|
private moduleDestroy;
|
|
@@ -17,7 +17,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
17
17
|
* @param {MouseEvent} event - specifies the mouse event
|
|
18
18
|
* @returns {void}
|
|
19
19
|
* @hidden
|
|
20
|
-
|
|
20
|
+
* @deprecated
|
|
21
21
|
*/
|
|
22
22
|
FullScreen.prototype.showFullScreen = function (event) {
|
|
23
23
|
var _this = this;
|
|
@@ -26,7 +26,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
26
26
|
this.parent.quickToolbarModule.hideQuickToolbars();
|
|
27
27
|
}
|
|
28
28
|
if (this.parent.showTooltip && !isNOU(document.querySelector('.e-tooltip-wrap'))) {
|
|
29
|
-
this.parent.notify(events.
|
|
29
|
+
this.parent.notify(events.destroyTooltip, { args: event });
|
|
30
30
|
}
|
|
31
31
|
this.scrollableParent = getScrollableParent(this.parent.element);
|
|
32
32
|
if (!this.parent.element.classList.contains(classes.CLS_FULL_SCREEN)) {
|
|
@@ -46,7 +46,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
46
46
|
_this.parent.element.classList.add(classes.CLS_FULL_SCREEN);
|
|
47
47
|
_this.toggleParentOverflow(true);
|
|
48
48
|
var isExpand = _this.parent.element.querySelectorAll('.e-toolbar-extended.e-popup-open').length > 0 ? true : false;
|
|
49
|
-
_this.parent.setContentHeight(
|
|
49
|
+
_this.parent.setContentHeight('Maximize', isExpand);
|
|
50
50
|
if (_this.parent.toolbarModule) {
|
|
51
51
|
if (!_this.parent.getBaseToolbarObject().toolbarObj.items[0].properties) {
|
|
52
52
|
_this.parent.getBaseToolbarObject().toolbarObj.removeItems(0);
|
|
@@ -72,7 +72,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
72
72
|
* @param {MouseEvent} event - specifies the mouse event
|
|
73
73
|
* @returns {void}
|
|
74
74
|
* @hidden
|
|
75
|
-
|
|
75
|
+
* @deprecated
|
|
76
76
|
*/
|
|
77
77
|
FullScreen.prototype.hideFullScreen = function (event) {
|
|
78
78
|
var _this = this;
|
|
@@ -81,7 +81,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
81
81
|
this.parent.quickToolbarModule.hideQuickToolbars();
|
|
82
82
|
}
|
|
83
83
|
if (this.parent.showTooltip && !isNOU(document.querySelector('.e-tooltip-wrap'))) {
|
|
84
|
-
this.parent.notify(events.
|
|
84
|
+
this.parent.notify(events.destroyTooltip, { args: event });
|
|
85
85
|
}
|
|
86
86
|
if (this.parent.element.classList.contains(classes.CLS_FULL_SCREEN)) {
|
|
87
87
|
var evenArgs = {
|
|
@@ -98,7 +98,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
98
98
|
removeClass([elem[i]], ['e-rte-overflow']);
|
|
99
99
|
}
|
|
100
100
|
var isExpand = _this.parent.element.querySelectorAll('.e-toolbar-extended.e-popup-open').length > 0 ? true : false;
|
|
101
|
-
_this.parent.setContentHeight(
|
|
101
|
+
_this.parent.setContentHeight('Minimize', isExpand);
|
|
102
102
|
if (_this.parent.toolbarModule) {
|
|
103
103
|
if (!_this.parent.getBaseToolbarObject().toolbarObj.items[0].properties) {
|
|
104
104
|
_this.parent.getBaseToolbarObject().toolbarObj.removeItems(0);
|
|
@@ -112,6 +112,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
112
112
|
_this.parent.toolbarModule.addFixedTBarClass();
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
_this.parent.refreshUI();
|
|
115
116
|
_this.parent.trigger(events.actionComplete, { requestType: 'Minimize', targetItem: 'Minimize', args: event });
|
|
116
117
|
}
|
|
117
118
|
});
|
|
@@ -161,7 +162,7 @@ var FullScreen = /** @class */ (function () {
|
|
|
161
162
|
*
|
|
162
163
|
* @returns {void}
|
|
163
164
|
* @hidden
|
|
164
|
-
|
|
165
|
+
* @deprecated
|
|
165
166
|
*/
|
|
166
167
|
FullScreen.prototype.destroy = function () {
|
|
167
168
|
if (isNOU(this.parent)) {
|
|
@@ -29,14 +29,14 @@ export declare class HtmlEditor {
|
|
|
29
29
|
* @function destroy
|
|
30
30
|
* @returns {void}
|
|
31
31
|
* @hidden
|
|
32
|
-
|
|
32
|
+
* @deprecated
|
|
33
33
|
*/
|
|
34
34
|
destroy(): void;
|
|
35
35
|
/**
|
|
36
36
|
* @param {string} value - specifies the string value
|
|
37
37
|
* @returns {void}
|
|
38
38
|
* @hidden
|
|
39
|
-
|
|
39
|
+
* @deprecated
|
|
40
40
|
*/
|
|
41
41
|
sanitizeHelper(value: string): string;
|
|
42
42
|
private addEventListener;
|
|
@@ -44,6 +44,8 @@ export declare class HtmlEditor {
|
|
|
44
44
|
private onSelectionSave;
|
|
45
45
|
private onSelectionRestore;
|
|
46
46
|
private isTableClassAdded;
|
|
47
|
+
private onHandleFontsizeChange;
|
|
48
|
+
private convertFontSize;
|
|
47
49
|
private onKeyUp;
|
|
48
50
|
private onKeyDown;
|
|
49
51
|
private isOrderedList;
|
|
@@ -67,7 +69,7 @@ export declare class HtmlEditor {
|
|
|
67
69
|
* @param {RichTextEditorModel} e - specifies the editor model
|
|
68
70
|
* @returns {void}
|
|
69
71
|
* @hidden
|
|
70
|
-
|
|
72
|
+
* @deprecated
|
|
71
73
|
*/
|
|
72
74
|
protected onPropertyChanged(e: {
|
|
73
75
|
[key: string]: RichTextEditorModel;
|
|
@@ -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
|
*/
|
|
@@ -33,7 +34,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
33
34
|
* @function destroy
|
|
34
35
|
* @returns {void}
|
|
35
36
|
* @hidden
|
|
36
|
-
|
|
37
|
+
* @deprecated
|
|
37
38
|
*/
|
|
38
39
|
HtmlEditor.prototype.destroy = function () {
|
|
39
40
|
this.removeEventListener();
|
|
@@ -42,7 +43,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
42
43
|
* @param {string} value - specifies the string value
|
|
43
44
|
* @returns {void}
|
|
44
45
|
* @hidden
|
|
45
|
-
|
|
46
|
+
* @deprecated
|
|
46
47
|
*/
|
|
47
48
|
HtmlEditor.prototype.sanitizeHelper = function (value) {
|
|
48
49
|
value = sanitizeHelper(value, this.parent);
|
|
@@ -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,6 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
88
90
|
};
|
|
89
91
|
HtmlEditor.prototype.onSelectionRestore = function (e) {
|
|
90
92
|
this.parent.isBlur = false;
|
|
91
|
-
this.contentRenderer.getEditPanel().focus();
|
|
92
93
|
if (isNullOrUndefined(e.items) || e.items) {
|
|
93
94
|
this.saveSelection.restore();
|
|
94
95
|
}
|
|
@@ -96,11 +97,91 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
96
97
|
HtmlEditor.prototype.isTableClassAdded = function () {
|
|
97
98
|
var tableElement = this.parent.inputElement.querySelectorAll('table');
|
|
98
99
|
for (var i = 0; i < tableElement.length; i++) {
|
|
99
|
-
if (!tableElement[i].classList.contains('e-rte-table')) {
|
|
100
|
+
if (!tableElement[i].classList.contains('e-rte-table') && !tableElement[i].classList.contains('e-rte-paste-table')) {
|
|
100
101
|
tableElement[i].classList.add('e-rte-table');
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
};
|
|
105
|
+
HtmlEditor.prototype.onHandleFontsizeChange = function (e) {
|
|
106
|
+
var keyboardArgs = e.args;
|
|
107
|
+
var args = { name: 'dropDownSelect' };
|
|
108
|
+
args.item = {
|
|
109
|
+
command: 'Font',
|
|
110
|
+
subCommand: 'FontSize'
|
|
111
|
+
};
|
|
112
|
+
var items = this.parent.fontSize.items;
|
|
113
|
+
var activeElem;
|
|
114
|
+
if (this.parent.toolbarModule && this.parent.toolbarModule.dropDownModule &&
|
|
115
|
+
this.parent.toolbarModule.dropDownModule.fontSizeDropDown && !isNOU(this.parent.toolbarModule.dropDownModule.fontSizeDropDown.activeElem[0].textContent) && this.parent.toolbarModule.dropDownModule.fontSizeDropDown.activeElem[0].textContent !== '') {
|
|
116
|
+
activeElem = this.parent.toolbarModule.dropDownModule.fontSizeDropDown.activeElem[0].textContent;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
var fontSizeValue = void 0;
|
|
120
|
+
var selection = this.parent.contentModule.getDocument().getSelection();
|
|
121
|
+
if (selection && selection.focusNode && selection.focusNode.parentElement) {
|
|
122
|
+
fontSizeValue = document.defaultView.getComputedStyle(selection.focusNode.parentElement, null).getPropertyValue('font-size');
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
fontSizeValue = this.parent.fontSize.width;
|
|
126
|
+
}
|
|
127
|
+
fontSizeValue = isNOU(fontSizeValue) ? this.parent.fontSize.width : fontSizeValue;
|
|
128
|
+
var actualTxtFontValues = fontSizeValue.match(/^([\d.]+)(\D+)$/);
|
|
129
|
+
var size_1 = parseInt(actualTxtFontValues[1], 10);
|
|
130
|
+
var unit = actualTxtFontValues[2];
|
|
131
|
+
var defaultFontValues = items[0].value.match(/^([\d.]+)(\D+)$/);
|
|
132
|
+
if (defaultFontValues[2] === unit) {
|
|
133
|
+
var index = items.findIndex(function (_a) {
|
|
134
|
+
var value = _a.value;
|
|
135
|
+
return parseInt(value, 10) >= size_1;
|
|
136
|
+
});
|
|
137
|
+
activeElem = items[index].text;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
var convertedSize_1 = this.convertFontSize(size_1, unit, defaultFontValues[2]);
|
|
141
|
+
var index = items.findIndex(function (_a) {
|
|
142
|
+
var value = _a.value;
|
|
143
|
+
return parseInt(value, 10) >= convertedSize_1;
|
|
144
|
+
});
|
|
145
|
+
activeElem = items[index].text;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
var fontIndex = items.findIndex(function (size) { return size.text === activeElem; });
|
|
149
|
+
if (keyboardArgs.action === 'increase-fontsize' && fontIndex !== -1) {
|
|
150
|
+
if (fontIndex >= items.length - 1) {
|
|
151
|
+
var fontValues = items[fontIndex].value.match(/^([\d.]+)(\D+)$/);
|
|
152
|
+
if (fontValues) {
|
|
153
|
+
var size = parseInt(fontValues[1], 10);
|
|
154
|
+
var unit = fontValues[2];
|
|
155
|
+
var roundedSize = size % 10 === 0 ? Math.ceil((size + 1) / 10) * 10 : Math.ceil(size / 10) * 10;
|
|
156
|
+
args.item.value = roundedSize.toLocaleString() + unit;
|
|
157
|
+
args.item.text = roundedSize.toLocaleString() + ' ' + unit;
|
|
158
|
+
}
|
|
159
|
+
this.parent.fontSize.items.push(args.item);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
args.item.value = items[fontIndex + 1].value;
|
|
163
|
+
args.item.text = items[fontIndex + 1].text;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (keyboardArgs.action === 'decrease-fontsize' && fontIndex !== -1 && fontIndex > 0) {
|
|
167
|
+
args.item.value = items[fontIndex - 1].value;
|
|
168
|
+
args.item.text = items[fontIndex - 1].text;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
if (fontIndex >= 0 && fontIndex < items.length && items[fontIndex]) {
|
|
172
|
+
args.item.value = items[fontIndex].value;
|
|
173
|
+
args.item.text = items[fontIndex].text;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.parent.formatter.process(this.parent, args, keyboardArgs);
|
|
177
|
+
};
|
|
178
|
+
HtmlEditor.prototype.convertFontSize = function (value, originalUnit, targetUnit) {
|
|
179
|
+
if (CONSTANT.supportedUnits.indexOf(originalUnit) !== -1 || CONSTANT.supportedUnits.indexOf(targetUnit) !== -1) {
|
|
180
|
+
originalUnit = 'px';
|
|
181
|
+
}
|
|
182
|
+
var convertedValue = value * CONSTANT.conversionFactors[originalUnit][targetUnit];
|
|
183
|
+
return convertedValue;
|
|
184
|
+
};
|
|
104
185
|
HtmlEditor.prototype.onKeyUp = function (e) {
|
|
105
186
|
var args = e.args;
|
|
106
187
|
var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
|
|
@@ -108,9 +189,12 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
108
189
|
var range = this.parent.getRange();
|
|
109
190
|
// eslint-disable-next-line
|
|
110
191
|
var regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
192
|
+
var isEmptyNode = range.startContainer === range.endContainer && range.startOffset === range.endOffset &&
|
|
193
|
+
range.startOffset === 1 && range.startContainer.textContent.length === 1 && range.startContainer.textContent.charCodeAt(0) == 8203 &&
|
|
194
|
+
range.startContainer.textContent.replace(regEx, '').length === 0;
|
|
111
195
|
var pointer;
|
|
112
196
|
var isRootParent = false;
|
|
113
|
-
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
|
|
197
|
+
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
|
|
114
198
|
pointer = range.startOffset;
|
|
115
199
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
116
200
|
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
@@ -222,7 +306,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
222
306
|
e.args.keyCode === 13) {
|
|
223
307
|
this.spaceLink(e.args);
|
|
224
308
|
if (this.parent.editorMode === 'HTML' && !this.parent.readonly) {
|
|
225
|
-
var currentLength = this.parent.getText().trim().length;
|
|
309
|
+
var currentLength = this.parent.getText().trim().replace(/(\r\n|\n|\r|\t)/gm, '').replace(/\u200B/g, '').length;
|
|
226
310
|
var selectionLength = this.parent.getSelection().length;
|
|
227
311
|
var totalLength = (currentLength - selectionLength) + 1;
|
|
228
312
|
if (!(this.parent.maxLength === -1 || totalLength <= this.parent.maxLength) &&
|
|
@@ -232,6 +316,15 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
232
316
|
}
|
|
233
317
|
else {
|
|
234
318
|
this.parent.notify(events.enterHandler, { args: e.args });
|
|
319
|
+
var newRange = this.parent.getRange();
|
|
320
|
+
if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
321
|
+
&& !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
|
|
322
|
+
this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
|
|
323
|
+
}
|
|
324
|
+
else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
325
|
+
&& !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
|
|
326
|
+
newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
327
|
+
}
|
|
235
328
|
}
|
|
236
329
|
}
|
|
237
330
|
}
|
|
@@ -312,11 +405,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
312
405
|
currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
|
|
313
406
|
isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
|
|
314
407
|
}
|
|
408
|
+
var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
409
|
+
var isSelectedPositionNotStart = closest(currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer, 'li') ?
|
|
410
|
+
checkNode.nodeName !== 'li' && isNOU(checkNode.previousSibling) : true;
|
|
315
411
|
if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
|
|
316
412
|
currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
|
|
317
413
|
currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
|
|
318
|
-
isPreviousNotContentEditable) {
|
|
319
|
-
var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
414
|
+
isPreviousNotContentEditable && isSelectedPositionNotStart) {
|
|
320
415
|
if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
|
|
321
416
|
!isNOU(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
|
|
322
417
|
(!isNOU(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
|
|
@@ -327,8 +422,9 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
327
422
|
var liElement = this.getRangeLiNode(currentRange.startContainer);
|
|
328
423
|
if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
|
|
329
424
|
this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
|
|
330
|
-
liElement.previousElementSibling : liElement.previousElementSibling.
|
|
331
|
-
if (!
|
|
425
|
+
liElement.previousElementSibling : liElement.previousElementSibling.lastChild;
|
|
426
|
+
if (!isNOU(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
|
|
427
|
+
isNOU(liElement.lastElementChild.previousSibling) && liElement.lastChild.nodeName !== "#text") {
|
|
332
428
|
this.rangeElement = liElement.lastElementChild;
|
|
333
429
|
isLiElement = true;
|
|
334
430
|
}
|
|
@@ -338,13 +434,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
338
434
|
}
|
|
339
435
|
}
|
|
340
436
|
else if (this.rangeElement === this.parent.inputElement || this.rangeElement.tagName === 'TABLE' ||
|
|
341
|
-
(!
|
|
437
|
+
(!isNOU(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
|
|
342
438
|
return;
|
|
343
439
|
}
|
|
344
440
|
else {
|
|
345
441
|
this.oldRangeElement = this.rangeElement.previousElementSibling;
|
|
346
442
|
}
|
|
347
|
-
if (
|
|
443
|
+
if (isNOU(this.oldRangeElement)) {
|
|
348
444
|
return;
|
|
349
445
|
}
|
|
350
446
|
else {
|
|
@@ -353,7 +449,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
353
449
|
? this.oldRangeElement.lastElementChild.lastElementChild :
|
|
354
450
|
this.oldRangeElement.lastElementChild;
|
|
355
451
|
}
|
|
356
|
-
var lastNode = this.oldRangeElement.lastChild;
|
|
452
|
+
var lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
|
|
357
453
|
while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
|
|
358
454
|
lastNode.nodeName !== 'BR') {
|
|
359
455
|
lastNode = lastNode.lastChild;
|
|
@@ -361,12 +457,17 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
361
457
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
|
|
362
458
|
// eslint-disable-next-line
|
|
363
459
|
lastNode, lastNode.textContent.length);
|
|
364
|
-
if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
460
|
+
if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
365
461
|
detach(this.oldRangeElement.querySelector('BR'));
|
|
366
462
|
}
|
|
367
|
-
if (!
|
|
463
|
+
if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
|
|
368
464
|
while (this.rangeElement.firstChild) {
|
|
369
|
-
this.oldRangeElement.
|
|
465
|
+
if (this.oldRangeElement.nodeName === '#text') {
|
|
466
|
+
this.oldRangeElement.parentElement.appendChild(this.rangeElement.childNodes[0]);
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
|
|
470
|
+
}
|
|
370
471
|
}
|
|
371
472
|
// eslint-disable-next-line
|
|
372
473
|
!isLiElement ? detach(this.rangeElement) : detach(this.rangeElement.parentElement);
|
|
@@ -380,7 +481,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
380
481
|
var liElement;
|
|
381
482
|
var rootElement;
|
|
382
483
|
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' &&
|
|
484
|
+
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
485
|
currentRange.startContainer.parentElement.tagName !== 'TH') {
|
|
385
486
|
this.deleteRangeElement = rootElement = this.getRootBlockNode(currentRange.startContainer);
|
|
386
487
|
if (this.deleteRangeElement.tagName === 'OL' || this.deleteRangeElement.tagName === 'UL') {
|
|
@@ -403,7 +504,11 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
403
504
|
(!isNullOrUndefined(this.deleteRangeElement.nextElementSibling) && this.deleteRangeElement.nextElementSibling.tagName === 'TABLE'))) {
|
|
404
505
|
return;
|
|
405
506
|
}
|
|
406
|
-
|
|
507
|
+
var isImgWithEmptyBlockNode = false;
|
|
508
|
+
if (this.deleteRangeElement.querySelectorAll('img').length > 0 && this.deleteRangeElement.textContent.trim() === '') {
|
|
509
|
+
isImgWithEmptyBlockNode = true;
|
|
510
|
+
}
|
|
511
|
+
if (this.getCaretIndex(currentRange, this.deleteRangeElement) === this.deleteRangeElement.textContent.length && !isImgWithEmptyBlockNode) {
|
|
407
512
|
if (!isNullOrUndefined(liElement)) {
|
|
408
513
|
if (isLiElement || !isNullOrUndefined(liElement.nextElementSibling)) {
|
|
409
514
|
this.deleteOldRangeElement = this.getRangeElement(liElement.nextElementSibling);
|
|
@@ -428,8 +533,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
428
533
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.deleteRangeElement, this.deleteRangeElement.childNodes.length);
|
|
429
534
|
this.isImageDelete = false;
|
|
430
535
|
}
|
|
431
|
-
|
|
432
|
-
|
|
536
|
+
var brNode = this.deleteRangeElement.querySelector('BR');
|
|
537
|
+
if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
|
|
538
|
+
removeClass([brNode], ['e-rte-image-focus']);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
else if (brNode) {
|
|
542
|
+
detach(brNode);
|
|
433
543
|
}
|
|
434
544
|
if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
|
|
435
545
|
&& this.deleteOldRangeElement !== this.deleteRangeElement) {
|
|
@@ -545,7 +655,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
545
655
|
for (var j = 0; j < splitTextContent.length; j++) {
|
|
546
656
|
if (splitTextContent[j].match(httpRegex) || splitTextContent[j].match(wwwRegex)) {
|
|
547
657
|
resultSplitContent += '<a class="e-rte-anchor" href="' + splitTextContent[j] +
|
|
548
|
-
'" title="' + splitTextContent[j] + '"target="_blank">' + splitTextContent[j] + ' </a>';
|
|
658
|
+
'" title="' + splitTextContent[j] + '" target="_blank"' + ' aria-label="' + this.parent.serviceLocator.getService('rteLocale').getConstant("linkAriaLabel") + '">' + splitTextContent[j] + ' </a>';
|
|
549
659
|
}
|
|
550
660
|
else {
|
|
551
661
|
resultSplitContent += splitTextContent[j] + ' ';
|
|
@@ -597,6 +707,8 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
597
707
|
var selectParentEle;
|
|
598
708
|
var item = args.item;
|
|
599
709
|
var closestElement = closest(args.originalEvent.target, '.e-rte-quick-popup');
|
|
710
|
+
var target = args.originalEvent.target;
|
|
711
|
+
this.parent.notify(events.closeTooltip, { target: target });
|
|
600
712
|
if (item.command !== 'FormatPainter') {
|
|
601
713
|
if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
|
|
602
714
|
if (!(item.subCommand === 'SourceCode' || item.subCommand === 'Preview' ||
|
|
@@ -796,7 +908,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
796
908
|
* @param {RichTextEditorModel} e - specifies the editor model
|
|
797
909
|
* @returns {void}
|
|
798
910
|
* @hidden
|
|
799
|
-
|
|
911
|
+
* @deprecated
|
|
800
912
|
*/
|
|
801
913
|
HtmlEditor.prototype.onPropertyChanged = function (e) {
|
|
802
914
|
// On property code change here
|