@syncfusion/ej2-richtexteditor 28.1.38 → 28.1.41
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/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 +151 -126
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +151 -126
- 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.d.ts +1 -2
- package/src/common/util.js +49 -95
- package/src/editor-manager/base/interface.d.ts +8 -0
- package/src/editor-manager/plugin/inserthtml.js +3 -3
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +13 -1
- package/src/rich-text-editor/actions/enter-key.js +34 -3
- package/src/rich-text-editor/actions/html-editor.js +23 -1
- package/src/rich-text-editor/actions/resize.d.ts +2 -0
- package/src/rich-text-editor/actions/resize.js +13 -2
- package/src/rich-text-editor/base/rich-text-editor.js +1 -2
- package/src/rich-text-editor/renderer/link-module.js +2 -2
- package/src/rich-text-editor/renderer/table-module.d.ts +2 -1
- package/src/rich-text-editor/renderer/table-module.js +14 -17
- package/src/rich-text-editor/renderer/toolbar-renderer.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNullOrUndefined, Browser, addClass, removeClass, selectAll as selectAll$1, createElement, detach, SanitizeHtmlHelper, extend, EventHandler, closest, getInstance, formatUnit, select, Ajax, Property, Event as Event$1, NotifyPropertyChanges, Base, ChildProperty, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes,
|
|
1
|
+
import { isNullOrUndefined, Browser, addClass, removeClass, selectAll as selectAll$1, createElement, detach, SanitizeHtmlHelper, extend, EventHandler, closest, getInstance, formatUnit, select, Ajax, Property, Event as Event$1, NotifyPropertyChanges, Base, getComponent, ChildProperty, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes, getEnumValue, Complex, print, L10n, compile, Touch, Component } from '@syncfusion/ej2-base';
|
|
2
2
|
import { Toolbar as Toolbar$1 } from '@syncfusion/ej2-navigations';
|
|
3
3
|
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
4
4
|
import { Tooltip, Popup, Dialog, isCollide, getScrollableParent } from '@syncfusion/ej2-popups';
|
|
@@ -4795,11 +4795,6 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
|
|
|
4795
4795
|
/**
|
|
4796
4796
|
* Defines common util methods used by Rich Text Editor.
|
|
4797
4797
|
*/
|
|
4798
|
-
var inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
4799
|
-
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
4800
|
-
'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
|
|
4801
|
-
'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
|
|
4802
|
-
'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
|
|
4803
4798
|
/**
|
|
4804
4799
|
* @returns {void}
|
|
4805
4800
|
* @hidden
|
|
@@ -4827,109 +4822,68 @@ function setEditFrameFocus(editableElement, selector) {
|
|
|
4827
4822
|
}
|
|
4828
4823
|
/**
|
|
4829
4824
|
* @param {string} value - specifies the string value
|
|
4830
|
-
* @param {string} enterAction - specifies the enter key action API
|
|
4831
4825
|
* @returns {void}
|
|
4832
4826
|
* @hidden
|
|
4833
4827
|
*/
|
|
4834
|
-
function updateTextNode$1(value
|
|
4835
|
-
var tempNode = document.createElement('div');
|
|
4836
|
-
tempNode.innerHTML = value;
|
|
4837
|
-
tempNode.setAttribute('class', 'tempDiv');
|
|
4828
|
+
function updateTextNode$1(value) {
|
|
4838
4829
|
var resultElm = document.createElement('div');
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
if (
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
if (!isPreviousInlineElem) {
|
|
4849
|
-
if (enterAction === 'BR') {
|
|
4850
|
-
resultElm.appendChild(tempNode.firstChild);
|
|
4851
|
-
previousParent = resultElm;
|
|
4852
|
-
}
|
|
4853
|
-
else {
|
|
4854
|
-
paraElm = createElement('p');
|
|
4855
|
-
resultElm.appendChild(paraElm);
|
|
4856
|
-
paraElm.appendChild(tempNode.firstChild);
|
|
4857
|
-
previousParent = paraElm;
|
|
4858
|
-
isPreviousInlineElem = true;
|
|
4859
|
-
}
|
|
4860
|
-
}
|
|
4861
|
-
else {
|
|
4862
|
-
previousParent.appendChild(tempNode.firstChild);
|
|
4863
|
-
previousParent = paraElm;
|
|
4864
|
-
isPreviousInlineElem = true;
|
|
4865
|
-
}
|
|
4830
|
+
resultElm.innerHTML = value;
|
|
4831
|
+
var tableElm = resultElm.querySelectorAll('table');
|
|
4832
|
+
for (var i = 0; i < tableElm.length; i++) {
|
|
4833
|
+
if (tableElm[i].classList.length > 0 &&
|
|
4834
|
+
!tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
4835
|
+
tableElm[i].classList.add('e-rte-paste-table');
|
|
4836
|
+
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
4837
|
+
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
4838
|
+
continue; // Skiping the removal of the border if the source is from word.
|
|
4866
4839
|
}
|
|
4867
|
-
else if (
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
else {
|
|
4872
|
-
resultElm.appendChild(tempNode.firstChild);
|
|
4873
|
-
isPreviousInlineElem = false;
|
|
4874
|
-
}
|
|
4875
|
-
}
|
|
4876
|
-
var tableElm = resultElm.querySelectorAll('table');
|
|
4877
|
-
for (var i = 0; i < tableElm.length; i++) {
|
|
4878
|
-
if (tableElm[i].classList.length > 0 &&
|
|
4879
|
-
!tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
4880
|
-
tableElm[i].classList.add('e-rte-paste-table');
|
|
4881
|
-
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
4882
|
-
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
4883
|
-
continue; // Skiping the removal of the border if the source is from word.
|
|
4840
|
+
else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
|
|
4841
|
+
tableElm[i].classList.remove('e-rte-paste-excel-table');
|
|
4842
|
+
if (tableElm[i].getAttribute('border') === '0') {
|
|
4843
|
+
tableElm[i].removeAttribute('border');
|
|
4884
4844
|
}
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
if (
|
|
4888
|
-
|
|
4845
|
+
var tdElm = tableElm[i].querySelectorAll('td');
|
|
4846
|
+
for (var j = 0; j < tdElm.length; j++) {
|
|
4847
|
+
if (tdElm[j].style.borderLeft === 'none') {
|
|
4848
|
+
tdElm[j].style.removeProperty('border-left');
|
|
4889
4849
|
}
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
if (tdElm[j].style.borderTop === 'none') {
|
|
4902
|
-
tdElm[j].style.removeProperty('border-top');
|
|
4903
|
-
}
|
|
4904
|
-
if (tdElm[j].style.border === 'none') {
|
|
4905
|
-
tdElm[j].style.removeProperty('border');
|
|
4906
|
-
}
|
|
4850
|
+
if (tdElm[j].style.borderRight === 'none') {
|
|
4851
|
+
tdElm[j].style.removeProperty('border-right');
|
|
4852
|
+
}
|
|
4853
|
+
if (tdElm[j].style.borderBottom === 'none') {
|
|
4854
|
+
tdElm[j].style.removeProperty('border-bottom');
|
|
4855
|
+
}
|
|
4856
|
+
if (tdElm[j].style.borderTop === 'none') {
|
|
4857
|
+
tdElm[j].style.removeProperty('border-top');
|
|
4858
|
+
}
|
|
4859
|
+
if (tdElm[j].style.border === 'none') {
|
|
4860
|
+
tdElm[j].style.removeProperty('border');
|
|
4907
4861
|
}
|
|
4908
4862
|
}
|
|
4909
|
-
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
4910
|
-
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
4911
|
-
continue;
|
|
4912
|
-
}
|
|
4913
|
-
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
4914
|
-
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
4915
|
-
continue;
|
|
4916
|
-
}
|
|
4917
|
-
}
|
|
4918
|
-
}
|
|
4919
|
-
var imageElm = resultElm.querySelectorAll('img');
|
|
4920
|
-
for (var i = 0; i < imageElm.length; i++) {
|
|
4921
|
-
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
4922
|
-
continue; // Should not add the class if the image is Broken.
|
|
4923
4863
|
}
|
|
4924
|
-
if (
|
|
4925
|
-
|
|
4864
|
+
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
4865
|
+
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
4866
|
+
continue;
|
|
4926
4867
|
}
|
|
4927
|
-
if (
|
|
4928
|
-
|
|
4929
|
-
|
|
4868
|
+
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
4869
|
+
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
4870
|
+
continue;
|
|
4930
4871
|
}
|
|
4931
4872
|
}
|
|
4932
4873
|
}
|
|
4874
|
+
var imageElm = resultElm.querySelectorAll('img');
|
|
4875
|
+
for (var i = 0; i < imageElm.length; i++) {
|
|
4876
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
4877
|
+
continue; // Should not add the class if the image is Broken.
|
|
4878
|
+
}
|
|
4879
|
+
if (!imageElm[i].classList.contains('e-rte-image')) {
|
|
4880
|
+
imageElm[i].classList.add('e-rte-image');
|
|
4881
|
+
}
|
|
4882
|
+
if (!(imageElm[i].classList.contains('e-imginline') ||
|
|
4883
|
+
imageElm[i].classList.contains('e-imgbreak'))) {
|
|
4884
|
+
imageElm[i].classList.add('e-imginline');
|
|
4885
|
+
}
|
|
4886
|
+
}
|
|
4933
4887
|
return resultElm.innerHTML;
|
|
4934
4888
|
}
|
|
4935
4889
|
/**
|
|
@@ -6154,7 +6108,6 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
|
|
|
6154
6108
|
var proxy = this;
|
|
6155
6109
|
var value;
|
|
6156
6110
|
var colorPicker = new ColorPicker({
|
|
6157
|
-
enablePersistence: this.parent.enablePersistence,
|
|
6158
6111
|
enableRtl: this.parent.enableRtl,
|
|
6159
6112
|
inline: true,
|
|
6160
6113
|
value: null,
|
|
@@ -6667,10 +6620,10 @@ var Link = /** @__PURE__ @class */ (function () {
|
|
|
6667
6620
|
}
|
|
6668
6621
|
if (!this.selfLink.isUrl(linkUrl)) {
|
|
6669
6622
|
if (this.selfLink.parent.editorMode === 'Markdown') {
|
|
6670
|
-
linkText = (linkText !== '') ? linkText : '';
|
|
6623
|
+
linkText = (linkText.trim() !== '') ? linkText : '';
|
|
6671
6624
|
}
|
|
6672
6625
|
else {
|
|
6673
|
-
linkText = (linkText === '') ? linkUrl : linkText;
|
|
6626
|
+
linkText = (linkText.trim() === '') ? linkUrl : linkText;
|
|
6674
6627
|
}
|
|
6675
6628
|
if (!this.selfLink.parent.enableAutoUrl) {
|
|
6676
6629
|
linkUrl = linkUrl.indexOf('http') > -1 ? linkUrl : 'http://' + linkUrl;
|
|
@@ -12556,7 +12509,6 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
12556
12509
|
this.parent.on(tableToolbarAction, this.onToolbarAction, this);
|
|
12557
12510
|
this.parent.on(dropDownSelect, this.dropdownSelect, this);
|
|
12558
12511
|
this.parent.on(keyDown, this.keyDown, this);
|
|
12559
|
-
this.parent.on(keyUp, this.keyUp, this);
|
|
12560
12512
|
this.parent.on(tableModulekeyUp, this.tableModulekeyUp, this);
|
|
12561
12513
|
this.parent.on(bindCssClass, this.setCssClass, this);
|
|
12562
12514
|
this.parent.on(destroy, this.destroy, this);
|
|
@@ -12577,7 +12529,6 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
12577
12529
|
this.parent.off(mouseDown, this.cellSelect);
|
|
12578
12530
|
this.parent.off(tableColorPickerChanged, this.setBGColor);
|
|
12579
12531
|
this.parent.off(keyDown, this.keyDown);
|
|
12580
|
-
this.parent.off(keyUp, this.keyUp);
|
|
12581
12532
|
this.parent.off(tableModulekeyUp, this.tableModulekeyUp);
|
|
12582
12533
|
this.parent.off(bindCssClass, this.setCssClass);
|
|
12583
12534
|
this.parent.off(destroy, this.destroy);
|
|
@@ -12674,20 +12625,6 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
12674
12625
|
this.parent.formatter.process(this.parent, e, e, { selection: selectCell, subCommand: e.item.subCommand });
|
|
12675
12626
|
this.hideTableQuickToolbar();
|
|
12676
12627
|
};
|
|
12677
|
-
Table.prototype.keyUp = function (e) {
|
|
12678
|
-
var target = e.args.target;
|
|
12679
|
-
if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + '\'' + this.popupObj.element.id + '\'' + ']')) && this.popupObj) {
|
|
12680
|
-
var createTableToolbarBtn = this.popupObj.relateTo;
|
|
12681
|
-
if (createTableToolbarBtn.nodeName !== 'BUTTON') {
|
|
12682
|
-
createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
|
|
12683
|
-
createTableToolbarBtn = createTableToolbarBtn.parentElement;
|
|
12684
|
-
}
|
|
12685
|
-
this.popupObj.hide();
|
|
12686
|
-
if (createTableToolbarBtn) {
|
|
12687
|
-
createTableToolbarBtn.focus();
|
|
12688
|
-
}
|
|
12689
|
-
}
|
|
12690
|
-
};
|
|
12691
12628
|
Table.prototype.keyDown = function (e) {
|
|
12692
12629
|
var event = e.args;
|
|
12693
12630
|
// eslint-disable-next-line
|
|
@@ -14266,6 +14203,8 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
14266
14203
|
var header = '1X1';
|
|
14267
14204
|
var insertbtn = this.l10n.getConstant('inserttablebtn');
|
|
14268
14205
|
this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
|
|
14206
|
+
this.createTablePopupBoundFn = this.createTablePopupKeyDown.bind(this);
|
|
14207
|
+
this.dlgDiv.addEventListener('keydown', this.createTablePopupBoundFn);
|
|
14269
14208
|
this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
|
|
14270
14209
|
this.tblHeader.innerHTML = header;
|
|
14271
14210
|
this.dlgDiv.appendChild(this.tblHeader);
|
|
@@ -14303,6 +14242,7 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
14303
14242
|
// eslint-disable-next-line
|
|
14304
14243
|
close: function (event) {
|
|
14305
14244
|
EventHandler.remove(btnEle, 'click', _this.insertTableDialog);
|
|
14245
|
+
_this.dlgDiv.removeEventListener('keydown', _this.createTablePopupBoundFn);
|
|
14306
14246
|
detach(btnEle);
|
|
14307
14247
|
if (_this.createTableButton && !_this.createTableButton.isDestroyed) {
|
|
14308
14248
|
_this.createTableButton.destroy();
|
|
@@ -14686,6 +14626,7 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
14686
14626
|
this.createTableButton.destroy();
|
|
14687
14627
|
this.createTableButton = null;
|
|
14688
14628
|
}
|
|
14629
|
+
this.createTablePopupBoundFn = null;
|
|
14689
14630
|
this.isDestroyed = true;
|
|
14690
14631
|
};
|
|
14691
14632
|
/**
|
|
@@ -14712,6 +14653,15 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
14712
14653
|
'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
|
|
14713
14654
|
}
|
|
14714
14655
|
};
|
|
14656
|
+
Table.prototype.createTablePopupKeyDown = function (e) {
|
|
14657
|
+
if (e.key === 'Escape') {
|
|
14658
|
+
var popupRootElem = e.target.closest('.e-rte-table-popup');
|
|
14659
|
+
var popup = getComponent(popupRootElem, 'popup');
|
|
14660
|
+
var tableToolbarButton = popup.relateTo;
|
|
14661
|
+
popup.hide();
|
|
14662
|
+
tableToolbarButton.focus({ preventScroll: true });
|
|
14663
|
+
}
|
|
14664
|
+
};
|
|
14715
14665
|
return Table;
|
|
14716
14666
|
}());
|
|
14717
14667
|
|
|
@@ -21903,7 +21853,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
21903
21853
|
nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
|
|
21904
21854
|
}
|
|
21905
21855
|
else {
|
|
21906
|
-
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode
|
|
21856
|
+
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
21907
21857
|
}
|
|
21908
21858
|
this.alignCheck(editNode);
|
|
21909
21859
|
this.listCleanUp(nodeSelection, docElement);
|
|
@@ -22167,9 +22117,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
22167
22117
|
}
|
|
22168
22118
|
}
|
|
22169
22119
|
};
|
|
22170
|
-
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode
|
|
22120
|
+
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
22171
22121
|
lastSelectionNode.classList.add('lastNode');
|
|
22172
|
-
editNode.innerHTML = updateTextNode$1(editNode.innerHTML
|
|
22122
|
+
editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
|
|
22173
22123
|
lastSelectionNode = editNode.querySelector('.lastNode');
|
|
22174
22124
|
if (!isNullOrUndefined(lastSelectionNode)) {
|
|
22175
22125
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -23657,6 +23607,17 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
23657
23607
|
}
|
|
23658
23608
|
return false;
|
|
23659
23609
|
};
|
|
23610
|
+
Lists.prototype.createAutoList = function (enterKey, shiftEnterKey) {
|
|
23611
|
+
var autoListRules = {
|
|
23612
|
+
BR: { BR: true, P: true, DIV: true },
|
|
23613
|
+
P: { BR: false, P: true, DIV: true },
|
|
23614
|
+
DIV: { BR: false, P: true, DIV: true }
|
|
23615
|
+
};
|
|
23616
|
+
if (autoListRules[enterKey] && autoListRules[enterKey][shiftEnterKey] !== undefined) {
|
|
23617
|
+
return autoListRules[enterKey][shiftEnterKey];
|
|
23618
|
+
}
|
|
23619
|
+
return false;
|
|
23620
|
+
};
|
|
23660
23621
|
Lists.prototype.spaceList = function (e) {
|
|
23661
23622
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
23662
23623
|
this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
@@ -23672,7 +23633,8 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
23672
23633
|
var startElementOLTest = this.testCurrentList(range);
|
|
23673
23634
|
var preElementOLTest = this.testList(preElement);
|
|
23674
23635
|
var nextElementOLTest = this.testList(nextElement);
|
|
23675
|
-
|
|
23636
|
+
var nextElementBRTest = range.startContainer.previousElementSibling && range.startContainer.previousElementSibling.tagName === 'BR';
|
|
23637
|
+
if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*' && (this.createAutoList(e.enterKey, e.shiftEnterKey) || !nextElementBRTest)) {
|
|
23676
23638
|
var brElement = createElement('br');
|
|
23677
23639
|
if (startElementOLTest) {
|
|
23678
23640
|
range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
|
|
@@ -32679,7 +32641,9 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
32679
32641
|
var eventArgs_1 = {
|
|
32680
32642
|
callBack: null,
|
|
32681
32643
|
event: e.args,
|
|
32682
|
-
name: 'keydown-handler'
|
|
32644
|
+
name: 'keydown-handler',
|
|
32645
|
+
enterKey: this.parent.enterKey,
|
|
32646
|
+
shiftEnterKey: this.parent.shiftEnterKey
|
|
32683
32647
|
};
|
|
32684
32648
|
var actionBeginArgs = {
|
|
32685
32649
|
cancel: false,
|
|
@@ -32815,6 +32779,26 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
32815
32779
|
if (isNullOrUndefined(this.oldRangeElement)) {
|
|
32816
32780
|
return;
|
|
32817
32781
|
}
|
|
32782
|
+
else if (findBlockElement[0].previousSibling) {
|
|
32783
|
+
var prevSibling = findBlockElement[0].previousSibling;
|
|
32784
|
+
var currentElement = findBlockElement[0];
|
|
32785
|
+
if (prevSibling.textContent.trim()) {
|
|
32786
|
+
if (prevSibling.lastChild.nodeName === 'BR') {
|
|
32787
|
+
prevSibling.removeChild(prevSibling.lastChild);
|
|
32788
|
+
}
|
|
32789
|
+
var cursorpointer = prevSibling.lastChild.textContent.length;
|
|
32790
|
+
var lastChild = prevSibling.lastChild;
|
|
32791
|
+
var childNodes = Array.from(currentElement.childNodes);
|
|
32792
|
+
for (var i = 0; i < childNodes.length; i++) {
|
|
32793
|
+
prevSibling.appendChild(childNodes[i].cloneNode(true));
|
|
32794
|
+
}
|
|
32795
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastChild, cursorpointer);
|
|
32796
|
+
currentElement.parentNode.removeChild(currentElement);
|
|
32797
|
+
}
|
|
32798
|
+
else {
|
|
32799
|
+
prevSibling.parentNode.removeChild(prevSibling);
|
|
32800
|
+
}
|
|
32801
|
+
}
|
|
32818
32802
|
else {
|
|
32819
32803
|
if (this.oldRangeElement.tagName === 'OL' || this.oldRangeElement.tagName === 'UL') {
|
|
32820
32804
|
this.oldRangeElement = this.oldRangeElement.lastElementChild.lastElementChild
|
|
@@ -34721,13 +34705,24 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
34721
34705
|
this.iframeElement = this.parent.contentModule.getDocument().querySelectorAll('iframe');
|
|
34722
34706
|
if (!isNullOrUndefined(this.iframeElement)) {
|
|
34723
34707
|
this.iframeElement.forEach(function (iframe) {
|
|
34724
|
-
EventHandler.add(iframe
|
|
34708
|
+
EventHandler.add(iframe, 'load', _this.onIFrameLoad, _this);
|
|
34725
34709
|
});
|
|
34726
34710
|
}
|
|
34727
34711
|
this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
|
|
34728
34712
|
EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
|
|
34729
34713
|
EventHandler.add(this.resizer, this.touchStartEvent, this.resizeStart, this);
|
|
34730
34714
|
};
|
|
34715
|
+
Resize.prototype.onIFrameLoad = function (e) {
|
|
34716
|
+
var iframe = e.target;
|
|
34717
|
+
if (iframe.nodeName === 'IFRAME' && iframe.contentDocument) {
|
|
34718
|
+
EventHandler.add(iframe.contentDocument, 'mouseup', this.stopResize, this);
|
|
34719
|
+
}
|
|
34720
|
+
};
|
|
34721
|
+
Resize.prototype.removeMouseUpEventListener = function (iframe) {
|
|
34722
|
+
if (iframe.contentDocument) {
|
|
34723
|
+
EventHandler.remove(iframe.contentDocument, 'mouseup', this.stopResize);
|
|
34724
|
+
}
|
|
34725
|
+
};
|
|
34731
34726
|
Resize.prototype.resizeStart = function (e) {
|
|
34732
34727
|
var _this = this;
|
|
34733
34728
|
this.isResizing = false;
|
|
@@ -34834,7 +34829,7 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
34834
34829
|
}
|
|
34835
34830
|
if (!isNullOrUndefined(this.iframeElement)) {
|
|
34836
34831
|
this.iframeElement.forEach(function (iframe) {
|
|
34837
|
-
|
|
34832
|
+
_this.removeMouseUpEventListener(iframe);
|
|
34838
34833
|
});
|
|
34839
34834
|
}
|
|
34840
34835
|
if (this.resizer) {
|
|
@@ -37588,7 +37583,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37588
37583
|
if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
|
|
37589
37584
|
(_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
|
|
37590
37585
|
(_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
|
|
37591
|
-
if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')
|
|
37586
|
+
if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
|
|
37592
37587
|
var newElem = _this.createInsertElement(shiftKey_1);
|
|
37593
37588
|
newElem.appendChild(_this.parent.createElement('BR'));
|
|
37594
37589
|
_this.parent.inputElement.appendChild(newElem);
|
|
@@ -37647,8 +37642,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37647
37642
|
(_this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(_this.range.startContainer.textContent[_this.range.startOffset]) &&
|
|
37648
37643
|
_this.range.startContainer.textContent[_this.range.startOffset].includes('\u200B') && _this.range.startContainer.textContent[_this.range.startOffset] === '\u200B' &&
|
|
37649
37644
|
_this.parent.inputElement.textContent[0] !== '\u200B'));
|
|
37645
|
+
var preventEnterkeyShiftKey = (_this.range.startContainer.nodeName === '#text' || _this.range.startContainer.nodeName === 'BR') && (_this.range.startOffset === 0 && _this.range.endOffset === 0) && _this.range.startContainer.parentElement === _this.parent.inputElement && _this.parent.enterKey === 'BR' && shiftKey_1;
|
|
37650
37646
|
// eslint-disable-next-line max-len
|
|
37651
|
-
if (!preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
37647
|
+
if (!preventEnterkeyShiftKey && !preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
37652
37648
|
!(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
|
|
37653
37649
|
(_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
37654
37650
|
var isNearBlockLengthZero = void 0;
|
|
@@ -37713,7 +37709,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37713
37709
|
}
|
|
37714
37710
|
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
|
|
37715
37711
|
}
|
|
37716
|
-
else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
37712
|
+
else if (nearBlockNode !== _this.parent.inputElement && nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
37717
37713
|
(nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
|
|
37718
37714
|
if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
|
|
37719
37715
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
|
|
@@ -37769,6 +37765,36 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37769
37765
|
_this.parent.videoModule.hideVideoQuickToolbar();
|
|
37770
37766
|
}
|
|
37771
37767
|
}
|
|
37768
|
+
else if (_this.parent.enterKey === 'BR' && shiftKey_1 && _this.range.startContainer.nodeType === Node.TEXT_NODE && _this.range.startContainer.parentElement && _this.range.startContainer.parentElement === _this.parent.inputElement) {
|
|
37769
|
+
var range = _this.range;
|
|
37770
|
+
var startContainer = range.startContainer;
|
|
37771
|
+
var startOffset = range.startOffset;
|
|
37772
|
+
var newElement = _this.parent.createElement(_this.parent.shiftEnterKey);
|
|
37773
|
+
if (startContainer.nodeType === Node.TEXT_NODE && range.endOffset !== 0 && range.startOffset !== 0) {
|
|
37774
|
+
var textNode = startContainer;
|
|
37775
|
+
if (startOffset < textNode.length) {
|
|
37776
|
+
var newTextNode = textNode.splitText(startOffset);
|
|
37777
|
+
newElement.appendChild(newTextNode);
|
|
37778
|
+
}
|
|
37779
|
+
else {
|
|
37780
|
+
newElement.innerHTML = '<br>';
|
|
37781
|
+
}
|
|
37782
|
+
textNode.parentNode.insertBefore(newElement, textNode.nextSibling);
|
|
37783
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
|
|
37784
|
+
}
|
|
37785
|
+
else if (startOffset === 0 && range.endOffset === 0) {
|
|
37786
|
+
newElement.innerHTML = '<br>';
|
|
37787
|
+
if (range.endOffset === startContainer.textContent.length) {
|
|
37788
|
+
var brElement = _this.parent.createElement('br');
|
|
37789
|
+
startContainer.parentNode.insertBefore(brElement, startContainer);
|
|
37790
|
+
}
|
|
37791
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
37792
|
+
var cursorTarget = (range.endOffset === startContainer.textContent.length)
|
|
37793
|
+
? newElement : newElement.nextSibling;
|
|
37794
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
37795
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), cursorTarget, 0);
|
|
37796
|
+
}
|
|
37797
|
+
}
|
|
37772
37798
|
else {
|
|
37773
37799
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
|
|
37774
37800
|
if (!isNullOrUndefined(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
|
|
@@ -39663,7 +39689,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
39663
39689
|
this.placeHolderWrapper.innerHTML = this.placeholder;
|
|
39664
39690
|
if (this.inputElement.textContent.length === 0 && this.inputElement.childNodes.length < 2 && !isNullOrUndefined(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
|
|
39665
39691
|
((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNullOrUndefined(this.inputElement.firstChild.firstChild) &&
|
|
39666
|
-
this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
39692
|
+
this.inputElement.firstChild.childNodes.length < 2 && this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
39667
39693
|
this.placeHolderWrapper.classList.add('enabled');
|
|
39668
39694
|
}
|
|
39669
39695
|
else {
|
|
@@ -40399,7 +40425,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
40399
40425
|
var value = this.getUpdatedValue();
|
|
40400
40426
|
this.setProperties({ value: value });
|
|
40401
40427
|
this.valueContainer.value = this.value;
|
|
40402
|
-
this.notify(toolbarRefresh, { args: e, documentNode: document });
|
|
40403
40428
|
this.isValueChangeBlurhandler = true;
|
|
40404
40429
|
this.invokeChangeEvent();
|
|
40405
40430
|
this.isFocusOut = true;
|