@syncfusion/ej2-richtexteditor 27.2.3 → 27.2.5
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 +226 -47
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +227 -46
- 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 -11
- package/src/editor-manager/plugin/indents.js +1 -1
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +42 -13
- package/src/editor-manager/plugin/ms-word-clean-up.js +19 -2
- package/src/editor-manager/plugin/nodecutter.js +5 -0
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +33 -16
- package/src/rich-text-editor/actions/dropdown-buttons.js +4 -4
- package/src/rich-text-editor/actions/html-editor.js +14 -3
- package/src/rich-text-editor/actions/paste-clean-up.js +31 -0
- package/src/rich-text-editor/actions/resize.d.ts +1 -0
- package/src/rich-text-editor/actions/resize.js +16 -0
- package/src/rich-text-editor/base/util.d.ts +6 -0
- package/src/rich-text-editor/base/util.js +55 -3
- package/src/rich-text-editor/renderer/image-module.js +3 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -3
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 27.2.
|
|
3
|
+
* version : 27.2.5
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. 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@27.2.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@27.2.4",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-1De20+Us2+PA3L4shDlbnUqadpJYfdbvv5DWyflNR5/axtshaR3WcqqfUCpCPxexCl3jVgznaEhnKv85YWf/zw==",
|
|
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-27.2.
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-27.2.4.tgz",
|
|
29
|
+
"_shasum": "5360188d231a7d646f0647d8de7e2745384588f6",
|
|
30
30
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
31
31
|
"_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
|
|
32
32
|
"author": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
},
|
|
38
38
|
"bundleDependencies": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@syncfusion/ej2-base": "~27.2.
|
|
41
|
-
"@syncfusion/ej2-buttons": "~27.2.
|
|
42
|
-
"@syncfusion/ej2-dropdowns": "~27.2.
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~27.2.
|
|
44
|
-
"@syncfusion/ej2-inputs": "~27.2.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~27.2.
|
|
40
|
+
"@syncfusion/ej2-base": "~27.2.5",
|
|
41
|
+
"@syncfusion/ej2-buttons": "~27.2.4",
|
|
42
|
+
"@syncfusion/ej2-dropdowns": "~27.2.5",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~27.2.5",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~27.2.4",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~27.2.5",
|
|
46
46
|
"@syncfusion/ej2-popups": "~27.2.2",
|
|
47
47
|
"@syncfusion/ej2-splitbuttons": "~27.2.2"
|
|
48
48
|
},
|
|
@@ -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": "27.2.
|
|
83
|
+
"version": "27.2.5",
|
|
84
84
|
"sideEffects": false
|
|
85
85
|
}
|
|
@@ -89,7 +89,7 @@ var Indents = /** @class */ (function () {
|
|
|
89
89
|
isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px' || marginLeftOrRight === '0in') ? '' : parseInt(marginLeftOrRight, null) - this.indentValue + 'px';
|
|
92
|
+
indentsValue = (marginLeftOrRight === '' || marginLeftOrRight === '0px' || marginLeftOrRight === '0in') ? '' : (parseInt(marginLeftOrRight, null) - this.indentValue < 0) ? '0px' : (parseInt(marginLeftOrRight, null) - this.indentValue) + 'px';
|
|
93
93
|
isRtl ? (parentNode.style.marginRight = indentsValue) : (parentNode.style.marginLeft = indentsValue);
|
|
94
94
|
/* eslint-enable */
|
|
95
95
|
}
|
|
@@ -18,6 +18,7 @@ export declare class InsertHtml {
|
|
|
18
18
|
private static pasteInsertHTML;
|
|
19
19
|
private static listCleanUp;
|
|
20
20
|
private static cleanUpListItems;
|
|
21
|
+
private static cleanUpFlattenListContainer;
|
|
21
22
|
private static cleanUpListContainer;
|
|
22
23
|
private static placeCursorEnd;
|
|
23
24
|
private static getNodeCollection;
|
|
@@ -406,27 +406,33 @@ var InsertHtml = /** @class */ (function () {
|
|
|
406
406
|
var range = nodeSelection.getRange(docElement);
|
|
407
407
|
var startContainer = range.startContainer;
|
|
408
408
|
var startOffset = range.startOffset;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
409
|
+
var startParentElement = range.startContainer.parentElement;
|
|
410
|
+
var endParentElement = range.endContainer.parentElement;
|
|
411
|
+
if (!isNOU(startParentElement) && !isNOU(endParentElement)) {
|
|
412
|
+
var startClosestList = startParentElement.closest('ol, ul');
|
|
413
|
+
var endClosestList = endParentElement.closest('ol, ul');
|
|
414
|
+
if (!isNOU(startClosestList) && !isNOU(endClosestList)) {
|
|
415
|
+
var hasListCleanUp = this.cleanUpListItems(startClosestList);
|
|
416
|
+
var hasListContainerCleanUp = this.cleanUpListContainer(startClosestList);
|
|
417
|
+
if (hasListCleanUp || hasListContainerCleanUp) {
|
|
418
|
+
range.setStart(startContainer, startOffset);
|
|
419
|
+
range.setEnd(startContainer, startOffset);
|
|
420
|
+
}
|
|
415
421
|
}
|
|
416
422
|
}
|
|
417
423
|
};
|
|
418
424
|
InsertHtml.cleanUpListItems = function (parentContainer) {
|
|
419
425
|
var _this = this;
|
|
420
426
|
var hasListCleanUp = false;
|
|
421
|
-
var listItems
|
|
422
|
-
if (
|
|
427
|
+
var listItems;
|
|
428
|
+
if (!isNOU(parentContainer.closest('ol, ul'))) {
|
|
429
|
+
listItems = parentContainer.closest('ol, ul').querySelectorAll('li');
|
|
430
|
+
}
|
|
431
|
+
if (isNOU(listItems) || listItems.length === 0) {
|
|
423
432
|
return false;
|
|
424
433
|
}
|
|
425
434
|
var nearestListItem = null;
|
|
426
435
|
listItems.forEach(function (listItem) {
|
|
427
|
-
if (!isNOU(listItem.firstChild) && (listItem.firstChild.nodeName === 'OL' || listItem.firstChild.nodeName === 'UL')) {
|
|
428
|
-
listItem.style.listStyleType = 'none';
|
|
429
|
-
}
|
|
430
436
|
var parentElement = listItem.parentElement;
|
|
431
437
|
if (!isNOU(parentElement) && parentElement.nodeName !== 'OL' && parentElement.nodeName !== 'UL') {
|
|
432
438
|
if (isNOU(nearestListItem)) {
|
|
@@ -453,15 +459,38 @@ var InsertHtml = /** @class */ (function () {
|
|
|
453
459
|
var closestList = parentElement.closest('ol, ul');
|
|
454
460
|
nearestListItem.insertAdjacentElement('afterend', listItem);
|
|
455
461
|
nearestListItem = nearestListItem.nextSibling;
|
|
456
|
-
|
|
462
|
+
if (!isNOU(closestList)) {
|
|
463
|
+
_this.removeEmptyElements(closestList);
|
|
464
|
+
}
|
|
457
465
|
hasListCleanUp = true;
|
|
458
466
|
}
|
|
459
467
|
}
|
|
468
|
+
});
|
|
469
|
+
var cleanUpFlattenListContainer = this.cleanUpFlattenListContainer(parentContainer);
|
|
470
|
+
hasListCleanUp = cleanUpFlattenListContainer ? cleanUpFlattenListContainer : hasListCleanUp;
|
|
471
|
+
return hasListCleanUp;
|
|
472
|
+
};
|
|
473
|
+
InsertHtml.cleanUpFlattenListContainer = function (parentContainer) {
|
|
474
|
+
var hasListCleanUp = false;
|
|
475
|
+
var listItems;
|
|
476
|
+
if (!isNOU(parentContainer.closest('ol, ul'))) {
|
|
477
|
+
listItems = parentContainer.closest('ol, ul').querySelectorAll('li');
|
|
478
|
+
}
|
|
479
|
+
if (isNOU(listItems) || listItems.length === 0) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
listItems.forEach(function (listItem) {
|
|
483
|
+
if (!isNOU(listItem.firstChild) && (listItem.firstChild.nodeName === 'OL' || listItem.firstChild.nodeName === 'UL')) {
|
|
484
|
+
listItem.style.listStyleType = 'none';
|
|
485
|
+
}
|
|
460
486
|
var nestedLi = Array.from(listItem.children).find(function (child) {
|
|
461
487
|
return child.tagName === 'LI' && (child.parentElement && child.parentElement.tagName !== 'OL' && child.parentElement.tagName !== 'UL');
|
|
462
488
|
});
|
|
463
|
-
if (nestedLi && listItem.parentNode) {
|
|
489
|
+
if (!isNOU(nestedLi) && !isNOU(listItem.parentNode)) {
|
|
464
490
|
listItem.parentNode.replaceChild(nestedLi, listItem);
|
|
491
|
+
if (isNOU(nestedLi.textContent) || nestedLi.textContent.trim() === '') {
|
|
492
|
+
nestedLi.remove();
|
|
493
|
+
}
|
|
465
494
|
hasListCleanUp = true;
|
|
466
495
|
}
|
|
467
496
|
});
|
|
@@ -204,6 +204,10 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
204
204
|
for (var i = 0; i < imgElem.length; i++) {
|
|
205
205
|
imgSrc.push(imgElem[i].getAttribute('src'));
|
|
206
206
|
imgName.push(imgElem[i].getAttribute('src').split('/')[imgElem[i].getAttribute('src').split('/').length - 1].split('.')[0]);
|
|
207
|
+
if (!isNOU(imgSrc) && imgSrc[i] !== '') {
|
|
208
|
+
var imgType = imgSrc[i].split('.').pop().toLowerCase();
|
|
209
|
+
imgElem[i].setAttribute('data-image-type', imgType);
|
|
210
|
+
}
|
|
207
211
|
}
|
|
208
212
|
var hexValue = this.hexConversion(rtfData);
|
|
209
213
|
for (var i = 0; i < hexValue.length; i++) {
|
|
@@ -1031,9 +1035,22 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
1031
1035
|
}
|
|
1032
1036
|
}
|
|
1033
1037
|
var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
|
|
1038
|
+
var isEmptyMarkerSpan = isNOU(listOrder);
|
|
1039
|
+
listOrder = isEmptyMarkerSpan ? firstChild : listOrder;
|
|
1034
1040
|
if (!isNOU(listOrder)) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1041
|
+
var textContent = listOrder.textContent.trim();
|
|
1042
|
+
if (isEmptyMarkerSpan) {
|
|
1043
|
+
var bulletPattern = /^(\d{1,2}|[a-zA-Z]|[*#~•○■])(\.|\)|-)\s*/;
|
|
1044
|
+
var textContentMatch = textContent.match(bulletPattern);
|
|
1045
|
+
if (!isNOU(textContentMatch)) {
|
|
1046
|
+
textContent = textContentMatch[0].trim();
|
|
1047
|
+
listOrder.textContent = listOrder.textContent.trim().substring(textContent.length).trim();
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
this.listContents.push(textContent);
|
|
1051
|
+
if (!isEmptyMarkerSpan) {
|
|
1052
|
+
detach(listOrder);
|
|
1053
|
+
}
|
|
1037
1054
|
this.removingComments(elem);
|
|
1038
1055
|
this.removeUnwantedElements(elem);
|
|
1039
1056
|
}
|
|
@@ -76,6 +76,11 @@ var NodeCutter = /** @class */ (function () {
|
|
|
76
76
|
if (node) {
|
|
77
77
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
78
78
|
}
|
|
79
|
+
else if (parent_1.childNodes.length > 1 && parent_1.childNodes.length !== index) {
|
|
80
|
+
node = parent_1.childNodes[parent_1.childNodes.length - 1];
|
|
81
|
+
InsertMethods.AppendBefore(fragment, node, true);
|
|
82
|
+
node = node.nextSibling;
|
|
83
|
+
}
|
|
79
84
|
else {
|
|
80
85
|
parent_1.appendChild(fragment);
|
|
81
86
|
var divNode = document.createElement('div');
|
|
@@ -284,8 +284,10 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
284
284
|
range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
|
|
285
285
|
range.startContainer.textContent;
|
|
286
286
|
var nodeText = nodes[index].textContent;
|
|
287
|
+
var isParentNodeSameAsParentElement = nodes[0].parentElement.nodeName === nodes[0].parentElement.parentElement.nodeName;
|
|
287
288
|
if (!(range.startContainer === range.endContainer && range.startOffset === 0
|
|
288
|
-
&& range.endOffset === range.startContainer.length
|
|
289
|
+
&& range.endOffset === range.startContainer.length
|
|
290
|
+
&& (range.startContainer.textContent === formatNode.textContent || isParentNodeSameAsParentElement))) {
|
|
289
291
|
var nodeIndex = [];
|
|
290
292
|
var cloneNode = nodes[index];
|
|
291
293
|
var clonedElement = cloneNode;
|
|
@@ -306,10 +308,19 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
306
308
|
if (!isCursor) {
|
|
307
309
|
while (cloneNode && cloneNode.childNodes.length > 0 && ((nodeIndex.length - 1) >= 0)
|
|
308
310
|
&& (cloneNode.childNodes.length > nodeIndex[nodeIndex.length - 1])) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
+
if (cloneNode.childNodes.length > 1 && nodeIndex.length > 1) {
|
|
312
|
+
cloneNode = cloneNode.childNodes[nodeIndex[nodeIndex.length - 2]];
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
cloneNode = cloneNode.childNodes[nodeIndex[nodeIndex.length - 1]];
|
|
317
|
+
nodeIndex.pop();
|
|
318
|
+
}
|
|
311
319
|
}
|
|
312
320
|
if (nodes[index].nodeName !== 'BR') {
|
|
321
|
+
while (cloneNode.nodeType === 1 && cloneNode.childNodes.length > 0) {
|
|
322
|
+
cloneNode = cloneNode.childNodes[0];
|
|
323
|
+
}
|
|
313
324
|
if (cloneNode.nodeType === 3 && !(isCursor && cloneNode.nodeValue === '')) {
|
|
314
325
|
nodes[index] = cloneNode;
|
|
315
326
|
}
|
|
@@ -498,12 +509,6 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
498
509
|
if (!isNOU(bgStyle) && bgStyle !== '') {
|
|
499
510
|
currentNodeElem.style.backgroundColor = bgStyle;
|
|
500
511
|
}
|
|
501
|
-
if ((format === 'backgroundcolor' && !isNOU(fontStyle) && fontStyle !== '') &&
|
|
502
|
-
currentNodeElem.parentElement.innerHTML === currentNodeElem.outerHTML) {
|
|
503
|
-
var curParentElem = currentNodeElem.parentElement;
|
|
504
|
-
curParentElem.parentElement.insertBefore(currentNodeElem, curParentElem);
|
|
505
|
-
detach(curParentElem);
|
|
506
|
-
}
|
|
507
512
|
if (format === 'fontsize' || format === 'fontcolor') {
|
|
508
513
|
var liElement = nodes[index].parentElement;
|
|
509
514
|
var parentElement = nodes[index].parentElement;
|
|
@@ -985,12 +990,12 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
985
990
|
case 'fontcolor':
|
|
986
991
|
liElement.querySelectorAll('span').forEach(function (span) {
|
|
987
992
|
colorStyle = span.style.color;
|
|
988
|
-
if (colorStyle
|
|
993
|
+
if (SelectionCommands.hasColorsEqual(colorStyle, constVal)) {
|
|
989
994
|
result = result + span.textContent;
|
|
990
995
|
}
|
|
991
996
|
});
|
|
992
|
-
if (result === value) {
|
|
993
|
-
liElement.style.color =
|
|
997
|
+
if (!isNOU(result) && !isNOU(value) && result !== '' && value !== '' && result.replace(/\s+/g, '') === value.replace(/\s+/g, '')) {
|
|
998
|
+
liElement.style.color = constVal;
|
|
994
999
|
liElement.style.textDecoration = 'inherit';
|
|
995
1000
|
}
|
|
996
1001
|
break;
|
|
@@ -1001,8 +1006,8 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
1001
1006
|
result = result + span.textContent;
|
|
1002
1007
|
}
|
|
1003
1008
|
});
|
|
1004
|
-
if (result === value) {
|
|
1005
|
-
liElement.style.fontSize =
|
|
1009
|
+
if (!isNOU(result) && !isNOU(value) && result !== '' && value !== '' && result.replace(/\s+/g, '') === value.replace(/\s+/g, '')) {
|
|
1010
|
+
liElement.style.fontSize = constVal;
|
|
1006
1011
|
}
|
|
1007
1012
|
break;
|
|
1008
1013
|
case 'fontname':
|
|
@@ -1013,12 +1018,24 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
1013
1018
|
result = result + span.textContent;
|
|
1014
1019
|
}
|
|
1015
1020
|
});
|
|
1016
|
-
if (result === value) {
|
|
1017
|
-
liElement.style.fontFamily =
|
|
1021
|
+
if (!isNOU(result) && !isNOU(value) && result !== '' && value !== '' && result.replace(/\s+/g, '') === value.replace(/\s+/g, '')) {
|
|
1022
|
+
liElement.style.fontFamily = constVal;
|
|
1018
1023
|
}
|
|
1019
1024
|
break;
|
|
1020
1025
|
}
|
|
1021
1026
|
};
|
|
1027
|
+
SelectionCommands.hasColorsEqual = function (color1, color2) {
|
|
1028
|
+
if (isNOU(color1) || isNOU(color2) || color1.trim() === '' || color2.trim() === '') {
|
|
1029
|
+
return color1 === color2;
|
|
1030
|
+
}
|
|
1031
|
+
if (color1.startsWith('rgb(')) {
|
|
1032
|
+
color1 = color1.replace('rgb(', 'rgba(').slice(0, -1) + ',1)';
|
|
1033
|
+
}
|
|
1034
|
+
if (color2.startsWith('rgb(')) {
|
|
1035
|
+
color2 = color2.replace('rgb(', 'rgba(').slice(0, -1) + ',1)';
|
|
1036
|
+
}
|
|
1037
|
+
return color1.replace(/\s+/g, '') === color2.replace(/\s+/g, '');
|
|
1038
|
+
};
|
|
1022
1039
|
SelectionCommands.enterAction = 'P';
|
|
1023
1040
|
return SelectionCommands;
|
|
1024
1041
|
}());
|
|
@@ -113,11 +113,11 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
113
113
|
command: { value: 'Font', enumerable: true }, subCommand: { value: 'FontName', enumerable: true }
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
var fontNameContent = isNullOrUndefined(_this.parent.fontFamily.default) ? fontItem[0].text :
|
|
116
|
+
var fontNameContent = isNullOrUndefined(_this.parent.fontFamily.default) ? fontItem.length === 0 ? '' : fontItem[0].text :
|
|
117
117
|
_this.parent.fontFamily.default;
|
|
118
118
|
_this.fontNameDropDown = _this.toolbarRenderer.renderDropDownButton({
|
|
119
119
|
iconCss: ((type === 'quick') ? 'e-font-name e-icons' : ''),
|
|
120
|
-
content: _this.dropdownContent(_this.parent.fontFamily.width, type, ((type === 'quick') ? '' : (getDropDownValue(fontItem, fontNameContent, 'text', 'text') === 'Default' ? _this.i10n.getConstant('fontName') : getDropDownValue(fontItem, fontNameContent, 'text', 'text')))),
|
|
120
|
+
content: _this.dropdownContent(_this.parent.fontFamily.width, type, ((fontItem.length === 0) ? _this.i10n.getConstant('fontName') : (type === 'quick') ? '' : (getDropDownValue(fontItem, fontNameContent, 'text', 'text') === 'Default' ? _this.i10n.getConstant('fontName') : getDropDownValue(fontItem, fontNameContent, 'text', 'text')))),
|
|
121
121
|
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_FONT_NAME_TB_BTN,
|
|
122
122
|
itemName: 'FontName', items: fontItem, element: targetElement
|
|
123
123
|
});
|
|
@@ -136,11 +136,11 @@ var DropDownButtons = /** @class */ (function () {
|
|
|
136
136
|
command: { value: 'Font', enumerable: true }, subCommand: { value: 'FontSize', enumerable: true }
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
|
-
var fontSizeContent = isNullOrUndefined(_this.parent.fontSize.default) ? fontsize[0].text :
|
|
139
|
+
var fontSizeContent = isNullOrUndefined(_this.parent.fontSize.default) ? fontsize.length === 0 ? '' : fontsize[0].text :
|
|
140
140
|
_this.parent.fontSize.default;
|
|
141
141
|
var fontSizeDropDownContent = ((fontSizeContent === 'Default') ? getDropDownValue(fontsize, fontSizeContent.replace(/\s/g, ''), 'text', 'text') : getDropDownValue(fontsize, fontSizeContent.replace(/\s/g, ''), 'value', 'text'));
|
|
142
142
|
_this.fontSizeDropDown = _this.toolbarRenderer.renderDropDownButton({
|
|
143
|
-
content: _this.dropdownContent(_this.parent.fontSize.width, type, getFormattedFontSize((fontSizeDropDownContent === 'Default') ? _this.i10n.getConstant('fontSize') : fontSizeDropDownContent)),
|
|
143
|
+
content: _this.dropdownContent(_this.parent.fontSize.width, type, fontsize.length === 0 ? _this.i10n.getConstant('fontSize') : (getFormattedFontSize((fontSizeDropDownContent === 'Default') ? _this.i10n.getConstant('fontSize') : fontSizeDropDownContent))),
|
|
144
144
|
cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_FONT_SIZE_TB_BTN,
|
|
145
145
|
itemName: 'FontSize', items: fontsize, element: targetElement
|
|
146
146
|
});
|
|
@@ -584,10 +584,21 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
584
584
|
// eslint-disable-next-line
|
|
585
585
|
lastNode, lastNode.textContent.length);
|
|
586
586
|
}
|
|
587
|
-
|
|
588
|
-
|
|
587
|
+
var checkParent = false;
|
|
588
|
+
if (this.oldRangeElement && this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
589
|
+
var brElement = this.oldRangeElement.querySelector('BR');
|
|
590
|
+
if (brElement) {
|
|
591
|
+
var brParentElement = brElement.parentNode;
|
|
592
|
+
var currentState = this.oldRangeElement.innerHTML;
|
|
593
|
+
this.parent.formatter.saveData(currentState);
|
|
594
|
+
detach(brElement);
|
|
595
|
+
if (brParentElement && brParentElement.childNodes.length === 0) {
|
|
596
|
+
detach(brParentElement);
|
|
597
|
+
checkParent = true;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
589
600
|
}
|
|
590
|
-
if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
|
|
601
|
+
if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement && !checkParent) {
|
|
591
602
|
while (this.rangeElement.firstChild) {
|
|
592
603
|
if (this.oldRangeElement.nodeName === '#text') {
|
|
593
604
|
this.oldRangeElement.parentElement.appendChild(this.rangeElement.childNodes[0]);
|
|
@@ -112,6 +112,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
112
112
|
var value = null;
|
|
113
113
|
var isClipboardHTMLDataNull = false;
|
|
114
114
|
var imageproperties;
|
|
115
|
+
var allowedTypes = this.parent.insertImageSettings.allowedTypes;
|
|
115
116
|
if (e.args && !isNOU(e.args.clipboardData)) {
|
|
116
117
|
value = e.args.clipboardData.getData('text/html');
|
|
117
118
|
}
|
|
@@ -131,6 +132,14 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
131
132
|
(!isNOU(e.args.clipboardData.items[1]) ?
|
|
132
133
|
e.args.clipboardData.items[1].getAsFile() : null) :
|
|
133
134
|
e.args.clipboardData.items[0].getAsFile()) : null;
|
|
135
|
+
if (file) {
|
|
136
|
+
var fileNameParts = file.name;
|
|
137
|
+
var imgType_1 = fileNameParts.substring(fileNameParts.lastIndexOf('.'));
|
|
138
|
+
if (allowedTypes.every(function (type) { return type.toLowerCase() !== imgType_1; })) {
|
|
139
|
+
e.args.preventDefault();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
134
143
|
this.parent.notify(events.paste, {
|
|
135
144
|
file: file,
|
|
136
145
|
args: e.args,
|
|
@@ -179,6 +188,28 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
179
188
|
value = tempDivElem.innerHTML;
|
|
180
189
|
var isValueNotEmpty = tempDivElem.textContent !== '' || !isNOU(tempDivElem.querySelector('img')) ||
|
|
181
190
|
!isNOU(tempDivElem.querySelector('table'));
|
|
191
|
+
var imgElements = tempDivElem.querySelectorAll('img');
|
|
192
|
+
imgElements.forEach(function (imgElement) {
|
|
193
|
+
var imageFileFormat;
|
|
194
|
+
var imgElementSrc = imgElement.getAttribute('src');
|
|
195
|
+
if (!isNullOrUndefined(imgElementSrc) && imgElementSrc !== '') {
|
|
196
|
+
if (!isNullOrUndefined(imgElement.getAttribute('data-image-type'))) {
|
|
197
|
+
imageFileFormat = imgElement.getAttribute('data-image-type');
|
|
198
|
+
}
|
|
199
|
+
else if (imgElementSrc.indexOf('base64') > -1 && imgElementSrc.indexOf('data:') > -1) {
|
|
200
|
+
imageFileFormat = imgElementSrc.split(';')[0].split('/')[1];
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
imageFileFormat = imgElementSrc.split('.').pop().toLowerCase();
|
|
204
|
+
}
|
|
205
|
+
if (!isNullOrUndefined(imageFileFormat) &&
|
|
206
|
+
allowedTypes.every(function (type) { return imageFileFormat !== type.substring(1).toLowerCase(); }) &&
|
|
207
|
+
imgElementSrc.indexOf('blob') === -1) {
|
|
208
|
+
detach(imgElement);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
value = tempDivElem.innerHTML;
|
|
182
213
|
this.parent.notify(events.cleanupResizeElements, {
|
|
183
214
|
value: value,
|
|
184
215
|
callBack: function (currentValue) {
|
|
@@ -20,6 +20,7 @@ var Resize = /** @class */ (function () {
|
|
|
20
20
|
this.parent.on(events.destroy, this.destroy, this);
|
|
21
21
|
};
|
|
22
22
|
Resize.prototype.renderResizable = function () {
|
|
23
|
+
var _this = this;
|
|
23
24
|
var enableRtlClass = (this.parent.enableRtl) ? classes.CLS_RTE_RES_WEST : classes.CLS_RTE_RES_EAST;
|
|
24
25
|
this.resizer = this.parent.createElement('div', {
|
|
25
26
|
id: this.parent.getID() + '-resizable', className: 'e-icons'
|
|
@@ -32,6 +33,12 @@ var Resize = /** @class */ (function () {
|
|
|
32
33
|
this.parent.inputElement.classList.add('e-resize-enabled');
|
|
33
34
|
this.parent.contentModule.getDocument().addEventListener('mouseup', this.iframeMouseUpBoundFn);
|
|
34
35
|
}
|
|
36
|
+
this.iframeElement = this.parent.contentModule.getDocument().querySelectorAll('iframe');
|
|
37
|
+
if (!isNullOrUndefined(this.iframeElement)) {
|
|
38
|
+
this.iframeElement.forEach(function (iframe) {
|
|
39
|
+
EventHandler.add(iframe.contentDocument, 'mouseup', _this.stopResize, _this);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
35
42
|
this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
|
|
36
43
|
EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
|
|
37
44
|
EventHandler.add(this.resizer, this.touchStartEvent, this.resizeStart, this);
|
|
@@ -130,6 +137,7 @@ var Resize = /** @class */ (function () {
|
|
|
130
137
|
this.isDestroyed = true;
|
|
131
138
|
};
|
|
132
139
|
Resize.prototype.removeEventListener = function () {
|
|
140
|
+
var _this = this;
|
|
133
141
|
this.parent.off(events.initialEnd, this.renderResizable);
|
|
134
142
|
this.parent.element.classList.remove(classes.CLS_RTE_RES_CNT);
|
|
135
143
|
if (this.parent && this.parent.rootContainer && this.parent.rootContainer.classList.contains('e-resize-enabled')) {
|
|
@@ -139,6 +147,11 @@ var Resize = /** @class */ (function () {
|
|
|
139
147
|
this.parent.inputElement.classList.remove('e-resize-enabled');
|
|
140
148
|
this.parent.contentModule.getDocument().removeEventListener('mouseup', this.iframeMouseUpBoundFn);
|
|
141
149
|
}
|
|
150
|
+
if (!isNullOrUndefined(this.iframeElement)) {
|
|
151
|
+
this.iframeElement.forEach(function (iframe) {
|
|
152
|
+
EventHandler.remove(iframe.contentDocument, 'mouseup', _this.stopResize);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
142
155
|
if (this.resizer) {
|
|
143
156
|
EventHandler.remove(this.resizer, 'mousedown', this.resizeStart);
|
|
144
157
|
EventHandler.remove(this.resizer, this.touchStartEvent, this.resizeStart);
|
|
@@ -151,6 +164,9 @@ var Resize = /** @class */ (function () {
|
|
|
151
164
|
if (this.isResizing) {
|
|
152
165
|
this.stopResize(e);
|
|
153
166
|
}
|
|
167
|
+
else {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
154
170
|
};
|
|
155
171
|
/**
|
|
156
172
|
* For internal use only - Get the module name.
|
|
@@ -155,6 +155,12 @@ export declare function decode(value: string): string;
|
|
|
155
155
|
* @hidden
|
|
156
156
|
*/
|
|
157
157
|
export declare function sanitizeHelper(value: string, parent: IRichTextEditor): string;
|
|
158
|
+
/**
|
|
159
|
+
* @param {string} value - specifies the string value
|
|
160
|
+
* @returns {string} - returns the string value
|
|
161
|
+
* @hidden
|
|
162
|
+
*/
|
|
163
|
+
export declare function parseHelper(value: string): string;
|
|
158
164
|
/**
|
|
159
165
|
* @param {string} dataUrl - specifies the string value
|
|
160
166
|
* @returns {BaseToolbar} - returns the value
|
|
@@ -54,6 +54,9 @@ export function hasClass(element, className) {
|
|
|
54
54
|
export function getDropDownValue(items, value, type, returnType) {
|
|
55
55
|
var data;
|
|
56
56
|
var result;
|
|
57
|
+
if (items.length === 0 && value === 'FontSize') {
|
|
58
|
+
return 'Font Size';
|
|
59
|
+
}
|
|
57
60
|
for (var k = 0; k < items.length; k++) {
|
|
58
61
|
if (type === 'value' && items[k].value.toLocaleLowerCase() === value.toLocaleLowerCase()) {
|
|
59
62
|
data = items[k];
|
|
@@ -202,7 +205,7 @@ export function setToolbarStatus(e, isPopToolbar, self) {
|
|
|
202
205
|
}
|
|
203
206
|
var fontNameItems = e.parent.fontFamily.items;
|
|
204
207
|
result = value === 'empty' ? '' : getDropDownValue(fontNameItems, value, 'value', 'text');
|
|
205
|
-
var fontNameContent = isNOU(e.parent.fontFamily.default) ? fontNameItems[0].text :
|
|
208
|
+
var fontNameContent = isNOU(e.parent.fontFamily.default) ? (fontNameItems.length === 0) ? self.serviceLocator.getService('rteLocale').getConstant('fontName') : fontNameItems[0].text :
|
|
206
209
|
e.parent.fontFamily.default;
|
|
207
210
|
var name_1 = (isNOU(result) ? fontNameContent : result) === 'Default' ? self.serviceLocator.getService('rteLocale').getConstant('fontName')
|
|
208
211
|
: (isNOU(result) ? fontNameContent : result);
|
|
@@ -219,9 +222,9 @@ export function setToolbarStatus(e, isPopToolbar, self) {
|
|
|
219
222
|
break;
|
|
220
223
|
}
|
|
221
224
|
var fontSizeItems = e.parent.fontSize.items;
|
|
222
|
-
var fontSizeContent = isNOU(e.parent.fontSize.default) ? fontSizeItems[0].text :
|
|
225
|
+
var fontSizeContent = isNOU(e.parent.fontSize.default) ? (fontSizeItems.length === 0) ? self.serviceLocator.getService('rteLocale').getConstant('fontSize') : fontSizeItems[0].text :
|
|
223
226
|
e.parent.fontSize.default;
|
|
224
|
-
var fontSizeToolbarText = getDropDownValue(fontSizeItems, (value === '' ? fontSizeContent.replace(/\s/g, '') : value), (fontSizeContent.replace(/\s/g, '') === fontSizeItems[0].text && value === '') ? 'text' : 'value', 'text');
|
|
227
|
+
var fontSizeToolbarText = getDropDownValue(fontSizeItems, (value === '' ? fontSizeContent.replace(/\s/g, '') : value), (fontSizeItems.length > 0 && fontSizeItems[0] && fontSizeContent.replace(/\s/g, '') === fontSizeItems[0].text && value === '') ? 'text' : 'value', 'text');
|
|
225
228
|
result = value === 'empty' ? '' : (fontSizeToolbarText === 'Default') ? self.serviceLocator.getService('rteLocale').getConstant('fontSize') : fontSizeToolbarText;
|
|
226
229
|
dropDown.fontSizeDropDown.content = ('<span style="display: inline-flex;' +
|
|
227
230
|
'width:' + e.parent.fontSize.width + '" >' +
|
|
@@ -556,8 +559,57 @@ export function sanitizeHelper(value, parent) {
|
|
|
556
559
|
value = SanitizeHtmlHelper.serializeValue(item, value);
|
|
557
560
|
}
|
|
558
561
|
}
|
|
562
|
+
value = parseHelper(value);
|
|
559
563
|
return value;
|
|
560
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* @param {string} value - specifies the string value
|
|
567
|
+
* @returns {string} - returns the string value
|
|
568
|
+
* @hidden
|
|
569
|
+
*/
|
|
570
|
+
export function parseHelper(value) {
|
|
571
|
+
var temp = createElement('div');
|
|
572
|
+
temp.innerHTML = value;
|
|
573
|
+
var fontElements = temp.querySelectorAll('font');
|
|
574
|
+
fontElements.forEach(function (font) {
|
|
575
|
+
var span = document.createElement('span');
|
|
576
|
+
var style = (font.getAttribute('style') || '').replace(/style:/gi, '').trim();
|
|
577
|
+
if (!isNOU(style) && style.trim() !== '' && !style.endsWith(';')) {
|
|
578
|
+
style += ';';
|
|
579
|
+
}
|
|
580
|
+
Array.from(font.attributes).forEach(function (attr) {
|
|
581
|
+
var name = attr.name.toLowerCase();
|
|
582
|
+
var value = attr.value;
|
|
583
|
+
switch (name) {
|
|
584
|
+
case 'size':
|
|
585
|
+
style += "font-size:" + value + ";";
|
|
586
|
+
break;
|
|
587
|
+
case 'face':
|
|
588
|
+
style += "font-family:" + value + ";";
|
|
589
|
+
break;
|
|
590
|
+
case 'bgcolor':
|
|
591
|
+
style += "background-color:" + value + ";";
|
|
592
|
+
break;
|
|
593
|
+
case 'style':
|
|
594
|
+
break;
|
|
595
|
+
default:
|
|
596
|
+
style += name + ":" + value + ";";
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
if (!isNOU(style) && style.trim() !== '') {
|
|
601
|
+
style = style.replace(/;;+/g, ';');
|
|
602
|
+
span.setAttribute('style', style);
|
|
603
|
+
}
|
|
604
|
+
span.innerHTML = font.innerHTML;
|
|
605
|
+
if (!isNOU(font.parentNode)) {
|
|
606
|
+
font.parentNode.replaceChild(span, font);
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
var parsedValue = temp.innerHTML;
|
|
610
|
+
temp.remove();
|
|
611
|
+
return parsedValue;
|
|
612
|
+
}
|
|
561
613
|
/**
|
|
562
614
|
* @param {string} dataUrl - specifies the string value
|
|
563
615
|
* @returns {BaseToolbar} - returns the value
|
|
@@ -1612,6 +1612,8 @@ var Image = /** @class */ (function () {
|
|
|
1612
1612
|
if (proxy.parent.formatter.getUndoRedoStack().length === 0) {
|
|
1613
1613
|
proxy.parent.formatter.saveData();
|
|
1614
1614
|
}
|
|
1615
|
+
var previousSubCommand = this.args.item.subCommand;
|
|
1616
|
+
this.args.item.subCommand = e.target.innerHTML === 'Update' ? 'Replace' : this.args.item.subCommand;
|
|
1615
1617
|
if (!isNOU(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
|
|
1616
1618
|
proxy.uploadUrl.cssClass = (proxy.parent.insertImageSettings.display === 'inline' ?
|
|
1617
1619
|
classes.CLS_IMGINLINE : classes.CLS_IMGBREAK);
|
|
@@ -1655,6 +1657,7 @@ var Image = /** @class */ (function () {
|
|
|
1655
1657
|
}
|
|
1656
1658
|
proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, value);
|
|
1657
1659
|
}
|
|
1660
|
+
this.args.item.subCommand = previousSubCommand;
|
|
1658
1661
|
};
|
|
1659
1662
|
Image.prototype.imgsizeInput = function (e) {
|
|
1660
1663
|
var _this = this;
|
|
@@ -227,7 +227,7 @@ var ToolbarRenderer = /** @class */ (function () {
|
|
|
227
227
|
alignEle = alignEle.parentElement;
|
|
228
228
|
}
|
|
229
229
|
var alignStyle = window.getComputedStyle(alignEle).textAlign;
|
|
230
|
-
if (args.items[0].command === 'Alignments') {
|
|
230
|
+
if (!isNOU(args.items[0]) && args.items[0].command === 'Alignments') {
|
|
231
231
|
if ((args.items[0].text === 'Align Left' && (alignStyle === 'left') || alignStyle === 'start')) {
|
|
232
232
|
addClass([args.element.childNodes[0]], 'e-active');
|
|
233
233
|
break;
|
|
@@ -250,7 +250,7 @@ var ToolbarRenderer = /** @class */ (function () {
|
|
|
250
250
|
//image preselect
|
|
251
251
|
var closestNode = startNode.closest('img');
|
|
252
252
|
var imageEle = closestNode ? closestNode : startNode.querySelector('img');
|
|
253
|
-
if (args.items[0].command === 'Images') {
|
|
253
|
+
if (!isNOU(args.items[0]) && args.items[0].command === 'Images') {
|
|
254
254
|
if (!isNOU(imageEle)) {
|
|
255
255
|
var index = void 0;
|
|
256
256
|
if (imageEle.classList.contains('e-imgleft') || imageEle.classList.contains('e-imginline')) {
|
|
@@ -268,7 +268,7 @@ var ToolbarRenderer = /** @class */ (function () {
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
//Formats preselect
|
|
271
|
-
if (args.items[0].command === 'Formats' || args.items[0].command === 'Font') {
|
|
271
|
+
if (!isNOU(args.items[0]) && (args.items[0].command === 'Formats' || args.items[0].command === 'Font')) {
|
|
272
272
|
var fontName_1 = [];
|
|
273
273
|
var formats_1 = [];
|
|
274
274
|
var hasUpdatedActive = false;
|