@syncfusion/ej2-image-editor 24.1.46 → 24.2.4

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 (68) hide show
  1. package/CHANGELOG.md +12 -0
  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 +189 -39
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +189 -39
  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 +11 -11
  12. package/src/image-editor/action/draw.js +3 -0
  13. package/src/image-editor/action/selection.d.ts +1 -0
  14. package/src/image-editor/action/selection.js +11 -2
  15. package/src/image-editor/action/shape.js +6 -6
  16. package/src/image-editor/action/undo-redo.d.ts +1 -0
  17. package/src/image-editor/action/undo-redo.js +43 -6
  18. package/src/image-editor/renderer/toolbar.d.ts +4 -0
  19. package/src/image-editor/renderer/toolbar.js +126 -25
  20. package/styles/bootstrap-dark.css +12 -0
  21. package/styles/bootstrap.css +12 -0
  22. package/styles/bootstrap4.css +12 -0
  23. package/styles/bootstrap5-dark.css +12 -0
  24. package/styles/bootstrap5.css +12 -0
  25. package/styles/fabric-dark.css +12 -0
  26. package/styles/fabric.css +12 -0
  27. package/styles/fluent-dark.css +12 -0
  28. package/styles/fluent.css +12 -0
  29. package/styles/highcontrast-light.css +12 -0
  30. package/styles/highcontrast.css +12 -0
  31. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  32. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  33. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  34. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  35. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  36. package/styles/image-editor/_fabric-definition.scss +1 -0
  37. package/styles/image-editor/_fluent-definition.scss +1 -0
  38. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  39. package/styles/image-editor/_highcontrast-definition.scss +1 -0
  40. package/styles/image-editor/_highcontrast-light-definition.scss +1 -0
  41. package/styles/image-editor/_layout.scss +32 -2
  42. package/styles/image-editor/_material-dark-definition.scss +1 -0
  43. package/styles/image-editor/_material-definition.scss +1 -0
  44. package/styles/image-editor/_material3-definition.scss +3 -2
  45. package/styles/image-editor/_tailwind-definition.scss +1 -0
  46. package/styles/image-editor/bootstrap-dark.css +12 -0
  47. package/styles/image-editor/bootstrap.css +12 -0
  48. package/styles/image-editor/bootstrap4.css +12 -0
  49. package/styles/image-editor/bootstrap5-dark.css +12 -0
  50. package/styles/image-editor/bootstrap5.css +12 -0
  51. package/styles/image-editor/fabric-dark.css +12 -0
  52. package/styles/image-editor/fabric.css +12 -0
  53. package/styles/image-editor/fluent-dark.css +12 -0
  54. package/styles/image-editor/fluent.css +12 -0
  55. package/styles/image-editor/highcontrast-light.css +12 -0
  56. package/styles/image-editor/highcontrast.css +12 -0
  57. package/styles/image-editor/material-dark.css +12 -0
  58. package/styles/image-editor/material.css +12 -0
  59. package/styles/image-editor/material3-dark.css +25 -4
  60. package/styles/image-editor/material3.css +25 -4
  61. package/styles/image-editor/tailwind-dark.css +15 -2
  62. package/styles/image-editor/tailwind.css +15 -2
  63. package/styles/material-dark.css +12 -0
  64. package/styles/material.css +12 -0
  65. package/styles/material3-dark.css +25 -4
  66. package/styles/material3.css +25 -4
  67. package/styles/tailwind-dark.css +15 -2
  68. package/styles/tailwind.css +15 -2
