@syncfusion/ej2-richtexteditor 28.1.38 → 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/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 +118 -124
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +118 -124
- 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 +10 -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/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/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
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 28.1.
|
|
3
|
+
* version : 28.1.39
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-richtexteditor@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-richtexteditor@28.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@28.1.38",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-VgcAoOpiEA/QFH8o0/1zMctqznoFqjYtvQtK8ep3Km41VszqWndVLw+FI0+bS9d51fTHTDIKKY4FSk+I1eoMRA==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
26
26
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
27
27
|
],
|
|
28
|
-
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-28.1.
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-28.1.38.tgz",
|
|
29
|
+
"_shasum": "344a03d500b197a42d3a8f28f1b7766e7bf90b2f",
|
|
30
30
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
31
31
|
"_where": "/jenkins/workspace/elease-automation_release_28.1.1/packages/included",
|
|
32
32
|
"author": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"bundleDependencies": false,
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@syncfusion/ej2-base": "~28.1.33",
|
|
41
|
-
"@syncfusion/ej2-buttons": "~28.1.
|
|
42
|
-
"@syncfusion/ej2-dropdowns": "~28.1.
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~28.1.
|
|
41
|
+
"@syncfusion/ej2-buttons": "~28.1.39",
|
|
42
|
+
"@syncfusion/ej2-dropdowns": "~28.1.39",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~28.1.39",
|
|
44
44
|
"@syncfusion/ej2-inputs": "~28.1.37",
|
|
45
|
-
"@syncfusion/ej2-navigations": "~28.1.
|
|
46
|
-
"@syncfusion/ej2-popups": "~28.1.
|
|
45
|
+
"@syncfusion/ej2-navigations": "~28.1.39",
|
|
46
|
+
"@syncfusion/ej2-popups": "~28.1.39",
|
|
47
47
|
"@syncfusion/ej2-splitbuttons": "~28.1.37"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
81
81
|
},
|
|
82
82
|
"typings": "index.d.ts",
|
|
83
|
-
"version": "28.1.
|
|
83
|
+
"version": "28.1.39",
|
|
84
84
|
"sideEffects": false
|
|
85
85
|
}
|
package/src/common/util.d.ts
CHANGED
|
@@ -13,11 +13,10 @@ export declare function isIDevice(): boolean;
|
|
|
13
13
|
export declare function setEditFrameFocus(editableElement: Element, selector: string): void;
|
|
14
14
|
/**
|
|
15
15
|
* @param {string} value - specifies the string value
|
|
16
|
-
* @param {string} enterAction - specifies the enter key action API
|
|
17
16
|
* @returns {void}
|
|
18
17
|
* @hidden
|
|
19
18
|
*/
|
|
20
|
-
export declare function updateTextNode(value: string
|
|
19
|
+
export declare function updateTextNode(value: string): string;
|
|
21
20
|
/**
|
|
22
21
|
* @param {Node} startChildNodes - specifies the node
|
|
23
22
|
* @returns {void}
|
package/src/common/util.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Defines common util methods used by Rich Text Editor.
|
|
3
3
|
*/
|
|
4
|
-
import { isNullOrUndefined, Browser,
|
|
5
|
-
var inlineNode = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
6
|
-
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
7
|
-
'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
|
|
8
|
-
'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
|
|
9
|
-
'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
|
|
4
|
+
import { isNullOrUndefined, Browser, removeClass } from '@syncfusion/ej2-base';
|
|
10
5
|
/**
|
|
11
6
|
* @returns {void}
|
|
12
7
|
* @hidden
|
|
@@ -34,109 +29,68 @@ export function setEditFrameFocus(editableElement, selector) {
|
|
|
34
29
|
}
|
|
35
30
|
/**
|
|
36
31
|
* @param {string} value - specifies the string value
|
|
37
|
-
* @param {string} enterAction - specifies the enter key action API
|
|
38
32
|
* @returns {void}
|
|
39
33
|
* @hidden
|
|
40
34
|
*/
|
|
41
|
-
export function updateTextNode(value
|
|
42
|
-
var tempNode = document.createElement('div');
|
|
43
|
-
tempNode.innerHTML = value;
|
|
44
|
-
tempNode.setAttribute('class', 'tempDiv');
|
|
35
|
+
export function updateTextNode(value) {
|
|
45
36
|
var resultElm = document.createElement('div');
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (!isPreviousInlineElem) {
|
|
56
|
-
if (enterAction === 'BR') {
|
|
57
|
-
resultElm.appendChild(tempNode.firstChild);
|
|
58
|
-
previousParent = resultElm;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
paraElm = createElement('p');
|
|
62
|
-
resultElm.appendChild(paraElm);
|
|
63
|
-
paraElm.appendChild(tempNode.firstChild);
|
|
64
|
-
previousParent = paraElm;
|
|
65
|
-
isPreviousInlineElem = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
previousParent.appendChild(tempNode.firstChild);
|
|
70
|
-
previousParent = paraElm;
|
|
71
|
-
isPreviousInlineElem = true;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
75
|
-
(tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
|
|
76
|
-
detach(tempNode.firstChild);
|
|
37
|
+
resultElm.innerHTML = value;
|
|
38
|
+
var tableElm = resultElm.querySelectorAll('table');
|
|
39
|
+
for (var i = 0; i < tableElm.length; i++) {
|
|
40
|
+
if (tableElm[i].classList.length > 0 &&
|
|
41
|
+
!tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
42
|
+
tableElm[i].classList.add('e-rte-paste-table');
|
|
43
|
+
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
44
|
+
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
45
|
+
continue; // Skiping the removal of the border if the source is from word.
|
|
77
46
|
}
|
|
78
|
-
else {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
var tableElm = resultElm.querySelectorAll('table');
|
|
84
|
-
for (var i = 0; i < tableElm.length; i++) {
|
|
85
|
-
if (tableElm[i].classList.length > 0 &&
|
|
86
|
-
!tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
|
|
87
|
-
tableElm[i].classList.add('e-rte-paste-table');
|
|
88
|
-
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
89
|
-
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
90
|
-
continue; // Skiping the removal of the border if the source is from word.
|
|
47
|
+
else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
|
|
48
|
+
tableElm[i].classList.remove('e-rte-paste-excel-table');
|
|
49
|
+
if (tableElm[i].getAttribute('border') === '0') {
|
|
50
|
+
tableElm[i].removeAttribute('border');
|
|
91
51
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
52
|
+
var tdElm = tableElm[i].querySelectorAll('td');
|
|
53
|
+
for (var j = 0; j < tdElm.length; j++) {
|
|
54
|
+
if (tdElm[j].style.borderLeft === 'none') {
|
|
55
|
+
tdElm[j].style.removeProperty('border-left');
|
|
96
56
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (tdElm[j].style.borderTop === 'none') {
|
|
109
|
-
tdElm[j].style.removeProperty('border-top');
|
|
110
|
-
}
|
|
111
|
-
if (tdElm[j].style.border === 'none') {
|
|
112
|
-
tdElm[j].style.removeProperty('border');
|
|
113
|
-
}
|
|
57
|
+
if (tdElm[j].style.borderRight === 'none') {
|
|
58
|
+
tdElm[j].style.removeProperty('border-right');
|
|
59
|
+
}
|
|
60
|
+
if (tdElm[j].style.borderBottom === 'none') {
|
|
61
|
+
tdElm[j].style.removeProperty('border-bottom');
|
|
62
|
+
}
|
|
63
|
+
if (tdElm[j].style.borderTop === 'none') {
|
|
64
|
+
tdElm[j].style.removeProperty('border-top');
|
|
65
|
+
}
|
|
66
|
+
if (tdElm[j].style.border === 'none') {
|
|
67
|
+
tdElm[j].style.removeProperty('border');
|
|
114
68
|
}
|
|
115
69
|
}
|
|
116
|
-
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
117
|
-
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
121
|
-
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
var imageElm = resultElm.querySelectorAll('img');
|
|
127
|
-
for (var i = 0; i < imageElm.length; i++) {
|
|
128
|
-
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
129
|
-
continue; // Should not add the class if the image is Broken.
|
|
130
70
|
}
|
|
131
|
-
if (
|
|
132
|
-
|
|
71
|
+
else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
|
|
72
|
+
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
73
|
+
continue;
|
|
133
74
|
}
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
75
|
+
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
76
|
+
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
77
|
+
continue;
|
|
137
78
|
}
|
|
138
79
|
}
|
|
139
80
|
}
|
|
81
|
+
var imageElm = resultElm.querySelectorAll('img');
|
|
82
|
+
for (var i = 0; i < imageElm.length; i++) {
|
|
83
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
84
|
+
continue; // Should not add the class if the image is Broken.
|
|
85
|
+
}
|
|
86
|
+
if (!imageElm[i].classList.contains('e-rte-image')) {
|
|
87
|
+
imageElm[i].classList.add('e-rte-image');
|
|
88
|
+
}
|
|
89
|
+
if (!(imageElm[i].classList.contains('e-imginline') ||
|
|
90
|
+
imageElm[i].classList.contains('e-imgbreak'))) {
|
|
91
|
+
imageElm[i].classList.add('e-imginline');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
140
94
|
return resultElm.innerHTML;
|
|
141
95
|
}
|
|
142
96
|
/**
|
|
@@ -156,6 +156,14 @@ export interface IHtmlKeyboardEvent {
|
|
|
156
156
|
* Specifies the enter key configuration.
|
|
157
157
|
*/
|
|
158
158
|
enterAction?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Defines tag to be used when enter key is pressed.
|
|
161
|
+
*/
|
|
162
|
+
enterKey?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Defines tag to be used when shift enter key is pressed.
|
|
165
|
+
*/
|
|
166
|
+
shiftEnterKey?: string;
|
|
159
167
|
}
|
|
160
168
|
/**
|
|
161
169
|
*
|
|
@@ -397,7 +397,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
397
397
|
nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
|
|
398
398
|
}
|
|
399
399
|
else {
|
|
400
|
-
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode
|
|
400
|
+
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
401
401
|
}
|
|
402
402
|
this.alignCheck(editNode);
|
|
403
403
|
this.listCleanUp(nodeSelection, docElement);
|
|
@@ -661,9 +661,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
};
|
|
664
|
-
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode
|
|
664
|
+
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
665
665
|
lastSelectionNode.classList.add('lastNode');
|
|
666
|
-
editNode.innerHTML = updateTextNode(editNode.innerHTML
|
|
666
|
+
editNode.innerHTML = updateTextNode(editNode.innerHTML);
|
|
667
667
|
lastSelectionNode = editNode.querySelector('.lastNode');
|
|
668
668
|
if (!isNOU(lastSelectionNode)) {
|
|
669
669
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -64,6 +64,17 @@ var Lists = /** @class */ (function () {
|
|
|
64
64
|
}
|
|
65
65
|
return false;
|
|
66
66
|
};
|
|
67
|
+
Lists.prototype.createAutoList = function (enterKey, shiftEnterKey) {
|
|
68
|
+
var autoListRules = {
|
|
69
|
+
BR: { BR: true, P: true, DIV: true },
|
|
70
|
+
P: { BR: false, P: true, DIV: true },
|
|
71
|
+
DIV: { BR: false, P: true, DIV: true }
|
|
72
|
+
};
|
|
73
|
+
if (autoListRules[enterKey] && autoListRules[enterKey][shiftEnterKey] !== undefined) {
|
|
74
|
+
return autoListRules[enterKey][shiftEnterKey];
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
};
|
|
67
78
|
Lists.prototype.spaceList = function (e) {
|
|
68
79
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
69
80
|
this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
@@ -79,7 +90,8 @@ var Lists = /** @class */ (function () {
|
|
|
79
90
|
var startElementOLTest = this.testCurrentList(range);
|
|
80
91
|
var preElementOLTest = this.testList(preElement);
|
|
81
92
|
var nextElementOLTest = this.testList(nextElement);
|
|
82
|
-
|
|
93
|
+
var nextElementBRTest = range.startContainer.previousElementSibling && range.startContainer.previousElementSibling.tagName === 'BR';
|
|
94
|
+
if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*' && (this.createAutoList(e.enterKey, e.shiftEnterKey) || !nextElementBRTest)) {
|
|
83
95
|
var brElement = createElement('br');
|
|
84
96
|
if (startElementOLTest) {
|
|
85
97
|
range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
|
|
@@ -151,7 +151,7 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
151
151
|
if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
|
|
152
152
|
(_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
|
|
153
153
|
(_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
|
|
154
|
-
if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')
|
|
154
|
+
if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
|
|
155
155
|
var newElem = _this.createInsertElement(shiftKey_1);
|
|
156
156
|
newElem.appendChild(_this.parent.createElement('BR'));
|
|
157
157
|
_this.parent.inputElement.appendChild(newElem);
|
|
@@ -210,8 +210,9 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
210
210
|
(_this.range.startContainer.nodeName === '#text' && !isNOU(_this.range.startContainer.textContent[_this.range.startOffset]) &&
|
|
211
211
|
_this.range.startContainer.textContent[_this.range.startOffset].includes('\u200B') && _this.range.startContainer.textContent[_this.range.startOffset] === '\u200B' &&
|
|
212
212
|
_this.parent.inputElement.textContent[0] !== '\u200B'));
|
|
213
|
+
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;
|
|
213
214
|
// eslint-disable-next-line max-len
|
|
214
|
-
if (!preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
215
|
+
if (!preventEnterkeyShiftKey && !preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
215
216
|
!(!isNOU(_this.range.startContainer.previousSibling) &&
|
|
216
217
|
(_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
217
218
|
var isNearBlockLengthZero = void 0;
|
|
@@ -276,7 +277,7 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
276
277
|
}
|
|
277
278
|
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
|
|
278
279
|
}
|
|
279
|
-
else if (nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
280
|
+
else if (nearBlockNode !== _this.parent.inputElement && nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
|
|
280
281
|
(nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
|
|
281
282
|
if (!isNOU(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
|
|
282
283
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
|
|
@@ -332,6 +333,36 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
332
333
|
_this.parent.videoModule.hideVideoQuickToolbar();
|
|
333
334
|
}
|
|
334
335
|
}
|
|
336
|
+
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) {
|
|
337
|
+
var range = _this.range;
|
|
338
|
+
var startContainer = range.startContainer;
|
|
339
|
+
var startOffset = range.startOffset;
|
|
340
|
+
var newElement = _this.parent.createElement(_this.parent.shiftEnterKey);
|
|
341
|
+
if (startContainer.nodeType === Node.TEXT_NODE && range.endOffset !== 0 && range.startOffset !== 0) {
|
|
342
|
+
var textNode = startContainer;
|
|
343
|
+
if (startOffset < textNode.length) {
|
|
344
|
+
var newTextNode = textNode.splitText(startOffset);
|
|
345
|
+
newElement.appendChild(newTextNode);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
newElement.innerHTML = '<br>';
|
|
349
|
+
}
|
|
350
|
+
textNode.parentNode.insertBefore(newElement, textNode.nextSibling);
|
|
351
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
|
|
352
|
+
}
|
|
353
|
+
else if (startOffset === 0 && range.endOffset === 0) {
|
|
354
|
+
newElement.innerHTML = '<br>';
|
|
355
|
+
if (range.endOffset === startContainer.textContent.length) {
|
|
356
|
+
var brElement = _this.parent.createElement('br');
|
|
357
|
+
startContainer.parentNode.insertBefore(brElement, startContainer);
|
|
358
|
+
}
|
|
359
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
360
|
+
var cursorTarget = (range.endOffset === startContainer.textContent.length)
|
|
361
|
+
? newElement : newElement.nextSibling;
|
|
362
|
+
startContainer.parentNode.insertBefore(newElement, startContainer);
|
|
363
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), cursorTarget, 0);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
335
366
|
else {
|
|
336
367
|
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
|
|
337
368
|
if (!isNOU(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
|
|
@@ -431,7 +431,9 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
431
431
|
var eventArgs_1 = {
|
|
432
432
|
callBack: null,
|
|
433
433
|
event: e.args,
|
|
434
|
-
name: 'keydown-handler'
|
|
434
|
+
name: 'keydown-handler',
|
|
435
|
+
enterKey: this.parent.enterKey,
|
|
436
|
+
shiftEnterKey: this.parent.shiftEnterKey
|
|
435
437
|
};
|
|
436
438
|
var actionBeginArgs = {
|
|
437
439
|
cancel: false,
|
|
@@ -1560,7 +1560,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
1560
1560
|
this.placeHolderWrapper.innerHTML = this.placeholder;
|
|
1561
1561
|
if (this.inputElement.textContent.length === 0 && this.inputElement.childNodes.length < 2 && !isNOU(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
|
|
1562
1562
|
((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNOU(this.inputElement.firstChild.firstChild) &&
|
|
1563
|
-
this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
1563
|
+
this.inputElement.firstChild.childNodes.length < 2 && this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
|
|
1564
1564
|
this.placeHolderWrapper.classList.add('enabled');
|
|
1565
1565
|
}
|
|
1566
1566
|
else {
|
|
@@ -2296,7 +2296,6 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
2296
2296
|
var value = this.getUpdatedValue();
|
|
2297
2297
|
this.setProperties({ value: value });
|
|
2298
2298
|
this.valueContainer.value = this.value;
|
|
2299
|
-
this.notify(events.toolbarRefresh, { args: e, documentNode: document });
|
|
2300
2299
|
this.isValueChangeBlurhandler = true;
|
|
2301
2300
|
this.invokeChangeEvent();
|
|
2302
2301
|
this.isFocusOut = true;
|
|
@@ -397,10 +397,10 @@ var Link = /** @class */ (function () {
|
|
|
397
397
|
}
|
|
398
398
|
if (!this.selfLink.isUrl(linkUrl)) {
|
|
399
399
|
if (this.selfLink.parent.editorMode === 'Markdown') {
|
|
400
|
-
linkText = (linkText !== '') ? linkText : '';
|
|
400
|
+
linkText = (linkText.trim() !== '') ? linkText : '';
|
|
401
401
|
}
|
|
402
402
|
else {
|
|
403
|
-
linkText = (linkText === '') ? linkUrl : linkText;
|
|
403
|
+
linkText = (linkText.trim() === '') ? linkUrl : linkText;
|
|
404
404
|
}
|
|
405
405
|
if (!this.selfLink.parent.enableAutoUrl) {
|
|
406
406
|
linkUrl = linkUrl.indexOf('http') > -1 ? linkUrl : 'http://' + linkUrl;
|
|
@@ -40,6 +40,7 @@ export declare class Table {
|
|
|
40
40
|
private resizeIconPositionTime;
|
|
41
41
|
private isResizeBind;
|
|
42
42
|
private isDestroyed;
|
|
43
|
+
private createTablePopupBoundFn;
|
|
43
44
|
private constructor();
|
|
44
45
|
protected addEventListener(): void;
|
|
45
46
|
protected removeEventListener(): void;
|
|
@@ -48,7 +49,6 @@ export declare class Table {
|
|
|
48
49
|
private afterRender;
|
|
49
50
|
private dropdownSelect;
|
|
50
51
|
private UpdateCells;
|
|
51
|
-
private keyUp;
|
|
52
52
|
private keyDown;
|
|
53
53
|
private tableCellsKeyboardSelection;
|
|
54
54
|
private resetTableSelection;
|
|
@@ -150,4 +150,5 @@ export declare class Table {
|
|
|
150
150
|
private getModuleName;
|
|
151
151
|
private afterKeyDown;
|
|
152
152
|
private updateResizeIconPosition;
|
|
153
|
+
private createTablePopupKeyDown;
|
|
153
154
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement, detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
|
|
1
|
+
import { createElement, detach, closest, Browser, isNullOrUndefined as isNOU, getComponent } from '@syncfusion/ej2-base';
|
|
2
2
|
import { isNullOrUndefined, EventHandler, addClass } from '@syncfusion/ej2-base';
|
|
3
3
|
import { Popup } from '@syncfusion/ej2-popups';
|
|
4
4
|
import { Button } from '@syncfusion/ej2-buttons';
|
|
@@ -45,7 +45,6 @@ var Table = /** @class */ (function () {
|
|
|
45
45
|
this.parent.on(events.tableToolbarAction, this.onToolbarAction, this);
|
|
46
46
|
this.parent.on(events.dropDownSelect, this.dropdownSelect, this);
|
|
47
47
|
this.parent.on(events.keyDown, this.keyDown, this);
|
|
48
|
-
this.parent.on(events.keyUp, this.keyUp, this);
|
|
49
48
|
this.parent.on(events.tableModulekeyUp, this.tableModulekeyUp, this);
|
|
50
49
|
this.parent.on(events.bindCssClass, this.setCssClass, this);
|
|
51
50
|
this.parent.on(events.destroy, this.destroy, this);
|
|
@@ -66,7 +65,6 @@ var Table = /** @class */ (function () {
|
|
|
66
65
|
this.parent.off(events.mouseDown, this.cellSelect);
|
|
67
66
|
this.parent.off(events.tableColorPickerChanged, this.setBGColor);
|
|
68
67
|
this.parent.off(events.keyDown, this.keyDown);
|
|
69
|
-
this.parent.off(events.keyUp, this.keyUp);
|
|
70
68
|
this.parent.off(events.tableModulekeyUp, this.tableModulekeyUp);
|
|
71
69
|
this.parent.off(events.bindCssClass, this.setCssClass);
|
|
72
70
|
this.parent.off(events.destroy, this.destroy);
|
|
@@ -163,20 +161,6 @@ var Table = /** @class */ (function () {
|
|
|
163
161
|
this.parent.formatter.process(this.parent, e, e, { selection: selectCell, subCommand: e.item.subCommand });
|
|
164
162
|
this.hideTableQuickToolbar();
|
|
165
163
|
};
|
|
166
|
-
Table.prototype.keyUp = function (e) {
|
|
167
|
-
var target = e.args.target;
|
|
168
|
-
if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + '\'' + this.popupObj.element.id + '\'' + ']')) && this.popupObj) {
|
|
169
|
-
var createTableToolbarBtn = this.popupObj.relateTo;
|
|
170
|
-
if (createTableToolbarBtn.nodeName !== 'BUTTON') {
|
|
171
|
-
createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
|
|
172
|
-
createTableToolbarBtn = createTableToolbarBtn.parentElement;
|
|
173
|
-
}
|
|
174
|
-
this.popupObj.hide();
|
|
175
|
-
if (createTableToolbarBtn) {
|
|
176
|
-
createTableToolbarBtn.focus();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
164
|
Table.prototype.keyDown = function (e) {
|
|
181
165
|
var event = e.args;
|
|
182
166
|
// eslint-disable-next-line
|
|
@@ -1755,6 +1739,8 @@ var Table = /** @class */ (function () {
|
|
|
1755
1739
|
var header = '1X1';
|
|
1756
1740
|
var insertbtn = this.l10n.getConstant('inserttablebtn');
|
|
1757
1741
|
this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
|
|
1742
|
+
this.createTablePopupBoundFn = this.createTablePopupKeyDown.bind(this);
|
|
1743
|
+
this.dlgDiv.addEventListener('keydown', this.createTablePopupBoundFn);
|
|
1758
1744
|
this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
|
|
1759
1745
|
this.tblHeader.innerHTML = header;
|
|
1760
1746
|
this.dlgDiv.appendChild(this.tblHeader);
|
|
@@ -1792,6 +1778,7 @@ var Table = /** @class */ (function () {
|
|
|
1792
1778
|
// eslint-disable-next-line
|
|
1793
1779
|
close: function (event) {
|
|
1794
1780
|
EventHandler.remove(btnEle, 'click', _this.insertTableDialog);
|
|
1781
|
+
_this.dlgDiv.removeEventListener('keydown', _this.createTablePopupBoundFn);
|
|
1795
1782
|
detach(btnEle);
|
|
1796
1783
|
if (_this.createTableButton && !_this.createTableButton.isDestroyed) {
|
|
1797
1784
|
_this.createTableButton.destroy();
|
|
@@ -2175,6 +2162,7 @@ var Table = /** @class */ (function () {
|
|
|
2175
2162
|
this.createTableButton.destroy();
|
|
2176
2163
|
this.createTableButton = null;
|
|
2177
2164
|
}
|
|
2165
|
+
this.createTablePopupBoundFn = null;
|
|
2178
2166
|
this.isDestroyed = true;
|
|
2179
2167
|
};
|
|
2180
2168
|
/**
|
|
@@ -2201,6 +2189,15 @@ var Table = /** @class */ (function () {
|
|
|
2201
2189
|
'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
|
|
2202
2190
|
}
|
|
2203
2191
|
};
|
|
2192
|
+
Table.prototype.createTablePopupKeyDown = function (e) {
|
|
2193
|
+
if (e.key === 'Escape') {
|
|
2194
|
+
var popupRootElem = e.target.closest('.e-rte-table-popup');
|
|
2195
|
+
var popup = getComponent(popupRootElem, 'popup');
|
|
2196
|
+
var tableToolbarButton = popup.relateTo;
|
|
2197
|
+
popup.hide();
|
|
2198
|
+
tableToolbarButton.focus({ preventScroll: true });
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2204
2201
|
return Table;
|
|
2205
2202
|
}());
|
|
2206
2203
|
export { Table };
|
|
@@ -645,7 +645,6 @@ var ToolbarRenderer = /** @class */ (function () {
|
|
|
645
645
|
var proxy = this;
|
|
646
646
|
var value;
|
|
647
647
|
var colorPicker = new ColorPicker({
|
|
648
|
-
enablePersistence: this.parent.enablePersistence,
|
|
649
648
|
enableRtl: this.parent.enableRtl,
|
|
650
649
|
inline: true,
|
|
651
650
|
value: null,
|