@syncfusion/ej2-richtexteditor 20.4.53 → 21.1.35

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.
Files changed (133) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/dist/ej2-richtexteditor.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  4. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es2015.js +1479 -576
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +1516 -605
  8. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  9. package/dist/global/ej2-richtexteditor.min.js +2 -2
  10. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +13 -13
  13. package/src/common/config.js +3 -1
  14. package/src/common/constant.d.ts +6 -0
  15. package/src/common/constant.js +6 -0
  16. package/src/common/util.d.ts +1 -0
  17. package/src/common/util.js +1 -0
  18. package/src/editor-manager/base/editor-manager.d.ts +2 -0
  19. package/src/editor-manager/base/editor-manager.js +5 -0
  20. package/src/editor-manager/base/enum.d.ts +14 -0
  21. package/src/editor-manager/base/interface.d.ts +34 -0
  22. package/src/editor-manager/plugin/clearformat.js +13 -4
  23. package/src/editor-manager/plugin/format-painter-actions.d.ts +63 -0
  24. package/src/editor-manager/plugin/format-painter-actions.js +474 -0
  25. package/src/editor-manager/plugin/image.js +0 -1
  26. package/src/editor-manager/plugin/inserthtml.js +4 -2
  27. package/src/editor-manager/plugin/isformatted.js +1 -0
  28. package/src/editor-manager/plugin/link.js +0 -1
  29. package/src/editor-manager/plugin/lists.js +1 -1
  30. package/src/editor-manager/plugin/ms-word-clean-up.js +4 -4
  31. package/src/editor-manager/plugin/selection-commands.d.ts +4 -1
  32. package/src/editor-manager/plugin/selection-commands.js +70 -9
  33. package/src/editor-manager/plugin/video.js +2 -0
  34. package/src/editor-manager/plugin.d.ts +1 -0
  35. package/src/editor-manager/plugin.js +1 -0
  36. package/src/global.js +1 -1
  37. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +1 -0
  38. package/src/rich-text-editor/actions/base-quick-toolbar.js +21 -1
  39. package/src/rich-text-editor/actions/base-toolbar.js +33 -10
  40. package/src/rich-text-editor/actions/enter-key.js +5 -10
  41. package/src/rich-text-editor/actions/format-painter.d.ts +24 -0
  42. package/src/rich-text-editor/actions/format-painter.js +142 -0
  43. package/src/rich-text-editor/actions/full-screen.js +0 -1
  44. package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
  45. package/src/rich-text-editor/actions/html-editor.js +117 -97
  46. package/src/rich-text-editor/actions/toolbar.js +5 -0
  47. package/src/rich-text-editor/actions.d.ts +1 -0
  48. package/src/rich-text-editor/actions.js +1 -0
  49. package/src/rich-text-editor/base/constant.d.ts +10 -0
  50. package/src/rich-text-editor/base/constant.js +10 -0
  51. package/src/rich-text-editor/base/enum.d.ts +4 -0
  52. package/src/rich-text-editor/base/interface.d.ts +30 -3
  53. package/src/rich-text-editor/base/interface.js +12 -0
  54. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +30 -4
  55. package/src/rich-text-editor/base/rich-text-editor.d.ts +35 -5
  56. package/src/rich-text-editor/base/rich-text-editor.js +40 -9
  57. package/src/rich-text-editor/base/util.js +2 -0
  58. package/src/rich-text-editor/formatter/formatter.js +22 -13
  59. package/src/rich-text-editor/formatter/html-formatter.d.ts +5 -3
  60. package/src/rich-text-editor/formatter/html-formatter.js +7 -5
  61. package/src/rich-text-editor/models/default-locale.js +4 -2
  62. package/src/rich-text-editor/models/items.d.ts +3 -0
  63. package/src/rich-text-editor/models/items.js +32 -0
  64. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +29 -1
  65. package/src/rich-text-editor/models/toolbar-settings.d.ts +24 -1
  66. package/src/rich-text-editor/models/toolbar-settings.js +20 -0
  67. package/src/rich-text-editor/renderer/audio-module.js +6 -3
  68. package/src/rich-text-editor/renderer/image-module.js +11 -6
  69. package/src/rich-text-editor/renderer/link-module.js +2 -1
  70. package/src/rich-text-editor/renderer/table-module.js +18 -6
  71. package/src/rich-text-editor/renderer/toolbar-renderer.js +10 -1
  72. package/src/rich-text-editor/renderer/video-module.js +8 -5
  73. package/src/rich-text-editor/renderer/view-source.js +1 -1
  74. package/styles/bootstrap-dark.css +31 -1
  75. package/styles/bootstrap.css +31 -1
  76. package/styles/bootstrap4.css +31 -1
  77. package/styles/bootstrap5-dark.css +32 -2
  78. package/styles/bootstrap5.css +32 -2
  79. package/styles/fabric-dark.css +31 -1
  80. package/styles/fabric.css +31 -1
  81. package/styles/fluent-dark.css +34 -4
  82. package/styles/fluent.css +34 -4
  83. package/styles/highcontrast-light.css +31 -1
  84. package/styles/highcontrast.css +31 -1
  85. package/styles/material-dark.css +31 -1
  86. package/styles/material.css +31 -1
  87. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +25 -1
  88. package/styles/rich-text-editor/_bootstrap-definition.scss +25 -1
  89. package/styles/rich-text-editor/_bootstrap4-definition.scss +25 -1
  90. package/styles/rich-text-editor/_bootstrap5-definition.scss +28 -5
  91. package/styles/rich-text-editor/_fabric-dark-definition.scss +25 -1
  92. package/styles/rich-text-editor/_fabric-definition.scss +25 -1
  93. package/styles/rich-text-editor/_fluent-definition.scss +30 -7
  94. package/styles/rich-text-editor/_fusionnew-definition.scss +26 -3
  95. package/styles/rich-text-editor/_highcontrast-definition.scss +25 -1
  96. package/styles/rich-text-editor/_highcontrast-light-definition.scss +25 -1
  97. package/styles/rich-text-editor/_layout.scss +47 -15
  98. package/styles/rich-text-editor/_material-dark-definition.scss +26 -1
  99. package/styles/rich-text-editor/_material-definition.scss +25 -1
  100. package/styles/rich-text-editor/_tailwind-definition.scss +28 -5
  101. package/styles/rich-text-editor/_theme.scss +54 -6
  102. package/styles/rich-text-editor/bootstrap-dark.css +31 -1
  103. package/styles/rich-text-editor/bootstrap.css +31 -1
  104. package/styles/rich-text-editor/bootstrap4.css +31 -1
  105. package/styles/rich-text-editor/bootstrap5-dark.css +32 -2
  106. package/styles/rich-text-editor/bootstrap5.css +32 -2
  107. package/styles/rich-text-editor/fabric-dark.css +31 -1
  108. package/styles/rich-text-editor/fabric.css +31 -1
  109. package/styles/rich-text-editor/fluent-dark.css +34 -4
  110. package/styles/rich-text-editor/fluent.css +34 -4
  111. package/styles/rich-text-editor/highcontrast-light.css +31 -1
  112. package/styles/rich-text-editor/highcontrast.css +31 -1
  113. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +8 -0
  114. package/styles/rich-text-editor/icons/_bootstrap.scss +8 -0
  115. package/styles/rich-text-editor/icons/_bootstrap4.scss +8 -0
  116. package/styles/rich-text-editor/icons/_bootstrap5.scss +8 -0
  117. package/styles/rich-text-editor/icons/_fabric-dark.scss +8 -0
  118. package/styles/rich-text-editor/icons/_fabric.scss +8 -0
  119. package/styles/rich-text-editor/icons/_fluent.scss +8 -0
  120. package/styles/rich-text-editor/icons/_fusionnew.scss +8 -0
  121. package/styles/rich-text-editor/icons/_highcontrast-light.scss +8 -0
  122. package/styles/rich-text-editor/icons/_highcontrast.scss +8 -0
  123. package/styles/rich-text-editor/icons/_material-dark.scss +8 -0
  124. package/styles/rich-text-editor/icons/_material.scss +8 -0
  125. package/styles/rich-text-editor/icons/_material3.scss +8 -0
  126. package/styles/rich-text-editor/icons/_tailwind.scss +8 -0
  127. package/styles/rich-text-editor/material-dark.css +31 -1
  128. package/styles/rich-text-editor/material.css +31 -1
  129. package/styles/rich-text-editor/tailwind-dark.css +31 -1
  130. package/styles/rich-text-editor/tailwind.css +31 -1
  131. package/styles/tailwind-dark.css +31 -1
  132. package/styles/tailwind.css +31 -1
  133. package/styles/rich-text-editor/_material3-definition.scss +0 -196
