@syncfusion/ej2-image-editor 26.1.40 → 26.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 (60) hide show
  1. package/dist/ej2-image-editor.umd.min.js +2 -2
  2. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-image-editor.es2015.js +197 -40
  4. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  5. package/dist/es6/ej2-image-editor.es5.js +196 -40
  6. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  7. package/dist/global/ej2-image-editor.min.js +2 -2
  8. package/dist/global/ej2-image-editor.min.js.map +1 -1
  9. package/dist/global/index.d.ts +1 -1
  10. package/hotfix/26.1.35_Vol2.txt +1 -0
  11. package/package.json +12 -12
  12. package/src/image-editor/action/draw.js +1 -2
  13. package/src/image-editor/action/export.js +11 -7
  14. package/src/image-editor/action/selection.d.ts +1 -0
  15. package/src/image-editor/action/selection.js +49 -1
  16. package/src/image-editor/action/transform.js +2 -1
  17. package/src/image-editor/action/undo-redo.js +4 -2
  18. package/src/image-editor/base/image-editor.d.ts +4 -1
  19. package/src/image-editor/base/image-editor.js +62 -10
  20. package/src/image-editor/base/interface.d.ts +4 -0
  21. package/src/image-editor/renderer/toolbar.d.ts +1 -0
  22. package/src/image-editor/renderer/toolbar.js +67 -17
  23. package/styles/bootstrap-dark.css +0 -2
  24. package/styles/bootstrap.css +0 -2
  25. package/styles/bootstrap4.css +2 -0
  26. package/styles/bootstrap5-dark.css +2 -0
  27. package/styles/bootstrap5.css +2 -0
  28. package/styles/fabric-dark.css +1 -2
  29. package/styles/fabric.css +1 -2
  30. package/styles/fluent-dark.css +3 -2
  31. package/styles/fluent.css +3 -2
  32. package/styles/fluent2.css +26 -12
  33. package/styles/highcontrast-light.css +3 -2
  34. package/styles/highcontrast.css +3 -2
  35. package/styles/image-editor/_layout.scss +16 -0
  36. package/styles/image-editor/_theme.scss +34 -1
  37. package/styles/image-editor/bootstrap-dark.css +0 -2
  38. package/styles/image-editor/bootstrap.css +0 -2
  39. package/styles/image-editor/bootstrap4.css +2 -0
  40. package/styles/image-editor/bootstrap5-dark.css +2 -0
  41. package/styles/image-editor/bootstrap5.css +2 -0
  42. package/styles/image-editor/fabric-dark.css +1 -2
  43. package/styles/image-editor/fabric.css +1 -2
  44. package/styles/image-editor/fluent-dark.css +3 -2
  45. package/styles/image-editor/fluent.css +3 -2
  46. package/styles/image-editor/fluent2.css +26 -12
  47. package/styles/image-editor/highcontrast-light.css +3 -2
  48. package/styles/image-editor/highcontrast.css +3 -2
  49. package/styles/image-editor/material-dark.css +0 -2
  50. package/styles/image-editor/material.css +0 -2
  51. package/styles/image-editor/material3-dark.css +2 -3
  52. package/styles/image-editor/material3.css +2 -3
  53. package/styles/image-editor/tailwind-dark.css +2 -2
  54. package/styles/image-editor/tailwind.css +2 -2
  55. package/styles/material-dark.css +0 -2
  56. package/styles/material.css +0 -2
  57. package/styles/material3-dark.css +2 -3
  58. package/styles/material3.css +2 -3
  59. package/styles/tailwind-dark.css +2 -2
  60. package/styles/tailwind.css +2 -2
