@syncfusion/ej2-richtexteditor 19.3.57 → 19.4.38

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.
@@ -3606,11 +3606,6 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
3606
3606
  var prop = _a[_i];
3607
3607
  switch (prop) {
3608
3608
  case 'fontFamily':
3609
- if (this.parent.inlineMode.enable) {
3610
- if (!isNullOrUndefined(this.parent.fontFamily.default)) {
3611
- this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
3612
- }
3613
- }
3614
3609
  if (this.fontNameDropDown) {
3615
3610
  for (var _b = 0, _c = Object.keys(newProp.fontFamily); _b < _c.length; _b++) {
3616
3611
  var fontFamily$$1 = _c[_b];
@@ -3642,11 +3637,6 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
3642
3637
  }
3643
3638
  break;
3644
3639
  case 'fontSize':
3645
- if (this.parent.inlineMode) {
3646
- if (!isNullOrUndefined(this.parent.fontSize.default)) {
3647
- this.getEditNode().style.fontSize = this.parent.fontSize.default;
3648
- }
3649
- }
3650
3640
  if (this.fontSizeDropDown) {
3651
3641
  for (var _d = 0, _e = Object.keys(newProp.fontSize); _d < _e.length; _d++) {
3652
3642
  var fontSize$$1 = _e[_d];
@@ -15397,6 +15387,15 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
15397
15387
  */
15398
15388
  UndoRedoManager.prototype.saveData = function (e) {
15399
15389
  var range = new NodeSelection().getRange(this.parent.currentDocument);
15390
+ var currentContainer = range.startContainer;
15391
+ for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
15392
+ if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
15393
+ currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
15394
+ currentContainer.childNodes[i].nodeName !== 'BR' && currentContainer.childNodes[i].nodeName && 'HR') {
15395
+ detach(currentContainer.childNodes[i]);
15396
+ }
15397
+ }
15398
+ range = new NodeSelection().getRange(this.parent.currentDocument);
15400
15399
  var save = new NodeSelection().save(range, this.parent.currentDocument);
15401
15400
  var htmlText = this.parent.editableElement.innerHTML;
15402
15401
  var changEle = { text: htmlText, range: save };
@@ -15547,7 +15546,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
15547
15546
  this.parent.observer.on(MS_WORD_CLEANUP_PLUGIN, this.wordCleanup, this);
15548
15547
  };
15549
15548
  MsWordPaste.prototype.wordCleanup = function (e) {
15550
- var wordPasteStyleConfig = e.allowedStylePropertiesArray;
15549
+ var wordPasteStyleConfig = !isNullOrUndefined(e.allowedStylePropertiesArray) ? e.allowedStylePropertiesArray : [];
15551
15550
  var listNodes = [];
15552
15551
  var tempHTMLContent = e.args.clipboardData.getData('text/HTML');
15553
15552
  var rtfData = e.args.clipboardData.getData('text/rtf');
@@ -17016,7 +17015,7 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
17016
17015
  this.ImageTags();
17017
17016
  this.removeTags();
17018
17017
  this.RemoveUnsupported();
17019
- this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === '\n' ?
17018
+ this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === "\n" ?
17020
17019
  this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
17021
17020
  this.parent.setProperties({ value: this.currentElement.innerHTML }, true);
17022
17021
  }
@@ -17302,7 +17301,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17302
17301
  e.args.action === 'enter' ||
17303
17302
  e.args.keyCode === 13) {
17304
17303
  this.spaceLink(e.args);
17305
- if (this.parent.editorMode === 'HTML') {
17304
+ if (this.parent.editorMode === 'HTML' && !this.parent.readonly) {
17306
17305
  this.parent.notify(enterHandler, { args: e.args });
17307
17306
  }
17308
17307
  }
@@ -24340,9 +24339,20 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24340
24339
  EnterKeyAction.prototype.enterHandler = function (e) {
24341
24340
  var _this = this;
24342
24341
  this.getRangeNode();
24342
+ var isTableEnter = true;
24343
+ if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
24344
+ isTableEnter = false;
24345
+ var curElement = this.startNode;
24346
+ var blockElement = curElement;
24347
+ while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
24348
+ blockElement = curElement;
24349
+ curElement = curElement.parentElement;
24350
+ }
24351
+ isTableEnter = blockElement.tagName === 'TD' ? false : true;
24352
+ }
24343
24353
  if (e.args.which === 13 && e.args.code === 'Enter') {
24344
- if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) && isNullOrUndefined(this.startNode.closest('TABLE')) &&
24345
- isNullOrUndefined(this.endNode.closest('TABLE')) && isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
24354
+ if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) && isTableEnter &&
24355
+ isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
24346
24356
  var shiftKey_1 = e.args.shiftKey;
