@syncfusion/ej2-richtexteditor 20.1.55 → 20.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-richtexteditor.es2015.js +481 -93
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +473 -93
  7. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  8. package/dist/global/ej2-richtexteditor.min.js +2 -2
  9. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +11 -11
  12. package/src/editor-manager/plugin/dom-node.js +7 -1
  13. package/src/editor-manager/plugin/lists.d.ts +1 -0
  14. package/src/editor-manager/plugin/lists.js +38 -1
  15. package/src/editor-manager/plugin/selection-commands.js +10 -2
  16. package/src/rich-text-editor/actions/base-quick-toolbar.js +8 -3
  17. package/src/rich-text-editor/actions/base-toolbar.d.ts +1 -0
  18. package/src/rich-text-editor/actions/base-toolbar.js +14 -1
  19. package/src/rich-text-editor/actions/color-picker.d.ts +2 -0
  20. package/src/rich-text-editor/actions/color-picker.js +22 -1
  21. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +2 -0
  22. package/src/rich-text-editor/actions/dropdown-buttons.js +25 -0
  23. package/src/rich-text-editor/actions/file-manager.d.ts +1 -0
  24. package/src/rich-text-editor/actions/file-manager.js +14 -1
  25. package/src/rich-text-editor/actions/html-editor.js +11 -1
  26. package/src/rich-text-editor/actions/paste-clean-up.d.ts +6 -0
  27. package/src/rich-text-editor/actions/paste-clean-up.js +79 -47
  28. package/src/rich-text-editor/actions/quick-toolbar.d.ts +2 -0
  29. package/src/rich-text-editor/actions/quick-toolbar.js +23 -2
  30. package/src/rich-text-editor/actions/toolbar.d.ts +1 -0
  31. package/src/rich-text-editor/actions/toolbar.js +15 -1
  32. package/src/rich-text-editor/base/constant.d.ts +10 -0
  33. package/src/rich-text-editor/base/constant.js +10 -0
  34. package/src/rich-text-editor/base/interface.d.ts +14 -0
  35. package/src/rich-text-editor/base/rich-text-editor.js +43 -1
  36. package/src/rich-text-editor/base/util.js +5 -0
  37. package/src/rich-text-editor/formatter/formatter.js +15 -0
  38. package/src/rich-text-editor/renderer/content-renderer.js +2 -1
  39. package/src/rich-text-editor/renderer/image-module.d.ts +5 -0
  40. package/src/rich-text-editor/renderer/image-module.js +57 -13
  41. package/src/rich-text-editor/renderer/link-module.d.ts +2 -0
  42. package/src/rich-text-editor/renderer/link-module.js +19 -2
  43. package/src/rich-text-editor/renderer/table-module.d.ts +6 -0
  44. package/src/rich-text-editor/renderer/table-module.js +58 -17
  45. package/src/rich-text-editor/renderer/toolbar-renderer.js +2 -1
  46. package/styles/bootstrap-dark.css +135 -519
  47. package/styles/bootstrap.css +136 -525
  48. package/styles/bootstrap4.css +145 -572
  49. package/styles/bootstrap5-dark.css +135 -539
  50. package/styles/bootstrap5.css +135 -539
  51. package/styles/fabric-dark.css +134 -518
  52. package/styles/fabric.css +135 -519
  53. package/styles/fluent-dark.css +134 -521
  54. package/styles/fluent.css +134 -521
  55. package/styles/highcontrast-light.css +135 -519
  56. package/styles/highcontrast.css +135 -517
  57. package/styles/material-dark.css +134 -518
  58. package/styles/material.css +135 -519
  59. package/styles/rich-text-editor/bootstrap-dark.css +135 -519
  60. package/styles/rich-text-editor/bootstrap.css +136 -525
  61. package/styles/rich-text-editor/bootstrap4.css +145 -572
  62. package/styles/rich-text-editor/bootstrap5-dark.css +135 -539
  63. package/styles/rich-text-editor/bootstrap5.css +135 -539
  64. package/styles/rich-text-editor/fabric-dark.css +134 -518
  65. package/styles/rich-text-editor/fabric.css +135 -519
  66. package/styles/rich-text-editor/fluent-dark.css +134 -521
  67. package/styles/rich-text-editor/fluent.css +134 -521
  68. package/styles/rich-text-editor/highcontrast-light.css +135 -519
  69. package/styles/rich-text-editor/highcontrast.css +135 -517
  70. package/styles/rich-text-editor/material-dark.css +134 -518
  71. package/styles/rich-text-editor/material.css +135 -519
  72. package/styles/rich-text-editor/tailwind-dark.css +135 -524
  73. package/styles/rich-text-editor/tailwind.css +135 -524
  74. package/styles/tailwind-dark.css +135 -524
  75. package/styles/tailwind.css +135 -524
@@ -1,7 +1,7 @@
1
1
  import * as events from '../base/constant';
