@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, Base, Property, Event as Event$1, NotifyPropertyChanges, 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, Base, Property, Event as Event$1, NotifyPropertyChanges, getComponent, ChildProperty, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes, getEnumValue, Complex, Component, print, L10n, compile, Touch } 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';
|
|
@@ -4793,11 +4793,6 @@ class NodeSelection {
|
|
|
4793
4793
|
/**
|
|
4794
4794
|
* Defines common util methods used by Rich Text Editor.
|
|
4795
4795
|
*/
|
|
4796
|
-
const inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
4797
|
-
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
4798
|
-
'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
|
|
4799
|
-
'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
|
|
4800
|
-
'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
|
|
4801
4796
|
/**
|
|
4802
4797
|
* @returns {void}
|
|
4803
4798
|
* @hidden
|
|
@@ -4825,109 +4820,68 @@ function setEditFrameFocus(editableElement, selector) {
|
|
|
4825
4820
|
}
|
|
4826
4821
|
/**
|
|
4827
4822
|
* @param {string} value - specifies the string value
|
|
4828
|
-
* @param {string} enterAction - specifies the enter key action API
|
|
4829
4823
|
* @returns {void}
|
|
4830
4824
|
* @hidden
|
|
4831
4825
|
*/
|
|
4832
|
-
function updateTextNode$1(value
|
|
4833
|
-
const tempNode = document.createElement('div');
|
|
4834
|
-
tempNode.innerHTML = value;
|
|
4835
|
-
tempNode.setAttribute('class', 'tempDiv');
|
|
4826
|
+
function updateTextNode$1(value) {
|
|
4836
4827
|
const resultElm = document.createElement('div');
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
if (
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
if (!isPreviousInlineElem) {
|
|
4847
|
-
if (enterAction === 'BR') {
|
|
4848
|
-
resultElm.appendChild(tempNode.firstChild);
|
|
4849
|
-
previousParent = resultElm;
|
|
4850
|
-
}
|
|
4851
|
-
else {
|
|
4852
|
-
paraElm = createElement('p');
|
|
4853
|
-
resultElm.appendChild(paraElm);
|
|
4854
|
-
paraElm.appendChild(tempNode.firstChild);
|
|
4855
|
-
previousParent = paraElm;
|
|
4856
|
-
isPreviousInlineElem = true;
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4859
|
-
else {
|
|
4860
|
-
previousParent.appendChild(tempNode.firstChild);
|
|
4861
|
-
previousParent = paraElm;
|
|
4862
|
-
isPreviousInlineElem = true;
|
|
4863
|
-
}
|
|
4864
|
-
}
|
|
4865
|
-
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
4866
|
-
(tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
|
|
4867
|
-
detach(tempNode.firstChild);
|
|
4828
|
+
resultElm.innerHTML = value;
|
|
4829
|
+
const tableElm = resultElm.querySelectorAll('table');
|
|
4830
|
+
for (let i = 0; i < tableElm.length; i++) {
|
|
4831
|
+
if (tableElm[i].classList.length > 0 &&
|
|
4832
|
+
!tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
4833
|
+
tableElm[i].classList.add('e-rte-paste-table');
|
|
4834
|
+
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
4835
|
+
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
4836
|
+
continue; // Skiping the removal of the border if the source is from word.
|
|
4868
4837
|
}
|
|
4869
|
-
else {
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
}
|
|
4874
|
-
const tableElm = resultElm.querySelectorAll('table');
|
|
4875
|
-
for (let i = 0; i < tableElm.length; i++) {
|
|
4876
|
-
if (tableElm[i].classList.length > 0 &&
|
|
4877
|
-
!tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
4878
|
-
tableElm[i].classList.add('e-rte-paste-table');
|
|
4879
|
-
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
4880
|
-
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
4881
|
-
continue; // Skiping the removal of the border if the source is from word.
|
|
4838
|
+
else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
|
|
4839
|
+
tableElm[i].classList.remove('e-rte-paste-excel-table');
|
|
4840
|
+
if (tableElm[i].getAttribute('border') === '0') {
|
|
4841
|
+
tableElm[i].removeAttribute('border');
|
|
4882
4842
|
}
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
if (
|
|
4886
|
-
|
|
4843
|
+
const tdElm = tableElm[i].querySelectorAll('td');
|
|
4844
|
+
for (let j = 0; j < tdElm.length; j++) {
|
|
4845
|
+
if (tdElm[j].style.borderLeft === 'none') {
|
|
4846
|
+
tdElm[j].style.removeProperty('border-left');
|
|
4887
4847
|
}
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
if (tdElm[j].style.borderTop === 'none') {
|
|
4900
|
-
tdElm[j].style.removeProperty('border-top');
|
|
4901
|
-
}
|
|
4902
|
-
if (tdElm[j].style.border === 'none') {
|
|
4903
|
-
tdElm[j].style.removeProperty('border');
|
|
4904
|
-
}
|
|
4848
|
+
if (tdElm[j].style.borderRight === 'none') {
|
|
4849
|
+
tdElm[j].style.removeProperty('border-right');
|
|
4850
|
+
}
|
|
4851
|
+
if (tdElm[j].style.borderBottom === 'none') {
|
|
4852
|
+
tdElm[j].style.removeProperty('border-bottom');
|
|
4853
|
+
}
|
|
4854
|
+
if (tdElm[j].style.borderTop === 'none') {
|
|
4855
|
+
tdElm[j].style.removeProperty('border-top');
|
|
4856
|
+
}
|
|
4857
|
+
if (tdElm[j].style.border === 'none') {
|
|
4858
|
+
tdElm[j].style.removeProperty('border');
|
|
4905
4859
|
}
|
|
4906
4860
|
}
|
|
4907
|
-
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
4908
|
-
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
4909
|
-
continue;
|
|
4910
|
-
}
|
|
4911
|
-
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
4912
|
-
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
4913
|
-
continue;
|
|
4914
|
-
}
|
|
4915
|
-
}
|
|
4916
|
-
}
|
|
4917
|
-
const imageElm = resultElm.querySelectorAll('img');
|
|
4918
|
-
for (let i = 0; i < imageElm.length; i++) {
|
|
4919
|
-
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
4920
|
-
continue; // Should not add the class if the image is Broken.
|
|
4921
4861
|
}
|
|
4922
|
-
if (
|
|
4923
|
-
|
|
4862
|
+
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
4863
|
+
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
4864
|
+
continue;
|
|
4924
4865
|
}
|
|
4925
|
-
if (
|
|
4926
|
-
|
|
4927
|
-
|
|
4866
|
+
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
4867
|
+
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
4868
|
+
continue;
|
|
4928
4869
|
}
|
|
4929
4870
|
}
|
|
4930
4871
|
}
|
|
4872
|
+
const imageElm = resultElm.querySelectorAll('img');
|
|
4873
|
+
for (let i = 0; i < imageElm.length; i++) {
|
|
4874
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
4875
|
+
continue; // Should not add the class if the image is Broken.
|
|
4876
|
+
}
|
|
4877
|
+
if (!imageElm[i].classList.contains('e-rte-image')) {
|
|
4878
|
+
imageElm[i].classList.add('e-rte-image');
|
|
4879
|
+
}
|
|
4880
|
+
if (!(imageElm[i].classList.contains('e-imginline') ||
|
|
4881
|
+
imageElm[i].classList.contains('e-imgbreak'))) {
|
|
4882
|
+
imageElm[i].classList.add('e-imginline');
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4931
4885
|
return resultElm.innerHTML;
|
|
4932
4886
|
}
|
|
4933
4887
|
/**
|
|
@@ -6143,7 +6097,6 @@ class ToolbarRenderer {
|
|
|
6143
6097
|
let proxy = this;
|
|
6144
6098
|
let value;
|
|
6145
6099
|
const colorPicker = new ColorPicker({
|
|
6146
|
-
enablePersistence: this.parent.enablePersistence,
|
|
6147
6100
|
enableRtl: this.parent.enableRtl,
|
|
6148
6101
|
inline: true,
|
|
6149
6102
|
value: null,
|
|
@@ -6654,10 +6607,10 @@ class Link {
|
|
|
6654
6607
|
}
|
|
6655
6608
|
if (!this.selfLink.isUrl(linkUrl)) {
|
|
6656
6609
|
if (this.selfLink.parent.editorMode === 'Markdown') {
|
|
6657
|
-
linkText = (linkText !== '') ? linkText : '';
|
|
6610
|
+
linkText = (linkText.trim() !== '') ? linkText : '';
|
|
6658
6611
|
}
|
|
6659
6612
|
else {
|
|
6660
|
-
linkText = (linkText === '') ? linkUrl : linkText;
|
|
6613
|
+
linkText = (linkText.trim() === '') ? linkUrl : linkText;
|
|
6661
6614
|
}
|
|
6662
6615
|
if (!this.selfLink.parent.enableAutoUrl) {
|
|
6663
6616
|
linkUrl = linkUrl.indexOf('http') > -1 ? linkUrl : 'http://' + linkUrl;
|
|
@@ -12488,7 +12441,6 @@ class Table {
|
|
|
12488
12441
|
this.parent.on(tableToolbarAction, this.onToolbarAction, this);
|
|
12489
12442
|
this.parent.on(dropDownSelect, this.dropdownSelect, this);
|
|
12490
12443
|
this.parent.on(keyDown, this.keyDown, this);
|
|
12491
|
-
this.parent.on(keyUp, this.keyUp, this);
|
|
12492
12444
|
this.parent.on(tableModulekeyUp, this.tableModulekeyUp, this);
|
|
12493
12445
|
this.parent.on(bindCssClass, this.setCssClass, this);
|
|
12494
12446
|
this.parent.on(destroy, this.destroy, this);
|
|
@@ -12509,7 +12461,6 @@ class Table {
|
|
|
12509
12461
|
this.parent.off(mouseDown, this.cellSelect);
|
|
12510
12462
|
this.parent.off(tableColorPickerChanged, this.setBGColor);
|
|
12511
12463
|
this.parent.off(keyDown, this.keyDown);
|
|
12512
|
-
this.parent.off(keyUp, this.keyUp);
|
|
12513
12464
|
this.parent.off(tableModulekeyUp, this.tableModulekeyUp);
|
|
12514
12465
|
this.parent.off(bindCssClass, this.setCssClass);
|
|
12515
12466
|
this.parent.off(destroy, this.destroy);
|
|
@@ -12606,20 +12557,6 @@ class Table {
|
|
|
12606
12557
|
this.parent.formatter.process(this.parent, e, e, { selection: selectCell, subCommand: e.item.subCommand });
|
|
12607
12558
|
this.hideTableQuickToolbar();
|
|
12608
12559
|
}
|
|
12609
|
-
keyUp(e) {
|
|
12610
|
-
const target = e.args.target;
|
|
12611
|
-
if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + '\'' + this.popupObj.element.id + '\'' + ']')) && this.popupObj) {
|
|
12612
|
-
let createTableToolbarBtn = this.popupObj.relateTo;
|
|
12613
|
-
if (createTableToolbarBtn.nodeName !== 'BUTTON') {
|
|
12614
|
-
createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
|
|
12615
|
-
createTableToolbarBtn = createTableToolbarBtn.parentElement;
|
|
12616
|
-
}
|
|
12617
|
-
this.popupObj.hide();
|
|
12618
|
-
if (createTableToolbarBtn) {
|
|
12619
|
-
createTableToolbarBtn.focus();
|
|
12620
|
-
}
|
|
12621
|
-
}
|
|
12622
|
-
}
|
|
12623
12560
|
keyDown(e) {
|
|
12624
12561
|
const event = e.args;
|
|
12625
12562
|
// eslint-disable-next-line
|
|
@@ -14191,6 +14128,8 @@ class Table {
|
|
|
14191
14128
|
const header = '1X1';
|
|
14192
14129
|
const insertbtn = this.l10n.getConstant('inserttablebtn');
|
|
14193
14130
|
this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
|
|
14131
|
+
this.createTablePopupBoundFn = this.createTablePopupKeyDown.bind(this);
|
|
14132
|
+
this.dlgDiv.addEventListener('keydown', this.createTablePopupBoundFn);
|
|
14194
14133
|
this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
|
|
14195
14134
|
this.tblHeader.innerHTML = header;
|
|
14196
14135
|
this.dlgDiv.appendChild(this.tblHeader);
|
|
@@ -14228,6 +14167,7 @@ class Table {
|
|
|
14228
14167
|
// eslint-disable-next-line
|
|
14229
14168
|
close: (event) => {
|
|
14230
14169
|
EventHandler.remove(btnEle, 'click', this.insertTableDialog);
|
|
14170
|
+
this.dlgDiv.removeEventListener('keydown', this.createTablePopupBoundFn);
|
|
14231
14171
|
detach(btnEle);
|
|
14232
14172
|
if (this.createTableButton && !this.createTableButton.isDestroyed) {
|
|
14233
14173
|
this.createTableButton.destroy();
|
|
@@ -14609,6 +14549,7 @@ class Table {
|
|
|
14609
14549
|
this.createTableButton.destroy();
|
|
14610
14550
|
this.createTableButton = null;
|
|
14611
14551
|
}
|
|
14552
|
+
this.createTablePopupBoundFn = null;
|
|
14612
14553
|
this.isDestroyed = true;
|
|
14613
14554
|
}
|
|
14614
14555
|
/**
|
|
@@ -14634,6 +14575,15 @@ class Table {
|
|
|
14634
14575
|
'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
|
|
14635
14576
|
}
|
|
14636
14577
|
}
|
|
14578
|
+
createTablePopupKeyDown(e) {
|
|
14579
|
+
if (e.key === 'Escape') {
|
|
14580
|
+
const popupRootElem = e.target.closest('.e-rte-table-popup');
|
|
14581
|
+
const popup = getComponent(popupRootElem, 'popup');
|
|
14582
|
+
const tableToolbarButton = popup.relateTo;
|
|
14583
|
+
popup.hide();
|
|
14584
|
+
tableToolbarButton.focus({ preventScroll: true });
|
|
14585
|
+
}
|
|
14586
|
+
}
|
|
14637
14587
|
}
|
|
14638
14588
|
|
|
14639
14589
|
/**
|
|
@@ -22303,7 +22253,7 @@ class InsertHtml {
|
|
|
22303
22253
|
nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
|
|
22304
22254
|
}
|
|
22305
22255
|
else {
|
|
22306
|
-
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode
|
|
22256
|
+
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
22307
22257
|
}
|
|
22308
22258
|
this.alignCheck(editNode);
|
|
22309
22259
|
this.listCleanUp(nodeSelection, docElement);
|
|
@@ -22563,9 +22513,9 @@ class InsertHtml {
|
|
|
22563
22513
|
}
|
|
22564
22514
|
}
|
|
22565
22515
|
}
|
|
22566
|
-
static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode
|
|
22516
|
+
static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
22567
22517
|
lastSelectionNode.classList.add('lastNode');
|
|
22568
|
-
editNode.innerHTML = updateTextNode$1(editNode.innerHTML
|
|
22518
|
+
editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
|
|
22569
22519
|
lastSelectionNode = editNode.querySelector('.lastNode');
|
|
22570
22520
|
if (!isNullOrUndefined(lastSelectionNode)) {
|
|
22571
22521
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -24044,6 +23994,17 @@ class Lists {
|
|
|
24044
23994
|
}
|
|
24045
23995
|
return false;
|
|
24046
23996
|
}
|
|
23997
|
+
createAutoList(enterKey, shiftEnterKey) {
|
|
23998
|
+
const autoListRules = {
|
|
23999
|
+
BR: { BR: true, P: true, DIV: true },
|
|
24000
|
+
P: { BR: false, P: true, DIV: true },
|
|
24001
|
+
DIV: { BR: false, P: true, DIV: true }
|
|
24002
|
+
};
|
|
24003
|
+
if (autoListRules[enterKey] && autoListRules[enterKey][shiftEnterKey] !== undefined) {
|
|
24004
|
+
return autoListRules[enterKey][shiftEnterKey];
|
|
24005
|
+
}
|
|
24006
|
+
return false;
|
|
24007
|
+
}
|
|
24047
24008
|
spaceList(e) {
|
|
24048
24009
|
const range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
24049
24010
|
this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
@@ -24059,7 +24020,8 @@ class Lists {
|
|
|
24059
24020
|
const startElementOLTest = this.testCurrentList(range);
|
|
24060
24021
|
const preElementOLTest = this.testList(preElement);
|
|
24061
24022
|
const nextElementOLTest = this.testList(nextElement);
|
|
24062
|
-
|
|
24023
|
+
const nextElementBRTest = range.startContainer.previousElementSibling && range.startContainer.previousElementSibling.tagName === 'BR';
|
|
24024
|
+
if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*' && (this.createAutoList(e.enterKey, e.shiftEnterKey) || !nextElementBRTest)) {
|
|
24063
24025
|
const brElement = createElement('br');
|
|
24064
24026
|
if (startElementOLTest) {
|
|
24065
24027
|
range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
|
|
@@ -28597,6 +28559,7 @@ class SelectionCommands {
|
|
|
28597
28559
|
}
|
|
28598
28560
|
else {
|
|
28599
28561
|
InsertMethods.unwrap(cursorFormat);
|
|
28562
|
+
domSelection.setCursorPoint(docElement, cursorNode, 0);
|
|
28600
28563
|
}
|
|
28601
28564
|
}
|
|
28602
28565
|
else {
|
|
@@ -33006,7 +32969,9 @@ class HtmlEditor {
|
|
|
33006
32969
|
const eventArgs = {
|
|
33007
32970
|
callBack: null,
|
|
33008
32971
|
event: e.args,
|
|
33009
|
-
name: 'keydown-handler'
|
|
32972
|
+
name: 'keydown-handler',
|
|
32973
|
+
enterKey: this.parent.enterKey,
|
|
32974
|
+
shiftEnterKey: this.parent.shiftEnterKey
|
|
33010
32975
|
};
|
|
33011
32976
|
const actionBeginArgs = {
|
|
33012
32977
|
cancel: false,
|
|
@@ -33921,6 +33886,7 @@ class PasteCleanup {
|
|
|
33921
33886
|
const isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
|
|
33922
33887
|
!isNullOrUndefined(tempDivElem.querySelector('table'));
|
|
33923
33888
|
const imgElements = tempDivElem.querySelectorAll('img');
|
|
33889
|
+
const base = this.parent.contentModule.getDocument().location.origin;
|
|
33924
33890
|
imgElements.forEach((imgElement) => {
|
|
33925
33891
|
let imageFileFormat;
|
|
33926
33892
|
const imgElementSrc = imgElement.getAttribute('src');
|
|
@@ -33929,7 +33895,9 @@ class PasteCleanup {
|
|
|
33929
33895
|
imageFileFormat = imgElementSrc.split(';')[0].split('/')[1];
|
|
33930
33896
|
}
|
|
33931
33897
|
else {
|
|
33932
|
-
|
|
33898
|
+
const parsedUrl = imgElementSrc.indexOf('http') > -1 ? new URL(imgElementSrc) : new URL(imgElementSrc, base);
|
|
33899
|
+
const path = parsedUrl.pathname;
|
|
33900
|
+
imageFileFormat = path.split('.').pop().toLowerCase();
|
|
33933
33901
|
}
|
|
33934
33902
|
if (!isNullOrUndefined(imageFileFormat) &&
|
|
33935
33903
|
allowedTypes.every((type) => imageFileFormat !== type.substring(1).toLowerCase()) &&
|
|
@@ -37722,7 +37690,7 @@ class EnterKeyAction {
|
|
|
37722
37690
|
if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.enterKey === 'DIV' && !shiftKey) ||
|
|
37723
37691
|
(this.parent.shiftEnterKey === 'P' && shiftKey) ||
|
|
37724
37692
|
(this.parent.shiftEnterKey === 'DIV' && shiftKey)) {
|
|
37725
|
-
if ((this.range.startOffset === 1 && this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE')
|
|
37693
|
+
if ((this.range.startOffset === 1 && this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
|
|
37726
37694
|
const newElem = this.createInsertElement(shiftKey);
|
|
37727
37695
|
newElem.appendChild(this.parent.createElement('BR'));
|
|
37728
37696
|
this.parent.inputElement.appendChild(newElem);
|
|
@@ -37781,8 +37749,9 @@ class EnterKeyAction {
|
|
|
37781
37749
|
(this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(this.range.startContainer.textContent[this.range.startOffset]) &&
|
|
37782
37750
|
this.range.startContainer.textContent[this.range.startOffset].includes('\u200B') && this.range.startContainer.textContent[this.range.startOffset] === '\u200B' &&
|
|
37783
37751
|
this.parent.inputElement.textContent[0] !== '\u200B'));
|
|
37752
|
+
const 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;
|
|
37784
37753
|
// eslint-disable-next-line max-len
|
|
37785
|
-
if (!preventZeroWithSpace && !fireFoxEnterAtMiddle && ((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
|
|
37754
|
+
if (!preventEnterkeyShiftKey && !preventZeroWithSpace && !fireFoxEnterAtMiddle && ((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
|
|
37786
37755
|
!(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
|
|
37787
37756
|
(this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
37788
37757
|
let isNearBlockLengthZero;
|
|
@@ -37847,7 +37816,7 @@ class EnterKeyAction {
|
|
|
37847
37816
|
}
|
|
37848
37817
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
|
|
37849
37818
|
}
|
|
37850
|
-
else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
37819
|
+
else if (nearBlockNode !== this.parent.inputElement && nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
37851
37820
|
(nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
|
|
37852
37821
|
if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
|
|
37853
37822
|
const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
|
|
@@ -37903,6 +37872,36 @@ class EnterKeyAction {
|
|
|
37903
37872
|
this.parent.videoModule.hideVideoQuickToolbar();
|
|
37904
37873
|
}
|
|
37905
37874
|
}
|
|
37875
|
+
else if (this.parent.enterKey === 'BR' && shiftKey && this.range.startContainer.nodeType === Node.TEXT_NODE && this.range.startContainer.parentElement && this.range.startContainer.parentElement === this.parent.inputElement) {
|
|
37876
|
+
const range = this.range;
|
|
37877
|
+
const startContainer = range.startContainer;
|
|
37878
|
+
const startOffset = range.startOffset;
|
|
37879
|
+
const newElement = this.parent.createElement(this.parent.shiftEnterKey);
|
|
37880
|
+
if (startContainer.nodeType === Node.TEXT_NODE && range.endOffset !== 0 && range.startOffset !== 0) {
|
|
37881
|
+
const textNode = startContainer;
|
|
37882
|
+
if (startOffset < textNode.length) {
|
|
37883
|
+
const newTextNode = textNode.splitText(startOffset);
|
|
37884
|
+
newElement.appendChild(newTextNode);
|
|
37885
|
+
}
|
|
37886
|
+
else {
|
|
37887
|
+
newElement.innerHTML = '<br>';
|
|
37888
|
+
}
|
|
37889
|
+
textNode.parentNode.insertBefore(newElement, textNode.nextSibling);
|
|
37890
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElement, 0);
|
|
37891
|
+
}
|
|
37892
|
+
else if (startOffset === 0 && range.endOffset === 0) {
|
|
37893
|
+
newElement.innerHTML = '<br>';
|
|
37894
|
+
if (range.endOffset === startContainer.textContent.length) {
|
|
37895
|
+
const brElement = this.parent.createElement('br');
|
|
37896
|
+
startContainer.parentNode.insertBefore(brElement, startContainer);
|
|
37897
|
+
}
|
|
37898
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
37899
|
+
const cursorTarget = (range.endOffset === startContainer.textContent.length)
|
|
37900
|
+
? newElement : newElement.nextSibling;
|
|
37901
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
37902
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), cursorTarget, 0);
|
|
37903
|
+
}
|
|
37904
|
+
}
|
|
37906
37905
|
else {
|
|
37907
37906
|
const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
|
|
37908
37907
|
if (!isNullOrUndefined(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
|
|
@@ -39765,7 +39764,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
39765
39764
|
this.placeHolderWrapper.innerHTML = this.placeholder;
|
|
39766
39765
|
if (this.inputElement.textContent.length === 0 && this.inputElement.childNodes.length < 2 && !isNullOrUndefined(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
|
|
39767
39766
|
((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNullOrUndefined(this.inputElement.firstChild.firstChild) &&
|
|
39768
|
-
this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
39767
|
+
this.inputElement.firstChild.childNodes.length < 2 && this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
39769
39768
|
this.placeHolderWrapper.classList.add('enabled');
|
|
39770
39769
|
}
|
|
39771
39770
|
else {
|
|
@@ -40499,7 +40498,6 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
40499
40498
|
const value = this.getUpdatedValue();
|
|
40500
40499
|
this.setProperties({ value: value });
|
|
40501
40500
|
this.valueContainer.value = this.value;
|
|
40502
|
-
this.notify(toolbarRefresh, { args: e, documentNode: document });
|
|
40503
40501
|
this.isValueChangeBlurhandler = true;
|
|
40504
40502
|
this.invokeChangeEvent();
|
|
40505
40503
|
this.isFocusOut = true;
|