@syncfusion/ej2-image-editor 24.2.5 → 25.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 (78) hide show
  1. package/CHANGELOG.md +3 -43
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +944 -1873
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +976 -1922
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.js +9 -45
  13. package/src/image-editor/action/draw.js +52 -207
  14. package/src/image-editor/action/export.js +6 -35
  15. package/src/image-editor/action/freehand-draw.js +26 -80
  16. package/src/image-editor/action/selection.js +122 -326
  17. package/src/image-editor/action/shape.js +130 -242
  18. package/src/image-editor/action/transform.d.ts +0 -1
  19. package/src/image-editor/action/transform.js +77 -289
  20. package/src/image-editor/action/undo-redo.js +32 -101
  21. package/src/image-editor/base/image-editor-model.d.ts +1 -1
  22. package/src/image-editor/base/image-editor.d.ts +51 -42
  23. package/src/image-editor/base/image-editor.js +304 -422
  24. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  25. package/src/image-editor/renderer/toolbar.js +228 -185
  26. package/styles/bootstrap-dark.css +0 -12
  27. package/styles/bootstrap.css +0 -12
  28. package/styles/bootstrap4.css +0 -12
  29. package/styles/bootstrap5-dark.css +0 -12
  30. package/styles/bootstrap5.css +0 -12
  31. package/styles/fabric-dark.css +0 -12
  32. package/styles/fabric.css +0 -12
  33. package/styles/fluent-dark.css +0 -12
  34. package/styles/fluent.css +0 -12
  35. package/styles/highcontrast-light.css +0 -12
  36. package/styles/highcontrast.css +0 -12
  37. package/styles/image-editor/_bds-definition.scss +21 -0
  38. package/styles/image-editor/_bootstrap-dark-definition.scss +0 -1
  39. package/styles/image-editor/_bootstrap-definition.scss +0 -1
  40. package/styles/image-editor/_bootstrap4-definition.scss +0 -1
  41. package/styles/image-editor/_bootstrap5-definition.scss +0 -1
  42. package/styles/image-editor/_fabric-dark-definition.scss +0 -1
  43. package/styles/image-editor/_fabric-definition.scss +0 -1
  44. package/styles/image-editor/_fluent-definition.scss +0 -1
  45. package/styles/image-editor/_fusionnew-definition.scss +0 -1
  46. package/styles/image-editor/_highcontrast-definition.scss +0 -1
  47. package/styles/image-editor/_highcontrast-light-definition.scss +0 -1
  48. package/styles/image-editor/_layout.scss +2 -32
  49. package/styles/image-editor/_material-dark-definition.scss +0 -1
  50. package/styles/image-editor/_material-definition.scss +0 -1
  51. package/styles/image-editor/_material3-definition.scss +2 -3
  52. package/styles/image-editor/_tailwind-definition.scss +0 -1
  53. package/styles/image-editor/bootstrap-dark.css +0 -12
  54. package/styles/image-editor/bootstrap.css +0 -12
  55. package/styles/image-editor/bootstrap4.css +0 -12
  56. package/styles/image-editor/bootstrap5-dark.css +0 -12
  57. package/styles/image-editor/bootstrap5.css +0 -12
  58. package/styles/image-editor/fabric-dark.css +0 -12
  59. package/styles/image-editor/fabric.css +0 -12
  60. package/styles/image-editor/fluent-dark.css +0 -12
  61. package/styles/image-editor/fluent.css +0 -12
  62. package/styles/image-editor/highcontrast-light.css +0 -12
  63. package/styles/image-editor/highcontrast.css +0 -12
  64. package/styles/image-editor/icons/_bds.scss +411 -0
  65. package/styles/image-editor/material-dark.css +0 -12
  66. package/styles/image-editor/material.css +0 -12
  67. package/styles/image-editor/material3-dark.css +4 -25
  68. package/styles/image-editor/material3.css +4 -25
  69. package/styles/image-editor/tailwind-dark.css +2 -15
  70. package/styles/image-editor/tailwind.css +2 -15
  71. package/styles/material-dark.css +0 -12
  72. package/styles/material.css +0 -12
  73. package/styles/material3-dark.css +4 -25
  74. package/styles/material3.css +4 -25
  75. package/styles/tailwind-dark.css +2 -15
  76. package/styles/tailwind.css +2 -15
  77. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -63
  78. package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -39
@@ -1,4 +1,4 @@
1
- import { extend, Browser, detach, select, isBlazor } from '@syncfusion/ej2-base';
1
+ import { extend, Browser, detach, select } from '@syncfusion/ej2-base';
2
2
  import { EventHandler, getComponent, isNullOrUndefined, L10n } from '@syncfusion/ej2-base';
