@syncfusion/ej2-richtexteditor 25.1.39 → 25.1.41

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 25.1.39
3
+ * version : 25.1.41
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@25.1.38",
3
+ "_id": "@syncfusion/ej2-richtexteditor@25.1.39",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-z1RBMwgqZdkE0VMxfBJILZ7asZ8xdJ5S87vxM7QVQSwgX1Xa/Yt7+pohXotJlmXCMLarZwZJ9ecU5KCfBqF4Qw==",
5
+ "_integrity": "sha512-vnRCdIzVVU3ZMq7rEllyCaOR5EaZqQhzFSpJO/Cu1rHpNVZ8FqYIedV0vxClmjmz/9yMbl30dCP7PNJtJ9Eu7A==",
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-25.1.38.tgz",
29
- "_shasum": "632ae6ac93a8c7190d9a9825e42f10cf16693584",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-25.1.39.tgz",
29
+ "_shasum": "3d96b955c7077bca2ff259ca6c380fc9885008a4",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
32
32
  "author": {
@@ -39,10 +39,10 @@
39
39
  "dependencies": {
40
40
  "@syncfusion/ej2-base": "~25.1.35",
41
41
  "@syncfusion/ej2-buttons": "~25.1.39",
42
- "@syncfusion/ej2-filemanager": "~25.1.39",
43
- "@syncfusion/ej2-inputs": "~25.1.38",
44
- "@syncfusion/ej2-navigations": "~25.1.39",
45
- "@syncfusion/ej2-popups": "~25.1.39",
42
+ "@syncfusion/ej2-filemanager": "~25.1.40",
43
+ "@syncfusion/ej2-inputs": "~25.1.40",
44
+ "@syncfusion/ej2-navigations": "~25.1.41",
45
+ "@syncfusion/ej2-popups": "~25.1.41",
46
46
  "@syncfusion/ej2-splitbuttons": "~25.1.38"
47
47
  },
48
48
  "deprecated": false,
@@ -69,6 +69,6 @@
69
69
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
70
70
  },
71
71
  "typings": "index.d.ts",
72
- "version": "25.1.39",
72
+ "version": "25.1.41",
73
73
  "sideEffects": false
74
74
  }
@@ -72,7 +72,7 @@ var AudioCommand = /** @class */ (function () {
72
72
  isReplaced = true;
73
73
  }
74
74
  else {
75
- wrapElement = createElement('span', { className: classes.CLASS_AUDIO_WRAP, attrs: { contentEditable: 'false', title: e.item.fileName } });
75
+ wrapElement = createElement('span', { className: classes.CLASS_AUDIO_WRAP, attrs: { contentEditable: 'false', title: ((!isNOU(e.item.title)) ? e.item.title : (!isNOU(e.item.fileName) ? e.item.fileName : '')) } });
76
76
  var audElement = createElement('audio', { className: classes.CLASS_AUDIO + ' ' + classes.CLASS_AUDIO_INLINE, attrs: { controls: '' } });
77
77
  var sourceElement = createElement('source');
78
78
  var clickElement = createElement('span', { className: classes.CLASS_CLICK_ELEM });
@@ -51,6 +51,12 @@ var Formats = /** @class */ (function () {
51
51
  }
52
52
  }
53
53
  }
54
+ if (e.enterAction !== 'BR' && !isNOU(range.startContainer) && !isNOU(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains("e-content") && range.startContainer.parentElement.isContentEditable) {
55
+ var pTag = createElement(e.enterAction);
56
+ range.startContainer.parentElement.insertBefore(pTag, range.startContainer);
57
+ pTag.appendChild(range.startContainer);
58
+ this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, pTag, 1);
59
+ }
54
60
  };
