@syncfusion/ej2-richtexteditor 27.1.57 → 27.1.58
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 +61 -26
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +61 -26
- 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/editor-manager/plugin/nodecutter.js +2 -2
- package/src/rich-text-editor/actions/html-editor.js +4 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +45 -21
- package/src/rich-text-editor/base/rich-text-editor.js +5 -2
- package/src/rich-text-editor/renderer/image-module.js +6 -2
|
@@ -7867,7 +7867,9 @@ class Image$1 {
|
|
|
7867
7867
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
7868
7868
|
this.parent.formatter.editorManager.nodeSelection.setSelectionContents(this.contentModule.getDocument(), target);
|
|
7869
7869
|
this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
|
|
7870
|
-
this.
|
|
7870
|
+
if (this.parent.insertImageSettings.resize === true) {
|
|
7871
|
+
this.resizeStart(e.args, target);
|
|
7872
|
+
}
|
|
7871
7873
|
}, 400);
|
|
7872
7874
|
}
|
|
7873
7875
|
else {
|
|
@@ -9333,7 +9335,9 @@ class Image$1 {
|
|
|
9333
9335
|
if (imageElement) {
|
|
9334
9336
|
this.showImageQTbarTime = setTimeout(() => {
|
|
9335
9337
|
this.showImageQuickToolbar(args);
|
|
9336
|
-
this.
|
|
9338
|
+
if (this.parent.insertImageSettings.resize) {
|
|
9339
|
+
this.resizeStart(e.args, imageElement);
|
|
9340
|
+
}
|
|
9337
9341
|
}, 0);
|
|
9338
9342
|
}
|
|
9339
9343
|
}
|
|
@@ -23875,7 +23879,7 @@ class NodeCutter {
|
|
|
23875
23879
|
fragment = this.spliceEmptyNode(fragment, false);
|
|
23876
23880
|
if (fragment && fragment.childNodes.length > 0) {
|
|
23877
23881
|
const isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0)
|
|
23878
|
-
&& this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
|
|
23882
|
+
&& this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
|
|
23879
23883
|
if (!isEmpty) {
|
|
23880
23884
|
if (node) {
|
|
23881
23885
|
InsertMethods.AppendBefore(fragment, node);
|
|
@@ -23896,7 +23900,7 @@ class NodeCutter {
|
|
|
23896
23900
|
fragment = this.spliceEmptyNode(fragment, true);
|
|
23897
23901
|
if (fragment && fragment.childNodes.length > 0) {
|
|
23898
23902
|
const isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
|
|
23899
|
-
&& this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
|
|
23903
|
+
&& this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
|
|
23900
23904
|
if (!isEmpty) {
|
|
23901
23905
|
if (node) {
|
|
23902
23906
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
@@ -32542,12 +32546,16 @@ class HtmlEditor {
|
|
|
32542
32546
|
}
|
|
32543
32547
|
const brNode = this.deleteRangeElement.querySelector('BR');
|
|
32544
32548
|
const brLastChildNode = this.deleteRangeElement.lastChild;
|
|
32549
|
+
const brParentNode = brLastChildNode.parentNode;
|
|
32545
32550
|
if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
|
|
32546
32551
|
removeClass([brNode], ['e-rte-image-focus']);
|
|
32547
32552
|
return;
|
|
32548
32553
|
}
|
|
32549
32554
|
else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
|
|
32550
32555
|
detach(brLastChildNode);
|
|
32556
|
+
if (!isNullOrUndefined(brParentNode) && brParentNode.childNodes.length === 0) {
|
|
32557
|
+
detach(brParentNode);
|
|
32558
|
+
}
|
|
32551
32559
|
e.args.preventDefault();
|
|
32552
32560
|
}
|
|
32553
32561
|
if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
|
|
@@ -33218,38 +33226,62 @@ class PasteCleanup {
|
|
|
33218
33226
|
}
|
|
33219
33227
|
}
|
|
33220
33228
|
splitBreakLine(value) {
|
|
33221
|
-
const enterSplitText = value.split('\n');
|
|
33222
|
-
let
|
|
33229
|
+
const enterSplitText = value.split('\r\n\r\n');
|
|
33230
|
+
let finalText = '';
|
|
33223
33231
|
const startNode = this.parent.enterKey === 'P' ? '<p>' : (this.parent.enterKey === 'DIV' ? '<div>' : '');
|
|
33224
33232
|
const endNode = this.parent.enterKey === 'P' ? '</p>' : (this.parent.enterKey === 'DIV' ? '</div>' : '<br>');
|
|
33225
33233
|
for (let i = 0; i < enterSplitText.length; i++) {
|
|
33226
|
-
|
|
33227
|
-
|
|
33234
|
+
const content = enterSplitText[i];
|
|
33235
|
+
const contentWithSpace = this.makeSpace(content);
|
|
33236
|
+
const contentWithLineBreak = contentWithSpace.replace(/\r\n|\n/g, '<br>');
|
|
33237
|
+
if (i === 0) {
|
|
33238
|
+
if (this.parent.enterKey === 'BR') {
|
|
33239
|
+
finalText += (contentWithLineBreak + endNode);
|
|
33240
|
+
}
|
|
33241
|
+
else {
|
|
33242
|
+
finalText += contentWithLineBreak; // In order to merge the content in current line. No P/Div tag is added.
|
|
33243
|
+
}
|
|
33228
33244
|
}
|
|
33229
33245
|
else {
|
|
33230
|
-
|
|
33231
|
-
|
|
33232
|
-
|
|
33233
|
-
|
|
33246
|
+
if (this.parent.enterKey === 'BR') {
|
|
33247
|
+
if (i === enterSplitText.length - 1) {
|
|
33248
|
+
finalText += (contentWithLineBreak + endNode);
|
|
33249
|
+
}
|
|
33250
|
+
else {
|
|
33251
|
+
finalText += (contentWithLineBreak + endNode + endNode);
|
|
33252
|
+
}
|
|
33253
|
+
}
|
|
33254
|
+
else {
|
|
33255
|
+
finalText += startNode + contentWithLineBreak + endNode;
|
|
33256
|
+
}
|
|
33234
33257
|
}
|
|
33235
33258
|
}
|
|
33236
|
-
return
|
|
33259
|
+
return finalText;
|
|
33237
33260
|
}
|
|
33238
|
-
makeSpace(
|
|
33239
|
-
let
|
|
33240
|
-
|
|
33241
|
-
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33245
|
-
|
|
33261
|
+
makeSpace(text) {
|
|
33262
|
+
let spacedContent = '';
|
|
33263
|
+
if (text === '') {
|
|
33264
|
+
return text;
|
|
33265
|
+
}
|
|
33266
|
+
const lineBreakSplitText = text.split(' ');
|
|
33267
|
+
for (let i = 0; i < lineBreakSplitText.length; i++) {
|
|
33268
|
+
const currentText = lineBreakSplitText[i];
|
|
33269
|
+
if (currentText === '') {
|
|
33270
|
+
spacedContent += ' ';
|
|
33271
|
+
}
|
|
33272
|
+
else if (currentText === '\t') {
|
|
33273
|
+
spacedContent += ' ';
|
|
33246
33274
|
}
|
|
33247
33275
|
else {
|
|
33248
|
-
|
|
33249
|
-
|
|
33276
|
+
if (i > 0 && i < lineBreakSplitText.length) {
|
|
33277
|
+
spacedContent += ' ';
|
|
33278
|
+
}
|
|
33279
|
+
spacedContent += currentText;
|
|
33250
33280
|
}
|
|
33251
33281
|
}
|
|
33252
|
-
|
|
33282
|
+
spacedContent = spacedContent.replace(/\t/g, ' ');
|
|
33283
|
+
spacedContent = spacedContent.replace(/ /g, ' ');
|
|
33284
|
+
return spacedContent;
|
|
33253
33285
|
}
|
|
33254
33286
|
imgUploading(elm) {
|
|
33255
33287
|
const allImgElm = elm.querySelectorAll('.pasteContent_Img');
|
|
@@ -38115,7 +38147,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
38115
38147
|
}
|
|
38116
38148
|
const notFormatPainterCopy = isNullOrUndefined(e.action) ? true : (e.action !== 'format-copy' ? true : false);
|
|
38117
38149
|
if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy &&
|
|
38118
|
-
!(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which === 67))) {
|
|
38150
|
+
!(e.altKey || (e.shiftKey && e.which === 16) || (e.altKey && e.shiftKey && e.which === 67))) {
|
|
38119
38151
|
this.formatter.saveData();
|
|
38120
38152
|
}
|
|
38121
38153
|
let preventingMention = false;
|
|
@@ -39165,7 +39197,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
39165
39197
|
const item = compiledTemplate[i];
|
|
39166
39198
|
append([item], appendElem);
|
|
39167
39199
|
}
|
|
39168
|
-
|
|
39200
|
+
const content = appendElem.innerHTML.trim();
|
|
39201
|
+
if (content.length > 0) {
|
|
39202
|
+
this.setProperties({ value: content });
|
|
39203
|
+
}
|
|
39169
39204
|
this.renderReactTemplates();
|
|
39170
39205
|
}
|
|
39171
39206
|
}
|