@@ -44,7 +44,7 @@ import { RendererFactory } from '../services/renderer-factory';
44
44
  import { RenderType, ToolbarType, DialogType } from './enum';
45
45
  import { ExecCommandCallBack } from '../actions/execute-command-callback';
46
46
  import { KeyboardEvents } from '../actions/keyboard';
47
- import { ToolbarSettings, ImageSettings, AudioSettings, VideoSettings, QuickToolbarSettings, FontFamily, FontSize, Format, NumberFormatList, BulletFormatList } from '../models/toolbar-settings';
47
+ import { ToolbarSettings, ImageSettings, AudioSettings, VideoSettings, QuickToolbarSettings, FontFamily, FontSize, Format, NumberFormatList, BulletFormatList, FormatPainterSettings } from '../models/toolbar-settings';
48
48
  import { FileManagerSettings } from '../models/toolbar-settings';
49
49
  import { TableSettings, PasteCleanupSettings } from '../models/toolbar-settings';
50
50
  import { FontColor, BackgroundColor } from '../models/toolbar-settings';
@@ -118,6 +118,10 @@ var RichTextEditor = /** @class */ (function (_super) {
118
118
  member: 'video',
119
119
  args: [this, this.serviceLocator]
120
120
  });
121
+ modules.push({
122
+ member: 'formatPainter',
123
+ args: [this]
124
+ });
121
125
  }