55
61
  Formats.prototype.getBlockParent = function (node, endNode) {
56
62
  var currentParent;
@@ -260,7 +260,7 @@ var InsertHtml = /** @class */ (function () {
260
260
  range.deleteContents();
261
261
  range.setStart(startContainerParent, startIndex);
262
262
  range.setEnd(startContainerParent, startIndex);
263
- if (!isNOU(lasNode)) {
263
+ if (!isNOU(lasNode) && lasNode !== editNode) {
264
264
  detach(lasNode);
265
265
  }
266
266
  // eslint-disable-next-line
@@ -129,7 +129,7 @@ var VideoCommand = /** @class */ (function () {
129
129
  }
130
130
  else {
131
131
  if (!e.item.isEmbedUrl) {
132
- wrapElement = createElement('span', { className: classes.CLASS_VIDEO_WRAP, attrs: { contentEditable: 'false', title: e.item.fileName } });
132
+ wrapElement = createElement('span', { className: classes.CLASS_VIDEO_WRAP, attrs: { contentEditable: 'false', title: ((!isNOU(e.item.title)) ? e.item.title : (!isNOU(e.item.fileName) ? e.item.fileName : '')) } });
133
133
  vidElement = createElement('video', { className: classes.CLASS_VIDEO + ' ' + classes.CLASS_VIDEO_INLINE, attrs: { controls: '' } });
134
134
  sourceElement = createElement('source');
135
135
  this.setStyle(sourceElement, e, vidElement);
@@ -19,4 +19,5 @@ export declare class EnterKeyAction {
19
19
  private insertBRElement;
20
20
  private insertFocusContent;
21
21
  private createInsertElement;
22
+ private handleCursorAtTableSide;
22
23
  }
@@ -39,6 +39,17 @@ var EnterKeyAction = /** @class */ (function () {
39
39
  this.getRangeNode();
40
40
  var isTableEnter = true;
41
41
  this.formatTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'];
42
+ var isCursorAtTableEnd = this.range.collapsed && (this.range.startContainer.nodeType === 1) &&
43
+ this.range.startContainer.isContentEditable &&
44
+ this.range.startContainer.childNodes[this.range.startOffset - 1] &&
45
+ this.range.startContainer.childNodes[this.range.startOffset - 1].nodeName === 'TABLE';
46
+ var isCursorAtTableStart = this.range.collapsed && (this.range.startContainer.nodeType === 1) &&
47
+ this.range.startContainer.isContentEditable && this.range.startContainer.childNodes[this.range.startOffset] &&
48
+ this.range.startContainer.childNodes[this.range.startOffset].nodeName === 'TABLE';
49
+ if (isCursorAtTableEnd || isCursorAtTableStart) {
50
+ this.handleCursorAtTableSide(e, isCursorAtTableStart, isCursorAtTableEnd);
51
+ return;
52
+ }
42
53
  if (!isNOU(this.startNode.closest('TABLE')) && !isNOU(this.endNode.closest('TABLE'))) {
43
54
  isTableEnter = false;
44
55
  var curElement = this.startNode;
@@ -497,6 +508,41 @@ var EnterKeyAction = /** @class */ (function () {
497
508
  }
498
509
  return insertElem;
499
510
  };
511
+ EnterKeyAction.prototype.handleCursorAtTableSide = function (e, isStart, isEnd) {
512
+ var _this = this;
513
+ if (this.parent.enterKey !== 'BR') {
514
+ var shiftKey_2 = e.args.shiftKey;
515
+ var actionBeginArgs = {
516
+ cancel: false,
517
+ name: events.actionBegin,
518
+ requestType: shiftKey_2 ? 'ShiftEnterAction' : 'EnterAction',
519
+ originalEvent: e.args
520
+ };
521
+ this.parent.trigger(events.actionBegin, actionBeginArgs, function (actionBeginArgs) {
522
+ if (!actionBeginArgs.cancel) {
523
+ var newElement = _this.parent.createElement(_this.parent.enterKey);
524
+ newElement.innerHTML = '<br>';
525
+ var tableElement = void 0;
526
+ if (isStart) {
527
+ tableElement = _this.range.startContainer.childNodes[_this.range.startOffset];
528
+ tableElement.parentElement.insertBefore(newElement, tableElement);
529
+ }
530
+ if (isEnd) {
531
+ tableElement = _this.range.startContainer.childNodes[_this.range.startOffset - 1];
532
+ if (!isNOU(tableElement.nextSibling)) {
533
+ tableElement.parentElement.insertBefore(newElement, tableElement.nextSibling);
534
+ }
535
+ else if (isNOU(tableElement.nextSibling)) {
536
+ tableElement.parentElement.appendChild(newElement);
537
+ }
538
+ }
539
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
540
+ e.args.preventDefault();
541
+ _this.parent.trigger(events.actionComplete, { requestType: shiftKey_2 ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
542
+ }
543
+ });
544
+ }
545
+ };
500
546
  return EnterKeyAction;
501
547
  }());
502
548
  export { EnterKeyAction };
@@ -76,7 +76,6 @@ export declare class PasteCleanup {
76
76
  private deniedTags;
77
77
  private deniedAttributes;
78
78
  private allowedStyle;
79
- private findLastElement;
80
79
  private processPictureElement;
81
80
  /**
82
81
  * For internal use only - Get the module name.
@@ -9,7 +9,7 @@ import { CLS_RTE_IMAGE, CLS_IMGINLINE, CLS_IMGBREAK } from '../base/classes';
9
9
  import { pasteCleanupGroupingTags } from '../../common/config';
10
10
  import { NodeSelection } from '../../selection/selection';
11
11
  import * as EVENTS from './../../common/constant';
12
- import { RenderType } from '../base/enum';
12
+ import { RenderType, UploadRequest } from '../base/enum';
13
13
  import { Uploader } from '@syncfusion/ej2-inputs';
14
14
  import * as classes from '../base/classes';
15
15
  import { sanitizeHelper, convertToBlob, getDefaultValue } from '../base/util';
@@ -410,6 +410,7 @@ var PasteCleanup = /** @class */ (function () {
410
410
  var _this = this;
411
411
  this.parent.inputElement.contentEditable = 'true';
412
412
  e.element = imgElem;
413
+ e.requestType = UploadRequest.Pasted;
413
414
  this.parent.trigger(events.imageUploadSuccess, e, function (e) {
414
415
  if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
415
416
  var url = _this.parent.insertImageSettings.path + e.file.name;
@@ -718,21 +719,6 @@ var PasteCleanup = /** @class */ (function () {
718
719
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
719
720
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
720
721
  _this.parent.formatter.onSuccess(_this.parent, args);
721
- if (!isNOU(returnArgs.elements) && !isNOU(returnArgs.imgElem) &&
722
- returnArgs.imgElem.length > 0) {
723
- var pasteContent = returnArgs.elements;
724
- var imageContent = returnArgs.imgElem;
725
- var lastElementChild = _this.findLastElement(pasteContent[pasteContent.length - 1]);
726
- var isImageAtLast = !isNOU(lastElementChild) ? lastElementChild.nodeName === 'IMG' : false;
727
- if (isImageAtLast || pasteContent[pasteContent.length - 1] === imageContent[imageContent.length - 1]) {
728
- _this.parent.notify(events.insertCompleted, {
729
- args: args.event,
730
- type: 'Images',
731
- isNotify: true,
732
- elements: imageContent[imageContent.length - 1]
733
- });
734
- }
735
- }
736
722
  }, clipBoardElem, null, null, this.parent.enterKey);
737
723
  this.removeTempClass();
738
724
  this.parent.notify(events.toolbarRefresh, {});
@@ -1131,16 +1117,6 @@ var PasteCleanup = /** @class */ (function () {
1131
1117
  }
1132
1118
  return clipBoardElem;
1133
1119
  };
1134
- PasteCleanup.prototype.findLastElement = function (element) {
1135
- if (!isNOU(element) && !isNOU(element.lastElementChild)) {
1136
- var lastChild = element.lastElementChild;
1137
- while (lastChild && lastChild.lastElementChild) {
1138
- lastChild = lastChild.lastElementChild;
1139
- }
1140
- return lastChild;
1141
- }
1142
- return null;
1143
- };
1144
1120
  PasteCleanup.prototype.processPictureElement = function (clipBoardElem) {
1145
1121
  var pictureElems = clipBoardElem.querySelectorAll('picture');
1146
1122
  for (var i = 0; i < pictureElems.length; i++) {
@@ -64,3 +64,14 @@ export declare type ToolbarItems = 'alignments' | 'justifyLeft' | 'justifyCenter
64
64
  * Defines types to be used to configure the toolbarSettings items.
65
65
  */
66
66
  export declare type ToolbarConfigItems = 'Alignments' | 'JustifyLeft' | 'JustifyCenter' | 'JustifyRight' | 'JustifyFull' | 'FontName' | 'FontSize' | 'FontColor' | 'BackgroundColor' | 'Bold' | 'Italic' | 'Underline' | 'StrikeThrough' | 'ClearFormat' | 'ClearAll' | 'Cut' | 'Copy' | 'Paste' | 'UnorderedList' | 'OrderedList' | 'Indent' | 'Outdent' | 'Undo' | 'Redo' | 'SuperScript' | 'SubScript' | 'CreateLink' | 'Image' | 'CreateTable' | 'InsertLink' | 'FullScreen' | 'LowerCase' | 'UpperCase' | 'Print' | 'Formats' | 'FormatPainter' | 'EmojiPicker' | 'UnderLine' | 'ZoomOut' | 'ZoomIn' | 'SourceCode' | 'Preview' | 'ViewSide' | 'InsertCode' | 'Audio' | 'Video' | 'NumberFormatList' | 'BulletFormatList' | 'FileManager' | '|' | '-';
67
+ /**
68
+ * Defines types to be used as inserted image.
69
+ */
70
+ export declare enum UploadRequest {
71
+ /** Defines UploadRequest as Uploaded */
72
+ Uploaded = "Uploaded",
73
+ /** Defines UploadRequest as Dropped */
74
+ Dropped = "Dropped",
75
+ /** Defines UploadRequest as Pasted */
76
+ Pasted = "Pasted"
77
+ }
@@ -61,3 +61,15 @@ export var DialogType;
61
61
  DialogType["InsertTable"] = "InsertTable";
62
62
  /* eslint-enable */
63
63
  })(DialogType || (DialogType = {}));
64
+ /**
65
+ * Defines types to be used as inserted image.
66
+ */
67
+ export var UploadRequest;
68
+ (function (UploadRequest) {
69
+ /** Defines UploadRequest as Uploaded */
70
+ UploadRequest["Uploaded"] = "Uploaded";
71
+ /** Defines UploadRequest as Dropped */
72
+ UploadRequest["Dropped"] = "Dropped";
73
+ /** Defines UploadRequest as Pasted */
74
+ UploadRequest["Pasted"] = "Pasted";
75
+ })(UploadRequest || (UploadRequest = {}));
@@ -1,7 +1,7 @@
1
1
  import { Component, Observer, L10n, KeyboardEventArgs, EmitType } from '@syncfusion/ej2-base';
2
2
  import { ItemModel, OverflowMode } from '@syncfusion/ej2-navigations';
3
3
  import { ItemModel as DropDownItemModel, DropDownButton } from '@syncfusion/ej2-splitbuttons';
4
- import { ToolbarType, RenderType } from './enum';
4
+ import { ToolbarType, RenderType, UploadRequest } from './enum';
5
5
  import { Toolbar } from '../actions/toolbar';
6
6
  import { UndoRedoManager } from '../../editor-manager/plugin/undo';
7
7
  import { ClickEventArgs } from '@syncfusion/ej2-navigations';
@@ -428,6 +428,8 @@ export interface IAudioCommandsArgs {
428
428
  cssClass?: string;
429
429
  /** Defines the audio element to be edited */
430
430
  selectParent?: Node[];
431
+ /** Defines the title of the audio */
432
+ title?: string;
431
433
  }
432
434
  /**
433
435
  * Provides information about a Video added in the Rich Text Editor.
@@ -457,6 +459,8 @@ export interface IVideoCommandsArgs {
457
459
  cssClass?: string;
458
460
  /** Defines the video element to be edited */
459
461
  selectParent?: Node[];
462
+ /** Defines the title of the video */
463
+ title?: string;
460
464
  }
461
465
  /**
462
466
 
@@ -1154,6 +1158,10 @@ export interface ImageSuccessEventArgs {
1154
1158
  * Specify the name of the event.
1155
1159
  */
1156
1160
  element?: HTMLElement;
1161
+ /**
1162
+ * Specify the request type of the event.
1163
+ */
1164
+ requestType?: UploadRequest;
1157
1165
  }
1158
1166
  /**
1159
1167
  * Provides information about a ImageFailed event.
@@ -7,7 +7,7 @@ import { ViewSource } from '../renderer/view-source';
7
7
  import { IRenderer, IFormatter, ActionCompleteEventArgs, ActionBeginEventArgs, ImageDropEventArgs } from './interface';
8
8
  import { CommandName, ResizeArgs, ToolbarStatusEventArgs } from './interface';
9
9
  import { BeforeQuickToolbarOpenArgs, ChangeEventArgs, AfterImageDeleteEventArgs, AfterMediaDeleteEventArgs, PasteCleanupArgs } from './interface';
10
- import { ILinkCommandsArgs, IImageCommandsArgs, BeforeSanitizeHtmlArgs, ITableCommandsArgs, ExecuteCommandOption } from './interface';
10
+ import { ILinkCommandsArgs, IImageCommandsArgs, IAudioCommandsArgs, IVideoCommandsArgs, BeforeSanitizeHtmlArgs, ITableCommandsArgs, ExecuteCommandOption } from './interface';
11
11
  import { ServiceLocator } from '../services/service-locator';
12
12
  import { DialogType } from './enum';
13
13
  import { EditorMode, ShiftEnterKey, EnterKey, ContentHeightSource } from './../../common/types';
@@ -1163,7 +1163,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
1163
1163
  * @param {ExecuteCommandOption} option - specifies the command option
1164
1164
  * @public
1165
1165
  */
1166
- executeCommand(commandName: CommandName, value?: string | HTMLElement | ILinkCommandsArgs | IImageCommandsArgs | ITableCommandsArgs | FormatPainterSettingsModel, option?: ExecuteCommandOption): void;
1166
+ executeCommand(commandName: CommandName, value?: string | HTMLElement | ILinkCommandsArgs | IImageCommandsArgs | ITableCommandsArgs | FormatPainterSettingsModel | IAudioCommandsArgs | IVideoCommandsArgs, option?: ExecuteCommandOption): void;
1167
1167
  private htmlPurifier;
1168
1168
  private encode;
1169
1169
  /**
@@ -177,7 +177,8 @@ var Formatter = /** @class */ (function () {
177
177
  event: e, callBack: function () {
178
178
  self.notify(CONSTANT.contentChanged, {});
179
179
  _this.enableUndo(self);
180
- }
180
+ },
181
+ enterAction: self.enterKey
181
182
  });
182
183
  };
183
184
  /**
@@ -5,7 +5,7 @@ import * as classes from '../base/classes';
5
5
  import { Uploader, TextBox } from '@syncfusion/ej2-inputs';
6
6
  import { Popup } from '@syncfusion/ej2-popups';
7
7
  import { Button, CheckBox } from '@syncfusion/ej2-buttons';
8
- import { RenderType } from '../base/enum';
8
+ import { RenderType, UploadRequest } from '../base/enum';
9
9
  import { dispatchEvent, parseHtml, hasClass, convertToBlob } from '../base/util';
10
10
  import { isIDevice } from '../../common/util';
11
11
  import { imageResizeFactor } from '../../common/config';
@@ -1797,6 +1797,7 @@ var Image = /** @class */ (function () {
1797
1797
  }
1798
1798
  },
1799
1799
  success: function (e) {
1800
+ e.requestType = UploadRequest.Uploaded;
1800
1801
  _this.parent.trigger(events.imageUploadSuccess, e, function (e) {
1801
1802
  if (!isNOU(_this.parent.insertImageSettings.path)) {
1802
1803
  var url = _this.parent.insertImageSettings.path + e.file.name;
@@ -2242,6 +2243,7 @@ var Image = /** @class */ (function () {
2242
2243
  imageElement.style.opacity = '1';
2243
2244
  imageElement.classList.add(classes.CLS_IMG_FOCUS);
2244
2245
  e.element = imageElement;
2246
+ e.requestType = UploadRequest.Dropped;
2245
2247
  this.parent.trigger(events.imageUploadSuccess, e, function (e) {
2246
2248
  if (!isNOU(_this.parent.insertImageSettings.path)) {
2247
2249
  var url = _this.parent.insertImageSettings.path + e.file.name;