@syncfusion/ej2-richtexteditor 23.1.43 → 23.2.4
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/CHANGELOG.md +24 -0
- 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 +53 -20
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +53 -20
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -13
- package/src/editor-manager/plugin/inserthtml.js +10 -6
- package/src/editor-manager/plugin/link.js +6 -0
- package/src/editor-manager/plugin/selection-commands.js +8 -1
- package/src/editor-manager/plugin/toolbar-status.js +12 -3
- package/src/rich-text-editor/actions/enter-key.js +8 -0
- package/src/rich-text-editor/base/util.js +3 -3
- package/src/rich-text-editor/renderer/image-module.js +6 -7
|
@@ -2903,7 +2903,7 @@ function setToolbarStatus(e, isPopToolbar, self) {
|
|
|
2903
2903
|
const formatItems$$1 = e.parent.format.types;
|
|
2904
2904
|
const formatContent = isNullOrUndefined(e.parent.format.default) ? formatItems$$1[0].text :
|
|
2905
2905
|
e.parent.format.default;
|
|
2906
|
-
result = getDropDownValue(formatItems$$1, value, 'subCommand', 'text');
|
|
2906
|
+
result = value === 'empty' ? '' : getDropDownValue(formatItems$$1, value, 'subCommand', 'text');
|
|
2907
2907
|
dropDown.formatDropDown.content = ('<span style="display: inline-flex;' +
|
|
2908
2908
|
'width:' + e.parent.format.width + '" >' +
|
|
2909
2909
|
'<span class="e-rte-dropdown-btn-text' + (isNullOrUndefined(e.parent.cssClass) ? '' : ' ' + e.parent.cssClass) + '">'
|
|
@@ -2929,7 +2929,7 @@ function setToolbarStatus(e, isPopToolbar, self) {
|
|
|
2929
2929
|
break;
|
|
2930
2930
|
}
|
|
2931
2931
|
const fontNameItems = e.parent.fontFamily.items;
|
|
2932
|
-
result = getDropDownValue(fontNameItems, value, 'value', 'text');
|
|
2932
|
+
result = value === 'empty' ? '' : getDropDownValue(fontNameItems, value, 'value', 'text');
|
|
2933
2933
|
const fontNameContent = isNullOrUndefined(e.parent.fontFamily.default) ? fontNameItems[0].text :
|
|
2934
2934
|
e.parent.fontFamily.default;
|
|
2935
2935
|
const name = (isNullOrUndefined(result) ? fontNameContent : result);
|
|
@@ -2948,7 +2948,7 @@ function setToolbarStatus(e, isPopToolbar, self) {
|
|
|
2948
2948
|
const fontSizeItems = e.parent.fontSize.items;
|
|
2949
2949
|
const fontSizeContent = isNullOrUndefined(e.parent.fontSize.default) ? fontSizeItems[1].text :
|
|
2950
2950
|
e.parent.fontSize.default;
|
|
2951
|
-
result = getDropDownValue(fontSizeItems, (value === '' ? fontSizeContent.replace(/\s/g, '') : value), 'value', 'text');
|
|
2951
|
+
result = value === 'empty' ? '' : getDropDownValue(fontSizeItems, (value === '' ? fontSizeContent.replace(/\s/g, '') : value), 'value', 'text');
|
|
2952
2952
|
dropDown.fontSizeDropDown.content = ('<span style="display: inline-flex;' +
|
|
2953
2953
|
'width:' + e.parent.fontSize.width + '" >' +
|
|
2954
2954
|
'<span class="e-rte-dropdown-btn-text' + (isNullOrUndefined(e.parent.cssClass) ? '' : ' ' + e.parent.cssClass) + '">'
|
|
@@ -13600,14 +13600,18 @@ class InsertHtml {
|
|
|
13600
13600
|
}
|
|
13601
13601
|
static removeEmptyElements(element) {
|
|
13602
13602
|
const emptyElements = element.querySelectorAll(':empty');
|
|
13603
|
-
|
|
13603
|
+
const nonSvgEmptyElements = Array.from(emptyElements).filter(element => {
|
|
13604
|
+
// Check if the element is an SVG element or an ancestor of an SVG element
|
|
13605
|
+
return !element.closest('svg') && !element.closest('canvas');
|
|
13606
|
+
});
|
|
13607
|
+
for (let i = 0; i < nonSvgEmptyElements.length; i++) {
|
|
13604
13608
|
let lineWithDiv = true;
|
|
13605
|
-
if (
|
|
13606
|
-
lineWithDiv =
|
|
13607
|
-
|
|
13609
|
+
if (nonSvgEmptyElements[i].tagName === 'DIV') {
|
|
13610
|
+
lineWithDiv = nonSvgEmptyElements[i].style.borderBottom === 'none' ||
|
|
13611
|
+
nonSvgEmptyElements[i].style.borderBottom === '' ? true : false;
|
|
13608
13612
|
}
|
|
13609
|
-
if (SELF_CLOSING_TAGS.indexOf(
|
|
13610
|
-
const detachableElement = this.findDetachEmptyElem(
|
|
13613
|
+
if (SELF_CLOSING_TAGS.indexOf(nonSvgEmptyElements[i].tagName.toLowerCase()) < 0 && lineWithDiv) {
|
|
13614
|
+
const detachableElement = this.findDetachEmptyElem(nonSvgEmptyElements[i]);
|
|
13611
13615
|
if (!isNullOrUndefined(detachableElement)) {
|
|
13612
13616
|
detach(detachableElement);
|
|
13613
13617
|
}
|
|
@@ -13722,6 +13726,12 @@ class LinkCommand {
|
|
|
13722
13726
|
|| e.event.keyCode === 13) || e.item.action === 'Paste' || range.collapsed || text) {
|
|
13723
13727
|
const anchor = this.createAchorNode(e);
|
|
13724
13728
|
anchor.innerText = e.item.text === '' ? e.item.url : e.item.text;
|
|
13729
|
+
const text = anchor.innerText;
|
|
13730
|
+
// Replace spaces with non-breaking spaces
|
|
13731
|
+
const modifiedText = text.replace(/ +/g, function (match) {
|
|
13732
|
+
return '\u00A0'.repeat(match.length);
|
|
13733
|
+
});
|
|
13734
|
+
anchor.innerText = modifiedText;
|
|
13725
13735
|
e.item.selection.restore();
|
|
13726
13736
|
InsertHtml.Insert(this.parent.currentDocument, anchor, this.parent.editableElement);
|
|
13727
13737
|
if (e.event && e.event.type === 'keydown' && (e.event.keyCode === 32
|
|
@@ -16381,7 +16391,14 @@ class SelectionCommands {
|
|
|
16381
16391
|
}
|
|
16382
16392
|
const formatNodeStyles = formatNode.getAttribute('style');
|
|
16383
16393
|
const formatNodeTagName = formatNode.tagName;
|
|
16384
|
-
|
|
16394
|
+
let child;
|
|
16395
|
+
if (formatNodeTagName === 'A' && format === 'underline') {
|
|
16396
|
+
formatNode.style.textDecoration = 'none';
|
|
16397
|
+
child = [formatNode];
|
|
16398
|
+
}
|
|
16399
|
+
else {
|
|
16400
|
+
child = InsertMethods.unwrap(formatNode);
|
|
16401
|
+
}
|
|
16385
16402
|
if (child[0] && !isFontStyle) {
|
|
16386
16403
|
let nodeTraverse = child[index] ? child[index] : child[0];
|
|
16387
16404
|
const textNode = nodeTraverse;
|
|
@@ -18483,12 +18500,18 @@ class ToolbarStatus {
|
|
|
18483
18500
|
if ((index === 0 && formatCollection.fontcolor) || !formatCollection.fontcolor) {
|
|
18484
18501
|
nodeCollection.fontcolor = formatCollection.fontcolor;
|
|
18485
18502
|
}
|
|
18486
|
-
if (
|
|
18503
|
+
if (index === 0 && formatCollection.fontname) {
|
|
18487
18504
|
nodeCollection.fontname = formatCollection.fontname;
|
|
18488
18505
|
}
|
|
18489
|
-
|
|
18506
|
+
else {
|
|
18507
|
+
nodeCollection.fontname = formatCollection.fontname === nodeCollection.fontname ? formatCollection.fontname : 'empty';
|
|
18508
|
+
}
|
|
18509
|
+
if (index === 0 && formatCollection.fontsize) {
|
|
18490
18510
|
nodeCollection.fontsize = formatCollection.fontsize;
|
|
18491
18511
|
}
|
|
18512
|
+
else {
|
|
18513
|
+
nodeCollection.fontsize = formatCollection.fontsize === nodeCollection.fontsize ? formatCollection.fontsize : 'empty';
|
|
18514
|
+
}
|
|
18492
18515
|
if ((index === 0 && formatCollection.backgroundcolor) || !formatCollection.backgroundcolor) {
|
|
18493
18516
|
nodeCollection.backgroundcolor = formatCollection.backgroundcolor;
|
|
18494
18517
|
}
|
|
@@ -18501,9 +18524,12 @@ class ToolbarStatus {
|
|
|
18501
18524
|
if ((index === 0 && formatCollection.alignments) || !formatCollection.alignments) {
|
|
18502
18525
|
nodeCollection.alignments = formatCollection.alignments;
|
|
18503
18526
|
}
|
|
18504
|
-
if (
|
|
18527
|
+
if (index === 0 && formatCollection.formats) {
|
|
18505
18528
|
nodeCollection.formats = formatCollection.formats;
|
|
18506
18529
|
}
|
|
18530
|
+
else {
|
|
18531
|
+
nodeCollection.formats = formatCollection.formats === nodeCollection.formats ? formatCollection.formats : 'empty';
|
|
18532
|
+
}
|
|
18507
18533
|
if ((index === 0 && formatCollection.createlink) || !formatCollection.createlink) {
|
|
18508
18534
|
nodeCollection.createlink = formatCollection.createlink;
|
|
18509
18535
|
}
|
|
@@ -25227,9 +25253,10 @@ class Image$1 {
|
|
|
25227
25253
|
const getAlt = (e.selectNode[0].getAttribute('alt') === null) ? '' :
|
|
25228
25254
|
e.selectNode[0].getAttribute('alt');
|
|
25229
25255
|
const content = '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
|
|
25230
|
-
'<input type="text" spellcheck="false"
|
|
25256
|
+
'<input type="text" spellcheck="false" class="e-input e-img-alt' + ' ' + this.parent.cssClass + '" placeholder="' + altText + '"/>' +
|
|
25231
25257
|
'</div>';
|
|
25232
25258
|
const contentElem = parseHtml(content);
|
|
25259
|
+
contentElem.querySelector('input').setAttribute('value', getAlt);
|
|
25233
25260
|
altWrap.appendChild(contentElem);
|
|
25234
25261
|
const inputAlt = altWrap.querySelector('.e-img-alt');
|
|
25235
25262
|
const altArgs = {
|
|
@@ -25761,14 +25788,12 @@ class Image$1 {
|
|
|
25761
25788
|
this.changedWidthValue = null;
|
|
25762
25789
|
this.changedHeightValue = null;
|
|
25763
25790
|
const content = '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"><label>' + imgWidth +
|
|
25764
|
-
'</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '
|
|
25765
|
-
widthVal
|
|
25766
|
-
+ ' /></div>' +
|
|
25791
|
+
'</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '/></div>' +
|
|
25767
25792
|
'<div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"> ' +
|
|
25768
|
-
'<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '"
|
|
25769
|
-
heightVal
|
|
25770
|
-
+ ' /></div>';
|
|
25793
|
+
'<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '"/></div>';
|
|
25771
25794
|
const contentElem = parseHtml(content);
|
|
25795
|
+
contentElem.getElementById('imgwidth').setAttribute('value', widthVal);
|
|
25796
|
+
contentElem.getElementById('imgheight').setAttribute('value', heightVal);
|
|
25772
25797
|
imgSizeWrap.appendChild(contentElem);
|
|
25773
25798
|
this.widthNum = new TextBox({
|
|
25774
25799
|
value: formatUnit(widthVal),
|
|
@@ -31711,6 +31736,14 @@ class EnterKeyAction {
|
|
|
31711
31736
|
else if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.shiftEnterKey === 'P' && shiftKey)) {
|
|
31712
31737
|
insertElem = this.parent.createElement('p');
|
|
31713
31738
|
}
|
|
31739
|
+
const previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
|
|
31740
|
+
const nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
|
|
31741
|
+
if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
|
|
31742
|
+
insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
|
|
31743
|
+
}
|
|
31744
|
+
if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
|
|
31745
|
+
insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
|
|
31746
|
+
}
|
|
31714
31747
|
return insertElem;
|
|
31715
31748
|
}
|
|
31716
31749
|
}
|