2
2
  import { Popup } from '@syncfusion/ej2-popups';
3
3
  import { RadioButton } from '@syncfusion/ej2-buttons';
4
- import { isNullOrUndefined as isNOU, isNullOrUndefined, detach, extend, addClass } from '@syncfusion/ej2-base';
4
+ import { isNullOrUndefined as isNOU, isNullOrUndefined, detach, extend, addClass, removeClass } from '@syncfusion/ej2-base';
5
5
  import { getUniqueID, Browser } from '@syncfusion/ej2-base';
6
6
  import { CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT } from '../base/classes';
7
7
  import { CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT } from '../base/classes';
@@ -42,6 +42,7 @@ var PasteCleanup = /** @class */ (function () {
42
42
  return;
43
43
  }
44
44
  this.parent.on(events.pasteClean, this.pasteClean, this);
45
+ this.parent.on(events.bindCssClass, this.setCssClass, this);
45
46
  this.parent.on(events.destroy, this.destroy, this);
46
47
  };
47
48
  PasteCleanup.prototype.destroy = function () {
@@ -52,6 +53,7 @@ var PasteCleanup = /** @class */ (function () {
52
53
  return;
53
54
  }
54
55
  this.parent.off(events.pasteClean, this.pasteClean);
56
+ this.parent.off(events.bindCssClass, this.setCssClass);
55
57
  this.parent.off(events.destroy, this.destroy);
56
58
  };
57
59
  PasteCleanup.prototype.pasteClean = function (e) {
@@ -231,7 +233,7 @@ var PasteCleanup = /** @class */ (function () {
231
233
  id: this.parent.element.id + '_upload', attrs: { type: 'File', name: 'UploadFiles' }
232
234
  });
233
235
  var offsetY = this.parent.iframeSettings.enable ? -50 : -90;
234
- var popupObj = new Popup(popupEle, {
236
+ this.popupObj = new Popup(popupEle, {
235
237
  relateTo: imgElem,
236
238
  height: '85px',
237
239
  width: '300px',
@@ -244,19 +246,22 @@ var PasteCleanup = /** @class */ (function () {
244
246
  // eslint-disable-next-line
245
247
  close: function (event) {
246
248
  _this.parent.isBlur = false;
247
- popupObj.destroy();
248
- detach(popupObj.element);
249
+ _this.popupObj.destroy();
250
+ detach(_this.popupObj.element);
249
251
  }
250
252
  });
251
- popupObj.element.style.display = 'none';
252
- addClass([popupObj.element], [classes.CLS_POPUP_OPEN, classes.CLS_RTE_UPLOAD_POPUP]);
253
+ this.popupObj.element.style.display = 'none';
254
+ addClass([this.popupObj.element], [classes.CLS_POPUP_OPEN, classes.CLS_RTE_UPLOAD_POPUP]);
255
+ if (!isNOU(this.parent.cssClass)) {
256
+ addClass([this.popupObj.element], this.parent.cssClass);
257
+ }
253
258
  var timeOut = fileList.size > 1000000 ? 300 : 100;
254
259
  setTimeout(function () {
255
- _this.refreshPopup(imgElem, popupObj);
260
+ _this.refreshPopup(imgElem, _this.popupObj);
256
261
  }, timeOut);
257
262
  var rawFile;
258
263
  var beforeUploadArgs;
259
- var uploadObj = new Uploader({
264
+ this.uploadObj = new Uploader({
260
265
  asyncSettings: {
261
266
  saveUrl: this.parent.insertImageSettings.saveUrl,
262
267
  removeUrl: this.parent.insertImageSettings.removeUrl
@@ -266,7 +271,7 @@ var PasteCleanup = /** @class */ (function () {
266
271
  allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
267
272
  success: function (e) {
268
273
  setTimeout(function () {
269
- _this.popupClose(popupObj, uploadObj, imgElem, e);
274
+ _this.popupClose(_this.popupObj, _this.uploadObj, imgElem, e);
270
275
  }, 900);
271
276
  },
272
277
  uploading: function (e) {
@@ -276,8 +281,8 @@ var PasteCleanup = /** @class */ (function () {
276
281
  if (!isNullOrUndefined(imgElem)) {
277
282
  detach(imgElem);
278
283
  }
279
- if (!isNullOrUndefined(popupObj.element)) {
280
- detach(popupObj.element);
284
+ if (!isNullOrUndefined(_this.popupObj.element)) {
285
+ detach(_this.popupObj.element);
281
286
  }
282
287
  }
283
288
  else {
@@ -297,11 +302,11 @@ var PasteCleanup = /** @class */ (function () {
297
302
  }
298
303
  _this.toolbarEnableDisable(true);
299
304
  /* eslint-disable */
300
- uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
301
- beforeUploadArgs.currentRequest : uploadObj.currentRequestHeader;
302
- uploadObj.customFormDatas = beforeUploadArgs.customFormData && beforeUploadArgs.customFormData.length > 0 ?
303
- beforeUploadArgs.customFormData : uploadObj.customFormDatas;
304
- uploadObj.uploadFiles(rawFile, null);
305
+ _this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
306
+ beforeUploadArgs.currentRequest : _this.uploadObj.currentRequestHeader;
307
+ _this.uploadObj.customFormDatas = beforeUploadArgs.customFormData && beforeUploadArgs.customFormData.length > 0 ?
308
+ beforeUploadArgs.customFormData : _this.uploadObj.customFormDatas;
309
+ _this.uploadObj.uploadFiles(rawFile, null);
305
310
  /* eslint-enable */
306
311
  });
307
312
  }
@@ -313,7 +318,7 @@ var PasteCleanup = /** @class */ (function () {
313
318
  // eslint-disable-next-line
314
319
  failure: function (e) {
315
320
  setTimeout(function () {
316
- _this.uploadFailure(imgElem, uploadObj, popupObj, e);
321
+ _this.uploadFailure(imgElem, _this.uploadObj, _this.popupObj, e);
317
322
  }, 900);
318
323
  },
319
324
  canceling: function () {
@@ -322,7 +327,7 @@ var PasteCleanup = /** @class */ (function () {
322
327
  detach(imgElem.nextSibling);
323
328
  }
324
329
  detach(imgElem);
325
- popupObj.close();
330
+ _this.popupObj.close();
326
331
  },
327
332
  selected: function (e) {
328
333
  e.cancel = true;
@@ -336,10 +341,10 @@ var PasteCleanup = /** @class */ (function () {
336
341
  detach(imgElem.nextSibling);
337
342
  }
338
343
  detach(imgElem);
339
- popupObj.close();
344
+ _this.popupObj.close();
340
345
  }
341
346
  });
342
- uploadObj.appendTo(popupObj.element.childNodes[0]);
347
+ this.uploadObj.appendTo(this.popupObj.element.childNodes[0]);
343
348
  /* eslint-disable */
344
349
  var fileData = [{
345
350
  name: fileList.name,
@@ -349,13 +354,13 @@ var PasteCleanup = /** @class */ (function () {
349
354
  validationMessages: { minSize: "", maxSize: "" },
350
355
  statusCode: '1'
351
356
  }];
352
- uploadObj.createFileList(fileData);
353
- uploadObj.filesData.push(fileData[0]);
357
+ this.uploadObj.createFileList(fileData);
358
+ this.uploadObj.filesData.push(fileData[0]);
354
359
  /* eslint-enable */
355
360
  rawFile = fileData;
356
- uploadObj.upload(fileData);
357
- popupObj.element.getElementsByClassName('e-file-select-wrap')[0].style.display = 'none';
358
- detach(popupObj.element.querySelector('.e-rte-dialog-upload .e-file-select-wrap'));
361
+ this.uploadObj.upload(fileData);
362
+ this.popupObj.element.getElementsByClassName('e-file-select-wrap')[0].style.display = 'none';
363
+ detach(this.popupObj.element.querySelector('.e-rte-dialog-upload .e-file-select-wrap'));
359
364
  };
360
365
  PasteCleanup.prototype.uploadFailure = function (imgElem, uploadObj, popupObj, e) {
361
366
  this.parent.inputElement.contentEditable = 'true';
@@ -448,19 +453,19 @@ var PasteCleanup = /** @class */ (function () {
448
453
  }
449
454
  };
450
455
  PasteCleanup.prototype.radioRender = function () {
451
- var keepRadioButton = new RadioButton({ label: this.i10n.getConstant('keepFormat'),
456
+ this.keepRadioButton = new RadioButton({ label: this.i10n.getConstant('keepFormat'),
452
457
  name: 'pasteOption', checked: true });
453
- keepRadioButton.isStringTemplate = true;
458
+ this.keepRadioButton.isStringTemplate = true;
454
459
  var keepFormatElement = this.parent.element.querySelector('#keepFormating');
455
- keepRadioButton.appendTo(keepFormatElement);
456
- var cleanRadioButton = new RadioButton({ label: this.i10n.getConstant('cleanFormat'), name: 'pasteOption' });
457
- cleanRadioButton.isStringTemplate = true;
460
+ this.keepRadioButton.appendTo(keepFormatElement);
461
+ this.cleanRadioButton = new RadioButton({ label: this.i10n.getConstant('cleanFormat'), name: 'pasteOption' });
462
+ this.cleanRadioButton.isStringTemplate = true;
458
463
  var cleanFormatElement = this.parent.element.querySelector('#cleanFormat');
459
- cleanRadioButton.appendTo(cleanFormatElement);
460
- var plainTextRadioButton = new RadioButton({ label: this.i10n.getConstant('plainText'), name: 'pasteOption' });
461
- plainTextRadioButton.isStringTemplate = true;
464
+ this.cleanRadioButton.appendTo(cleanFormatElement);
465
+ this.plainTextRadioButton = new RadioButton({ label: this.i10n.getConstant('plainText'), name: 'pasteOption' });
466
+ this.plainTextRadioButton.isStringTemplate = true;
462
467
  var plainTextElement = this.parent.element.querySelector('#plainTextFormat');
463
- plainTextRadioButton.appendTo(plainTextElement);
468
+ this.plainTextRadioButton.appendTo(plainTextElement);
464
469
  };
465
470
  PasteCleanup.prototype.selectFormatting = function (value, args, keepChecked, cleanChecked) {
466
471
  if (keepChecked) {
@@ -481,15 +486,15 @@ var PasteCleanup = /** @class */ (function () {
481
486
  buttons: [
482
487
  {
483
488
  click: function () {
484
- if (!dialog.isDestroyed) {
489
+ if (!_this.dialogObj.isDestroyed) {
485
490
  var keepChecked = _this.parent.element.querySelector('#keepFormating').checked;
486
491
  var cleanChecked = _this.parent.element.querySelector('#cleanFormat').checked;
487
- dialog.hide();
492
+ _this.dialogObj.hide();
488
493
  _this.parent.height = isHeight ? preRTEHeight : _this.parent.height;
489
494
  isHeight = false;
490
- var argument = dialog;
495
+ var argument = _this.dialogObj;
491
496
  _this.dialogRenderObj.close(argument);
492
- dialog.destroy();
497
+ _this.dialogObj.destroy();
493
498
  _this.selectFormatting(value, args, keepChecked, cleanChecked);
494
499
  }
495
500
  },
@@ -501,13 +506,13 @@ var PasteCleanup = /** @class */ (function () {
501
506
  },
502
507
  {
503
508
  click: function () {
504
- if (!dialog.isDestroyed) {
505
- dialog.hide();
509
+ if (!_this.dialogObj.isDestroyed) {
510
+ _this.dialogObj.hide();
506
511
  _this.parent.height = isHeight ? preRTEHeight : _this.parent.height;
507
512
  isHeight = false;
508
- var args_1 = dialog;
513
+ var args_1 = _this.dialogObj;
509
514
  _this.dialogRenderObj.close(args_1);
510
- dialog.destroy();
515
+ _this.dialogObj.destroy();
511
516
  }
512
517
  },
513
518
  buttonModel: {
@@ -530,7 +535,7 @@ var PasteCleanup = /** @class */ (function () {
530
535
  isModal: true,
531
536
  visible: false
532
537
  };
533
- var dialog = this.dialogRenderObj.render(dialogModel);
538
+ this.dialogObj = this.dialogRenderObj.render(dialogModel);
534
539
  var rteDialogWrapper = this.parent.element.querySelector('#' + this.parent.getID()
535
540
  + '_pasteCleanupDialog');
536
541
  if (rteDialogWrapper !== null && rteDialogWrapper.innerHTML !== '') {
@@ -542,15 +547,42 @@ var PasteCleanup = /** @class */ (function () {
542
547
  });
543
548
  this.parent.element.appendChild(rteDialogWrapper);
544
549
  }
545
- dialog.appendTo(rteDialogWrapper);
550
+ this.dialogObj.appendTo(rteDialogWrapper);
546
551
  this.radioRender();
547
552
  /* eslint-disable */
548
- if (this.parent.element.offsetHeight < parseInt(dialog.height.split('px')[0], null)) {
549
- this.parent.height = parseInt(dialog.height.split('px')[0], null) + 40;
553
+ if (this.parent.element.offsetHeight < parseInt(this.dialogObj.height.split('px')[0], null)) {
554
+ this.parent.height = parseInt(this.dialogObj.height.split('px')[0], null) + 40;
550
555
  /* eslint-enable */
551
556
  isHeight = true;
552
557
  }
553
- dialog.show();
558
+ this.dialogObj.show();
559
+ this.setCssClass({ cssClass: this.parent.cssClass });
560
+ };
561
+ PasteCleanup.prototype.updateCss = function (currentObj, e) {
562
+ if (currentObj && e.cssClass) {
563
+ if (isNullOrUndefined(e.oldCssClass)) {
564
+ currentObj.setProperties({ cssClass: (currentObj.cssClass + ' ' + e.cssClass).trim() });
565
+ }
566
+ else {
567
+ currentObj.setProperties({ cssClass: (currentObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
568
+ }
569
+ }
570
+ };
571
+ PasteCleanup.prototype.setCssClass = function (e) {
572
+ if (this.popupObj && e.cssClass) {
573
+ if (isNullOrUndefined(e.oldCssClass)) {
574
+ addClass([this.popupObj.element], e.cssClass);
575
+ }
576
+ else {
577
+ removeClass([this.popupObj.element], e.oldCssClass);
578
+ addClass([this.popupObj.element], e.cssClass);
579
+ }
580
+ }
581
+ this.updateCss(this.dialogObj, e);
582
+ this.updateCss(this.uploadObj, e);
583
+ this.updateCss(this.plainTextRadioButton, e);
584
+ this.updateCss(this.cleanRadioButton, e);
585
+ this.updateCss(this.keepRadioButton, e);
554
586
  };
555
587
  PasteCleanup.prototype.destroyDialog = function (rteDialogWrapper) {
556
588
  var rteDialogContainer = this.parent.element.querySelector('.e-dlg-container');
@@ -105,6 +105,8 @@ export declare class QuickToolbar {
105
105
  addEventListener(): void;
106
106
  private onKeyDown;
107
107
  private onIframeMouseDown;
108
+ private updateCss;
109
+ private setCssClass;
108
110
  private setRtl;
109
111
  /**
110
112
  * removeEventListener
@@ -46,7 +46,8 @@ var QuickToolbar = /** @class */ (function () {
46
46
  popupType: popType,
47
47
  toolbarItems: items,
48
48
  mode: mode,
49
- renderType: type
49
+ renderType: type,
50
+ cssClass: this.parent.cssClass
50
51
  };
51
52
  };
52
53
  /**
@@ -357,6 +358,7 @@ var QuickToolbar = /** @class */ (function () {
357
358
  this.parent.on(events.destroy, this.destroy, this);
358
359
  this.parent.on(events.keyDown, this.onKeyDown, this);
359
360
  this.parent.on(events.rtlMode, this.setRtl, this);
361
+ this.parent.on(events.bindCssClass, this.setCssClass, this);
360
362
  };
361
363
  QuickToolbar.prototype.onKeyDown = function (e) {
362
364
  var args = e.args;
@@ -370,6 +372,24 @@ var QuickToolbar = /** @class */ (function () {
370
372
  this.hideQuickToolbars();
371
373
  this.hideInlineQTBar();
372
374
  };
375
+ QuickToolbar.prototype.updateCss = function (baseQTObj, e) {
376
+ if (baseQTObj && e.cssClass) {
377
+ if (isNullOrUndefined(e.oldCssClass && baseQTObj.quickTBarObj.toolbarObj.cssClass !== e.cssClass)) {
378
+ baseQTObj.quickTBarObj.toolbarObj.setProperties({ cssClass: (baseQTObj.quickTBarObj.toolbarObj.cssClass + ' ' + e.cssClass).trim() });
379
+ }
380
+ else {
381
+ baseQTObj.quickTBarObj.toolbarObj.setProperties({ cssClass: (baseQTObj.quickTBarObj.toolbarObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
382
+ }
383
+ }
384
+ };
385
+ QuickToolbar.prototype.setCssClass = function (e) {
386
+ var baseQuickToolbarObj = [
387
+ this.inlineQTBar, this.imageQTBar, this.linkQTBar, this.textQTBar, this.tableQTBar
388
+ ];
389
+ for (var i = 0; i < baseQuickToolbarObj.length; i++) {
390
+ this.updateCss(baseQuickToolbarObj[i], e);
391
+ }
392
+ };
373
393
  QuickToolbar.prototype.setRtl = function (args) {
374
394
  if (this.inlineQTBar) {
375
395
  this.inlineQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
@@ -378,7 +398,7 @@ var QuickToolbar = /** @class */ (function () {
378
398
  this.imageQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
379
399
  }
380
400
  if (this.linkQTBar) {
381
- this.imageQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
401
+ this.linkQTBar.quickTBarObj.toolbarObj.setProperties({ enableRtl: args.enableRtl });
382
402
  }
383
403
  };
384
404
  /**
@@ -407,6 +427,7 @@ var QuickToolbar = /** @class */ (function () {
407
427
  this.parent.off(events.iframeMouseDown, this.onIframeMouseDown);
408
428
  this.parent.off(events.keyDown, this.onKeyDown);
409
429
  this.parent.off(events.rtlMode, this.setRtl);
430
+ this.parent.off(events.bindCssClass, this.setCssClass);
410
431
  };
411
432
  /**
412
433
  * Called internally if any of the property value changed.
@@ -161,6 +161,7 @@ export declare class Toolbar {
161
161
  protected unWireEvents(): void;
162
162
  protected addEventListener(): void;
163
163
  protected removeEventListener(): void;
164
+ private setCssClass;
164
165
  private onRefresh;
165
166
  /**
166
167
  * Called internally if any of the property value changed.
@@ -593,6 +593,7 @@ var Toolbar = /** @class */ (function () {
593
593
  this.parent.on(events.focusChange, this.focusChangeHandler, this);
594
594
  this.parent.on(events.mouseDown, this.mouseDownHandler, this);
595
595
  this.parent.on(events.sourceCodeMouseDown, this.mouseDownHandler, this);
596
+ this.parent.on(events.bindCssClass, this.setCssClass, this);
596
597
  if (!this.parent.inlineMode.enable && !isIDevice()) {
597
598
  this.parent.on(events.toolbarClick, this.toolbarClickHandler, this);
598
599
  }
@@ -616,12 +617,25 @@ var Toolbar = /** @class */ (function () {
616
617
  this.parent.off(events.focusChange, this.focusChangeHandler);
617
618
  this.parent.off(events.mouseDown, this.mouseDownHandler);
618
619
  this.parent.off(events.sourceCodeMouseDown, this.mouseDownHandler);
620
+ this.parent.off(events.bindCssClass, this.setCssClass);
619
621
  if (!this.parent.inlineMode.enable && !isIDevice()) {
620
622
  this.parent.off(events.toolbarClick, this.toolbarClickHandler);
621
623
  }
622
624
  };
625
+ Toolbar.prototype.setCssClass = function (e) {
626
+ if (this.toolbarObj && e.cssClass) {
627
+ if (isNullOrUndefined(e.oldCssClass)) {
628
+ this.toolbarObj.setProperties({ cssClass: (this.toolbarObj.cssClass + ' ' + e.cssClass).trim() });
629
+ }
630
+ else {
631
+ this.toolbarObj.setProperties({ cssClass: (this.toolbarObj.cssClass.replace(e.oldCssClass, '').trim() + ' ' + e.cssClass).trim() });
632
+ }
633
+ }
634
+ };
623
635
  Toolbar.prototype.onRefresh = function () {
624
- this.refreshToolbarOverflow();
636
+ if (!this.parent.inlineMode.enable) {
637
+ this.refreshToolbarOverflow();
638
+ }
625
639
  this.parent.setContentHeight('', true);
626
640
  };
627
641
  /**
@@ -601,3 +601,13 @@ export declare const showTableDialog: string;
601
601
 
602
602
  */
603
603
  export declare const closeTableDialog: string;
604
+ /**
605
+ * @hidden
606
+
607
+ */
608
+ export declare const bindCssClass: string;
609
+ /**
610
+ * @hidden
611
+
612
+ */
613
+ export declare const blockInlineEmptyNodes: string;
@@ -601,3 +601,13 @@ export var showTableDialog = 'showTableDialog';
601
601
 
602
602
  */
603
603
  export var closeTableDialog = 'closeTableDialog';
604
+ /**
605
+ * @hidden
606
+
607
+ */
608
+ export var bindCssClass = 'closeTableDialog';
609
+ /**
610
+ * @hidden
611
+
612
+ */
613
+ export var blockInlineEmptyNodes = "address:empty, article:empty, aside:empty, blockquote:empty,\ndetails:empty, dd:empty, div:empty, dl:empty, dt:empty, fieldset:empty, footer:empty,form:empty, h1:empty,\nh2:empty, h3:empty, h4:empty, h5:empty, h6:empty, header:empty, hgroup:empty, hr:empty, li:empty, main:empty, nav:empty,\nnoscript:empty, output:empty, p:empty, pre:empty, section:empty, td:empty, th:empty,\na:empty, abbr:empty, acronym:empty, b:empty, bdi:empty, bdo:empty, big:empty, button:empty,\ncanvas:empty, cite:empty, code:empty, data:empty, datalist:empty, del:empty, dfn:empty, em:empty, font:empty, i:empty, iframe:empty,\nins:empty, kbd:empty, label:empty, map:empty, mark:empty, meter:empty, noscript:empty, object:empty, output:empty, picture:empty, progress:empty,\nq:empty, ruby:empty, s:empty, samp:empty, script:empty, select:empty, slot:empty, small:empty, span:empty, strong:empty, strike:empty, sub:empty, sup:empty, svg:empty,\ntemplate:empty, textarea:empty, time:empty, u:empty, tt:empty, var:empty, wbr:empty";
@@ -80,6 +80,7 @@ export interface IRichTextEditor extends Component<HTMLElement> {
80
80
  enabled?: boolean;
81
81
  readonly?: boolean;
82
82
  placeholder?: string;
83
+ cssClass?: string;
83
84
  valueContainer?: HTMLTextAreaElement;
84
85
  editorMode?: EditorMode;
85
86
  enableHtmlEncode?: boolean;
@@ -117,6 +118,7 @@ export interface IRichTextEditor extends Component<HTMLElement> {
117
118
  getCollection?(items: string | string[]): string[];
118
119
  getRange(): Range;
119
120
  getID(): string;
121
+ getText(): string;
120
122
  updateValueData?(): void;
121
123
  getBaseToolbarObject(): BaseToolbar;
122
124
  setContentHeight(target?: string, isExpand?: boolean): void;
@@ -205,6 +207,13 @@ export interface NotifyArgs {
205
207
  touchData?: ITouchData;
206
208
  allowedStylePropertiesArray?: string[];
207
209
  }
210
+ /**
211
+ * Provides information about the current and previous cssClass property .
212
+ */
213
+ export interface ICssClassArgs {
214
+ cssClass?: string;
215
+ oldCssClass?: string;
216
+ }
208
217
  /**
209
218
 
210
219
  */
@@ -217,6 +226,8 @@ export interface IItemCollectionArgs {
217
226
  selectParent?: Node[];
218
227
  /** Defines the URL action details for link element */
219
228
  url?: string;
229
+ /** Defines the Display Text action details for link element */
230
+ text?: string;
220
231
  /** Defines the title of the link action details */
221
232
  title?: string;
222
233
  /** Defines the target as string for link element */
@@ -458,6 +469,7 @@ export interface IToolbarOptions {
458
469
  rteToolbarObj: BaseToolbar;
459
470
  enablePersistence: boolean;
460
471
  overflowMode?: OverflowMode;
472
+ cssClass?: string;
461
473
  }
462
474
  /**
463
475
 
@@ -476,6 +488,7 @@ export interface IToolbarRenderOptions {
476
488
  items?: (string | IToolbarItems)[];
477
489
  mode?: OverflowMode;
478
490
  container?: string;
491
+ cssClass?: string;
479
492
  }
480
493
  /**
481
494
 
@@ -645,6 +658,7 @@ export interface IQuickToolbarOptions {
645
658
  mode: OverflowMode;
646
659
  renderType: RenderType;
647
660
  toolbarItems: (string | IToolbarItems)[];
661
+ cssClass: string;
648
662
  }
649
663
  /**
650
664
  * Provides information about a BeforeQuickToolbarOpen event.
@@ -339,6 +339,35 @@ var RichTextEditor = /** @class */ (function (_super) {
339
339
  this.formatter.saveData();
340
340
  }
341
341
  }
342
+ if (this.maxLength !== -1 && !isNOU(tool.command)) {
343
+ var currentInsertContentLength = 0;
344
+ if (tool.command === 'Links') {
345
+ currentInsertContentLength = value.text.length === 0 ?
346
+ value.url.length : value.text.length;
347
+ }
348
+ if (tool.command === 'Images' || tool.command === 'Table' || tool.command === 'Files') {
349
+ currentInsertContentLength = 1;
350
+ }
351
+ if (tool.command === 'InsertHTML') {
352
+ if (!isNOU(value)) {
353
+ var tempElem = this.createElement('div');
354
+ tempElem.innerHTML = value;
355
+ currentInsertContentLength = tempElem.textContent.length;
356
+ }
357
+ else if (!isNOU(tool.value) && (tool.value === '<hr/>' || tool.value === '<br/>')) {
358
+ currentInsertContentLength = 1;
359
+ }
360
+ }
361
+ if (tool.command === 'InsertText') {
362
+ currentInsertContentLength = value.length;
363
+ }
364
+ var currentLength = this.getText().trim().length;
365
+ var selectionLength = this.getSelection().length;
366
+ var totalLength = (currentLength - selectionLength) + currentInsertContentLength;
367
+ if (!(this.maxLength === -1 || totalLength <= this.maxLength)) {
368
+ return;
369
+ }
370
+ }
342
371
  this.formatter.editorManager.execCommand(tool.command, tool.subCommand ? tool.subCommand : (value ? value : tool.value), null, null, (value ? value : tool.value), (value ? value : tool.value));
343
372
  if (option && option.undo) {
344
373
  this.formatter.saveData();
@@ -450,6 +479,7 @@ var RichTextEditor = /** @class */ (function (_super) {
450
479
  }
451
480
  // eslint-disable-next-line
452
481
  (!this.enabled) ? this.unWireEvents() : this.eventInitializer();
482
+ this.notify(events.bindCssClass, { cssClass: this.cssClass });
453
483
  this.renderComplete();
454
484
  };
455
485
  /**
@@ -570,6 +600,17 @@ var RichTextEditor = /** @class */ (function (_super) {
570
600
  this.autoResize();
571
601
  };
572
602
  RichTextEditor.prototype.keyUp = function (e) {
603
+ if (this.editorMode === "HTML") {
604
+ var range = this.getRange();
605
+ if (Browser.userAgent.indexOf('Firefox') != -1 && range.startContainer.nodeName === '#text' &&
606
+ range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
607
+ var range_1 = this.getRange();
608
+ var tempElem = this.createElement(this.enterKey);
609
+ range_1.startContainer.parentElement.insertBefore(tempElem, range_1.startContainer);
610
+ tempElem.appendChild(range_1.startContainer);
611
+ this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), tempElem.childNodes[0], tempElem.childNodes[0], tempElem.childNodes[0].textContent.length, tempElem.childNodes[0].textContent.length);
612
+ }
613
+ }
573
614
  this.notify(events.keyUp, { member: 'keyup', args: e });
574
615
  if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
575
616
  this.inputElement.innerHTML === '<br>')) {
@@ -722,7 +763,7 @@ var RichTextEditor = /** @class */ (function (_super) {
722
763
  requestType: 'Paste'
723
764
  };
724
765
  this.trigger(events.actionBegin, evenArgs, function (pasteArgs) {
725
- var currentLength = _this.getText().trim().length;
766
+ var currentLength = _this.inputElement.textContent.length;
726
767
  var selectionLength = _this.getSelection().length;
727
768
  var pastedContentLength = (isNOU(e) || isNOU(e.clipboardData))
728
769
  ? 0 : e.clipboardData.getData('text/plain').length;
@@ -1032,6 +1073,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1032
1073
  case 'cssClass':
1033
1074
  this.element.classList.remove(oldProp[prop]);
1034
1075
  this.setCssClass(newProp[prop]);
1076
+ this.notify(events.bindCssClass, { cssClass: newProp[prop], oldCssClass: oldProp[prop] });
1035
1077
  break;
1036
1078
  case 'enabled':
1037
1079
  this.setEnable();
@@ -4,6 +4,7 @@
4
4
  import { isNullOrUndefined as isNOU, addClass, removeClass, selectAll, createElement } from '@syncfusion/ej2-base';
5
5
  import { Browser, detach, SanitizeHtmlHelper, extend } from '@syncfusion/ej2-base';
6
6
  import * as classes from '../base/classes';
7
+ import * as CONSTANT from '../base/constant';
7
8
  import * as model from '../models/items';
8
9
  import { toolsLocale, fontNameLocale, formatsLocale, numberFormatListLocale, bulletFormatListLocale } from '../models/default-locale';
9
10
  var undoRedoItems = ['Undo', 'Redo'];
@@ -413,6 +414,10 @@ export function updateTextNode(value, rteObj) {
413
414
  var previousParent = void 0;
414
415
  var insertElem = void 0;
415
416
  while (tempNode.firstChild) {
417
+ var emptyElem = tempNode.querySelectorAll(CONSTANT.blockInlineEmptyNodes);
418
+ for (var i = 0; i < emptyElem.length; i++) {
419
+ emptyElem[i].innerHTML = '<br>';
420
+ }
416
421
  if (rteObj.enterKey !== 'BR' && ((tempNode.firstChild.nodeName === '#text' &&
417
422
  (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
418
423
  inlineNode.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
@@ -43,6 +43,21 @@ var Formatter = /** @class */ (function () {
43
43
  || self.contentModule.getPanel() === range.commonAncestorContainer)) {
44
44
  return;
45
45
  }
46
+ if (!isNullOrUndefined(args) && self.maxLength !== -1 && !isNullOrUndefined(args.item.command)) {
47
+ var currentInsertContentLength = 0;
48
+ if (args.item.command === 'Links') {
49
+ currentInsertContentLength = value.text.length === 0 ? value.url.length : value.text.length;
50
+ }
51
+ if (args.item.command === 'Images' || args.item.command === 'Table' || args.item.command === 'Files') {
52
+ currentInsertContentLength = 1;
53
+ }
54
+ var currentLength = self.getText().trim().length;
55
+ var selectionLength = self.getSelection().length;
56
+ var totalLength = (currentLength - selectionLength) + currentInsertContentLength;
57
+ if (!(self.maxLength === -1 || totalLength <= self.maxLength)) {
58
+ return;
59
+ }
60
+ }
46
61
  if (isNullOrUndefined(args)) {
47
62
  var action_1 = event.action;
48
63
  if (action_1 !== 'tab' && action_1 !== 'enter' && action_1 !== 'space' && action_1 !== 'escape') {
@@ -66,7 +66,8 @@ var ContentRender = /** @class */ (function () {
66
66
  * @returns {string} - specifies the string element.
67
67
  */
68
68
  ContentRender.prototype.getText = function () {
69
- return this.getEditPanel().innerText;
69
+ var textString = this.getEditPanel().innerText;
70
+ return textString === '\n' ? '' : textString;
70
71
  };
71
72
  /**
72
73
  * Set the content div element of RichTextEditor
@@ -14,6 +14,9 @@ export declare class Image {
14
14
  private inputUrl;
15
15
  private captionEle;
16
16
  private checkBoxObj;
17
+ private widthNum;
18
+ private heightNum;
19
+ private browseButton;
17
20
  private uploadUrl;
18
21
  private contentModule;
19
22
  private rendererFactory;
@@ -37,6 +40,8 @@ export declare class Image {
37
40
  private constructor();
38
41
  protected addEventListener(): void;
39
42
  protected removeEventListener(): void;
43
+ private updateCss;
44
+ private setCssClass;
40
45
  private onIframeMouseDown;
41
46
  private afterRender;
42
47
  private undoStack;