3
3
  import { NumericTextBox } from '@syncfusion/ej2-inputs';
4
4
  import { Toolbar } from '@syncfusion/ej2-navigations';
@@ -242,7 +242,9 @@ var ToolbarModule = /** @class */ (function () {
242
242
  args.value['obj']['toolbarHeight'] = this.toolbarHeight;
243
243
  break;
244
244
  case 'setToolbarHeight':
245
- this.toolbarHeight = args.value['height'];
245
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') > -1)) {
246
+ this.toolbarHeight = args.value['height'];
247
+ }
246
248
  break;
247
249
  case 'setCurrentToolbar':
248
250
  this.currentToolbar = args.value['type'];
@@ -326,11 +328,14 @@ var ToolbarModule = /** @class */ (function () {
326
328
  this.frameToolbarClick();
327
329
  break;
328
330
  case 'performCropTransformClick':
329
- this.performCropTransformClick(args.value['shape']);
331
+ this.performCropTransformClick(args.value['shape'], args.value['isTransform']);
330
332
  break;
331
333
  case 'duplicateShape':
332
334
  this.duplicateShape(args.value['isPreventUndoRedo'], true);
333
335
  break;
336
+ case 'editText':
337
+ this.editText();
338
+ break;
334
339
  }
335
340
  };
336
341
  ToolbarModule.prototype.updatePrivateVariables = function () {
@@ -443,6 +448,13 @@ var ToolbarModule = /** @class */ (function () {
443
448
  var mToolbar = document.getElementById(id + '_toolbar');
444
449
  if (toolbar_1) {
445
450
  this.toolbarHeight = mToolbar.clientHeight;
451
+ if (parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1) {
452
+ var toolabr = getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar');
453
+ if (toolabr) {
454
+ toolabr.destroy();
455
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
456
+ }
457
+ }
446
458
  }
447
459
  }
448
460
  else {
@@ -523,31 +535,33 @@ var ToolbarModule = /** @class */ (function () {
523
535
  var args = { toolbarType: 'main', toolbarItems: this.defToolbarItems };
524
536
  parent.trigger('toolbarUpdating', args);
525
537
  this.defToolbarItems = args.toolbarItems;
526
- var toolbarObj = new Toolbar({
527
- width: '100%',
528
- items: this.defToolbarItems,
529
- clicked: this.defToolbarClicked.bind(this),
530
- created: function () {
531
- if (!isDevice) {
532
- _this.renderAnnotationBtn();
538
+ if (this.defToolbarItems.length > 0) {
539
+ var toolbarObj = new Toolbar({
540
+ width: '100%',
541
+ items: this.defToolbarItems,
542
+ clicked: this.defToolbarClicked.bind(this),
543
+ created: function () {
544
+ if (!isDevice) {
545
+ _this.renderAnnotationBtn();
546
+ }
547
+ _this.wireZoomBtnEvents();
548
+ _this.renderSaveBtn();
549
+ parent.trigger('toolbarCreated', { toolbarType: 'main' });
533
550
  }
534
- _this.wireZoomBtnEvents();
535
- _this.renderSaveBtn();
536
- parent.trigger('toolbarCreated', { toolbarType: 'main' });
551
+ });
552
+ if (isDevice && isFrame) {
553
+ toolbarObj.appendTo('#' + id + '_bottomToolbar');
554
+ }
555
+ else {
556
+ toolbarObj.appendTo('#' + id + '_toolbar');
557
+ }
558
+ this.createLeftToolbarControls();
559
+ this.enableDisableTbrBtn();
560
+ if (this.isToolbar() && document.getElementById(id + '_toolbar')) {
561
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
562
+ var toolbar_4 = getComponent(id + '_toolbar', 'toolbar');
563
+ toolbar_4.refreshOverflow();
537
564
  }
538
- });
539
- if (isDevice && isFrame) {
540
- toolbarObj.appendTo('#' + id + '_bottomToolbar');
541
- }
542
- else {
543
- toolbarObj.appendTo('#' + id + '_toolbar');
544
- }
545
- this.createLeftToolbarControls();
546
- this.enableDisableTbrBtn();
547
- if (this.isToolbar() && document.getElementById(id + '_toolbar')) {
548
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
549
- var toolbar_4 = getComponent(id + '_toolbar', 'toolbar');
550
- toolbar_4.refreshOverflow();
551
565
  }
552
566
  }
553
567
  };
@@ -582,8 +596,14 @@ var ToolbarModule = /** @class */ (function () {
582
596
  var id = parent.element.id;
583
597
  var toolbarItems = [];
584
598
  if (!isOkBtn || isResize) {
585
- toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
586
- toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
599
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Open') > -1)) {
600
+ toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
601
+ toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
602
+ }
603
+ else if (Browser.isDevice && (parent.toolbar && parent.toolbar.indexOf('Open') === -1)) {
604
+ toolbarItems.push({ visible: false, id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
605
+ toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
606
+ }
587
607
  }
588
608
  if (parent.allowUndoRedo && !isResize) {
589
609
  if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
@@ -714,6 +734,9 @@ var ToolbarModule = /** @class */ (function () {
714
734
  var id = parent.element.id;
715
735
  var toolbarArea = parent.element.querySelector('#' + id + '_toolbarArea');
716
736
  var contextualToolbarArea = parent.element.querySelector('#' + id + '_contextualToolbarArea');
737
+ if (!contextualToolbarArea) {
738
+ return;
739
+ }
717
740
  contextualToolbarArea.classList.remove('e-hide');
718
741
  contextualToolbarArea.style.left = toolbarArea.offsetLeft + 'px';
719
742
  if (type === 'filter') {
@@ -743,15 +766,13 @@ var ToolbarModule = /** @class */ (function () {
743
766
  this.renderSlider(cType, isSelect);
744
767
  }
745
768
  }
746
- if (!isBlazor()) {
747
- if (parent.toolbarTemplate) {
748
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
749
- }
750
- else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
751
- this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
752
- }
753
- parent.toolbarHeight = this.toolbarHeight;
769
+ if (parent.toolbarTemplate) {
770
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbarArea').clientHeight;
771
+ }
772
+ else if (parent.element.querySelector('#' + parent.element.id + '_toolbar')) {
773
+ this.toolbarHeight = parent.element.querySelector('#' + parent.element.id + '_toolbar').clientHeight;
754
774
  }
775
+ parent.toolbarHeight = this.toolbarHeight;
755
776
  if (Browser.isDevice) {
756
777
  var cHt = contextualToolbarArea.offsetHeight + 1;
757
778
  var cusWrapper = parent.element.querySelector('#' + id + '_customizeWrapper');
@@ -1539,7 +1560,7 @@ var ToolbarModule = /** @class */ (function () {
1539
1560
  }
1540
1561
  return toolbarItems;
1541
1562
  };
1542
- ToolbarModule.prototype.initCropTransformToolbar = function (shape) {
1563
+ ToolbarModule.prototype.initCropTransformToolbar = function (shape, isTransform) {
1543
1564
  var _this = this;
1544
1565
  var parent = this.parent;
1545
1566
  var id = parent.element.id;
@@ -1583,7 +1604,7 @@ var ToolbarModule = /** @class */ (function () {
1583
1604
  toolbar.refreshOverflow();
1584
1605
  }
1585
1606
  }
1586
- if (document.getElementById(id + '_cropBtn')) {
1607
+ if (document.getElementById(id + '_cropBtn') && isNullOrUndefined(isTransform)) {
1587
1608
  if (!Browser.isDevice) {
1588
1609
  parent.notify('draw', { prop: 'select', onPropertyChange: false,
1589
1610
  value: { type: _this.getCropTextContent(document.getElementById(id + '_cropBtn')).toLowerCase(),
@@ -1782,7 +1803,7 @@ var ToolbarModule = /** @class */ (function () {
1782
1803
  },
1783
1804
  beforeClose: function () {
1784
1805
  fillDDB_1.toggle();
1785
- }
1806
+ },
1786
1807
  }, '#' + id + '_shape_fill');
1787
1808
  var fillDDB_1 = new DropDownButton({
1788
1809
  open: function (args) {
@@ -2256,7 +2277,7 @@ var ToolbarModule = /** @class */ (function () {
2256
2277
  fontSizeBtn_1.appendTo('#' + id + '_fontSizeBtn');
2257
2278
  }
2258
2279
  };
2259
- ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType, shape) {
2280
+ ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType, shape, isTransform) {
2260
2281
  var parent = this.parent;
2261
2282
  var id = parent.element.id;
2262
2283
  if (!parent.isImageLoaded || parent.isCropToolbar) {
@@ -2273,10 +2294,18 @@ var ToolbarModule = /** @class */ (function () {
2273
2294
  getComponent(cusWrapper, 'toolbar').destroy();
2274
2295
  cusWrapper.innerHTML = '';
2275
2296
  }
2276
- if (toolbarElement && this.defToolbarItems.length > 0) {
2297
+ if (toolbarElement && toolbarElement.classList.contains('e-control') && this.defToolbarItems.length > 0) {
2277
2298
  getComponent(toolbarElement, 'toolbar').destroy();
2278
2299
  toolbarElement.innerHTML = '';
2279
2300
  }
2301
+ if (toolbarElement && (this.defToolbarItems.length > 0 ||
2302
+ parent.toolbar && parent.toolbar.length > 0 && parent.toolbar.indexOf('Open') === -1)) {
2303
+ var toolbar_9 = getComponent(toolbarElement, 'toolbar');
2304
+ if (!isNullOrUndefined(toolbar_9)) {
2305
+ toolbar_9.destroy();
2306
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
2307
+ }
2308
+ }
2280
2309
  if (bottomToolbar && this.defToolbarItems.length > 0) {
2281
2310
  if (bottomToolbar.className.indexOf('e-control') > -1) {
2282
2311
  getComponent(bottomToolbar, 'toolbar').destroy();
@@ -2377,14 +2406,18 @@ var ToolbarModule = /** @class */ (function () {
2377
2406
  this.updateContextualToolbar(type, cType);
2378
2407
  break;
2379
2408
  case 'croptransform':
2380
- parent.allowDownScale = false;
2381
- parent.isCropTab = true;
2409
+ if (isNullOrUndefined(isTransform)) {
2410
+ parent.allowDownScale = false;
2411
+ parent.isCropTab = true;
2412
+ }
2382
2413
  if (Browser.isDevice) {
2383
2414
  this.initMainToolbar(false, true, true);
2384
2415
  }
2385
- parent.updateCropTransformItems();
2386
- this.initCropTransformToolbar(shape);
2387
- if (Browser.isDevice) {
2416
+ if (isNullOrUndefined(isTransform)) {
2417
+ parent.updateCropTransformItems();
2418
+ }
2419
+ this.initCropTransformToolbar(shape, isTransform);
2420
+ if (Browser.isDevice && this.isToolbar()) {
2388
2421
  this.updateContextualToolbar('color', 'straighten', true);
2389
2422
  }
2390
2423
  break;
@@ -2410,17 +2443,21 @@ var ToolbarModule = /** @class */ (function () {
2410
2443
  this.currToolbar = type;
2411
2444
  this.refreshDropDownBtn(isCropping);
2412
2445
  };
2413
- ToolbarModule.prototype.performCropTransformClick = function (shape) {
2446
+ ToolbarModule.prototype.performCropTransformClick = function (shape, isTransform) {
2414
2447
  var parent = this.parent;
2415
- parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
2416
- parent.tempStraighten = parent.transform.straighten;
2417
- if (parent.currObjType.isFiltered) {
2418
- parent.okBtn();
2448
+ if (isNullOrUndefined(isTransform)) {
2449
+ parent.notify('draw', { prop: 'setTempStraightenZoomDeg' });
2450
+ parent.tempStraighten = parent.transform.straighten;
2451
+ if (parent.currObjType.isFiltered) {
2452
+ parent.okBtn();
2453
+ }
2454
+ parent.isStraightening = true;
2455
+ }
2456
+ this.refreshToolbar('croptransform', null, null, null, null, shape, isTransform);
2457
+ if (isNullOrUndefined(isTransform)) {
2458
+ parent.notify('draw', { prop: 'setDestForStraighten' });
2459
+ parent.notify('draw', { prop: 'setTempDestForStraighten' });
2419
2460
  }
2420
- parent.isStraightening = true;
2421
- this.refreshToolbar('croptransform', null, null, null, null, shape);
2422
- parent.notify('draw', { prop: 'setDestForStraighten' });
2423
- parent.notify('draw', { prop: 'setTempDestForStraighten' });
2424
2461
  };
2425
2462
  ToolbarModule.prototype.getAdjustmentToolbarItem = function () {
2426
2463
  var toolbarItems = [];
@@ -2744,15 +2781,15 @@ var ToolbarModule = /** @class */ (function () {
2744
2781
  if (Browser.isDevice) {
2745
2782
  if (document.getElementById(id + '_bottomToolbar')) {
2746
2783
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2747
- var toolbar_9 = getComponent(id + '_bottomToolbar', 'toolbar');
2748
- toolbar_9.refreshOverflow();
2784
+ var toolbar_10 = getComponent(id + '_bottomToolbar', 'toolbar');
2785
+ toolbar_10.refreshOverflow();
2749
2786
  }
2750
2787
  }
2751
2788
  else {
2752
2789
  if (document.getElementById(id + '_toolbar')) {
2753
2790
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2754
- var toolbar_10 = getComponent(id + '_toolbar', 'toolbar');
2755
- toolbar_10.refreshOverflow();
2791
+ var toolbar_11 = getComponent(id + '_toolbar', 'toolbar');
2792
+ toolbar_11.refreshOverflow();
2756
2793
  }
2757
2794
  }
2758
2795
  }
@@ -3076,15 +3113,15 @@ var ToolbarModule = /** @class */ (function () {
3076
3113
  if (Browser.isDevice) {
3077
3114
  if (document.getElementById(id + '_bottomToolbar')) {
3078
3115
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3079
- var toolbar_11 = getComponent(id + '_bottomToolbar', 'toolbar');
3080
- toolbar_11.refreshOverflow();
3116
+ var toolbar_12 = getComponent(id + '_bottomToolbar', 'toolbar');
3117
+ toolbar_12.refreshOverflow();
3081
3118
  }
3082
3119
  }
3083
3120
  else {
3084
3121
  if (document.getElementById(id + '_toolbar')) {
3085
3122
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3086
- var toolbar_12 = getComponent(id + '_toolbar', 'toolbar');
3087
- toolbar_12.refreshOverflow();
3123
+ var toolbar_13 = getComponent(id + '_toolbar', 'toolbar');
3124
+ toolbar_13.refreshOverflow();
3088
3125
  }
3089
3126
  }
3090
3127
  }
@@ -3151,15 +3188,15 @@ var ToolbarModule = /** @class */ (function () {
3151
3188
  if (Browser.isDevice) {
3152
3189
  if (document.getElementById(id + '_bottomToolbar')) {
3153
3190
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3154
- var toolbar_13 = getComponent(id + '_bottomToolbar', 'toolbar');
3155
- toolbar_13.refreshOverflow();
3191
+ var toolbar_14 = getComponent(id + '_bottomToolbar', 'toolbar');
3192
+ toolbar_14.refreshOverflow();
3156
3193
  }
3157
3194
  }
3158
3195
  else {
3159
3196
  if (document.getElementById(id + '_toolbar')) {
3160
3197
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3161
- var toolbar_14 = getComponent(id + '_toolbar', 'toolbar');
3162
- toolbar_14.refreshOverflow();
3198
+ var toolbar_15 = getComponent(id + '_toolbar', 'toolbar');
3199
+ toolbar_15.refreshOverflow();
3163
3200
  }
3164
3201
  }
3165
3202
  }
@@ -3226,15 +3263,15 @@ var ToolbarModule = /** @class */ (function () {
3226
3263
  if (Browser.isDevice) {
3227
3264
  if (document.getElementById(id + '_bottomToolbar')) {
3228
3265
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3229
- var toolbar_15 = getComponent(id + '_bottomToolbar', 'toolbar');
3230
- toolbar_15.refreshOverflow();
3266
+ var toolbar_16 = getComponent(id + '_bottomToolbar', 'toolbar');
3267
+ toolbar_16.refreshOverflow();
3231
3268
  }
3232
3269
  }
3233
3270
  else {
3234
3271
  if (document.getElementById(id + '_toolbar')) {
3235
3272
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3236
- var toolbar_16 = getComponent(id + '_toolbar', 'toolbar');
3237
- toolbar_16.refreshOverflow();
3273
+ var toolbar_17 = getComponent(id + '_toolbar', 'toolbar');
3274
+ toolbar_17.refreshOverflow();
3238
3275
  }
3239
3276
  }
3240
3277
  }
@@ -3302,15 +3339,15 @@ var ToolbarModule = /** @class */ (function () {
3302
3339
  if (Browser.isDevice) {
3303
3340
  if (document.getElementById(id + '_bottomToolbar')) {
3304
3341
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3305
- var toolbar_17 = getComponent(id + '_bottomToolbar', 'toolbar');
3306
- toolbar_17.refreshOverflow();
3342
+ var toolbar_18 = getComponent(id + '_bottomToolbar', 'toolbar');
3343
+ toolbar_18.refreshOverflow();
3307
3344
  }
3308
3345
  }
3309
3346
  else {
3310
3347
  if (document.getElementById(id + '_toolbar')) {
3311
3348
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3312
- var toolbar_18 = getComponent(id + '_toolbar', 'toolbar');
3313
- toolbar_18.refreshOverflow();
3349
+ var toolbar_19 = getComponent(id + '_toolbar', 'toolbar');
3350
+ toolbar_19.refreshOverflow();
3314
3351
  }
3315
3352
  }
3316
3353
  }
@@ -3377,15 +3414,15 @@ var ToolbarModule = /** @class */ (function () {
3377
3414
  if (Browser.isDevice) {
3378
3415
  if (document.getElementById(id + '_bottomToolbar')) {
3379
3416
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3380
- var toolbar_19 = getComponent(id + '_bottomToolbar', 'toolbar');
3381
- toolbar_19.refreshOverflow();
3417
+ var toolbar_20 = getComponent(id + '_bottomToolbar', 'toolbar');
3418
+ toolbar_20.refreshOverflow();
3382
3419
  }
3383
3420
  }
3384
3421
  else {
3385
3422
  if (document.getElementById(id + '_toolbar')) {
3386
3423
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3387
- var toolbar_20 = getComponent(id + '_toolbar', 'toolbar');
3388
- toolbar_20.refreshOverflow();
3424
+ var toolbar_21 = getComponent(id + '_toolbar', 'toolbar');
3425
+ toolbar_21.refreshOverflow();
3389
3426
  }
3390
3427
  }
3391
3428
  }
@@ -3450,15 +3487,15 @@ var ToolbarModule = /** @class */ (function () {
3450
3487
  if (Browser.isDevice) {
3451
3488
  if (document.getElementById(id + '_bottomToolbar')) {
3452
3489
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3453
- var toolbar_21 = getComponent(id + '_bottomToolbar', 'toolbar');
3454
- toolbar_21.refreshOverflow();
3490
+ var toolbar_22 = getComponent(id + '_bottomToolbar', 'toolbar');
3491
+ toolbar_22.refreshOverflow();
3455
3492
  }
3456
3493
  }
3457
3494
  else {
3458
3495
  if (document.getElementById(id + '_toolbar')) {
3459
3496
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
3460
- var toolbar_22 = getComponent(id + '_toolbar', 'toolbar');
3461
- toolbar_22.refreshOverflow();
3497
+ var toolbar_23 = getComponent(id + '_toolbar', 'toolbar');
3498
+ toolbar_23.refreshOverflow();
3462
3499
  }
3463
3500
  }
3464
3501
  }
@@ -3782,33 +3819,7 @@ var ToolbarModule = /** @class */ (function () {
3782
3819
  break;
3783
3820
  case 'edittext':
3784
3821
  if (!parent.element.querySelector('#' + id + '_editText').classList.contains('e-disabled')) {
3785
- this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3786
- parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
3787
- value: { obj: extend({}, parent.activeObj, {}, true) } });
3788
- parent.notify('selection', { prop: 'setInitialTextEdit', onPropertyChange: false,
3789
- value: { bool: true } });
3790
- parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
3791
- value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
3792
- if (parent.activeObj.rotatedAngle !== 0) {
3793
- var object_1 = { x: points.x, y: points.y };
3794
- parent.notify('shape', { prop: 'getTextBoxPosition', onPropertyChange: false,
3795
- value: { obj: parent.activeObj, object: object_1 } });
3796
- points.x = object_1['x'];
3797
- points.y = object_1['y'];
3798
- var object1 = { x: points.x, y: points.y };
3799
- parent.notify('shape', { prop: 'setFlipState', onPropertyChange: false,
3800
- value: { x: points.x, y: points.y, obj: parent.activeObj, object: object1 } });
3801
- points.x = object1['x'];
3802
- points.y = object1['y'];
3803
- }
3804
- parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
3805
- value: { x: points.x, y: points.y, actObj: parent.activeObj } });
3806
- if (isNullOrUndefined(parent.activeObj.currIndex)) {
3807
- parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
3808
- }
3809
- if (document.getElementById(id + '_quickAccessToolbarArea')) {
3810
- document.getElementById(id + '_quickAccessToolbarArea').style.display = 'none';
3811
- }
3822
+ this.editText();
3812
3823
  }
3813
3824
  break;
3814
3825
  case 'rotleft':
@@ -3841,6 +3852,37 @@ var ToolbarModule = /** @class */ (function () {
3841
3852
  parent.trigger('quickAccessToolbarItemClick', args);
3842
3853
  }
3843
3854
  };
3855
+ ToolbarModule.prototype.editText = function () {
3856
+ var parent = this.parent;
3857
+ var points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
3858
+ this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
3859
+ parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
3860
+ value: { obj: extend({}, parent.activeObj, {}, true) } });
3861
+ parent.notify('selection', { prop: 'setInitialTextEdit', onPropertyChange: false,
3862
+ value: { bool: true } });
3863
+ parent.notify('draw', { prop: 'setPrevActObj', onPropertyChange: false,
3864
+ value: { prevActObj: extend({}, parent.activeObj, {}, true) } });
3865
+ if (parent.activeObj.rotatedAngle !== 0) {
3866
+ var object = { x: points.x, y: points.y };
3867
+ parent.notify('shape', { prop: 'getTextBoxPosition', onPropertyChange: false,
3868
+ value: { obj: parent.activeObj, object: object } });
3869
+ points.x = object['x'];
3870
+ points.y = object['y'];
3871
+ var object1 = { x: points.x, y: points.y };
3872
+ parent.notify('shape', { prop: 'setFlipState', onPropertyChange: false,
3873
+ value: { x: points.x, y: points.y, obj: parent.activeObj, object: object1 } });
3874
+ points.x = object1['x'];
3875
+ points.y = object1['y'];
3876
+ }
3877
+ parent.notify('shape', { prop: 'renderTextArea', onPropertyChange: false,
3878
+ value: { x: points.x, y: points.y, actObj: parent.activeObj } });
3879
+ if (isNullOrUndefined(parent.activeObj.currIndex)) {
3880
+ parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
3881
+ }
3882
+ if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
3883
+ document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
3884
+ }
3885
+ };
3844
3886
  ToolbarModule.prototype.duplicateShape = function (isPreventUndoRedo, isPublicMethod) {
3845
3887
  var parent = this.parent;
3846
3888
  var tempObj = { activePoint: { startX: 0, startY: 0, endX: 0, endY: 0, width: 0, height: 0 },
@@ -4094,7 +4136,6 @@ var ToolbarModule = /** @class */ (function () {
4094
4136
  parseFloat(getComponent(aspectRatioHeight, 'numerictextbox').placeholder);
4095
4137
  parent.notify('transform', { prop: 'resize', value: { width: parent.aspectWidth, height: parent.aspectHeight, isAspectRatio: false } });
4096
4138
  }
4097
- parent.cancelCropSelection = null;
4098
4139
  parent.resizeSrc = { startX: parent.img.srcLeft, startY: parent.img.srcTop, width: parent.img.srcWidth,
4099
4140
  height: parent.img.srcHeight };
4100
4141
  this.refreshToolbar('resize');
@@ -4790,91 +4831,93 @@ var ToolbarModule = /** @class */ (function () {
4790
4831
  if (!parent.isImageLoaded) {
4791
4832
  return;
4792
4833
  }
4793
- var selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
4794
- var selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
4795
- var selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
4796
- var selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
4797
- var strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
4798
- var fontFamilyElem = parent.element.querySelector('.e-text-font-family');
4799
- var fontSizeElem = parent.element.querySelector('.e-text-font-size');
4800
- var boldBtn = parent.element.querySelector('#' + id + '_bold');
4801
- var italicBtn = parent.element.querySelector('#' + id + '_italic');
4802
- if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
4803
- if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
4804
- parent.activeObj.strokeSettings.strokeWidth = 2;
4805
- }
4806
- if (selFillElem) {
4807
- var value = parent.activeObj.strokeSettings.fillColor;
4808
- if (parent.activeObj.strokeSettings.fillColor === '') {
4809
- selFillElem.classList.add('e-nocolor-item');
4810
- }
4811
- else {
4812
- selFillElem.classList.remove('e-nocolor-item');
4813
- selFillElem.style.background = value;
4814
- }
4815
- if (document.querySelector('#' + id + '_shape_fill')) {
4816
- getComponent(id + '_shape_fill', 'colorpicker').value = value;
4817
- }
4818
- }
4819
- if (selStrokeElem) {
4820
- var value = parent.activeObj.strokeSettings.strokeColor;
4821
- selStrokeElem.style.background = value;
4822
- if (document.querySelector('#' + id + '_shape_stroke')) {
4823
- getComponent(id + '_shape_stroke', 'colorpicker').value = value;
4824
- }
4825
- }
4826
- if (selTextStrokeElem) {
4827
- var value = parent.activeObj.strokeSettings.strokeColor;
4828
- selTextStrokeElem.style.background = value;
4829
- if (document.querySelector('#' + id + '_text_font')) {
4830
- getComponent(id + '_text_font', 'colorpicker').value = value;
4834
+ if (this.isToolbar()) {
4835
+ var selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
4836
+ var selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
4837
+ var selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
4838
+ var selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
4839
+ var strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
4840
+ var fontFamilyElem = parent.element.querySelector('.e-text-font-family');
4841
+ var fontSizeElem = parent.element.querySelector('.e-text-font-size');
4842
+ var boldBtn = parent.element.querySelector('#' + id + '_bold');
4843
+ var italicBtn = parent.element.querySelector('#' + id + '_italic');
4844
+ if (parent.activeObj.strokeSettings && parent.activeObj.textSettings) {
4845
+ if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
4846
+ parent.activeObj.strokeSettings.strokeWidth = 2;
4847
+ }
4848
+ if (selFillElem) {
4849
+ var value = parent.activeObj.strokeSettings.fillColor;
4850
+ if (parent.activeObj.strokeSettings.fillColor === '') {
4851
+ selFillElem.classList.add('e-nocolor-item');
4852
+ }
4853
+ else {
4854
+ selFillElem.classList.remove('e-nocolor-item');
4855
+ selFillElem.style.background = value;
4856
+ }
4857
+ if (document.querySelector('#' + id + '_shape_fill')) {
4858
+ getComponent(id + '_shape_fill', 'colorpicker').value = value;
4859
+ }
4831
4860
  }
4832
- }
4833
- if (selPenStrokeElem) {
4834
- var value = parent.activeObj.strokeSettings.strokeColor;
4835
- selPenStrokeElem.style.background = value;
4836
- if (document.querySelector('#' + id + '_pen_stroke')) {
4837
- getComponent(id + '_pen_stroke', 'colorpicker').value = value;
4861
+ if (selStrokeElem) {
4862
+ var value = parent.activeObj.strokeSettings.strokeColor;
4863
+ selStrokeElem.style.background = value;
4864
+ if (document.querySelector('#' + id + '_shape_stroke')) {
4865
+ getComponent(id + '_shape_stroke', 'colorpicker').value = value;
4866
+ }
4838
4867
  }
4839
- var obj = { penOpacity: 1 };
4840
- parent.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
4841
- }
4842
- if (fontFamilyElem) {
4843
- if (Browser.isDevice) {
4844
- fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
4868
+ if (selTextStrokeElem) {
4869
+ var value = parent.activeObj.strokeSettings.strokeColor;
4870
+ selTextStrokeElem.style.background = value;
4871
+ if (document.querySelector('#' + id + '_text_font')) {
4872
+ getComponent(id + '_text_font', 'colorpicker').value = value;
4873
+ }
4845
4874
  }
4846
- else {
4847
- fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
4875
+ if (selPenStrokeElem) {
4876
+ var value = parent.activeObj.strokeSettings.strokeColor;
4877
+ selPenStrokeElem.style.background = value;
4878
+ if (document.querySelector('#' + id + '_pen_stroke')) {
4879
+ getComponent(id + '_pen_stroke', 'colorpicker').value = value;
4880
+ }
4881
+ var obj = { penOpacity: 1 };
4882
+ parent.notify('freehand-draw', { prop: 'getPenOpacity', onPropertyChange: false, value: { obj: obj } });
4848
4883
  }
4849
- }
4850
- if (fontSizeElem) {
4851
- for (var i = 0; i < parent.fontSizeColl.length; i++) {
4852
- if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
4853
- fontSizeElem.textContent = (i + 1).toString();
4854
- break;
4884
+ if (fontFamilyElem) {
4885
+ if (Browser.isDevice) {
4886
+ fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
4887
+ }
4888
+ else {
4889
+ fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
4855
4890
  }
4856
4891
  }
4857
- }
4858
- if (boldBtn) {
4859
- if (parent.activeObj.textSettings.bold) {
4860
- boldBtn.classList.add('e-selected-btn');
4892
+ if (fontSizeElem) {
4893
+ for (var i = 0; i < parent.fontSizeColl.length; i++) {
4894
+ if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
4895
+ fontSizeElem.textContent = (i + 1).toString();
4896
+ break;
4897
+ }
4898
+ }
4861
4899
  }
4862
- else {
4863
- boldBtn.classList.remove('e-selected-btn');
4900
+ if (boldBtn) {
4901
+ if (parent.activeObj.textSettings.bold) {
4902
+ boldBtn.classList.add('e-selected-btn');
4903
+ }
4904
+ else {
4905
+ boldBtn.classList.remove('e-selected-btn');
4906
+ }
4864
4907
  }
4865
- }
4866
- if (italicBtn) {
4867
- if (parent.activeObj.textSettings.italic) {
4868
- italicBtn.classList.add('e-selected-btn');
4908
+ if (italicBtn) {
4909
+ if (parent.activeObj.textSettings.italic) {
4910
+ italicBtn.classList.add('e-selected-btn');
4911
+ }
4912
+ else {
4913
+ italicBtn.classList.remove('e-selected-btn');
4914
+ }
4869
4915
  }
4870
- else {
4871
- italicBtn.classList.remove('e-selected-btn');
4916
+ if (strokeWidthElem) {
4917
+ var strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
4918
+ strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
4872
4919
  }
4873
4920
  }
4874
- if (strokeWidthElem) {
4875
- var strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
4876
- strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
4877
- }
4878
4921
  }
4879
4922
  };
4880
4923
  ToolbarModule.prototype.getStrokeWidth = function (text) {