@@ -4894,6 +4894,9 @@ var Draw = /** @__PURE__ @class */ (function () {
4894
4894
  if (lastDotIndex !== -1) {
4895
4895
  return url.slice(lastDotIndex + 1).toLowerCase();
4896
4896
  }
4897
+ else if (url.indexOf('base64') !== -1) {
4898
+ return url.slice(url.indexOf('/') + 1, url.indexOf(';')).toLowerCase();
4899
+ }
4897
4900
  return null;
4898
4901
  };
4899
4902
  Draw.prototype.fileSelect = function (inputElement, args) {
@@ -8318,6 +8321,7 @@ var Selection = /** @__PURE__ @class */ (function () {
8318
8321
  this.isImageClarity = true;
8319
8322
  this.isPinching = false;
8320
8323
  this.isSliding = false;
8324
+ this.mouseDown = '';
8321
8325
  this.parent = parent;
8322
8326
  this.addEventListener();
8323
8327
  }
@@ -8606,6 +8610,7 @@ var Selection = /** @__PURE__ @class */ (function () {
8606
8610
  this.currentDrawingShape = '';
8607
8611
  this.initialPrevObj = {};
8608
8612
  this.resizedElement = '';
8613
+ this.mouseDown = '';
8609
8614
  };
8610
8615
  Selection.prototype.performTabAction = function () {
8611
8616
  var parent = this.parent;
@@ -11024,6 +11029,8 @@ var Selection = /** @__PURE__ @class */ (function () {
11024
11029
  Selection.prototype.mouseDownEventHandler = function (e) {
11025
11030
  var _this = this;
11026
11031
  var parent = this.parent;
11032
+ this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
11033
+ 'canvas' : '';
11027
11034
  if (e.type === 'touchstart') {
11028
11035
  this.isTouch = true;
11029
11036
  }
@@ -11461,6 +11468,10 @@ var Selection = /** @__PURE__ @class */ (function () {
11461
11468
  && !parent.element.querySelector('#' + id + '_headWrapper').parentElement.classList.contains('e-hide')))) {
11462
11469
  return;
11463
11470
  }
11471
+ else if (e.currentTarget === document && this.mouseDown === '') {
11472
+ e.stopImmediatePropagation();
11473
+ return;
11474
+ }
11464
11475
  if (e.type === 'touchstart') {
11465
11476
  this.isTouch = false;
11466
11477
  }
@@ -11582,13 +11593,13 @@ var Selection = /** @__PURE__ @class */ (function () {
11582
11593
  if (this.currentDrawingShape === 'text') {
11583
11594
  var prevCropObj_1 = extend({}, parent.cropObj, {}, true);
11584
11595
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
11585
- value: { operation: 'shapeTransform', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11596
+ value: { operation: 'shapeInsert', previousObj: this.initialPrevObj, previousObjColl: this.initialPrevObj.objColl,
11586
11597
  previousPointColl: this.initialPrevObj.pointColl, previousSelPointColl: this.initialPrevObj.selPointColl,
11587
11598
  previousCropObj: prevCropObj_1, previousText: null,
11588
11599
  currentText: null, previousFilter: null, isCircleCrop: null } });
11589
11600
  }
11590
11601
  else {
11591
- parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl } });
11602
+ parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: this.initialPrevObj.objColl, operation: 'shapeInsert' } });
11592
11603
  }
11593
11604
  this.isShapeInserted = true;
11594
11605
  this.currentDrawingShape = '';
@@ -11720,6 +11731,7 @@ var Selection = /** @__PURE__ @class */ (function () {
11720
11731
  parent.currObjType.shape = '';
11721
11732
  }
11722
11733
  this.dragElement = '';
11734
+ this.mouseDown = '';
11723
11735
  parent.currObjType.isInitialLine = parent.currObjType.isDragging = false;
11724
11736
  this.selMouseUpEvent();
11725
11737
  };
@@ -13751,7 +13763,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13751
13763
  parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
13752
13764
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl_1 } });
13753
13765
  if (parent.isPublicMethod) {
13754
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13766
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13755
13767
  }
13756
13768
  parent.isPublicMethod = false;
13757
13769
  });
@@ -13777,7 +13789,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13777
13789
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
13778
13790
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
13779
13791
  if (parent.isPublicMethod) {
13780
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13792
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13781
13793
  }
13782
13794
  parent.isPublicMethod = false;
13783
13795
  }
