@syncfusion/ej2-richtexteditor 28.1.37 → 28.1.39
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/README.md +1 -1
- 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 +123 -125
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +123 -125
- 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 -10
- 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/editor-manager/plugin/selection-commands.js +1 -0
- package/src/rich-text-editor/actions/enter-key.js +34 -3
- package/src/rich-text-editor/actions/html-editor.js +3 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +4 -1
- 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
|
-
}
|
|
4866
|
-
}
|
|
4867
|
-
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
4868
|
-
(tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
|
|
4869
|
-
detach(tempNode.firstChild);
|
|
4870
|
-
}
|
|
4871
|
-
else {
|
|
4872
|
-
resultElm.appendChild(tempNode.firstChild);
|
|
4873
|
-
isPreviousInlineElem = false;
|
|
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.
|
|
4874
4839
|
}
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
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);
|
|
@@ -28230,6 +28192,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
|
|
|
28230
28192
|
}
|
|
28231
28193
|
else {
|
|
28232
28194
|
InsertMethods.unwrap(cursorFormat);
|
|
28195
|
+
domSelection.setCursorPoint(docElement, cursorNode, 0);
|
|
28233
28196
|
}
|
|
28234
28197
|
}
|
|
28235
28198
|
else {
|
|
@@ -32678,7 +32641,9 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
32678
32641
|
var eventArgs_1 = {
|
|
32679
32642
|
callBack: null,
|
|
32680
32643
|
event: e.args,
|
|
32681
|
-
name: 'keydown-handler'
|
|
32644
|
+
name: 'keydown-handler',
|
|
32645
|
+
enterKey: this.parent.enterKey,
|
|
32646
|
+
shiftEnterKey: this.parent.shiftEnterKey
|
|
32682
32647
|
};
|
|
32683
32648
|
var actionBeginArgs = {
|
|
32684
32649
|
cancel: false,
|
|
@@ -33596,6 +33561,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
33596
33561
|
var isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
|
|
33597
33562
|
!isNullOrUndefined(tempDivElem.querySelector('table'));
|
|
33598
33563
|
var imgElements = tempDivElem.querySelectorAll('img');
|
|
33564
|
+
var base_1 = this.parent.contentModule.getDocument().location.origin;
|
|
33599
33565
|
imgElements.forEach(function (imgElement) {
|
|
33600
33566
|
var imageFileFormat;
|
|
33601
33567
|
var imgElementSrc = imgElement.getAttribute('src');
|
|
@@ -33604,7 +33570,9 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
33604
33570
|
imageFileFormat = imgElementSrc.split(';')[0].split('/')[1];
|
|
33605
33571
|
}
|
|
33606
33572
|
else {
|
|
33607
|
-
|
|
33573
|
+
var parsedUrl = imgElementSrc.indexOf('http') > -1 ? new URL(imgElementSrc) : new URL(imgElementSrc, base_1);
|
|
33574
|
+
var path = parsedUrl.pathname;
|
|
33575
|
+
imageFileFormat = path.split('.').pop().toLowerCase();
|
|
33608
33576
|
}
|
|
33609
33577
|
if (!isNullOrUndefined(imageFileFormat) &&
|
|
33610
33578
|
allowedTypes.every(function (type) { return imageFileFormat !== type.substring(1).toLowerCase(); }) &&
|
|
@@ -37584,7 +37552,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37584
37552
|
if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
|
|
37585
37553
|
(_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
|
|
37586
37554
|
(_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
|
|
37587
|
-
if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')
|
|
37555
|
+
if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
|
|
37588
37556
|
var newElem = _this.createInsertElement(shiftKey_1);
|
|
37589
37557
|
newElem.appendChild(_this.parent.createElement('BR'));
|
|
37590
37558
|
_this.parent.inputElement.appendChild(newElem);
|
|
@@ -37643,8 +37611,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37643
37611
|
(_this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(_this.range.startContainer.textContent[_this.range.startOffset]) &&
|
|
37644
37612
|
_this.range.startContainer.textContent[_this.range.startOffset].includes('\u200B') && _this.range.startContainer.textContent[_this.range.startOffset] === '\u200B' &&
|
|
37645
37613
|
_this.parent.inputElement.textContent[0] !== '\u200B'));
|
|
37614
|
+
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;
|
|
37646
37615
|
// eslint-disable-next-line max-len
|
|
37647
|
-
if (!preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
37616
|
+
if (!preventEnterkeyShiftKey && !preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
37648
37617
|
!(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
|
|
37649
37618
|
(_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
37650
37619
|
var isNearBlockLengthZero = void 0;
|
|
@@ -37709,7 +37678,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37709
37678
|
}
|
|
37710
37679
|
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
|
|
37711
37680
|
}
|
|
37712
|
-
else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
37681
|
+
else if (nearBlockNode !== _this.parent.inputElement && nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
37713
37682
|
(nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
|
|
37714
37683
|
if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
|
|
37715
37684
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
|
|
@@ -37765,6 +37734,36 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
37765
37734
|
_this.parent.videoModule.hideVideoQuickToolbar();
|
|
37766
37735
|
}
|
|
37767
37736
|
}
|
|
37737
|
+
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) {
|
|
37738
|
+
var range = _this.range;
|
|
37739
|
+
var startContainer = range.startContainer;
|
|
37740
|
+
var startOffset = range.startOffset;
|
|
37741
|
+
var newElement = _this.parent.createElement(_this.parent.shiftEnterKey);
|
|
37742
|
+
if (startContainer.nodeType === Node.TEXT_NODE && range.endOffset !== 0 && range.startOffset !== 0) {
|
|
37743
|
+
var textNode = startContainer;
|
|
37744
|
+
if (startOffset < textNode.length) {
|
|
37745
|
+
var newTextNode = textNode.splitText(startOffset);
|
|
37746
|
+
newElement.appendChild(newTextNode);
|
|
37747
|
+
}
|
|
37748
|
+
else {
|
|
37749
|
+
newElement.innerHTML = '<br>';
|
|
37750
|
+
}
|
|
37751
|
+
textNode.parentNode.insertBefore(newElement, textNode.nextSibling);
|
|
37752
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
|
|
37753
|
+
}
|
|
37754
|
+
else if (startOffset === 0 && range.endOffset === 0) {
|
|
37755
|
+
newElement.innerHTML = '<br>';
|
|
37756
|
+
if (range.endOffset === startContainer.textContent.length) {
|
|
37757
|
+
var brElement = _this.parent.createElement('br');
|
|
37758
|
+
startContainer.parentNode.insertBefore(brElement, startContainer);
|
|
37759
|
+
}
|
|
37760
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
37761
|
+
var cursorTarget = (range.endOffset === startContainer.textContent.length)
|
|
37762
|
+
? newElement : newElement.nextSibling;
|
|
37763
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
37764
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), cursorTarget, 0);
|
|
37765
|
+
}
|
|
37766
|
+
}
|
|
37768
37767
|
else {
|
|
37769
37768
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
|
|
37770
37769
|
if (!isNullOrUndefined(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
|
|
@@ -39659,7 +39658,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
39659
39658
|
this.placeHolderWrapper.innerHTML = this.placeholder;
|
|
39660
39659
|
if (this.inputElement.textContent.length === 0 && this.inputElement.childNodes.length < 2 && !isNullOrUndefined(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
|
|
39661
39660
|
((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNullOrUndefined(this.inputElement.firstChild.firstChild) &&
|
|
39662
|
-
this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
39661
|
+
this.inputElement.firstChild.childNodes.length < 2 && this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
39663
39662
|
this.placeHolderWrapper.classList.add('enabled');
|
|
39664
39663
|
}
|
|
39665
39664
|
else {
|
|
@@ -40395,7 +40394,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
40395
40394
|
var value = this.getUpdatedValue();
|
|
40396
40395
|
this.setProperties({ value: value });
|
|
40397
40396
|
this.valueContainer.value = this.value;
|
|
40398
|
-
this.notify(toolbarRefresh, { args: e, documentNode: document });
|
|
40399
40397
|
this.isValueChangeBlurhandler = true;
|
|
40400
40398
|
this.invokeChangeEvent();
|
|
40401
40399
|
this.isFocusOut = true;
|