@syncfusion/ej2-richtexteditor 24.2.4 → 24.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +669 -272
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +662 -269
- 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 +12 -12
- package/src/common/util.js +4 -1
- package/src/editor-manager/plugin/dom-node.js +3 -1
- package/src/editor-manager/plugin/format-painter-actions.d.ts +1 -0
- package/src/editor-manager/plugin/format-painter-actions.js +18 -0
- 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 +85 -63
- 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 +4 -4
- package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
- package/src/rich-text-editor/actions/color-picker.js +10 -0
- 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 +4 -1
- package/src/rich-text-editor/base/constant.d.ts +5 -0
- package/src/rich-text-editor/base/constant.js +5 -0
- 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 +33 -7
- package/src/rich-text-editor/base/util.js +3 -0
- package/src/rich-text-editor/models/default-locale.js +3 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +5 -1
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +31 -10
- package/src/rich-text-editor/renderer/table-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/table-module.js +200 -131
- package/src/rich-text-editor/renderer/toolbar-renderer.js +13 -13
- package/styles/bootstrap-dark.css +57 -22
- package/styles/bootstrap.css +61 -29
- package/styles/bootstrap4.css +48 -17
- package/styles/bootstrap5-dark.css +47 -18
- package/styles/bootstrap5.css +47 -18
- package/styles/fabric-dark.css +43 -12
- package/styles/fabric.css +43 -12
- package/styles/fluent-dark.css +51 -14
- package/styles/fluent.css +51 -14
- package/styles/highcontrast-light.css +43 -12
- package/styles/highcontrast.css +46 -12
- package/styles/material-dark.css +47 -12
- package/styles/material.css +47 -12
- package/styles/material3-dark.css +45 -14
- package/styles/material3.css +45 -14
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +12 -10
- package/styles/rich-text-editor/_bootstrap-definition.scss +18 -16
- 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 +46 -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 +6 -4
- package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
- package/styles/rich-text-editor/_theme.scss +65 -16
- package/styles/rich-text-editor/bootstrap-dark.css +57 -22
- package/styles/rich-text-editor/bootstrap.css +61 -29
- package/styles/rich-text-editor/bootstrap4.css +48 -17
- package/styles/rich-text-editor/bootstrap5-dark.css +47 -18
- package/styles/rich-text-editor/bootstrap5.css +47 -18
- package/styles/rich-text-editor/fabric-dark.css +43 -12
- package/styles/rich-text-editor/fabric.css +43 -12
- package/styles/rich-text-editor/fluent-dark.css +51 -14
- package/styles/rich-text-editor/fluent.css +51 -14
- package/styles/rich-text-editor/highcontrast-light.css +43 -12
- package/styles/rich-text-editor/highcontrast.css +46 -12
- package/styles/rich-text-editor/material-dark.css +47 -12
- package/styles/rich-text-editor/material.css +47 -12
- package/styles/rich-text-editor/material3-dark.css +45 -14
- package/styles/rich-text-editor/material3.css +45 -14
- package/styles/rich-text-editor/tailwind-dark.css +98 -35
- package/styles/rich-text-editor/tailwind.css +98 -35
- package/styles/tailwind-dark.css +98 -35
- package/styles/tailwind.css +98 -35
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
|
@@ -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);
|
|
@@ -56,6 +56,9 @@ var Toolbar = /** @class */ (function () {
|
|
|
56
56
|
if (e.target.classList.contains('e-hor-nav')) {
|
|
57
57
|
this.adjustContentHeight(e.target, true);
|
|
58
58
|
}
|
|
59
|
+
if (!isNullOrUndefined(e.target) && (e.target.classList.contains("e-rte-fontcolor-dropdown") || e.target.classList.contains("e-rte-backgroundcolor-dropdown"))) {
|
|
60
|
+
this.parent.notify(events.showColorPicker, { toolbarClick: e.target.classList.contains("e-rte-fontcolor-dropdown") ? "fontcolor" : "backgroundcolor" });
|
|
61
|
+
}
|
|
59
62
|
}
|
|
60
63
|
};
|
|
61
64
|
Toolbar.prototype.createToolbarElement = function () {
|
|
@@ -585,7 +588,7 @@ var Toolbar = /** @class */ (function () {
|
|
|
585
588
|
else if (Browser.isDevice || this.parent.inlineMode.enable) {
|
|
586
589
|
this.isToolbar = true;
|
|
587
590
|
}
|
|
588
|
-
if (isNOU(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand) {
|
|
591
|
+
if (isNOU(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand && this.parent.toolbarModule.getExpandTBarPopHeight() === 0) {
|
|
589
592
|
removeClass([this.tbElement], [classes.CLS_EXPAND_OPEN]);
|
|
590
593
|
}
|
|
591
594
|
};
|
|
@@ -759,6 +759,11 @@ export var documentClickClosedBy = 'documentClickClosedBy';
|
|
|
759
759
|
/**
|
|
760
760
|
* @hidden
|
|
761
761
|
|
|
762
|
+
*/
|
|
763
|
+
export var showColorPicker = 'showColorPicker';
|
|
764
|
+
/**
|
|
765
|
+
* @hidden
|
|
766
|
+
|
|
762
767
|
*/
|
|
763
768
|
export var blockEmptyNodes = "address:empty, article:empty, aside:empty, blockquote:empty,\n details:empty, dd:empty, div:empty, dl:empty, dt:empty, fieldset:empty, footer:empty,form:empty, h1:empty,\n h2:empty, h3:empty, h4:empty, h5:empty, h6:empty, header:empty, hgroup:empty, li:empty, main:empty, nav:empty,\n noscript:empty, output:empty, p:empty, pre:empty, section:empty, td:empty, th:empty";
|
|
764
769
|
/**
|
|
@@ -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();
|
|
@@ -901,11 +911,14 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
901
911
|
clientX: touch.clientX, clientY: touch.clientY }
|
|
902
912
|
});
|
|
903
913
|
if (this.inputElement && ((this.editorMode === 'HTML' && this.inputElement.textContent.length !== 0) ||
|
|
904
|
-
(this.editorMode === 'Markdown' && this.inputElement.value.length !== 0)) ||
|
|
905
|
-
|
|
906
|
-
(e.target.
|
|
907
|
-
e.target.
|
|
908
|
-
e.target.
|
|
914
|
+
(this.editorMode === 'Markdown' && this.inputElement.value.length !== 0)) ||
|
|
915
|
+
(e.target && !isNOU(closest(e.target, 'table'))) ||
|
|
916
|
+
(e.target && (e.target.nodeName === 'VIDEO' ||
|
|
917
|
+
e.target.querySelectorAll('.' + classes.CLS_VIDEOWRAP).length > 0) ||
|
|
918
|
+
(e.target && e.target.nodeName !== 'BR' &&
|
|
919
|
+
(e.target.classList.contains(classes.CLS_AUDIOWRAP) ||
|
|
920
|
+
e.target.classList.contains(classes.CLS_CLICKELEM) ||
|
|
921
|
+
e.target.classList.contains(classes.CLS_VID_CLICK_ELEM))))) {
|
|
909
922
|
this.notify(events.toolbarRefresh, { args: e });
|
|
910
923
|
}
|
|
911
924
|
this.triggerEditArea(e);
|
|
@@ -1672,10 +1685,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1672
1685
|
if (this.iframeSettings.resources) {
|
|
1673
1686
|
var styleSrc = this.iframeSettings.resources.styles;
|
|
1674
1687
|
var scriptSrc = this.iframeSettings.resources.scripts;
|
|
1675
|
-
if (this.iframeSettings.resources.scripts.length > 0) {
|
|
1688
|
+
if (!isNOU(this.iframeSettings.resources.scripts) && this.iframeSettings.resources.scripts.length > 0) {
|
|
1676
1689
|
this.InjectSheet(true, scriptSrc);
|
|
1677
1690
|
}
|
|
1678
|
-
if (this.iframeSettings.resources.styles.length > 0) {
|
|
1691
|
+
if (!isNOU(this.iframeSettings.resources.styles) && this.iframeSettings.resources.styles.length > 0) {
|
|
1679
1692
|
this.InjectSheet(false, styleSrc);
|
|
1680
1693
|
}
|
|
1681
1694
|
}
|
|
@@ -1789,6 +1802,13 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1789
1802
|
var imgPadding = 12;
|
|
1790
1803
|
var imgResizeBorder = 2;
|
|
1791
1804
|
var editEle = this.contentModule.getEditPanel();
|
|
1805
|
+
if (this.editorMode === "HTML" && !isNOU(this.formatter.editorManager.nodeSelection) && !isNOU(this.formatter.editorManager.nodeSelection.range)) {
|
|
1806
|
+
var currentRange = this.formatter.editorManager.nodeSelection.range;
|
|
1807
|
+
if (currentRange.startContainer.nodeType !== 3 && currentRange.startContainer.closest &&
|
|
1808
|
+
!isNOU(currentRange.startContainer.closest('TD'))) {
|
|
1809
|
+
editEle = currentRange.startContainer;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1792
1812
|
var eleStyle = window.getComputedStyle(editEle);
|
|
1793
1813
|
var editEleMaxWidth = editEle.offsetWidth - (imgPadding + imgResizeBorder +
|
|
1794
1814
|
parseFloat(eleStyle.paddingLeft.split('px')[0]) + parseFloat(eleStyle.paddingRight.split('px')[0]) +
|
|
@@ -2232,6 +2252,12 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
2232
2252
|
var trg = e.relatedTarget;
|
|
2233
2253
|
if (trg) {
|
|
2234
2254
|
var rteElement = closest(trg, '.' + classes.CLS_RTE);
|
|
2255
|
+
if (!rteElement && this.iframeSettings.enable) {
|
|
2256
|
+
var iframeElement = this.element.querySelector('#' + this.getID() + '_rte-view');
|
|
2257
|
+
if (iframeElement && iframeElement.contentWindow.document.body.contains(trg)) {
|
|
2258
|
+
rteElement = closest(iframeElement, '.' + classes.CLS_RTE);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2235
2261
|
if (rteElement && rteElement === this.element) {
|
|
2236
2262
|
this.isBlur = false;
|
|
2237
2263
|
if (trg === this.getToolbarElement()) {
|
|
@@ -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
|
}
|
|
@@ -94,7 +94,7 @@ export var defaultLocale = {
|
|
|
94
94
|
'browse': 'Browse',
|
|
95
95
|
'imageUrl': 'http://example.com/image.png',
|
|
96
96
|
'audioUrl': 'http://example.com/audio.mp3',
|
|
97
|
-
'videoUrl': 'http://example.com/video.
|
|
97
|
+
'videoUrl': 'http://example.com/video.mp4',
|
|
98
98
|
'webUrl': 'Web URL',
|
|
99
99
|
'embedUrl': 'Embed Code',
|
|
100
100
|
'imageCaption': 'Caption',
|
|
@@ -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' },
|
|
@@ -37,7 +37,11 @@ var DialogRenderer = /** @class */ (function () {
|
|
|
37
37
|
var dlgObj;
|
|
38
38
|
e.beforeOpen = this.beforeOpen.bind(this);
|
|
39
39
|
e.open = this.open.bind(this);
|
|
40
|
-
e.position = {
|
|
40
|
+
e.position = {
|
|
41
|
+
X: 'center',
|
|
42
|
+
Y: (e.target !== 'string' && e.target.nodeName === 'BODY' &&
|
|
43
|
+
!isNOU(e.position)) ? e.position.Y : this.getDialogPosition()
|
|
44
|
+
};
|
|
41
45
|
if (isNOU(e.close)) {
|
|
42
46
|
e.close = this.close.bind(this);
|
|
43
47
|
}
|
|
@@ -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;\n margin-left: 5px;margin-right: 5px;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
|
*
|
|
@@ -234,6 +234,7 @@ var Image = /** @class */ (function () {
|
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
+
EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
|
|
237
238
|
EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
|
|
238
239
|
}
|
|
239
240
|
};
|
|
@@ -285,7 +286,6 @@ var Image = /** @class */ (function () {
|
|
|
285
286
|
this.imgResizePos(e, this.imgResizeDiv);
|
|
286
287
|
this.resizeImgDupPos(e);
|
|
287
288
|
this.contentModule.getEditPanel().appendChild(this.imgResizeDiv);
|
|
288
|
-
EventHandler.add(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing, this);
|
|
289
289
|
};
|
|
290
290
|
Image.prototype.getPointX = function (e) {
|
|
291
291
|
if (e.touches && e.touches.length) {
|
|
@@ -644,7 +644,9 @@ var Image = /** @class */ (function () {
|
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
|
|
647
|
-
|
|
647
|
+
if (this.parent.editorMode !== 'Markdown') {
|
|
648
|
+
this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
|
|
649
|
+
}
|
|
648
650
|
}
|
|
649
651
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
650
652
|
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
@@ -1014,7 +1016,7 @@ var Image = /** @class */ (function () {
|
|
|
1014
1016
|
this.checkBoxObj.createElement = this.parent.createElement;
|
|
1015
1017
|
this.checkBoxObj.appendTo(linkTarget);
|
|
1016
1018
|
var target_1 = this.checkBoxObj.checked ? '_blank' : null;
|
|
1017
|
-
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('
|
|
1019
|
+
var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
|
|
1018
1020
|
var linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
1019
1021
|
var linkargs_1 = {
|
|
1020
1022
|
args: e.args,
|
|
@@ -1134,14 +1136,14 @@ var Image = /** @class */ (function () {
|
|
|
1134
1136
|
}
|
|
1135
1137
|
if (e.selectNode[0].parentElement.nodeName === 'A') {
|
|
1136
1138
|
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('
|
|
1139
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1138
1140
|
subCommand: e.args.item.subCommand
|
|
1139
1141
|
});
|
|
1140
1142
|
proxy.dialogObj.hide({ returnValue: true });
|
|
1141
1143
|
return;
|
|
1142
1144
|
}
|
|
1143
1145
|
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('
|
|
1146
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
1145
1147
|
subCommand: e.args.item.subCommand, selection: e.selection
|
|
1146
1148
|
});
|
|
1147
1149
|
var captionEle = closest(e.selectNode[0], '.e-img-caption');
|
|
@@ -1169,7 +1171,29 @@ var Image = /** @class */ (function () {
|
|
|
1169
1171
|
if (this.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1170
1172
|
this.parent.formatter.saveData();
|
|
1171
1173
|
}
|
|
1172
|
-
e.selection.
|
|
1174
|
+
var restoreStartElement = e.selection.range.startContainer;
|
|
1175
|
+
if (e.selection.range.startContainer.nodeName === 'SPAN' &&
|
|
1176
|
+
restoreStartElement.classList.contains('e-img-wrap') &&
|
|
1177
|
+
restoreStartElement.parentElement.classList.contains('e-img-caption')) {
|
|
1178
|
+
restoreStartElement = restoreStartElement.parentElement;
|
|
1179
|
+
if (!isNOU(restoreStartElement.previousSibling)) {
|
|
1180
|
+
var lastNode = restoreStartElement.previousSibling;
|
|
1181
|
+
while (lastNode.nodeName !== '#text' && lastNode.nodeName !== 'BR') {
|
|
1182
|
+
lastNode = lastNode.lastChild;
|
|
1183
|
+
}
|
|
1184
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), lastNode, lastNode.nodeName !== 'BR' ? lastNode.textContent.length : 0);
|
|
1185
|
+
}
|
|
1186
|
+
else if (!isNOU(restoreStartElement.nextSibling)) {
|
|
1187
|
+
var firstNode = restoreStartElement.nextSibling;
|
|
1188
|
+
while (firstNode.nodeName !== '#text' && firstNode.nodeName !== 'BR') {
|
|
1189
|
+
firstNode = firstNode.firstChild;
|
|
1190
|
+
}
|
|
1191
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), firstNode, 0);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
e.selection.restore();
|
|
1196
|
+
}
|
|
1173
1197
|
if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
|
|
1174
1198
|
this.removeResizeEle();
|
|
1175
1199
|
}
|
|
@@ -1383,7 +1407,7 @@ var Image = /** @class */ (function () {
|
|
|
1383
1407
|
animationSettings: { effect: 'None' },
|
|
1384
1408
|
close: function (event) {
|
|
1385
1409
|
if (_this.isImgUploaded) {
|
|
1386
|
-
_this.uploadObj.
|
|
1410
|
+
_this.uploadObj.remove();
|
|
1387
1411
|
}
|
|
1388
1412
|
_this.parent.isBlur = false;
|
|
1389
1413
|
if (event && event.event.returnValue) {
|
|
@@ -1451,9 +1475,6 @@ var Image = /** @class */ (function () {
|
|
|
1451
1475
|
Image.prototype.cancelDialog = function (e) {
|
|
1452
1476
|
this.parent.isBlur = false;
|
|
1453
1477
|
this.dialogObj.hide({ returnValue: true });
|
|
1454
|
-
if (this.isImgUploaded) {
|
|
1455
|
-
this.uploadObj.removing();
|
|
1456
|
-
}
|
|
1457
1478
|
};
|
|
1458
1479
|
Image.prototype.onDocumentClick = function (e) {
|
|
1459
1480
|
var target = e.target;
|
|
@@ -33,7 +33,6 @@ export declare class Table {
|
|
|
33
33
|
private helper;
|
|
34
34
|
private dialogRenderObj;
|
|
35
35
|
private currentColumnResize;
|
|
36
|
-
private currentMarginLeft;
|
|
37
36
|
private previousTableElement;
|
|
38
37
|
private constructor();
|
|
39
38
|
protected addEventListener(): void;
|
|
@@ -76,17 +75,20 @@ export declare class Table {
|
|
|
76
75
|
private getPointX;
|
|
77
76
|
private getPointY;
|
|
78
77
|
private resizeStart;
|
|
78
|
+
private getCellIndex;
|
|
79
79
|
private removeHelper;
|
|
80
80
|
private appendHelper;
|
|
81
81
|
private setHelperHeight;
|
|
82
82
|
private updateHelper;
|
|
83
83
|
private calMaxCol;
|
|
84
84
|
private resizing;
|
|
85
|
+
private getCurrentColWidth;
|
|
85
86
|
private getCurrentTableWidth;
|
|
86
87
|
private findFirstLastColCells;
|
|
87
88
|
private convertPixelToPercentage;
|
|
88
89
|
private cancelResizeAction;
|
|
89
90
|
private resizeEnd;
|
|
91
|
+
private resetResizeHelper;
|
|
90
92
|
private resizeBtnInit;
|
|
91
93
|
private addRow;
|
|
92
94
|
private addColumn;
|
|
@@ -122,4 +124,5 @@ export declare class Table {
|
|
|
122
124
|
*/
|
|
123
125
|
private getModuleName;
|
|
124
126
|
private afterKeyDown;
|
|
127
|
+
private updateResizeIconPosition;
|
|
125
128
|
}
|