122
126
  if (this.fileManagerSettings.enable) {
123
127
  modules.push({ member: 'fileManager', args: [this, this.serviceLocator] });
@@ -187,7 +191,7 @@ var RichTextEditor = /** @class */ (function (_super) {
187
191
  this.setContainer();
188
192
  this.persistData();
189
193
  setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
190
- attributes(this.element, { role: 'application' });
194
+ attributes(this.element, { role: 'application', 'aria-label': 'Rich Text Editor' });
191
195
  };
192
196
  RichTextEditor.prototype.persistData = function () {
193
197
  if (this.enablePersistence && this.originalElement.tagName === 'TEXTAREA') {
@@ -328,6 +332,7 @@ var RichTextEditor = /** @class */ (function (_super) {
328
332
  */
329
333
  RichTextEditor.prototype.executeCommand = function (commandName, value, option) {
330
334
  value = this.htmlPurifier(commandName, value);
335
+ var internalValue;
331
336
  if (this.editorMode === 'HTML') {
332
337
  var range = this.getRange();
333
338
  if (this.iframeSettings.enable) {
@@ -374,7 +379,16 @@ var RichTextEditor = /** @class */ (function (_super) {
374
379
  return;
375
380
  }
376
381
  }
377
- this.formatter.editorManager.execCommand(tool.command, tool.subCommand ? tool.subCommand : (value ? value : tool.value), null, null, (value ? value : tool.value), (value ? value : tool.value));
382
+ internalValue = value;
383
+ if (tool.command === 'FormatPainter') {
384
+ if (!isNOU(value)) {
385
+ this.formatPainterSettings = value;
386
+ }
387
+ internalValue = {
388
+ formatPainterAction: tool.value
389
+ };
390
+ }
391
+ this.formatter.editorManager.execCommand(tool.command, tool.subCommand ? tool.subCommand : (internalValue ? internalValue : tool.value), null, null, (internalValue ? internalValue : tool.value), (internalValue ? internalValue : tool.value));
378
392
  if (option && option.undo) {
379
393
  this.formatter.saveData();
380
394
  this.formatter.enableUndo(this);
@@ -628,6 +642,7 @@ var RichTextEditor = /** @class */ (function (_super) {
628
642
  var currentEndContainer = range.endContainer;
629
643
  var currentStartOffset = range.startOffset;
630
644
  var isSameContainer = currentStartContainer === currentEndContainer ? true : false;
645
+ var currentEndOffset = currentEndContainer.textContent.length;
631
646
  var endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
632
647
  range.endContainer;
633
648
  var closestLI = closest(endNode, 'LI');
@@ -713,14 +728,21 @@ var RichTextEditor = /** @class */ (function (_super) {
713
728
  this.formatter.saveData();
714
729
  }
715
730
  if (e.action !== 'insert-link' &&
731
+ e.action !== 'format-copy' && e.action !== 'format-paste' &&
716
732
  (e.action && e.action !== 'paste' && e.action !== 'space'
717
733
  || e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
718
- this.formatter.process(this, null, e);
734
+ var FormatPainterEscapeAction = false;
735
+ if (!isNOU(this.formatPainterModule)) {
736
+ FormatPainterEscapeAction = this.formatPainterModule.previousAction === 'escape';
737
+ }
738
+ if (!FormatPainterEscapeAction) {
739
+ this.formatter.process(this, null, e);
740
+ }
719
741
  switch (e.action) {
720
742
  case 'toolbar-focus':
721
743
  if (this.toolbarSettings.enable) {
722
744
  // eslint-disable-next-line
723
- var selector = '.e-toolbar-item[aria-disabled="false"][title] [tabindex]';
745
+ var selector = '.e-toolbar-item[title] [tabindex]';
724
746
  this.toolbarModule.baseToolbar.toolbarObj.element.querySelector(selector).focus();
725
747
  }
726
748
  break;
@@ -1668,6 +1690,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1668
1690
  }
1669
1691
  else {
1670
1692
  var compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
1693
+ // eslint-disable-next-line
1671
1694
  if (typeof this.valueTemplate !== 'string' && this.isReact) {
1672
1695
  this.displayTempElem = this.createElement('div');
1673
1696
  for (var i = 0; i < compiledTemplate.length; i++) {
@@ -1707,7 +1730,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1707
1730
  }
1708
1731
  }
1709
1732
  };
1710
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1733
+ // eslint-disable-next-line
1711
1734
  RichTextEditor.prototype.renderTemplates = function (callBack) {
1712
1735
  this.renderReactTemplates(callBack);
1713
1736
  };
@@ -1821,7 +1844,9 @@ var RichTextEditor = /** @class */ (function (_super) {
1821
1844
  * @public
1822
1845
  */
1823
1846
  RichTextEditor.prototype.getHtml = function () {
1824
- return this.serializeValue(this.contentModule.getEditPanel().innerHTML);
1847
+ var htmlValue = this.contentModule.getEditPanel().innerHTML;
1848
+ return (this.enableXhtml && (htmlValue === '<p><br></p>' || htmlValue === '<div><br></div>' ||
1849
+ htmlValue === '<br>') ? null : this.serializeValue(htmlValue));
1825
1850
  };
1826
1851
  /**
1827
1852
  * Retrieves the Rich Text Editor's XHTML validated HTML content when `enableXhtml` property is enabled.
@@ -2072,8 +2097,8 @@ var RichTextEditor = /** @class */ (function (_super) {
2072
2097
  }
2073
2098
  var getTextArea = this.element.querySelector('.e-rte-srctextarea');
2074
2099
  if (this.editorMode === 'HTML') {
2075
- value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>'
2076
- || this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
2100
+ value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
2101
+ this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
2077
2102
  this.encode(decode(this.inputElement.innerHTML)) : this.inputElement.innerHTML;
2078
2103
  if (getTextArea && getTextArea.style.display === 'block') {
2079
2104
  value = getTextArea.value;
@@ -2425,6 +2450,9 @@ var RichTextEditor = /** @class */ (function (_super) {
2425
2450
  __decorate([
2426
2451
  Complex({}, PasteCleanupSettings)
2427
2452
  ], RichTextEditor.prototype, "pasteCleanupSettings", void 0);
2453
+ __decorate([
2454
+ Complex({}, FormatPainterSettings)
2455
+ ], RichTextEditor.prototype, "formatPainterSettings", void 0);
2428
2456
  __decorate([
2429
2457
  Complex({}, IFrameSettings)
2430
2458
  ], RichTextEditor.prototype, "iframeSettings", void 0);
@@ -2455,6 +2483,9 @@ var RichTextEditor = /** @class */ (function (_super) {
2455
2483
  __decorate([
2456
2484
  Property(false)
2457
2485
  ], RichTextEditor.prototype, "enablePersistence", void 0);
2486
+ __decorate([
2487
+ Property(true)
2488
+ ], RichTextEditor.prototype, "showTooltip", void 0);
2458
2489
  __decorate([
2459
2490
  Property(false)
2460
2491
  ], RichTextEditor.prototype, "enableResize", void 0);
@@ -512,6 +512,8 @@ export function decode(value) {
512
512
  export function sanitizeHelper(value, parent) {
513
513
  if (parent.enableHtmlSanitizer) {
514
514
  var item = SanitizeHtmlHelper.beforeSanitize();
515
+ if (item.selectors.tags[2] && item.selectors.tags[2].indexOf('iframe') > -1)
516
+ item.selectors.tags[2] = 'iframe:not(.e-rte-embed-url)';
515
517
  var beforeEvent = {
516
518
  cancel: false,
517
519
  helper: null
@@ -1,4 +1,4 @@
1
- import { extend, isNullOrUndefined, Browser } from '@syncfusion/ej2-base';
1
+ import { extend, isNullOrUndefined as isNOU, Browser } from '@syncfusion/ej2-base';
2
2
  import * as CONSTANT from '../base/constant';
3
3
  import { updateUndoRedoStatus, isIDevice } from '../base/util';
4
4
  import { KEY_DOWN, KEY_UP } from './../../common/constant';
@@ -27,10 +27,16 @@ var Formatter = /** @class */ (function () {
27
27
  var selection = self.contentModule.getDocument().getSelection();
28
28
  var range = (selection.rangeCount > 0) ? selection.getRangeAt(selection.rangeCount - 1) : null;
29
29
  var saveSelection;
30
+ var isKeyboardVideoInsert = (!isNOU(value) && !isNOU(value.cssClass) &&
31
+ value.cssClass !== 'e-video-inline');
30
32
  if (self.editorMode === 'HTML') {
31
- saveSelection = this.editorManager.nodeSelection.save(range, self.contentModule.getDocument());
33
+ if (!isNOU(args) && !isKeyboardVideoInsert) {
34
+ if (isNOU(args.name) || (!isNOU(args.name) && args.name !== 'showDialog')) {
35
+ saveSelection = this.editorManager.nodeSelection.save(range, self.contentModule.getDocument());
36
+ }
37
+ }
32
38
  }
33
- if (!isNullOrUndefined(args)
39
+ if (!isNOU(args)
34
40
  && args.item.command
35
41
  && args.item.command !== 'Table'
36
42
  && args.item.command !== 'Actions'
@@ -45,7 +51,7 @@ var Formatter = /** @class */ (function () {
45
51
  || self.contentModule.getPanel() === range.commonAncestorContainer)) {
46
52
  return;
47
53
  }
48
- if (!isNullOrUndefined(args) && self.maxLength !== -1 && !isNullOrUndefined(args.item.command)) {
54
+ if (!isNOU(args) && self.maxLength !== -1 && !isNOU(args.item.command)) {
49
55
  var currentInsertContentLength = 0;
50
56
  if (args.item.command === 'Links') {
51
57
  currentInsertContentLength = value.text.length === 0 ? value.url.length : value.text.length;
@@ -60,7 +66,7 @@ var Formatter = /** @class */ (function () {
60
66
  return;
61
67
  }
62
68
  }
63
- if (isNullOrUndefined(args)) {
69
+ if (isNOU(args)) {
64
70
  var action_1 = event.action;
65
71
  if (action_1 !== 'tab' && action_1 !== 'enter' && action_1 !== 'space' && action_1 !== 'escape') {
66
72
  args = {};
@@ -84,7 +90,7 @@ var Formatter = /** @class */ (function () {
84
90
  }
85
91
  });
86
92
  }
87
- var isTableModule = isNullOrUndefined(self.tableModule) ? true : self.tableModule ?
93
+ var isTableModule = isNOU(self.tableModule) ? true : self.tableModule ?
88
94
  self.tableModule.ensureInsideTableList : false;
89
95
  if ((event.which === 9 && isTableModule) || event.which !== 9) {
90
96
  if (event.which === 13 && self.editorMode === 'HTML') {
@@ -100,22 +106,25 @@ var Formatter = /** @class */ (function () {
100
106
  });
101
107
  }
102
108
  }
103
- else if (!isNullOrUndefined(args) && args.item.command && args.item.subCommand && ((args.item.command !== args.item.subCommand
109
+ else if (!isNOU(args) && args.item.command && args.item.subCommand && ((args.item.command !== args.item.subCommand
104
110
  && args.item.command !== 'Font')
105
111
  || ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
106
112
  || ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
107
- && args.name === 'colorPickerChanged'))) {
113
+ && args.name === 'colorPickerChanged') || args.item.subCommand === 'FormatPainter')) {
108
114
  extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
109
115
  self.trigger(CONSTANT.actionBegin, args, function (actionBeginArgs) {
110
116
  if (!actionBeginArgs.cancel) {
117
+ var formatPainterCopyAction = !isNOU(actionBeginArgs.name) && actionBeginArgs.name === 'format-copy';
111
118
  if (_this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
112
- && actionBeginArgs.item.command !== 'Images') {
119
+ && actionBeginArgs.item.command !== 'Images' && !formatPainterCopyAction) {
113
120
  _this.saveData();
114
121
  }
115
122
  self.isBlur = false;
116
123
  self.contentModule.getEditPanel().focus();
117
- if (self.editorMode === 'HTML') {
118
- saveSelection.restore();
124
+ if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
125
+ if (isNOU(args.selectType) || (!isNOU(args.selectType) && args.selectType !== 'showDialog')) {
126
+ saveSelection.restore();
127
+ }
119
128
  }
120
129
  var command = actionBeginArgs.item.subCommand.toLocaleLowerCase();
121
130
  if (command === 'paste' || command === 'cut' || command === 'copy') {
@@ -129,7 +138,7 @@ var Formatter = /** @class */ (function () {
129
138
  }
130
139
  });
131
140
  }
132
- if (isNullOrUndefined(event) || event && event.action !== 'copy') {
141
+ if (isNOU(event) || event && event.action !== 'copy') {
133
142
  this.enableUndo(self);
134
143
  }
135
144
  };
@@ -166,7 +175,7 @@ var Formatter = /** @class */ (function () {
166
175
  */
167
176
  Formatter.prototype.onSuccess = function (self, events) {
168
177
  self.notify(CONSTANT.contentChanged, {});
169
- if (events && (isNullOrUndefined(events.event) || events.event.action !== 'copy')) {
178
+ if (events && (isNOU(events.event) || events.event.action !== 'copy')) {
170
179
  this.enableUndo(self);
171
180
  self.notify(CONSTANT.execCommandCallBack, events);
172
181
  }
@@ -1,5 +1,6 @@
1
1
  import { Formatter } from './formatter';
2
2
  import { IEditorModel, IHtmlFormatterModel } from './../base/interface';
3
+ import { FormatPainterSettingsModel } from '../models';
3
4
  /**
4
5
  * HTML adapter
5
6
  *
@@ -19,14 +20,15 @@ export declare class HTMLFormatter extends Formatter {
19
20
  /**
20
21
  * Update the formatter of RichTextEditor
21
22
  *
22
- * @param {Element} editElement - specifies the edit element.
23
- * @param {Document} doc - specifies the doucment
23
+ * @param {Element} editElement - specifies the edit element.
24
+ * @param {Document} doc - specifies the doucment
24
25
  * @param {number} options - specifies the options
26
+ * @param {FormatPainterSettingsModel} formatPainterSettings - specifies the format painter settings
25
27
  * @returns {void}
26
28
  * @hidden
27
29
 
28
30
  */
29
31
  updateFormatter(editElement: Element, doc?: Document, options?: {
30
32
  [key: string]: number;
31
- }): void;
33
+ }, formatPainterSettings?: FormatPainterSettingsModel): void;
32
34
  }
@@ -28,7 +28,7 @@ var HTMLFormatter = /** @class */ (function (_super) {
28
28
  _this.initialize();
29
29
  extend(_this, _this, options, true);
30
30
  if (_this.currentDocument && _this.element) {
31
- _this.updateFormatter(_this.element, _this.currentDocument, options.options);
31
+ _this.updateFormatter(_this.element, _this.currentDocument, options.options, options.formatPainterSettings);
32
32
  }
33
33
  return _this;
34
34
  }
@@ -38,19 +38,21 @@ var HTMLFormatter = /** @class */ (function (_super) {
38
38
  /**
39
39
  * Update the formatter of RichTextEditor
40
40
  *
41
- * @param {Element} editElement - specifies the edit element.
42
- * @param {Document} doc - specifies the doucment
41
+ * @param {Element} editElement - specifies the edit element.
42
+ * @param {Document} doc - specifies the doucment
43
43
  * @param {number} options - specifies the options
44
+ * @param {FormatPainterSettingsModel} formatPainterSettings - specifies the format painter settings
44
45
  * @returns {void}
45
46
  * @hidden
46
47
 
47
48
  */
48
- HTMLFormatter.prototype.updateFormatter = function (editElement, doc, options) {
49
+ HTMLFormatter.prototype.updateFormatter = function (editElement, doc, options, formatPainterSettings) {
49
50
  if (editElement && doc) {
50
51
  this.editorManager = new EditorManager({
51
52
  document: doc,
52
53
  editableElement: editElement,
53
- options: options
54
+ options: options,
55
+ formatPainterSettings: formatPainterSettings
54
56
  });
55
57
  }
56
58
  };
@@ -190,7 +190,8 @@ export var defaultLocale = {
190
190
  'bulletFormatListCircle': 'Circle',
191
191
  'bulletFormatListSquare': 'Square',
192
192
  'numberFormatListNone': 'None',
193
- 'bulletFormatListNone': 'None'
193
+ 'bulletFormatListNone': 'None',
194
+ 'formatPainter': 'Format Painter'
194
195
  };
195
196
  export var toolsLocale = {
196
197
  'alignments': 'alignments',
@@ -277,7 +278,8 @@ export var toolsLocale = {
277
278
  'alignbottom': 'AlignBottom',
278
279
  'insertrowbefore': 'insertRowBefore',
279
280
  'insertrowafter': 'insertRowAfter',
280
- 'deleterow': 'deleteRow'
281
+ 'deleterow': 'deleteRow',
282
+ 'formatpainter': 'formatPainter'
281
283
  };
282
284
  export var fontNameLocale = [
283
285
  { locale: 'fontNameSegoeUI', value: 'Segoe UI' },
@@ -30,3 +30,6 @@ export declare const backgroundColor: {
30
30
  export declare const numberFormatList: IListDropDownModel[];
31
31
  export declare const bulletFormatList: IListDropDownModel[];
32
32
  export declare function updateDropDownLocale(self: IRichTextEditor): void;
33
+ export declare let windowKeys: {
34
+ [key: string]: string;
35
+ };
@@ -551,6 +551,13 @@ export var tools = {
551
551
  'tooltip': 'Styles',
552
552
  'command': 'Table',
553
553
  'subCommand': 'Styles'
554
+ },
555
+ 'formatpainter': {
556
+ 'id': 'FormatPainter',
557
+ 'icon': 'e-rte-format-painter',
558
+ 'tooltip': 'Format Painter',
559
+ 'command': 'FormatPainter',
560
+ 'subCommand': 'FormatPainter'
554
561
  }
555
562
  };
556
563
  var alignmentLocale = [
@@ -740,3 +747,28 @@ export function updateDropDownLocale(self) {
740
747
  TableStyleItems[i].text = getLocale(self, tableStyleLocale, TableStyleItems[i]);
741
748
  });
742
749
  }
750
+ export var windowKeys = {
751
+ 'Insert Link': 'Ctrl + K',
752
+ 'Insert Image': 'Ctrl + Shift + I',
753
+ 'Create Table': 'Ctrl + Shift + E',
754
+ 'Undo': 'Ctrl + Z',
755
+ 'Redo': 'Ctrl + Y',
756
+ 'Copy': 'Ctrl + C',
757
+ 'Cut': 'Ctrl + X',
758
+ 'Paste': 'Ctrl + V',
759
+ 'Bold': 'Ctrl + B',
760
+ 'Italic': 'Ctrl + I',
761
+ 'Underline': 'Ctrl + U',
762
+ 'Strikethrough': 'Ctrl + Shift + S',
763
+ 'Upper Case': 'Ctrl + Shift + U',
764
+ 'Lower Case': 'Ctrl + Shift + L',
765
+ 'Superscript': 'Ctrl + Shift + =',
766
+ 'Subscript': 'Ctrl + =',
767
+ 'Source Code': 'Ctrl + Shift + H',
768
+ 'Maximize': 'Ctrl + Shift + F',
769
+ 'Minimize': 'Esc',
770
+ 'Clear Format': 'Ctrl + Shift + R',
771
+ 'Numbered List': 'Ctrl + Shift + O',
772
+ 'Bulleted List': 'Ctrl + Alt + O',
773
+ 'Format Painter': 'Ctrl + Shift + C, Ctrl + Shift + V'
774
+ };
@@ -1,4 +1,4 @@
1
- import { Property, ChildProperty, Complex } from '@syncfusion/ej2-base';import { AjaxSettings, AjaxSettingsModel, ContextMenuSettings, ContextMenuSettingsModel } from '@syncfusion/ej2-filemanager';import { DetailsViewSettings, DetailsViewSettingsModel, NavigationPaneSettings } from '@syncfusion/ej2-filemanager';import { NavigationPaneSettingsModel, SearchSettings, SearchSettingsModel, SortOrder } from '@syncfusion/ej2-filemanager';import { ToolbarSettingsModel as FileToolbarSettingsModel, ToolbarSettings as FileToolbarSettings } from '@syncfusion/ej2-filemanager';import { UploadSettings, UploadSettingsModel, ViewType } from '@syncfusion/ej2-filemanager';import { SaveFormat, DisplayLayoutOptions } from '../../common';import { ToolbarType, ActionOnScroll, ToolbarItems } from '../base/enum';import { IToolbarItems, IDropDownItemModel, ColorModeType, IToolsItemConfigs, IListDropDownModel } from '../base/interface';import { backgroundColor, fontColor, fontFamily, fontSize, formatItems, predefinedItems, TableStyleItems, numberFormatList, bulletFormatList } from './items';
1
+ import { Property, ChildProperty, Complex } from '@syncfusion/ej2-base';import { AjaxSettings, AjaxSettingsModel, ContextMenuSettings, ContextMenuSettingsModel } from '@syncfusion/ej2-filemanager';import { DetailsViewSettings, DetailsViewSettingsModel, NavigationPaneSettings } from '@syncfusion/ej2-filemanager';import { NavigationPaneSettingsModel, SearchSettings, SearchSettingsModel, SortOrder } from '@syncfusion/ej2-filemanager';import { ToolbarSettingsModel as FileToolbarSettingsModel, ToolbarSettings as FileToolbarSettings } from '@syncfusion/ej2-filemanager';import { UploadSettings, UploadSettingsModel, ViewType } from '@syncfusion/ej2-filemanager';import { SaveFormat, DisplayLayoutOptions } from '../../common';import { ToolbarType, ActionOnScroll, ToolbarItems, FormatPainterContext } from '../base/enum';import { IToolbarItems, IDropDownItemModel, ColorModeType, IToolsItemConfigs, IListDropDownModel } from '../base/interface';import { backgroundColor, fontColor, fontFamily, fontSize, formatItems, predefinedItems, TableStyleItems, numberFormatList, bulletFormatList } from './items';
2
2
 
3
3
  /**
4
4
  * Interface for a class ToolbarSettings
@@ -575,6 +575,34 @@ export interface QuickToolbarSettingsModel {
575
575
 
576
576
  }
577
577
 
578
+ /**
579
+ * Interface for a class FormatPainterSettings
580
+ */
581
+ export interface FormatPainterSettingsModel {
582
+
583
+ /**
584
+ * Defines the context or contexts in which styles will be copied.
585
+ *
586
+ * @default ['Text', 'List', 'Table']
587
+ */
588
+ allowedContext?: FormatPainterContext[];
589
+
590
+ /**
591
+ * Defines the tag name selectors for obtaining the formats from the elements.
592
+ *
593
+ * @default 'b; em; font; sub; sup; kbd; i; s; u; code; strong; span; p; div; h1; h2; h3; h4; h5; h6; blockquote; table; thead; tbody; tr; td; th; ol; ul; li; pre;'
594
+ */
595
+ allowedFormats?: string;
596
+
597
+ /**
598
+ * Defines selectors for the elements from which fetching formats is expressly prohibited.
599
+ *
600
+ * @default null
601
+ */
602
+ deniedFormats?: string;
603
+
604
+ }
605
+
578
606
  /**
579
607
  * Interface for a class PasteCleanupSettings
580
608
  */
@@ -5,7 +5,7 @@ import { NavigationPaneSettingsModel, SearchSettingsModel, SortOrder } from '@sy
5
5
  import { ToolbarSettingsModel as FileToolbarSettingsModel } from '@syncfusion/ej2-filemanager';
6
6
  import { UploadSettingsModel, ViewType } from '@syncfusion/ej2-filemanager';
7
7
  import { SaveFormat, DisplayLayoutOptions } from '../../common';
8
- import { ToolbarType, ActionOnScroll, ToolbarItems } from '../base/enum';
8
+ import { ToolbarType, ActionOnScroll, ToolbarItems, FormatPainterContext } from '../base/enum';
9
9
  import { IToolbarItems, IDropDownItemModel, ColorModeType, IToolsItemConfigs, IListDropDownModel } from '../base/interface';
10
10
  /**
11
11
  * Configures the toolbar settings of the RichTextEditor.
@@ -497,6 +497,29 @@ export declare class QuickToolbarSettings extends ChildProperty<QuickToolbarSett
497
497
  */
498
498
  table: (string | IToolbarItems)[];
499
499
  }
500
+ /**
501
+ * Configure the format painter settings of the Rich Text Editor.
502
+ */
503
+ export declare class FormatPainterSettings extends ChildProperty<FormatPainterSettings> {
504
+ /**
505
+ * Defines the context or contexts in which styles will be copied.
506
+ *
507
+ * @default ['Text', 'List', 'Table']
508
+ */
509
+ allowedContext: FormatPainterContext[];
510
+ /**
511
+ * Defines the tag name selectors for obtaining the formats from the elements.
512
+ *
513
+ * @default 'b; em; font; sub; sup; kbd; i; s; u; code; strong; span; p; div; h1; h2; h3; h4; h5; h6; blockquote; table; thead; tbody; tr; td; th; ol; ul; li; pre;'
514
+ */
515
+ allowedFormats: string;
516
+ /**
517
+ * Defines selectors for the elements from which fetching formats is expressly prohibited.
518
+ *
519
+ * @default null
520
+ */
521
+ deniedFormats: string;
522
+ }
500
523
  /**
501
524
  * Configures the Paste Cleanup settings of the RichTextEditor.
502
525
  */
@@ -309,6 +309,26 @@ var QuickToolbarSettings = /** @class */ (function (_super) {
309
309
  return QuickToolbarSettings;
310
310
  }(ChildProperty));
311
311
  export { QuickToolbarSettings };
312
+ /**
313
+ * Configure the format painter settings of the Rich Text Editor.
314
+ */
315
+ var FormatPainterSettings = /** @class */ (function (_super) {
316
+ __extends(FormatPainterSettings, _super);
317
+ function FormatPainterSettings() {
318
+ return _super !== null && _super.apply(this, arguments) || this;
319
+ }
320
+ __decorate([
321
+ Property(['Text', 'List', 'Table'])
322
+ ], FormatPainterSettings.prototype, "allowedContext", void 0);
323
+ __decorate([
324
+ Property('b; em; font; sub; sup; kbd; i; s; u; code; strong; span; p; div; h1; h2; h3; h4; h5; h6; blockquote; table; thead; tbody; tr; td; th; ol; ul; li; pre;')
325
+ ], FormatPainterSettings.prototype, "allowedFormats", void 0);
326
+ __decorate([
327
+ Property(null)
328
+ ], FormatPainterSettings.prototype, "deniedFormats", void 0);
329
+ return FormatPainterSettings;
330
+ }(ChildProperty));
331
+ export { FormatPainterSettings };
312
332
  /**
313
333
  * Configures the Paste Cleanup settings of the RichTextEditor.
314
334
  */
@@ -181,8 +181,9 @@ var Audio = /** @class */ (function () {
181
181
  }
182
182
  if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
183
183
  if (selectNodeEle && this.isAudioElem(selectNodeEle[0]) && selectNodeEle.length < 1) {
184
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
184
+ if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
185
185
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
186
+ }
186
187
  originalEvent.preventDefault();
187
188
  var event_1 = {
188
189
  selectNode: selectNodeEle, selection: save, selectParent: selectParentEle,
@@ -231,8 +232,9 @@ var Audio = /** @class */ (function () {
231
232
  }
232
233
  break;
233
234
  case 'insert-audio':
234
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
235
+ if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
235
236
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
237
+ }
236
238
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
237
239
  originalEvent.preventDefault();
238
240
  break;
@@ -258,7 +260,8 @@ var Audio = /** @class */ (function () {
258
260
  this.insertAudio({
259
261
  args: {
260
262
  item: { command: 'Audios', subCommand: 'Audio' },
261
- originalEvent: event
263
+ originalEvent: event,
264
+ name: !isInternal ? 'showDialog' : null
262
265
  },
263
266
  selectNode: selectNodeEle,
264
267
  selection: save,
@@ -387,7 +387,8 @@ var Image = /** @class */ (function () {
387
387
  img.setAttribute('width', (img.width + this.mouseX).toString());
388
388
  }
389
389
  else {
390
- img.setAttribute('width', (img.offsetWidth + this.mouseX).toString());
390
+ var currentWidth = img.offsetWidth === 0 ? img.width + this.mouseX + parseInt(img.style.outlineWidth.split('p')[0]) : img.offsetWidth + this.mouseX;
391
+ img.setAttribute('width', (currentWidth).toString());
391
392
  }
392
393
  }
393
394
  }
@@ -470,7 +471,7 @@ var Image = /** @class */ (function () {
470
471
  var pageX = this.getPointX(e);
471
472
  var pageY = this.getPointY(e);
472
473
  var mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
473
- var mouseY = (this.resizeBtnStat.topLeft || this.resizeBtnStat.topRight) ? -(pageY - this.pageY) : (pageY - this.pageY);
474
+ var mouseY = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageY - this.pageY) : (pageY - this.pageY);
474
475
  var width = parseInt(this.imgDupPos.width, 10) + mouseX;
475
476
  var height = parseInt(this.imgDupPos.height, 10) + mouseY;
476
477
  this.mouseX = mouseX;
@@ -641,8 +642,9 @@ var Image = /** @class */ (function () {
641
642
  }
642
643
  if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
643
644
  if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
644
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
645
+ if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
645
646
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
647
+ }
646
648
  originalEvent.preventDefault();
647
649
  var event_1 = {
648
650
  selectNode: selectNodeEle, selection: save, selectParent: selectParentEle,
@@ -701,8 +703,9 @@ var Image = /** @class */ (function () {
701
703
  }
702
704
  break;
703
705
  case 'insert-image':
704
- if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection))
706
+ if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
705
707
  save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
708
+ }
706
709
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
707
710
  originalEvent.preventDefault();
708
711
  break;
@@ -728,7 +731,8 @@ var Image = /** @class */ (function () {
728
731
  this.insertImage({
729
732
  args: {
730
733
  item: { command: 'Images', subCommand: 'Image' },
731
- originalEvent: event
734
+ originalEvent: event,
735
+ name: !isInternal ? 'showDialog' : null
732
736
  },
733
737
  selectNode: selectNodeEle,
734
738
  selection: save,
@@ -739,7 +743,8 @@ var Image = /** @class */ (function () {
739
743
  this.insertImage({
740
744
  args: {
741
745
  item: { command: 'Images', subCommand: 'Image' },
742
- originalEvent: event
746
+ originalEvent: event,
747
+ name: !isInternal ? 'showDialog' : null
743
748
  },
744
749
  member: 'image',
745
750
  text: this.parent.formatter.editorManager.markdownSelection.getSelectedText(this.parent.contentModule.getEditPanel()),
@@ -198,7 +198,8 @@ var Link = /** @class */ (function () {
198
198
  var eventArgs = {
199
199
  args: event ? event.args : {
200
200
  item: { command: 'Links', subCommand: 'CreateLink' },
201
- originalEvent: undefined
201
+ originalEvent: undefined,
202
+ name: !isInternal ? 'showDialog' : null
202
203
  },
203
204
  selectNode: selectNodeEle, selection: save, selectParent: selectParentEle
204
205
  };