@syncfusion/ej2-richtexteditor 24.2.4 → 24.2.7
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 +22 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +400 -150
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +393 -149
- 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 +11 -11
- package/src/common/util.js +4 -1
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +37 -2
- package/src/editor-manager/plugin/inserthtml.js +15 -2
- package/src/editor-manager/plugin/lists.js +14 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
- package/src/editor-manager/plugin/nodecutter.js +1 -1
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +56 -1
- package/src/editor-manager/plugin/table.js +1 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.js +2 -2
- package/src/rich-text-editor/actions/enter-key.js +2 -2
- package/src/rich-text-editor/actions/html-editor.js +25 -12
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +0 -8
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.js +12 -2
- package/src/rich-text-editor/base/util.js +3 -0
- package/src/rich-text-editor/models/default-locale.js +2 -1
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +3 -3
- package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
- package/src/rich-text-editor/renderer/table-module.js +106 -98
- package/styles/bootstrap-dark.css +25 -9
- package/styles/bootstrap.css +25 -9
- package/styles/bootstrap4.css +30 -14
- package/styles/bootstrap5-dark.css +25 -9
- package/styles/bootstrap5.css +25 -9
- package/styles/fabric-dark.css +25 -9
- package/styles/fabric.css +25 -9
- package/styles/fluent-dark.css +27 -11
- package/styles/fluent.css +27 -11
- package/styles/highcontrast-light.css +25 -9
- package/styles/highcontrast.css +25 -9
- package/styles/material-dark.css +25 -9
- package/styles/material.css +25 -9
- package/styles/material3-dark.css +26 -10
- package/styles/material3.css +26 -10
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_bootstrap-definition.scss +4 -2
- package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
- package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
- package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_fabric-definition.scss +4 -2
- package/styles/rich-text-editor/_fluent-definition.scss +5 -3
- package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
- package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
- package/styles/rich-text-editor/_layout.scss +35 -6
- package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_material-definition.scss +4 -2
- package/styles/rich-text-editor/_material3-definition.scss +5 -3
- package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
- package/styles/rich-text-editor/_theme.scss +18 -3
- package/styles/rich-text-editor/bootstrap-dark.css +25 -9
- package/styles/rich-text-editor/bootstrap.css +25 -9
- package/styles/rich-text-editor/bootstrap4.css +30 -14
- package/styles/rich-text-editor/bootstrap5-dark.css +25 -9
- package/styles/rich-text-editor/bootstrap5.css +25 -9
- package/styles/rich-text-editor/fabric-dark.css +25 -9
- package/styles/rich-text-editor/fabric.css +25 -9
- package/styles/rich-text-editor/fluent-dark.css +27 -11
- package/styles/rich-text-editor/fluent.css +27 -11
- package/styles/rich-text-editor/highcontrast-light.css +25 -9
- package/styles/rich-text-editor/highcontrast.css +25 -9
- package/styles/rich-text-editor/material-dark.css +25 -9
- package/styles/rich-text-editor/material.css +25 -9
- package/styles/rich-text-editor/material3-dark.css +26 -10
- package/styles/rich-text-editor/material3.css +26 -10
- package/styles/rich-text-editor/tailwind-dark.css +68 -32
- package/styles/rich-text-editor/tailwind.css +68 -32
- package/styles/tailwind-dark.css +68 -32
- package/styles/tailwind.css +68 -32
|
@@ -192,9 +192,12 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
192
192
|
var range = this.parent.getRange();
|
|
193
193
|
// eslint-disable-next-line
|
|
194
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;
|
|
195
198
|
var pointer;
|
|
196
199
|
var isRootParent = false;
|
|
197
|
-
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) {
|
|
198
201
|
pointer = range.startOffset;
|
|
199
202
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
200
203
|
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
@@ -317,8 +320,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
317
320
|
else {
|
|
318
321
|
this.parent.notify(events.enterHandler, { args: e.args });
|
|
319
322
|
var newRange = this.parent.getRange();
|
|
320
|
-
if (!
|
|
321
|
-
newRange.startContainer.
|
|
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' });
|
|
322
330
|
}
|
|
323
331
|
}
|
|
324
332
|
}
|
|
@@ -400,11 +408,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
400
408
|
currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
|
|
401
409
|
isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
|
|
402
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;
|
|
403
414
|
if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
|
|
404
415
|
currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
|
|
405
416
|
currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
|
|
406
|
-
isPreviousNotContentEditable) {
|
|
407
|
-
var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
417
|
+
isPreviousNotContentEditable && isSelectedPositionNotStart) {
|
|
408
418
|
if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
|
|
409
419
|
!isNOU(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
|
|
410
420
|
(!isNOU(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
|
|
@@ -416,7 +426,8 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
416
426
|
if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
|
|
417
427
|
this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
|
|
418
428
|
liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
|
|
419
|
-
if (!
|
|
429
|
+
if (!isNOU(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
|
|
430
|
+
isNOU(liElement.lastElementChild.previousSibling)) {
|
|
420
431
|
this.rangeElement = liElement.lastElementChild;
|
|
421
432
|
isLiElement = true;
|
|
422
433
|
}
|
|
@@ -426,13 +437,13 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
426
437
|
}
|
|
427
438
|
}
|
|
428
439
|
else if (this.rangeElement === this.parent.inputElement || this.rangeElement.tagName === 'TABLE' ||
|
|
429
|
-
(!
|
|
440
|
+
(!isNOU(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
|
|
430
441
|
return;
|
|
431
442
|
}
|
|
432
443
|
else {
|
|
433
444
|
this.oldRangeElement = this.rangeElement.previousElementSibling;
|
|
434
445
|
}
|
|
435
|
-
if (
|
|
446
|
+
if (isNOU(this.oldRangeElement)) {
|
|
436
447
|
return;
|
|
437
448
|
}
|
|
438
449
|
else {
|
|
@@ -452,7 +463,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
452
463
|
if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
453
464
|
detach(this.oldRangeElement.querySelector('BR'));
|
|
454
465
|
}
|
|
455
|
-
if (!
|
|
466
|
+
if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
|
|
456
467
|
while (this.rangeElement.firstChild) {
|
|
457
468
|
this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
|
|
458
469
|
}
|
|
@@ -708,9 +719,11 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
708
719
|
this.tooltipTargetEle = closest(args.originalEvent.target, '[data-tooltip-id]');
|
|
709
720
|
if (!isNOU(this.tooltipTargetEle) && this.parent.showTooltip && !isNOU(currentDocument.querySelector('.e-tooltip-wrap'))) {
|
|
710
721
|
this.parent.notify(events.destroyTooltip, { args: event });
|
|
711
|
-
this.tooltipTargetEle.
|
|
712
|
-
|
|
713
|
-
|
|
722
|
+
if (!this.tooltipTargetEle.closest('.e-rte-quick-popup')) {
|
|
723
|
+
this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
|
|
724
|
+
this.tooltipTargetEle.removeAttribute('title');
|
|
725
|
+
EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
|
|
726
|
+
}
|
|
714
727
|
}
|
|
715
728
|
if (item.command !== 'FormatPainter') {
|
|
716
729
|
if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
|
|
@@ -2,7 +2,7 @@ import * as events from '../base/constant';
|
|
|
2
2
|
import { Popup } from '@syncfusion/ej2-popups';
|
|
3
3
|
import { RadioButton } from '@syncfusion/ej2-buttons';
|
|
4
4
|
import { isNullOrUndefined as isNOU, isNullOrUndefined, detach, extend, addClass, removeClass } from '@syncfusion/ej2-base';
|
|
5
|
-
import { getUniqueID, Browser } from '@syncfusion/ej2-base';
|
|
5
|
+
import { getUniqueID, Browser, closest } from '@syncfusion/ej2-base';
|
|
6
6
|
import { CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT } from '../base/classes';
|
|
7
7
|
import { CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT } from '../base/classes';
|
|
8
8
|
import { CLS_RTE_IMAGE, CLS_IMGINLINE, CLS_IMGBREAK } from '../base/classes';
|
|
@@ -46,6 +46,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
46
46
|
this.parent.on(events.pasteClean, this.pasteClean, this);
|
|
47
47
|
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
48
48
|
this.parent.on(events.destroy, this.destroy, this);
|
|
49
|
+
this.parent.on(events.docClick, this.docClick, this);
|
|
49
50
|
};
|
|
50
51
|
PasteCleanup.prototype.destroy = function () {
|
|
51
52
|
this.removeEventListener();
|
|
@@ -57,6 +58,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
57
58
|
this.parent.off(events.pasteClean, this.pasteClean);
|
|
58
59
|
this.parent.off(events.bindCssClass, this.setCssClass);
|
|
59
60
|
this.parent.off(events.destroy, this.destroy);
|
|
61
|
+
this.parent.off(events.docClick, this.docClick);
|
|
60
62
|
};
|
|
61
63
|
PasteCleanup.prototype.pasteClean = function (e) {
|
|
62
64
|
var _this = this;
|
|
@@ -126,6 +128,12 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
126
128
|
this.saveSelection = this.nodeSelectionObj.save(range, currentDocument);
|
|
127
129
|
var tempDivElem = this.parent.createElement('div');
|
|
128
130
|
tempDivElem.innerHTML = value;
|
|
131
|
+
var unsupportedImg = tempDivElem.querySelectorAll('.e-rte-image-unsupported');
|
|
132
|
+
for (var index = 0; index < unsupportedImg.length; index++) {
|
|
133
|
+
unsupportedImg[index].setAttribute('alt', this.i10n.getConstant('unsupportedImage'));
|
|
134
|
+
unsupportedImg[index].classList.remove('e-rte-image-unsupported');
|
|
135
|
+
}
|
|
136
|
+
value = tempDivElem.innerHTML;
|
|
129
137
|
var isValueNotEmpty = tempDivElem.textContent !== '' || !isNOU(tempDivElem.querySelector('img')) ||
|
|
130
138
|
!isNOU(tempDivElem.querySelector('table'));
|
|
131
139
|
this.parent.notify(events.cleanupResizeElements, {
|
|
@@ -411,7 +419,9 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
411
419
|
});
|
|
412
420
|
popupObj.close();
|
|
413
421
|
imgElem.style.opacity = '1';
|
|
414
|
-
uploadObj.
|
|
422
|
+
if (!uploadObj.isDestroyed) {
|
|
423
|
+
uploadObj.destroy();
|
|
424
|
+
}
|
|
415
425
|
this.toolbarEnableDisable(false);
|
|
416
426
|
};
|
|
417
427
|
PasteCleanup.prototype.refreshPopup = function (imageElement, popupObj) {
|
|
@@ -562,7 +572,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
562
572
|
width: '300px',
|
|
563
573
|
height: '265px',
|
|
564
574
|
cssClass: CLS_RTE_DIALOG_MIN_HEIGHT,
|
|
565
|
-
isModal:
|
|
575
|
+
isModal: Browser.isDevice,
|
|
566
576
|
visible: false
|
|
567
577
|
};
|
|
568
578
|
this.dialogObj = this.dialogRenderObj.render(dialogModel);
|
|
@@ -616,13 +626,22 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
616
626
|
this.updateCss(this.keepRadioButton, e);
|
|
617
627
|
};
|
|
618
628
|
PasteCleanup.prototype.destroyDialog = function (rteDialogWrapper) {
|
|
619
|
-
var rteDialogContainer = this.parent.element.querySelector('.e-
|
|
629
|
+
var rteDialogContainer = this.parent.element.querySelector('.e-rte-dialog-minheight');
|
|
620
630
|
detach(rteDialogContainer);
|
|
621
631
|
var rteDialogWrapperChildLength = rteDialogWrapper.children.length;
|
|
622
632
|
for (var i = 0; i < rteDialogWrapperChildLength; i++) {
|
|
623
633
|
detach(rteDialogWrapper.children[0]);
|
|
624
634
|
}
|
|
625
635
|
};
|
|
636
|
+
PasteCleanup.prototype.docClick = function (e) {
|
|
637
|
+
var target = e.args.target;
|
|
638
|
+
if (target && target.classList && ((this.dialogObj && !closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']')))
|
|
639
|
+
&& (!target.classList.contains('e-toolbar-item'))) {
|
|
640
|
+
if (this.dialogObj) {
|
|
641
|
+
this.dialogObj.hide();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
};
|
|
626
645
|
PasteCleanup.prototype.cleanAppleClass = function (elem) {
|
|
627
646
|
var appleClassElem = elem.querySelectorAll('br.Apple-interchange-newline');
|
|
628
647
|
for (var i = 0; i < appleClassElem.length; i++) {
|
|
@@ -696,7 +715,8 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
696
715
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
|
|
697
716
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
698
717
|
_this.parent.formatter.onSuccess(_this.parent, args);
|
|
699
|
-
if (!isNOU(returnArgs.elements) && !isNOU(returnArgs.imgElem)
|
|
718
|
+
if (!isNOU(returnArgs.elements) && !isNOU(returnArgs.imgElem) &&
|
|
719
|
+
returnArgs.imgElem.length > 0) {
|
|
700
720
|
var pasteContent = returnArgs.elements;
|
|
701
721
|
var imageContent = returnArgs.imgElem;
|
|
702
722
|
var lastElementChild = _this.findLastElement(pasteContent[pasteContent.length - 1]);
|
|
@@ -765,6 +785,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
765
785
|
}
|
|
766
786
|
};
|
|
767
787
|
PasteCleanup.prototype.addTableClass = function (element, source) {
|
|
788
|
+
source = isNOU(source) ? '' : source;
|
|
768
789
|
var tableElement = element.querySelectorAll('table');
|
|
769
790
|
for (var i = 0; i < tableElement.length; i++) {
|
|
770
791
|
if (!tableElement[i].classList.contains('e-rte-table') && (source === 'html' || source === '')) {
|
|
@@ -39,7 +39,7 @@ var ToolbarAction = /** @class */ (function () {
|
|
|
39
39
|
if (args.item.command === 'Lists') {
|
|
40
40
|
if (args.originalEvent.target.classList.contains('e-caret') &&
|
|
41
41
|
(args.originalEvent.target.parentElement.classList.contains('e-rte-bulletformatlist-dropdown') || args.originalEvent.target.parentElement.classList.contains('e-rte-numberformatlist-dropdown'))) {
|
|
42
|
-
|
|
42
|
+
return;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
this.parent.notify(events.htmlToolbarClick, args);
|
|
@@ -585,7 +585,7 @@ var Toolbar = /** @class */ (function () {
|
|
|
585
585
|
else if (Browser.isDevice || this.parent.inlineMode.enable) {
|
|
586
586
|
this.isToolbar = true;
|
|
587
587
|
}
|
|
588
|
-
if (isNOU(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand) {
|
|
588
|
+
if (isNOU(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand && this.parent.toolbarModule.getExpandTBarPopHeight() === 0) {
|
|
589
589
|
removeClass([this.tbElement], [classes.CLS_EXPAND_OPEN]);
|
|
590
590
|
}
|
|
591
591
|
};
|
|
@@ -667,10 +667,6 @@ export interface IToolsItemConfigs {
|
|
|
667
667
|
subCommand?: string;
|
|
668
668
|
value?: string;
|
|
669
669
|
}
|
|
670
|
-
/**
|
|
671
|
-
* @hidden
|
|
672
|
-
|
|
673
|
-
*/
|
|
674
670
|
export interface IListDropDownModel extends DropDownItemModel {
|
|
675
671
|
cssClass?: string;
|
|
676
672
|
command?: string;
|
|
@@ -680,10 +676,6 @@ export interface IListDropDownModel extends DropDownItemModel {
|
|
|
680
676
|
listStyle?: string;
|
|
681
677
|
listImage?: string;
|
|
682
678
|
}
|
|
683
|
-
/**
|
|
684
|
-
* @hidden
|
|
685
|
-
|
|
686
|
-
*/
|
|
687
679
|
export interface IDropDownItemModel extends DropDownItemModel {
|
|
688
680
|
cssClass?: string;
|
|
689
681
|
command?: string;
|
|
@@ -802,6 +802,16 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
802
802
|
RichTextEditor.prototype.keyUp = function (e) {
|
|
803
803
|
if (this.editorMode === 'HTML') {
|
|
804
804
|
var range = this.getRange();
|
|
805
|
+
if (!isNOU(e) && !isNOU(e.code) && (e.code === 'Backspace' || e.code === 'Delete')) {
|
|
806
|
+
// To prevent the reformatting the content removed browser behavior.
|
|
807
|
+
var currentRange = this.getRange();
|
|
808
|
+
var selection = this.iframeSettings.enable ? this.contentModule.getPanel().ownerDocument.getSelection() :
|
|
809
|
+
this.contentModule.getDocument().getSelection();
|
|
810
|
+
if (selection.rangeCount > 0) {
|
|
811
|
+
selection.removeAllRanges();
|
|
812
|
+
selection.addRange(currentRange);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
805
815
|
if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer.nodeName === '#text' &&
|
|
806
816
|
range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
|
|
807
817
|
var range_1 = this.getRange();
|
|
@@ -1672,10 +1682,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1672
1682
|
if (this.iframeSettings.resources) {
|
|
1673
1683
|
var styleSrc = this.iframeSettings.resources.styles;
|
|
1674
1684
|
var scriptSrc = this.iframeSettings.resources.scripts;
|
|
1675
|
-
if (this.iframeSettings.resources.scripts.length > 0) {
|
|
1685
|
+
if (!isNOU(this.iframeSettings.resources.scripts) && this.iframeSettings.resources.scripts.length > 0) {
|
|
1676
1686
|
this.InjectSheet(true, scriptSrc);
|
|
1677
1687
|
}
|
|
1678
|
-
if (this.iframeSettings.resources.styles.length > 0) {
|
|
1688
|
+
if (!isNOU(this.iframeSettings.resources.styles) && this.iframeSettings.resources.styles.length > 0) {
|
|
1679
1689
|
this.InjectSheet(false, styleSrc);
|
|
1680
1690
|
}
|
|
1681
1691
|
}
|
|
@@ -499,6 +499,9 @@ export function updateTextNode(value, rteObj) {
|
|
|
499
499
|
}
|
|
500
500
|
var imageElm = resultElm.querySelectorAll('img');
|
|
501
501
|
for (var i = 0; i < imageElm.length; i++) {
|
|
502
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
503
|
+
continue; // Should not add the class if the image is Broken.
|
|
504
|
+
}
|
|
502
505
|
if (!imageElm[i].classList.contains(classes.CLS_RTE_IMAGE)) {
|
|
503
506
|
imageElm[i].classList.add(classes.CLS_RTE_IMAGE);
|
|
504
507
|
}
|
|
@@ -199,6 +199,7 @@ export var defaultLocale = {
|
|
|
199
199
|
'emojiPickerNoResultFound': 'No results found',
|
|
200
200
|
'emojiPickerTrySomethingElse': 'Try something else',
|
|
201
201
|
'linkAriaLabel': 'Open in new window',
|
|
202
|
+
'unsupportedImage': 'Unsupported file format'
|
|
202
203
|
};
|
|
203
204
|
export var toolsLocale = {
|
|
204
205
|
'alignments': 'alignments',
|
|
@@ -294,7 +295,7 @@ export var toolsLocale = {
|
|
|
294
295
|
'emojiPickerTypeToFind': 'Type to find',
|
|
295
296
|
'emojiPickerNoResultFound': 'No results found',
|
|
296
297
|
'emojiPickerTrySomethingElse': 'Try something else',
|
|
297
|
-
'
|
|
298
|
+
'imageLinkAriaLabel': 'Open in new window',
|
|
298
299
|
};
|
|
299
300
|
export var fontNameLocale = [
|
|
300
301
|
{ locale: 'fontNameSegoeUI', value: 'Segoe UI' },
|
|
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
import { ContentRender } from '../renderer/content-renderer';
|
|
15
15
|
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
16
|
import { getEditValue } from '../base/util';
|
|
17
|
-
var IFRAMEHEADER = "\n<!DOCTYPE html> \n <html>\n <head>\n <meta charset='utf-8' /> \n <style>\n @charset \"UTF-8\";\n body {\n font-family: \"Roboto\", sans-serif;\n font-size: 14px;\n }\n html, body{height: 100%;margin: 0;}\n body.e-cursor{cursor:default}\n span.e-selected-node\t{background-color: #939393;color: white;}\n span.e-selected-node.e-highlight {background-color: #1d9dd8;}\n body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}\n .e-rte-image, .e-rte-
|
|
17
|
+
var IFRAMEHEADER = "\n<!DOCTYPE html> \n <html>\n <head>\n <meta charset='utf-8' /> \n <style>\n @charset \"UTF-8\";\n body {\n font-family: \"Roboto\", sans-serif;\n font-size: 14px;\n }\n html, body{height: 100%;margin: 0;}\n body.e-cursor{cursor:default}\n span.e-selected-node\t{background-color: #939393;color: white;}\n span.e-selected-node.e-highlight {background-color: #1d9dd8;}\n body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}\n .e-rte-image, .e-rte-video {border: 0;cursor: pointer;display:\n block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-audio {border: 0;cursor: pointer;display:\n block;float: none;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imginline, .e-rte-audio.e-audio-inline, .e-rte-video.e-video-inline {display: inline-block;float: none;max-width: calc(100% - (2 * 5px));padding: 1px;vertical-align: bottom;}\n .e-rte-image.e-imgcenter, .e-rte-video.e-video-center {cursor: pointer;display: block;float: none;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imgright, .e-rte-video.e-video-right { float: right; margin: 0 auto;margin-left: 5px;text-align: right;}\n .e-rte-image.e-imgleft, .e-rte-video.e-video-left {float: left;margin: 0 auto;margin-right: 5px;text-align: left;}\n .e-img-caption { display: inline-block; float: none; margin: 5px auto; max-width: 100%;position: relative;}\n .e-img-caption.e-caption-inline {display: inline-block;float: none;\n margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));\n position: relativetext-align: center;vertical-align: bottom;}\n .e-rte-img-caption.e-imgcenter {display: contents; margin-left: auto; margin-right: auto;}\n .e-rte-img-caption.e-imgright {display: contents; margin-left: auto; margin-right: 0;}\n .e-rte-img-caption.e-imgleft {display: contents;margin-left: 0;margin-right: auto;}\n .e-img-caption.e-rte-img-caption.e-imgbreak {display: contents;}\n .e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;\n margin: auto;opacity: .9;text-align: center;width: 100%;}\n .e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}\n .e-imgleft, .e-video-left {float: left;margin: 0 5px 0 0;text-align: left;}\n .e-imgright, .e-video-right {float: right;margin: 0 0 0 5px;text-align: right;}\n .e-imgcenter, .e-video-center {cursor: pointer;display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-control img:not(.e-resize) {border: 2px solid transparent; z-index: 1000}\n .e-imginline , .e-audio-inline, .e-video-inline {display: inline-block;float: none;margin-left: 5px;margin-right: 5px;\n max-width: calc(100% - (2 * 5px));vertical-align: bottom;}\n .e-imgbreak, .e-audio-break, .e-video-break {border: 0;cursor: pointer;\n display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-img-focus:not(.e-resize), .e-audio-focus:not(.e-resize), .e-video-focus:not(.e-resize) {border: solid 2px #4a90e2;}\n img.e-img-focus::selection, audio.e-audio-focus::selection, .e-video-focus::selection { background: transparent;color: transparent;}\n span.e-rte-imageboxmark, span.e-rte-videoboxmark { width: 10px; height: 10px; position: absolute; display: block;\n background: #4a90e2; border: 1px solid #fff; z-index: 1000;}\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-mob-rte span.e-rte-imageboxmark, .e-mob-rte span.e-rte-videoboxmark { background: #fff; border: 1px solid #4a90e2;\n border-radius: 15px; height: 20px; width: 20px; }\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-rte-content .e-content img.e-resize, .e-rte-content .e-content video.e-resize { z-index: 1000; }\n .e-img-caption .e-img-inner { outline: 0; }\n .e-img-caption a:focus-visible { outline: none; }\n .e-img-caption .e-rte-image.e-imgright, .e-img-caption .e-rte-image.e-imgleft { float: none; margin: 0;}\n body{box-sizing: border-box;min-height: 100px;outline: 0 solid transparent;\n overflow-x: auto;padding: 16px;position: relative;text-align: inherit;z-index: 2;}\n p{margin: 0 0 10px;margin-bottom: 10px;}\n li{margin-bottom: 10px;}\n h1{font-size: 2.17em;font-weight: 400;line-height: 1;margin: 10px 0;}\n h2{font-size: 1.74em;font-weight: 400;margin: 10px 0;}\n h3{font-size: 1.31em;font-weight: 400;margin: 10px 0;}\n h4{font-size: 16px;font-weight: 400;line-height: 1.5;margin: 0;}\n h5{font-size: 00.8em;font-weight: 400;margin: 0;}\n h6{font-size: 00.65em;font-weight: 400;margin: 0;}\n blockquote{margin: 10px 0;margin-left: 0;padding-left: 5px;border-left: solid 2px #5c5c5c;}\n pre{background-color: inherit;border: 0;border-radius: 0;color: #333;\n font-size: inherit;line-height: inherit;margin: 0 0 10px;overflow: visible;padding: 0;\n white-space: pre-wrap;word-break: inherit;word-wrap: break-word;}\n strong, b{font-weight: 700;}\n a{text-decoration: none;user-select: auto;}\n a:hover{text-decoration: underline;};\n p:last-child, pre:last-child, blockquote:last-child{margin-bottom: 0;}\n h3+h4, h4+h5, h5+h6{margin-top: 00.6em;}\n ul:last-child{margin-bottom: 0;}\n table { border-collapse: collapse; empty-cells: show;}\n table td,table th {border: 1px solid #BDBDBD; height: 20px; padding: 2px 5px; vertical-align: middle;}\n table.e-alternate-border tbody tr:nth-child(2n) {background-color: #F5F5F5;}\n table th {background-color: #E0E0E0;}\n table.e-dashed-border td,table.e-dashed-border th { border: 1px dashed #BDBDBD} \n table .e-cell-select {border: 1px double #4a90e2;}\n span.e-table-box { cursor: nwse-resize; display: block; height: 10px; position: absolute; width: 10px; }\n span.e-table-box.e-rmob {height: 14px;width: 14px;}\n .e-row-resize, .e-column-resize { background-color: transparent; background-repeat: repeat;\n bottom: 0;cursor: col-resize;height: 1px;overflow: visible;position: absolute;width: 1px; }\n .e-row-resize { cursor: row-resize; height: 1px;}\n .e-table-rhelper { cursor: col-resize; opacity: .87;position: absolute;}\n .e-table-rhelper.e-column-helper { width: 1px; }\n .e-table-rhelper.e-row-helper {height: 1px;}\n .e-reicon::before { border-bottom: 6px solid transparent; border-right: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block; height: 0;\n position: absolute; right: 4px; top: 4px; width: 20px; }\n .e-reicon::after { border-bottom: 6px solid transparent; border-left: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block;\n height: 0; left: 4px; position: absolute; top: 4px; width: 20px; z-index: 3; }\n .e-row-helper.e-reicon::after { top: 10px; transform: rotate(90deg); }\n .e-row-helper.e-reicon::before { left: 4px; top: -20px; transform: rotate(90deg); }\n span.e-table-box { background-color: #ffffff; border: 1px solid #BDBDBD; }\n span.e-table-box.e-rbox-select { background-color: #BDBDBD; border: 1px solid #BDBDBD; }\n .e-table-rhelper { background-color: #4a90e2;}\n .e-rtl { direction: rtl; }\n .e-rte-placeholder::before { content: attr(placeholder); opacity: 0.54; overflow: hidden; padding-top: 16px; position: absolute; text-align: start; top: 0; z-index: 1; }\n </style>\n </head>";
|
|
18
18
|
/**
|
|
19
19
|
* Content module is used to render Rich Text Editor content
|
|
20
20
|
*
|
|
@@ -1014,7 +1014,7 @@ var Image = /** @class */ (function () {
|
|
|
1014
1014
|
this.checkBoxObj.createElement = this.parent.createElement;
|
|
1015
1015
|
this.checkBoxObj.appendTo(linkTarget);
|
|
1016
1016
|
var target_1 = this.checkBoxObj.checked ? '_blank' : null;
|
|
1017
|
-
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1017
|
+
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
|
|
1018
1018
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1019
1019
|
var linkargs_1 = {
|
|
1020
1020
|
args: e.args,
|
|
@@ -1134,14 +1134,14 @@ var Image = /** @class */ (function () {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
if (e.selectNode[0].parentElement.nodeName === 'A') {
|
|
1136
1136
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
1137
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1137
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1138
1138
|
subCommand: e.args.item.subCommand
|
|
1139
1139
|
});
|
|
1140
1140
|
proxy.dialogObj.hide({ returnValue: true });
|
|
1141
1141
|
return;
|
|
1142
1142
|
}
|
|
1143
1143
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
1144
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1144
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1145
1145
|
subCommand: e.args.item.subCommand, selection: e.selection
|
|
1146
1146
|
});
|
|
1147
1147
|
var captionEle = closest(e.selectNode[0], '.e-img-caption');
|