@@ -1173,7 +1173,7 @@ var Draw = /** @__PURE__ @class */ (function () {
1173
1173
  args.value['obj']['isNewPath'] = this.isNewPath;
1174
1174
  break;
1175
1175
  case 'getArrowDimension':
1176
- args.value['obj']['arrowDimension'] = this.arrowDimension;
1176
+ args.value['obj']['arrowDimension'] = extend({}, this.arrowDimension, {}, true);
1177
1177
  break;
1178
1178
  case 'setArrowDimension':
1179
1179
  this.arrowDimension = args.value['arrowDimension'];
@@ -4740,7 +4740,6 @@ var Draw = /** @__PURE__ @class */ (function () {
4740
4740
  return [3 /*break*/, 3];
4741
4741
  case 2:
4742
4742
  ex_1 = _a.sent();
4743
- console.log(ex_1.message);
4744
4743
  return [3 /*break*/, 3];
4745
4744
  case 3: return [2 /*return*/];
4746
4745
  }
@@ -5843,7 +5842,7 @@ var Export = /** @__PURE__ @class */ (function () {
5843
5842
  this.updatePvtVar();
5844
5843
  switch (args.prop) {
5845
5844
  case 'export':
5846
- this.exportImg(args.value['type'], args.value['fileName']);
5845
+ this.exportImg(args.value['type'], args.value['fileName'], args.value['imgQuality']);
5847
5846
  break;
5848
5847
  case 'exportToCanvas':
5849
5848
  this.exportToCanvas(args.value['object']);
@@ -5864,7 +5863,7 @@ var Export = /** @__PURE__ @class */ (function () {
5864
5863
  this.lowerContext = parent.lowerCanvas.getContext('2d');
5865
5864
  }
5866
5865
  };
5867
- Export.prototype.exportImg = function (type, fileName) {
5866
+ Export.prototype.exportImg = function (type, fileName, imgQuality) {
5868
5867
  var parent = this.parent;
5869
5868
  var obj = { fileName: '' };
5870
5869
  parent.notify('draw', { prop: 'getFileName', onPropertyChange: false, value: { obj: obj } });
@@ -5890,12 +5889,12 @@ var Export = /** @__PURE__ @class */ (function () {
5890
5889
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
5891
5890
  value: { x: null, y: null, isMouseDown: null } });
5892
5891
  var beforeSave = { cancel: false, fileName: fileName ? fileName : imageName,
5893
- fileType: type };
5892
+ fileType: type, imageQuality: imgQuality };
5894
5893
  parent.trigger('beforeSave', beforeSave);
5895
- this.beforeSaveEvent(beforeSave, type, fileName, imageName);
5894
+ this.beforeSaveEvent(beforeSave, type, fileName, imageName, imgQuality);
5896
5895
  }
5897
5896
  };
5898
- Export.prototype.beforeSaveEvent = function (observableSaveArgs, type, fileName, imageName) {
5897
+ Export.prototype.beforeSaveEvent = function (observableSaveArgs, type, fileName, imageName, imgQuality) {
5899
5898
  var parent = this.parent;
5900
5899
  if (!observableSaveArgs.cancel) {
5901
5900
  parent.currObjType.isSave = true;
@@ -5906,7 +5905,7 @@ var Export = /** @__PURE__ @class */ (function () {
5906
5905
  this.toSVGImg(fileName);
5907
5906
  }
5908
5907
  else {
5909
- this.toBlobFn(fileName, lowerCaseType);
5908
+ this.toBlobFn(fileName, lowerCaseType, imgQuality);
5910
5909
  }
5911
5910
  var saved = { fileName: fileName ? fileName : imageName, fileType: type };
5912
5911
  parent.trigger('saved', saved);
@@ -5949,12 +5948,16 @@ var Export = /** @__PURE__ @class */ (function () {
5949
5948
  return null;
5950
5949
  }
5951
5950
  };
5952
- Export.prototype.toBlobFn = function (fileName, type) {
5951
+ Export.prototype.toBlobFn = function (fileName, type, imgQuality) {
5953
5952
  // eslint-disable-next-line @typescript-eslint/no-this-alias
5954
5953
  var proxy = this;
5955
5954
  var parent = this.parent;
5956
5955
  showSpinner(parent.element);
5957
5956
  parent.element.style.opacity = '0.5';
5957
+ if (!isNullOrUndefined(imgQuality)) {
5958
+ imgQuality = imgQuality > 1 ? 1 : (imgQuality <= 0 ? 0.01 : imgQuality);
5959
+ this.imageQuality = imgQuality ? imgQuality : null;
5960
+ }
5958
5961
  var tempCanvas = this.exportToCanvas();
5959
5962
  var imagetype = type !== 'jpeg' ? 'image/png' : 'image/jpeg';
5960
5963
  // eslint-disable-next-line @typescript-eslint/tslint/config
@@ -8512,6 +8515,7 @@ var Selection = /** @__PURE__ @class */ (function () {
8512
8515
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
8513
8516
  }
8514
8517
  }
8518
+ parent.isKBDNavigation = true;
8515
8519
  };
8516
8520
  Selection.prototype.selMouseUpEvent = function () {
8517
8521
  this.oldPoint.x = undefined;
@@ -9095,6 +9099,10 @@ var Selection = /** @__PURE__ @class */ (function () {
9095
9099
  return;
9096
9100
  }
9097
9101
  var actObj = extend({}, obj[i], {}, true);
9102
+ if (actObj.activePoint.width === 0 && actObj.activePoint.height === 0) {
9103
+ obj.splice(i, 1);
9104
+ return;
9105
+ }
9098
9106
  this.cursorTargetId = actObj.currIndex;
9099
9107
  if (actObj.shape === 'line' || actObj.shape === 'arrow') {
9100
9108
  this.setCursorForLineArrow(actObj, x, y, upperCanvas);
@@ -11072,6 +11080,7 @@ var Selection = /** @__PURE__ @class */ (function () {
11072
11080
  };
11073
11081
  Selection.prototype.mouseDownEventHandler = function (e) {
11074
11082
  var parent = this.parent;
11083
+ parent.isKBDNavigation = false;
11075
11084
  this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
11076
11085
  'canvas' : '';
11077
11086
  if (e.type === 'touchstart') {
@@ -11532,6 +11541,7 @@ var Selection = /** @__PURE__ @class */ (function () {
11532
11541
  Selection.prototype.mouseUpEventHandler = function (e) {
11533
11542
  var parent = this.parent;
11534
11543
  var id = parent.element.id;
11544
+ parent.isKBDNavigation = false;
11535
11545
  if (!Browser.isDevice && ((parent.element.querySelector('#' + id + '_contextualToolbar') &&
11536
11546
  !parent.element.querySelector('#' + id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
11537
11547
  (parent.element.querySelector('#' + id + '_headWrapper')
@@ -11679,7 +11689,9 @@ var Selection = /** @__PURE__ @class */ (function () {
11679
11689
  previousCropObj: prevCropObj, previousText: null,
11680
11690
  currentText: null, previousFilter: null, isCircleCrop: null } });
11681
11691
  }
11682
- this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
11692
+ var tempObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
11693
+ parent.objColl.pop();
11694
+ this.redrawShape(tempObj);
11683
11695
  this.tempObjColl = undefined;
11684
11696
  }
11685
11697
  if (!this.isFhdEditing) {
@@ -11729,6 +11741,7 @@ var Selection = /** @__PURE__ @class */ (function () {
11729
11741
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
11730
11742
  }
11731
11743
  if (!isCropSelection_1) {
11744
+ this.adjustActObjForLineArrow();
11732
11745
  if (parent.isShapeDrawing) {
11733
11746
  var temp = this.currentDrawingShape;
11734
11747
  parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
@@ -11754,8 +11767,11 @@ var Selection = /** @__PURE__ @class */ (function () {
11754
11767
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11755
11768
  }
11756
11769
  else {
11770
+ var temp = this.currentDrawingShape;
11771
+ this.currentDrawingShape = '';
11757
11772
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11758
11773
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11774
+ this.currentDrawingShape = temp;
11759
11775
  }
11760
11776
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11761
11777
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
@@ -12289,8 +12305,15 @@ var Selection = /** @__PURE__ @class */ (function () {
12289
12305
  Selection.prototype.performEnterAction = function (e) {
12290
12306
  var parent = this.parent;
12291
12307
  if (parent.isResize) {
12308
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12309
+ var target = e.target;
12310
+ var isIcon = target.id.indexOf('aspectratio') ||
12311
+ target.id.indexOf('non-aspectratio') > -1 ? true : false;
12292
12312
  var isValue = this.isValueUpdated();
12293
12313
  if (!isValue) {
12314
+ if (isIcon) {
12315
+ this.focusRatioBtn();
12316
+ }
12294
12317
  return;
12295
12318
  }
12296
12319
  var point = this.getNumTextValue();
@@ -12323,6 +12346,21 @@ var Selection = /** @__PURE__ @class */ (function () {
12323
12346
  }
12324
12347
  }
12325
12348
  parent.notify('draw', { prop: 'redrawDownScale' });
12349
+ if (isIcon) {
12350
+ this.focusRatioBtn();
12351
+ }
12352
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12353
+ }
12354
+ else if (e.target.classList.contains('e-upload')) {
12355
+ var upload = parent.element.querySelector('.e-image-upload');
12356
+ if (upload && upload.querySelector('.e-tbar-btn')) {
12357
+ upload.querySelector('.e-tbar-btn').click();
12358
+ }
12359
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12360
+ }
12361
+ else if (e.target.classList.contains('filter-wrapper')) {
12362
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12363
+ e.target.parentElement.click();
12326
12364
  }
12327
12365
  else {
12328
12366
  var splitWords = void 0;
@@ -12335,6 +12373,19 @@ var Selection = /** @__PURE__ @class */ (function () {
12335
12373
  }
12336
12374
  }
12337
12375
  };
12376
+ Selection.prototype.focusRatioBtn = function () {
12377
+ var id = this.parent.element.id;
12378
+ if (this.parent.isKBDNavigation) {
12379
+ setTimeout(function () {
12380
+ if (document.getElementById(id + '_aspectratio')) {
12381
+ document.getElementById(id + '_aspectratio').focus();
12382
+ }
12383
+ else if (document.getElementById(id + '_nonaspectratio')) {
12384
+ document.getElementById(id + '_nonaspectratio').focus();
12385
+ }
12386
+ }, 50);
12387
+ }
12388
+ };
12338
12389
  Selection.prototype.isKeyBoardCrop = function (e) {
12339
12390
  var bool = false;
12340
12391
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -18635,7 +18686,8 @@ var Transform = /** @__PURE__ @class */ (function () {
18635
18686
  if (freehandObj['bool']) {
18636
18687
  parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18637
18688
  }
18638
- if (parent.activeObj.shape !== undefined) {
18689
+ var actPoint = extend({}, parent.activeObj.activePoint, {}, true);
18690
+ if (parent.activeObj.shape && (actPoint.width !== 0 || actPoint.height !== 0)) {
18639
18691
  isActiveObj = true;
18640
18692
  if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
18641
18693
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
@@ -19630,7 +19682,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19630
19682
  case 'freehanddraw':
19631
19683
  case 'freehand-draw':
19632
19684
  this.updateFreehandDraw(obj.previousPointColl, obj.previousSelPointColl);
19633
- parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex', value: { value: parent.pointColl.length } });
19685
+ parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
19686
+ value: { value: parent.pointColl.length } });
19634
19687
  break;
19635
19688
  case 'freehanddrawCustomized':
19636
19689
  this.updateFreehandDrawCustomized(obj.previousObjColl, obj.previousPointColl);
@@ -19761,7 +19814,8 @@ var UndoRedo = /** @__PURE__ @class */ (function () {
19761
19814
  case 'freehanddraw':
19762
19815
  case 'freehand-draw':
19763
19816
  this.updateFreehandDraw(obj.currentPointColl, obj.currentSelPointColl);
19764
- parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex', value: { value: parent.pointColl.length } });
19817
+ parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
19818
+ value: { value: parent.pointColl.length } });
19765
19819
  break;
19766
19820
  case 'freehanddrawCustomized':
19767
19821
  this.updateFreehandDrawCustomized(obj.currentObjColl, obj.currentPointColl);
@@ -20624,6 +20678,8 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
20624
20678
  /** @hidden */
20625
20679
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20626
20680
  _this.shapeColl = [];
20681
+ /** @hidden */
20682
+ _this.isKBDNavigation = false;
20627
20683
  ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
20628
20684
  ImageEditor_1.Inject(UndoRedo);
20629
20685
  ImageEditor_1.Inject(Filter);
@@ -21382,7 +21438,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
21382
21438
  this.aspectWidth = this.aspectHeight = null;
21383
21439
  this.isResize = false;
21384
21440
  this.drawingShape = null;
21385
- this.isShapeDrawing = this.noPushUndo = this.isUndoRedoStack = false;
21441
+ this.isShapeDrawing = this.noPushUndo = this.isUndoRedoStack = this.isKBDNavigation = false;
21386
21442
  this.shapeColl = [];
21387
21443
  var obj_1 = { initialZoomValue: false };
21388
21444
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj_1 } });
@@ -21448,15 +21504,16 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
21448
21504
  *
21449
21505
  * @param {string} type - Specifies a format of image to be saved.
21450
21506
  * @param {string} fileName – Specifies a file name to be saved
21507
+ * @param {number} imageQuality – Specifies the quality of an image to be saved. The default value is “1” which represents the original size of the image if not specified.
21451
21508
  *
21452
21509
  * @remarks
21453
21510
  * The supported file types are JPG, JPEG, PNG, and SVG.
21454
21511
  *
21455
21512
  * @returns {void}.
21456
21513
  */
21457
- ImageEditor.prototype.export = function (type, fileName) {
21514
+ ImageEditor.prototype.export = function (type, fileName, imageQuality) {
21458
21515
  this.applyShapes();
21459
- this.notify('export', { prop: 'export', onPropertyChange: false, value: { type: type, fileName: fileName } });
21516
+ this.notify('export', { prop: 'export', onPropertyChange: false, value: { type: type, fileName: fileName, imgQuality: imageQuality } });
21460
21517
  };
21461
21518
  /**
21462
21519
  * Perform selection in an image editor. The selection helps to crop an image.
@@ -22936,7 +22993,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22936
22993
  * @returns {void}.
22937
22994
  */
22938
22995
  ImageEditor.prototype.updateArrow = function (type, id) {
22996
+ var isObjPushed = false;
22997
+ var collLength = this.objColl.length;
22939
22998
  this.notify('shape', { prop: 'pushActItemIntoObj' });
22999
+ if (collLength !== this.objColl.length) {
23000
+ isObjPushed = true;
23001
+ }
22940
23002
  var prevCropObj = extend({}, this.cropObj, {}, true);
22941
23003
  var object = { currObj: {} };
22942
23004
  var objt = { shapeSettingsObj: {} };
@@ -22947,7 +23009,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22947
23009
  prevObj.objColl = extend([], this.objColl, [], true);
22948
23010
  prevObj.pointColl = extend([], this.pointColl, [], true);
22949
23011
  prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
22950
- this.objColl.pop();
23012
+ if (isObjPushed) {
23013
+ this.objColl.pop();
23014
+ }
22951
23015
  if (type === 'startArrow') {
22952
23016
  this.activeObj.start = this.getTextFromId(id);
22953
23017
  }
@@ -22991,7 +23055,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
22991
23055
  */
22992
23056
  ImageEditor.prototype.updateFontFamily = function (id) {
22993
23057
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
23058
+ var isObjPushed = false;
23059
+ var collLength = this.objColl.length;
22994
23060
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23061
+ if (collLength !== this.objColl.length) {
23062
+ isObjPushed = true;
23063
+ }
22995
23064
  var objColl = extend([], this.objColl, [], true);
22996
23065
  var prevCropObj = extend({}, this.cropObj, {}, true);
22997
23066
  var objt = { shapeSettingsObj: {} };
@@ -23007,7 +23076,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23007
23076
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23008
23077
  value: { obj: selPointCollObj } });
23009
23078
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23010
- this.objColl.pop();
23079
+ if (isObjPushed) {
23080
+ this.objColl.pop();
23081
+ }
23011
23082
  if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
23012
23083
  this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
23013
23084
  value: { obj: this.activeObj, isTextArea: true } });
@@ -23067,7 +23138,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23067
23138
  ImageEditor.prototype.updateFontSize = function (text) {
23068
23139
  var itemText = text;
23069
23140
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
23141
+ var isObjPushed = false;
23142
+ var collLength = this.objColl.length;
23070
23143
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23144
+ if (collLength !== this.objColl.length) {
23145
+ isObjPushed = true;
23146
+ }
23071
23147
  var prevCropObj = extend({}, this.cropObj, {}, true);
23072
23148
  var objt = { shapeSettingsObj: {} };
23073
23149
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
@@ -23082,7 +23158,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23082
23158
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23083
23159
  value: { obj: selPointCollObj } });
23084
23160
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23085
- this.objColl.pop();
23161
+ if (isObjPushed) {
23162
+ this.objColl.pop();
23163
+ }
23086
23164
  if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
23087
23165
  this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
23088
23166
  value: { obj: this.activeObj, isTextArea: true } });
@@ -23170,7 +23248,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23170
23248
  */
23171
23249
  ImageEditor.prototype.updateFontColor = function (value) {
23172
23250
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
23251
+ var isObjPushed = false;
23252
+ var collLength = this.objColl.length;
23173
23253
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23254
+ if (collLength !== this.objColl.length) {
23255
+ isObjPushed = true;
23256
+ }
23174
23257
  var prevCropObj = extend({}, this.cropObj, {}, true);
23175
23258
  var objt = { shapeSettingsObj: {} };
23176
23259
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
@@ -23185,7 +23268,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23185
23268
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23186
23269
  value: { obj: selPointCollObj } });
23187
23270
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23188
- this.objColl.pop();
23271
+ if (isObjPushed) {
23272
+ this.objColl.pop();
23273
+ }
23189
23274
  if (this.textArea.style.display === 'none') {
23190
23275
  this.activeObj.strokeSettings.strokeColor = value;
23191
23276
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
@@ -23362,7 +23447,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23362
23447
  var obj = { shapeSettingsObj: {} };
23363
23448
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
23364
23449
  var shapeSettings = obj['shapeSettingsObj'];
23450
+ var isObjPushed = false;
23451
+ var collLength = this.objColl.length;
23365
23452
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23453
+ if (collLength !== this.objColl.length) {
23454
+ isObjPushed = true;
23455
+ }
23366
23456
  var prevCropObj = extend({}, this.cropObj, {}, true);
23367
23457
  var object = { currObj: {} };
23368
23458
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23374,7 +23464,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23374
23464
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23375
23465
  value: { obj: selPointCollObj } });
23376
23466
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23377
- this.objColl.pop();
23467
+ if (isObjPushed) {
23468
+ this.objColl.pop();
23469
+ }
23378
23470
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
23379
23471
  if (this.activeObj.shape === 'rectangle' || this.activeObj.shape === 'ellipse') {
23380
23472
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10) - 1;
@@ -23416,7 +23508,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23416
23508
  var shapeSettings = objt['shapeSettingsObj'];
23417
23509
  if (this.activeObj.shape && (this.activeObj.shape !== 'path' || (this.activeObj.shape === 'path' &&
23418
23510
  this.activeObj.pointColl.length > 0))) {
23511
+ var isObjPushed = false;
23512
+ var collLength = this.objColl.length;
23419
23513
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23514
+ if (collLength !== this.objColl.length) {
23515
+ isObjPushed = true;
23516
+ }
23420
23517
  var prevCropObj = extend({}, this.cropObj, {}, true);
23421
23518
  var object = { currObj: {} };
23422
23519
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23428,7 +23525,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23428
23525
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23429
23526
  value: { obj: selPointCollObj } });
23430
23527
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23431
- this.objColl.pop();
23528
+ if (isObjPushed) {
23529
+ this.objColl.pop();
23530
+ }
23432
23531
  this.activeObj.strokeSettings.strokeColor = value;
23433
23532
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
23434
23533
  if (!this.togglePen) {
@@ -23463,7 +23562,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23463
23562
  var obj = { shapeSettingsObj: {} };
23464
23563
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
23465
23564
  var shapeSettings = obj['shapeSettingsObj'];
23565
+ var isObjPushed = false;
23566
+ var collLength = this.objColl.length;
23466
23567
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23568
+ if (collLength !== this.objColl.length) {
23569
+ isObjPushed = true;
23570
+ }
23467
23571
  var prevCropObj = extend({}, this.cropObj, {}, true);
23468
23572
  var object = { currObj: {} };
23469
23573
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23475,7 +23579,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
23475
23579
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23476
23580
  value: { obj: selPointCollObj } });
23477
23581
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23478
- this.objColl.pop();
23582
+ if (isObjPushed) {
23583
+ this.objColl.pop();
23584
+ }
23479
23585
  this.activeObj.strokeSettings.fillColor = value;
23480
23586
  this.notify('shape', { prop: 'setStrokeSettings',
23481
23587
  value: { strokeSettings: null, strokeColor: null, fillColor: this.activeObj.strokeSettings.fillColor,
@@ -25042,7 +25148,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25042
25148
  var toolbarItems = [];
25043
25149
  if (isOkBtn) {
25044
25150
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
25045
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
25151
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
25046
25152
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
25047
25153
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
25048
25154
  }
@@ -25124,7 +25230,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25124
25230
  }
25125
25231
  if (isApplyOption) {
25126
25232
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
25127
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
25233
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
25128
25234
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
25129
25235
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
25130
25236
  }
@@ -25268,7 +25374,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25268
25374
  };
25269
25375
  ToolbarModule.prototype.widthAspectRatio = function (e) {
25270
25376
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25271
- if (e.keyCode === 109) {
25377
+ if (e.keyCode === 109 || e.keyCode === 9) {
25272
25378
  return;
25273
25379
  }
25274
25380
  var parent = this.parent;
@@ -25312,7 +25418,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25312
25418
  };
25313
25419
  ToolbarModule.prototype.heightAspectRatio = function (e) {
25314
25420
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25315
- if (e.keyCode === 109) {
25421
+ if (e.keyCode === 109 || e.keyCode === 9) {
25316
25422
  return;
25317
25423
  }
25318
25424
  var parent = this.parent;
@@ -25380,7 +25486,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25380
25486
  placeholder: isResize ? null : height, format: '###.## px' })
25381
25487
  });
25382
25488
  if (!this.isAspectRatio) {
25383
- toolbarItems.push({ id: id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
25489
+ toolbarItems.push({ id: id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center',
25490
+ tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button', tabIndex: 0 });
25384
25491
  this.isAspectRatio = true;
25385
25492
  }
25386
25493
  else {
@@ -25389,7 +25496,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
25389
25496
  }
25390
25497
  if (!Browser.isDevice) {
25391
25498
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
25392
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
25499
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
25393
25500
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
25394
25501
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
25395
25502
  }
@@ -26034,7 +26141,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26034
26141
  { id: 'svg', text: 'SVG' }
26035
26142
  ];
26036
26143
  var inputObj = new TextBox({
26037
- placeholder: this.l10n.getConstant('ImageName'),
26144
+ placeholder: this.l10n.getConstant('ImageName')
26038
26145
  });
26039
26146
  inputObj.appendTo('#' + id + '_imgNametext');
26040
26147
  var qualityContainer = document.getElementById(id + '_imgQualitydiv');
@@ -26205,7 +26312,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26205
26312
  else {
26206
26313
  imageNameLabel = document.getElementById(id + '_imageNameLabel');
26207
26314
  }
26208
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config */
26315
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
26209
26316
  tempCanvas.toBlob((function (blob) {
26210
26317
  fileSize = Math.floor(blob.size / 1024);
26211
26318
  if (fileSize > 1000) {
@@ -26285,7 +26392,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26285
26392
  }
26286
26393
  if (!Browser.isDevice) {
26287
26394
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
26288
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
26395
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
26289
26396
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
26290
26397
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
26291
26398
  }
@@ -26362,7 +26469,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26362
26469
  parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
26363
26470
  if (obj['shape'] !== 'path') {
26364
26471
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
26365
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
26472
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
26366
26473
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
26367
26474
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
26368
26475
  }
@@ -26976,7 +27083,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
26976
27083
  }
26977
27084
  if (!Browser.isDevice) {
26978
27085
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
26979
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
27086
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
26980
27087
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
26981
27088
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
26982
27089
  }
@@ -27274,6 +27381,15 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27274
27381
  args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'z-order', 'duplicate', 'remove'];
27275
27382
  }
27276
27383
  this.initShapesToolbarItem(args.toolbarItems);
27384
+ if (parent.activeObj.shape === 'image') {
27385
+ var actObj = extend({}, parent.activeObj, {}, true);
27386
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
27387
+ parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
27388
+ parent.activeObj = actObj;
27389
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj,
27390
+ isCropRatio: null, points: null, isPreventDrag: true } });
27391
+ this.renderQAT(false);
27392
+ }
27277
27393
  break;
27278
27394
  case 'text':
27279
27395
  if (Browser.isDevice) {
@@ -27357,8 +27473,46 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27357
27473
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
27358
27474
  break;
27359
27475
  }
27360
- this.currToolbar = type;
27361
27476
  this.refreshDropDownBtn(isCropping);
27477
+ this.updateKBDNavigation(type);
27478
+ this.currToolbar = type;
27479
+ };
27480
+ ToolbarModule.prototype.updateKBDNavigation = function (type) {
27481
+ var parent = this.parent;
27482
+ var id = parent.element.id;
27483
+ if (!parent.isKBDNavigation || this.currToolbar === type) {
27484
+ return;
27485
+ }
27486
+ if (this.isToolbar()) {
27487
+ var tbar = parent.element.querySelectorAll('#' + id + '_toolbar')[0];
27488
+ var tbarInitialChild = void 0;
27489
+ var tbarInitialBtn_1;
27490
+ if (tbar) {
27491
+ tbarInitialChild = tbar.querySelector('.e-toolbar-center');
27492
+ if (!tbarInitialChild || !tbarInitialChild.children[0]) {
27493
+ return;
27494
+ }
27495
+ tbarInitialBtn_1 = tbarInitialChild.children[0].querySelector('.e-btn');
27496
+ var tempElem = tbarInitialChild.children[1];
27497
+ if (tempElem) {
27498
+ tempElem = tempElem.children[0];
27499
+ }
27500
+ if (tempElem) {
27501
+ tempElem = tempElem.children[0];
27502
+ }
27503
+ if (type === 'resize' && tempElem) {
27504
+ tbarInitialBtn_1 = tempElem;
27505
+ }
27506
+ if (tbarInitialBtn_1) {
27507
+ if (type === 'main') {
27508
+ setTimeout(function () { return tbarInitialBtn_1.focus(); }, 50);
27509
+ }
27510
+ else {
27511
+ tbarInitialBtn_1.focus();
27512
+ }
27513
+ }
27514
+ }
27515
+ }
27362
27516
  };
27363
27517
  ToolbarModule.prototype.performCropTransformClick = function (shape, isTransform) {
27364
27518
  var parent = this.parent;
@@ -27424,7 +27578,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27424
27578
  }
27425
27579
  if (!Browser.isDevice) {
27426
27580
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
27427
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
27581
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
27428
27582
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
27429
27583
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
27430
27584
  }
@@ -27477,7 +27631,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27477
27631
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
27478
27632
  toolbarItems.push({ id: id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
27479
27633
  tooltipText: this.l10n.getConstant('Default'), align: 'Center',
27480
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
27634
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + id + '_defaultCanvas' + ' tabindex=0></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
27481
27635
  }
27482
27636
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
27483
27637
  toolbarItems.push({ id: id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
@@ -27550,7 +27704,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
27550
27704
  }
27551
27705
  if (!Browser.isDevice) {
27552
27706
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
27553
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
27707
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
27554
27708
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
27555
27709
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
27556
27710
  }
@@ -29818,8 +29972,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
29818
29972
  }
29819
29973
  parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
29820
29974
  if (type === 'transparency') {
29821
- parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
29822
- parent.element.querySelector('#' + parent.element.id + '_transparency').click();
29975
+ setTimeout(function () {
29976
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
29977
+ parent.element.querySelector('#' + parent.element.id + '_transparency').click();
29978
+ }, 50);
29823
29979
  }
29824
29980
  }
29825
29981
  });