24347
24357
  var actionBeginArgs = {
24348
24358
  cancel: false,
@@ -24403,10 +24413,29 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24403
24413
  if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
24404
24414
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
24405
24415
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
24406
- var nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
24416
+ var nearBlockNode = void 0;
24417
+ if (isTableEnter && _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
24418
+ nearBlockNode = _this.startNode;
24419
+ }
24420
+ else {
24421
+ nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
24422
+ }
24407
24423
  var isImageNode = false;
24408
- if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24409
- (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24424
+ var isFocusedFirst = false;
24425
+ if (_this.range.startOffset != 0 && _this.range.endOffset != 0 && _this.range.startContainer === _this.range.endContainer &&
24426
+ !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
24427
+ var startNodeText = _this.range.startContainer.textContent;
24428
+ var splitFirstText = startNodeText.substring(0, _this.range.startOffset);
24429
+ if (splitFirstText.charCodeAt(_this.range.startOffset - 1) != 160 && splitFirstText.trim().length === 0) {
24430
+ isFocusedFirst = true;
24431
+ }
24432
+ }
24433
+ else if (_this.range.startOffset === 0 && _this.range.endOffset === 0) {
24434
+ isFocusedFirst = true;
24435
+ }
24436
+ if (((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
24437
+ !(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24438
+ (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24410
24439
  var isNearBlockLengthZero = void 0;
24411
24440
  var newElem = void 0;
24412
24441
  if (_this.range.startContainer.nodeName === 'IMG') {
@@ -24415,7 +24444,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24415
24444
  isNearBlockLengthZero = false;
24416
24445
  }
24417
24446
  else {
24418
- if (nearBlockNode.textContent.length !== 0) {
24447
+ if (nearBlockNode.textContent.trim().length !== 0) {
24419
24448
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
24420
24449
  isNearBlockLengthZero = false;
24421
24450
  }
@@ -24464,7 +24493,18 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24464
24493
  }
24465
24494
  if (newElem.textContent.trim().length === 0) {
24466
24495
  var brElm = _this.parent.createElement('br');
24467
- _this.startNode.appendChild(brElm);
24496
+ if (_this.startNode.nodeName === 'A') {
24497
+ var startParentElem = _this.startNode.parentElement;
24498
+ _this.startNode.parentElement.insertBefore(brElm, _this.startNode);
24499
+ detach(_this.startNode);
24500
+ _this.startNode = startParentElem;
24501
+ }
24502
+ else {
24503
+ _this.startNode.appendChild(brElm);
24504
+ }
24505
+ if (newElem.childNodes[0].textContent === '\n') {
24506
+ detach(newElem.childNodes[0]);
24507
+ }
24468
24508
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.startNode, 0);
24469
24509
  }
24470
24510
  if (((_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV') && !shiftKey_1) || ((_this.parent.shiftEnterKey === 'DIV' ||
@@ -24475,7 +24515,8 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24475
24515
  }
24476
24516
  _this.parent.formatter.editorManager.domNode.insertAfter(insertElm, newElem);
24477
24517
  detach(newElem);
24478
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ? insertElm : _this.startNode, 0);
24518
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ?
24519
+ insertElm : _this.startNode, 0);
24479
24520
  }
24480
24521
  }
24481
24522
  e.args.preventDefault();
@@ -26000,7 +26041,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
26000
26041
  this.setProperties({ value: this.valueTemplate });
26001
26042
  }
26002
26043
  else {
26003
- var compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
26044
+ var compiledTemplate = compile(this.valueTemplate)("", this, 'valueTemplate');
26004
26045
  for (var i = 0; i < compiledTemplate.length; i++) {
26005
26046
  var item = compiledTemplate[i];
26006
26047
  append([item], this.element);