@@ -13875,7 +13887,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13875
13887
  parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs, null).then(function (shapeChangingArgs) {
13876
13888
  _this.drawShapeTextEvent(shapeChangingArgs);
13877
13889
  if (parent.isPublicMethod) {
13878
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13890
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13879
13891
  }
13880
13892
  parent.isPublicMethod = false;
13881
13893
  });
@@ -13884,7 +13896,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13884
13896
  parent.trigger('shapeChanging', shapeChangingArgs);
13885
13897
  this.drawShapeTextEvent(shapeChangingArgs);
13886
13898
  if (parent.isPublicMethod) {
13887
- parent.notify('undo-redo', { prop: 'updateUndoRedo', onPropertyChange: false });
13899
+ parent.notify('undo-redo', { prop: 'updateUndoRedo', value: { operation: 'shapeInsert' }, onPropertyChange: false });
13888
13900
  }
13889
13901
  parent.isPublicMethod = false;
13890
13902
  }
@@ -13897,7 +13909,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13897
13909
  parent.objColl.push(parent.activeObj);
13898
13910
  var prevCropObj = extend({}, parent.cropObj, {}, true);
13899
13911
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13900
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13912
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13901
13913
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl, previousCropObj: prevCropObj,
13902
13914
  previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13903
13915
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -13928,7 +13940,7 @@ var Shape = /** @__PURE__ @class */ (function () {
13928
13940
  parent.objColl.push(parent.activeObj);
13929
13941
  var prevCropObj = extend({}, parent.cropObj, {}, true);
13930
13942
  parent.notify('undo-redo', { prop: 'updateUndoRedoColl', onPropertyChange: false,
13931
- value: { operation: 'shapeTransform', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13943
+ value: { operation: 'shapeInsert', previousObj: this.prevObj, previousObjColl: this.prevObj.objColl,
13932
13944
  previousPointColl: this.prevObj.pointColl, previousSelPointColl: this.prevObj.selPointColl,
13933
13945
  previousCropObj: prevCropObj, previousText: null, currentText: null, previousFilter: null, isCircleCrop: null } });
13934
13946
  parent.notify('selection', { prop: 'redrawShape', onPropertyChange: false,
@@ -19179,10 +19191,10 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19179
19191
  this.redo();
19180
19192
  break;
19181
19193
  case 'updateUrObj':
19182
- this.updateUrObj(args.value['objColl']);
19194
+ this.updateUrObj(args.value['objColl'], args.value['operation']);
19183
19195
  break;
19184
19196
  case 'updateUndoRedo':
19185
- this.updateUndoRedo();
19197
+ this.updateUndoRedo(args.value ? args.value['operation'] : null);
19186
19198
  break;
19187
19199
  case 'getAppliedUndoRedoColl':
19188
19200
  args.value['obj']['appliedUndoRedoColl'] = this.appliedUndoRedoColl;
@@ -19389,6 +19401,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19389
19401
  UndoRedo.prototype.undo = function () {
19390
19402
  var parent = this.parent;
19391
19403
  this.cancelCropSelection();
19404
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19392
19405
  if (!parent.disabled && parent.isImageLoaded) {
19393
19406
  if (this.undoRedoStep > 0) {
19394
19407
  this.refreshToolbarActions();
@@ -19449,6 +19462,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19449
19462
  case 'invert':
19450
19463
  case 'sharpen':
19451
19464
  case 'imageRotate':
19465
+ case 'shapeInsert':
19452
19466
  this.shapeTransform(obj.previousObjColl);
19453
19467
  break;
19454
19468
  case 'freehanddraw':
@@ -19526,6 +19540,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19526
19540
  UndoRedo.prototype.redo = function () {
19527
19541
  var parent = this.parent;
19528
19542
  this.cancelCropSelection();
19543
+ parent.notify('draw', { prop: 'resetFrameZoom', onPropertyChange: false, value: { isOk: false } });
19529
19544
  if (!parent.disabled && parent.isImageLoaded) {
19530
19545
  if (this.undoRedoStep < this.appliedUndoRedoColl.length) {
19531
19546
  this.refreshToolbarActions();
@@ -19582,6 +19597,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19582
19597
  case 'invert':
19583
19598
  case 'sharpen':
19584
19599
  case 'imageRotate':
19600
+ case 'shapeInsert':
19585
19601
  this.shapeTransform(obj.currentObjColl);
19586
19602
  break;
19587
19603
  case 'freehanddraw':
@@ -19919,6 +19935,37 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19919
19935
  }
19920
19936
  parent.notify('filter', { prop: 'setAdjustmentValue', onPropertyChange: false, value: { adjustmentValue: this.lowerContext.filter } });
19921
19937
  parent.currObjType.isCustomCrop = false;
19938
+ if (isBlazor() && parent.events && parent.events.historyChanged.hasDelegate === true) {
19939
+ var imageAction = this.getImageAction(operation);
19940
+ var args = { length: this.undoRedoColl.length, index: this.undoRedoStep, actionTrigger: isUndo ? 'Undo' : 'Redo', imageAction: imageAction };
19941
+ parent.dotNetRef.invokeMethodAsync('OnHistoryChangedAsync', args);
19942
+ }
19943
+ };
19944
+ UndoRedo.prototype.getImageAction = function (operation) {
19945
+ if (['brightness', 'contrast', 'saturation', 'opacity', 'blur', 'hue'].indexOf(operation) !== -1) {
19946
+ return 'FinetuneApplied';
19947
+ }
19948
+ else if (['chrome', 'cold', 'warm', 'grayscale', 'blackandwhite', 'sepia', 'invert'].indexOf(operation) !== -1) {
19949
+ return 'FilterApplied';
19950
+ }
19951
+ else if (operation === 'frame') {
19952
+ return 'FrameApplied';
19953
+ }
19954
+ else if (operation === 'resize') {
19955
+ return 'ImageResized';
19956
+ }
19957
+ else if (['deleteFreehandDrawing', 'deleteObj'].indexOf(operation) !== -1) {
19958
+ return 'ShapeDeleted';
19959
+ }
19960
+ else if (operation === 'crop') {
19961
+ return 'Cropped';
19962
+ }
19963
+ else if (['shapeInsert', 'freehanddraw', 'freehand-draw'].indexOf(operation) !== -1) {
19964
+ return 'ShapeInserted';
19965
+ }
19966
+ else {
19967
+ return 'ShapeCustomized';
19968
+ }
19922
19969
  };
19923
19970
  UndoRedo.prototype.updateUrc = function (operation, previousObj, previousObjColl, previousPointColl, previousSelPointColl, previousCropObj, previousText, currentText, previousFilter, isCircleCrop) {
19924
19971
  var parent = this.parent;
@@ -19986,7 +20033,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19986
20033
  }
19987
20034
  }
19988
20035
  };
19989
- UndoRedo.prototype.updateUrObj = function (objColl) {
20036
+ UndoRedo.prototype.updateUrObj = function (objColl, operation) {
19990
20037
  var parent = this.parent;
19991
20038
  if (parent.allowUndoRedo) {
19992
20039
  if (parent.currObjType.isUndoAction) {
@@ -20007,7 +20054,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
20007
20054
  parent.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
20008
20055
  value: { obj: selPointCollObj } });
20009
20056
  obj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
20010
- this.undoRedoColl.push({ operation: 'shapeTransform', previousObj: obj, currentObj: obj,
20057
+ var oper = operation ? operation : 'shapeTransform';
20058
+ this.undoRedoColl.push({ operation: oper, previousObj: obj, currentObj: obj,
20011
20059
  previousObjColl: objColl, currentObjColl: obj.objColl,
20012
20060
  previousPointColl: obj.pointColl, currentPointColl: obj.pointColl,
20013
20061
  previousSelPointColl: obj.selPointColl, currentSelPointColl: obj.selPointColl,
@@ -20016,7 +20064,7 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
20016
20064
  value: { obj: parent.objColl[parent.objColl.length - 1] } });
20017
20065
  }
20018
20066
  };
20019
- UndoRedo.prototype.updateUndoRedo = function () {
20067
+ UndoRedo.prototype.updateUndoRedo = function (operation) {
20020
20068
  var parent = this.parent;
20021
20069
  var prevCropObj = extend({}, parent.cropObj, {}, true);
20022
20070
  var object = { currObj: {} };
@@ -20033,7 +20081,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
20033
20081
  parent.notify('shape', { prop: 'updImgRatioForActObj', onPropertyChange: false });
20034
20082
  }
20035
20083
  parent.objColl.push(parent.activeObj);
20036
- this.updateUrc('shapeTransform', prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
20084
+ var oper = operation ? operation : 'shapeTransform';
20085
+ this.updateUrc(oper, prevObj, prevObj.objColl, prevObj.pointColl, prevObj.selPointColl, prevCropObj);
20037
20086
  parent.objColl.pop();
20038
20087
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: null } });
20039
20088
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
@@ -25624,7 +25673,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25624
25673
  var args = { toolbarType: parent.activeObj.shape ? parent.activeObj.shape : 'shapes',
25625
25674
  toolbarItems: this.defToolbarItems };
25626
25675
  parent.trigger('toolbarUpdating', args);
25627
- this.defToolbarItems = args.toolbarItems;
25676
+ if (this.isToolbarString(args.toolbarItems)) {
25677
+ items = args.toolbarItems;
25678
+ this.excludeItems(args.toolbarItems);
25679
+ }
25680
+ else {
25681
+ this.defToolbarItems = args.toolbarItems;
25682
+ }
25628
25683
  var toolbar = new Toolbar({
25629
25684
  width: '100%',
25630
25685
  items: this.defToolbarItems,
@@ -25634,8 +25689,12 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25634
25689
  _this.createShapeColor(items);
25635
25690
  _this.createShapeBtn(items);
25636
25691
  if (parent.activeObj.shape === 'arrow') {
25637
- _this.createStartBtn();
25638
- _this.createEndBtn();
25692
+ if (items.some(function (item) { return item.toLowerCase().indexOf('start') > -1; })) {
25693
+ _this.createStartBtn();
25694
+ }
25695
+ if (items.some(function (item) { return item.toLowerCase().indexOf('end') > -1; })) {
25696
+ _this.createEndBtn();
25697
+ }
25639
25698
  }
25640
25699
  _this.wireZoomBtnEvents();
25641
25700
  if (!Browser.isDevice) {
@@ -25799,24 +25858,24 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25799
25858
  ToolbarModule.prototype.createShapeBtn = function (items) {
25800
25859
  var parent = this.parent;
25801
25860
  var id = parent.element.id;
25802
- var strokeWidthItems = [
25803
- { id: '1', text: this.l10n.getConstant('XSmall') },
25804
- { id: '2', text: this.l10n.getConstant('Small') },
25805
- { id: '3', text: this.l10n.getConstant('Medium') },
25806
- { id: '4', text: this.l10n.getConstant('Large') },
25807
- { id: '5', text: this.l10n.getConstant('XLarge') }
25808
- ];
25809
- if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25810
- strokeWidthItems = [
25811
- { id: '1', text: this.l10n.getConstant('NoOutline') },
25812
- { id: '2', text: this.l10n.getConstant('XSmall') },
25813
- { id: '3', text: this.l10n.getConstant('Small') },
25814
- { id: '4', text: this.l10n.getConstant('Medium') },
25815
- { id: '5', text: this.l10n.getConstant('Large') },
25816
- { id: '6', text: this.l10n.getConstant('XLarge') }
25817
- ];
25818
- }
25819
25861
  if (items.indexOf('strokeWidth') > -1) {
25862
+ var strokeWidthItems = [
25863
+ { id: '1', text: this.l10n.getConstant('XSmall') },
25864
+ { id: '2', text: this.l10n.getConstant('Small') },
25865
+ { id: '3', text: this.l10n.getConstant('Medium') },
25866
+ { id: '4', text: this.l10n.getConstant('Large') },
25867
+ { id: '5', text: this.l10n.getConstant('XLarge') }
25868
+ ];
25869
+ if (parent.activeObj.shape && (parent.activeObj.shape === 'rectangle' || parent.activeObj.shape === 'ellipse')) {
25870
+ strokeWidthItems = [
25871
+ { id: '1', text: this.l10n.getConstant('NoOutline') },
25872
+ { id: '2', text: this.l10n.getConstant('XSmall') },
25873
+ { id: '3', text: this.l10n.getConstant('Small') },
25874
+ { id: '4', text: this.l10n.getConstant('Medium') },
25875
+ { id: '5', text: this.l10n.getConstant('Large') },
25876
+ { id: '6', text: this.l10n.getConstant('XLarge') }
25877
+ ];
25878
+ }
25820
25879
  var strokeWidthBtn = document.getElementById(id + '_borderWidthBtn');
25821
25880
  var spanElem_1 = document.createElement('span');
25822
25881
  spanElem_1.innerHTML = this.l10n.getConstant('XSmall');
@@ -26033,7 +26092,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26033
26092
  }
26034
26093
  var args = { toolbarType: 'text', toolbarItems: this.defToolbarItems };
26035
26094
  parent.trigger('toolbarUpdating', args);
26036
- this.defToolbarItems = args.toolbarItems;
26095
+ if (this.isToolbarString(args.toolbarItems)) {
26096
+ items = args.toolbarItems;
26097
+ this.excludeItems(args.toolbarItems);
26098
+ }
26099
+ else {
26100
+ this.defToolbarItems = args.toolbarItems;
26101
+ }
26037
26102
  var toolbar = new Toolbar({
26038
26103
  width: '100%',
26039
26104
  items: this.defToolbarItems,
@@ -26519,7 +26584,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26519
26584
  template: '<button id="' + id + '_penColorBtn"></button>' });
26520
26585
  }
26521
26586
  if (items.indexOf('strokeWidth') > -1) {
26522
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
26587
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: id + '_pen_strokewidth',
26588
+ cssClass: 'top-icon e-size',
26523
26589
  tooltipText: this.l10n.getConstant('StrokeWidth'),
26524
26590
  align: 'Center', type: 'Input', template: '<button id="' + id + '_penStrokeWidth"></button>' });
26525
26591
  }
@@ -26556,7 +26622,13 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26556
26622
  }
26557
26623
  var args = { toolbarType: 'pen', toolbarItems: this.defToolbarItems };
26558
26624
  parent.trigger('toolbarUpdating', args);
26559
- this.defToolbarItems = args.toolbarItems;
26625
+ if (this.isToolbarString(args.toolbarItems)) {
26626
+ items = args.toolbarItems;
26627
+ this.excludeItems(args.toolbarItems);
26628
+ }
26629
+ else {
26630
+ this.defToolbarItems = args.toolbarItems;
26631
+ }
26560
26632
  var toolbar = new Toolbar({
26561
26633
  width: '100%',
26562
26634
  items: this.defToolbarItems,
@@ -27698,6 +27770,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27698
27770
  var ctx = void 0;
27699
27771
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
27700
27772
  var type = args.item.id.replace(id + '_', '').toLowerCase();
27773
+ var left = void 0;
27774
+ var right = void 0;
27701
27775
  switch (type) {
27702
27776
  case 'duplicate':
27703
27777
  if (!parent.element.querySelector('#' + id + '_duplicate').classList.contains('e-disabled')) {
@@ -27747,8 +27821,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27747
27821
  break;
27748
27822
  case 'rotleft':
27749
27823
  case 'rotright':
27750
- if (!parent.element.querySelector('#' + id + '_rotLeft').classList.contains('e-disabled') ||
27751
- !parent.element.querySelector('#' + id + '_rotRight').classList.contains('e-disabled')) {
27824
+ left = parent.element.querySelector('#' + id + '_rotLeft');
27825
+ right = parent.element.querySelector('#' + id + '_rotRight');
27826
+ if ((left && !left.classList.contains('e-disabled')) ||
27827
+ (right && !right.classList.contains('e-disabled'))) {
27752
27828
  parent.rotateImage(args.item.id.replace(id + '_', '').toLowerCase());
27753
27829
  }
27754
27830
  break;
@@ -28878,6 +28954,80 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
28878
28954
  parent.activeObj.textFlip = parent.transform.currFlipState;
28879
28955
  parent.activeObj.flipObjColl = [];
28880
28956
  };
28957
+ ToolbarModule.prototype.isToolbarString = function (items) {
28958
+ var isString = false;
28959
+ for (var i = 0; i < items.length; i++) {
28960
+ if (typeof (items[i]) === 'string') {
28961
+ isString = true;
28962
+ break;
28963
+ }
28964
+ }
28965
+ return isString;
28966
+ };
28967
+ ToolbarModule.prototype.excludeItems = function (items) {
28968
+ var indexArr = [];
28969
+ for (var i = 0; i < items.length; i++) {
28970
+ var index = this.getIndex(items[i]);
28971
+ if (index !== -1) {
28972
+ indexArr.push(index);
28973
+ }
28974
+ }
28975
+ var negativeIndexArr = [];
28976
+ for (var i = 0; i < this.defToolbarItems.length; i++) {
28977
+ if (this.defToolbarItems[i].align === 'Center' && !this.isSameIndex(indexArr, i) &&
28978
+ this.defToolbarItems[i].id !== this.parent.element.id + '_' + 'annotation') {
28979
+ negativeIndexArr.push(i);
28980
+ }
28981
+ }
28982
+ for (var i = negativeIndexArr.length - 1; i >= 0; i--) {
28983
+ this.defToolbarItems.splice(negativeIndexArr[i], 1);
28984
+ }
28985
+ };
28986
+ ToolbarModule.prototype.isSameIndex = function (indexArr, index) {
28987
+ for (var i = 0; i < indexArr.length; i++) {
28988
+ if (indexArr[i] === index) {
28989
+ return true;
28990
+ }
28991
+ }
28992
+ return false;
28993
+ };
28994
+ ToolbarModule.prototype.getIndex = function (item) {
28995
+ var index = -1;
28996
+ var isFontColor = false;
28997
+ if (item === 'rotateLeft') {
28998
+ item = 'rotLeft';
28999
+ }
29000
+ if (item === 'rotateRight') {
29001
+ item = 'rotRight';
29002
+ }
29003
+ if (item === 'horizontalFlip') {
29004
+ item = 'hflip';
29005
+ }
29006
+ if (item === 'verticalFlip') {
29007
+ item = 'vflip';
29008
+ }
29009
+ if (item === 'arrowStart') {
29010
+ item = 'start';
29011
+ }
29012
+ if (item === 'arrowEnd') {
29013
+ item = 'end';
29014
+ }
29015
+ if (item === 'fontColor') {
29016
+ item = 'strokeColor';
29017
+ isFontColor = true;
29018
+ }
29019
+ for (var i = 0; i < this.defToolbarItems.length; i++) {
29020
+ var id = this.defToolbarItems[i].id;
29021
+ if (id && id.toLowerCase().indexOf(item.toLowerCase()) !== -1) {
29022
+ index = i;
29023
+ break;
29024
+ }
29025
+ }
29026
+ if (isFontColor) {
29027
+ item = 'fontColor';
29028
+ }
29029
+ return index;
29030
+ };
28881
29031
  ToolbarModule.prototype.getModuleName = function () {
28882
29032
  return 'toolbar-module';
28883
29033
  };