@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
@@ -1144,7 +1144,7 @@ class Draw {
1144
1144
  args.value['obj']['isNewPath'] = this.isNewPath;
1145
1145
  break;
1146
1146
  case 'getArrowDimension':
1147
- args.value['obj']['arrowDimension'] = this.arrowDimension;
1147
+ args.value['obj']['arrowDimension'] = extend({}, this.arrowDimension, {}, true);
1148
1148
  break;
1149
1149
  case 'setArrowDimension':
1150
1150
  this.arrowDimension = args.value['arrowDimension'];
@@ -4703,7 +4703,7 @@ class Draw {
4703
4703
  callback(imageSizeMB);
4704
4704
  }
4705
4705
  catch (ex) {
4706
- console.log(ex.message);
4706
+ /* action on catch */
4707
4707
  }
4708
4708
  });
4709
4709
  }
@@ -5796,7 +5796,7 @@ class Export {
5796
5796
  this.updatePvtVar();
5797
5797
  switch (args.prop) {
5798
5798
  case 'export':
5799
- this.exportImg(args.value['type'], args.value['fileName']);
5799
+ this.exportImg(args.value['type'], args.value['fileName'], args.value['imgQuality']);
5800
5800
  break;
5801
5801
  case 'exportToCanvas':
5802
5802
  this.exportToCanvas(args.value['object']);
@@ -5817,7 +5817,7 @@ class Export {
5817
5817
  this.lowerContext = parent.lowerCanvas.getContext('2d');
5818
5818
  }
5819
5819
  }
5820
- exportImg(type, fileName) {
5820
+ exportImg(type, fileName, imgQuality) {
5821
5821
  const parent = this.parent;
5822
5822
  const obj = { fileName: '' };
5823
5823
  parent.notify('draw', { prop: 'getFileName', onPropertyChange: false, value: { obj: obj } });
@@ -5843,12 +5843,12 @@ class Export {
5843
5843
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
5844
5844
  value: { x: null, y: null, isMouseDown: null } });
5845
5845
  const beforeSave = { cancel: false, fileName: fileName ? fileName : imageName,
5846
- fileType: type };
5846
+ fileType: type, imageQuality: imgQuality };
5847
5847
  parent.trigger('beforeSave', beforeSave);
5848
- this.beforeSaveEvent(beforeSave, type, fileName, imageName);
5848
+ this.beforeSaveEvent(beforeSave, type, fileName, imageName, imgQuality);
5849
5849
  }
5850
5850
  }
5851
- beforeSaveEvent(observableSaveArgs, type, fileName, imageName) {
5851
+ beforeSaveEvent(observableSaveArgs, type, fileName, imageName, imgQuality) {
5852
5852
  const parent = this.parent;
5853
5853
  if (!observableSaveArgs.cancel) {
5854
5854
  parent.currObjType.isSave = true;
@@ -5859,7 +5859,7 @@ class Export {
5859
5859
  this.toSVGImg(fileName);
5860
5860
  }
5861
5861
  else {
5862
- this.toBlobFn(fileName, lowerCaseType);
5862
+ this.toBlobFn(fileName, lowerCaseType, imgQuality);
5863
5863
  }
5864
5864
  const saved = { fileName: fileName ? fileName : imageName, fileType: type };
5865
5865
  parent.trigger('saved', saved);
@@ -5902,12 +5902,16 @@ class Export {
5902
5902
  return null;
5903
5903
  }
5904
5904
  }
5905
- toBlobFn(fileName, type) {
5905
+ toBlobFn(fileName, type, imgQuality) {
5906
5906
  // eslint-disable-next-line @typescript-eslint/no-this-alias
5907
5907
  const proxy = this;
5908
5908
  const parent = this.parent;
5909
5909
  showSpinner(parent.element);
5910
5910
  parent.element.style.opacity = '0.5';
5911
+ if (!isNullOrUndefined(imgQuality)) {
5912
+ imgQuality = imgQuality > 1 ? 1 : (imgQuality <= 0 ? 0.01 : imgQuality);
5913
+ this.imageQuality = imgQuality ? imgQuality : null;
5914
+ }
5911
5915
  const tempCanvas = this.exportToCanvas();
5912
5916
  const imagetype = type !== 'jpeg' ? 'image/png' : 'image/jpeg';
5913
5917
  // eslint-disable-next-line @typescript-eslint/tslint/config
@@ -8461,6 +8465,7 @@ class Selection {
8461
8465
  parent.notify('undo-redo', { prop: 'updateCurrUrc', value: { type: 'ok' } });
8462
8466
  }
8463
8467
  }
8468
+ parent.isKBDNavigation = true;
8464
8469
  }
8465
8470
  selMouseUpEvent() {
8466
8471
  this.oldPoint.x = undefined;
@@ -9043,6 +9048,10 @@ class Selection {
9043
9048
  return;
9044
9049
  }
9045
9050
  const actObj = extend({}, obj[i], {}, true);
9051
+ if (actObj.activePoint.width === 0 && actObj.activePoint.height === 0) {
9052
+ obj.splice(i, 1);
9053
+ return;
9054
+ }
9046
9055
  this.cursorTargetId = actObj.currIndex;
9047
9056
  if (actObj.shape === 'line' || actObj.shape === 'arrow') {
9048
9057
  this.setCursorForLineArrow(actObj, x, y, upperCanvas);
@@ -11019,6 +11028,7 @@ class Selection {
11019
11028
  }
11020
11029
  mouseDownEventHandler(e) {
11021
11030
  const parent = this.parent;
11031
+ parent.isKBDNavigation = false;
11022
11032
  this.mouseDown = e.currentTarget === parent.lowerCanvas || e.currentTarget === parent.upperCanvas ?
11023
11033
  'canvas' : '';
11024
11034
  if (e.type === 'touchstart') {
@@ -11479,6 +11489,7 @@ class Selection {
11479
11489
  mouseUpEventHandler(e) {
11480
11490
  const parent = this.parent;
11481
11491
  const id = parent.element.id;
11492
+ parent.isKBDNavigation = false;
11482
11493
  if (!Browser.isDevice && ((parent.element.querySelector('#' + id + '_contextualToolbar') &&
11483
11494
  !parent.element.querySelector('#' + id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
11484
11495
  (parent.element.querySelector('#' + id + '_headWrapper')
@@ -11626,7 +11637,9 @@ class Selection {
11626
11637
  previousCropObj: prevCropObj, previousText: null,
11627
11638
  currentText: null, previousFilter: null, isCircleCrop: null } });
11628
11639
  }
11629
- this.redrawShape(parent.objColl[parent.objColl.length - 1], true);
11640
+ const tempObj = extend({}, parent.objColl[parent.objColl.length - 1], {}, true);
11641
+ parent.objColl.pop();
11642
+ this.redrawShape(tempObj);
11630
11643
  this.tempObjColl = undefined;
11631
11644
  }
11632
11645
  if (!this.isFhdEditing) {
@@ -11676,6 +11689,7 @@ class Selection {
11676
11689
  parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
11677
11690
  }
11678
11691
  if (!isCropSelection) {
11692
+ this.adjustActObjForLineArrow();
11679
11693
  if (parent.isShapeDrawing) {
11680
11694
  const temp = this.currentDrawingShape;
11681
11695
  parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
@@ -11701,8 +11715,11 @@ class Selection {
11701
11715
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11702
11716
  }
11703
11717
  else {
11718
+ const temp = this.currentDrawingShape;
11719
+ this.currentDrawingShape = '';
11704
11720
  parent.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'shapes',
11705
11721
  isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
11722
+ this.currentDrawingShape = temp;
11706
11723
  }
11707
11724
  parent.notify('toolbar', { prop: 'update-toolbar-items', onPropertyChange: false });
11708
11725
  parent.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
@@ -12236,8 +12253,15 @@ class Selection {
12236
12253
  performEnterAction(e) {
12237
12254
  const parent = this.parent;
12238
12255
  if (parent.isResize) {
12256
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12257
+ const target = e.target;
12258
+ const isIcon = target.id.indexOf('aspectratio') ||
12259
+ target.id.indexOf('non-aspectratio') > -1 ? true : false;
12239
12260
  const isValue = this.isValueUpdated();
12240
12261
  if (!isValue) {
12262
+ if (isIcon) {
12263
+ this.focusRatioBtn();
12264
+ }
12241
12265
  return;
12242
12266
  }
12243
12267
  const point = this.getNumTextValue();
@@ -12270,6 +12294,21 @@ class Selection {
12270
12294
  }
12271
12295
  }
12272
12296
  parent.notify('draw', { prop: 'redrawDownScale' });
12297
+ if (isIcon) {
12298
+ this.focusRatioBtn();
12299
+ }
12300
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12301
+ }
12302
+ else if (e.target.classList.contains('e-upload')) {
12303
+ const upload = parent.element.querySelector('.e-image-upload');
12304
+ if (upload && upload.querySelector('.e-tbar-btn')) {
12305
+ upload.querySelector('.e-tbar-btn').click();
12306
+ }
12307
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12308
+ }
12309
+ else if (e.target.classList.contains('filter-wrapper')) {
12310
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
12311
+ e.target.parentElement.click();
12273
12312
  }
12274
12313
  else {
12275
12314
  let splitWords;
@@ -12282,6 +12321,19 @@ class Selection {
12282
12321
  }
12283
12322
  }
12284
12323
  }
12324
+ focusRatioBtn() {
12325
+ const id = this.parent.element.id;
12326
+ if (this.parent.isKBDNavigation) {
12327
+ setTimeout(() => {
12328
+ if (document.getElementById(id + '_aspectratio')) {
12329
+ document.getElementById(id + '_aspectratio').focus();
12330
+ }
12331
+ else if (document.getElementById(id + '_nonaspectratio')) {
12332
+ document.getElementById(id + '_nonaspectratio').focus();
12333
+ }
12334
+ }, 50);
12335
+ }
12336
+ }
12285
12337
  isKeyBoardCrop(e) {
12286
12338
  let bool = false;
12287
12339
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -18578,7 +18630,8 @@ class Transform {
18578
18630
  if (freehandObj['bool']) {
18579
18631
  parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
18580
18632
  }
18581
- if (parent.activeObj.shape !== undefined) {
18633
+ const actPoint = extend({}, parent.activeObj.activePoint, {}, true);
18634
+ if (parent.activeObj.shape && (actPoint.width !== 0 || actPoint.height !== 0)) {
18582
18635
  isActiveObj = true;
18583
18636
  if (parent.textArea.style.display === 'block' || parent.textArea.style.display === 'inline-block') {
18584
18637
  parent.notify('shape', { prop: 'redrawActObj', onPropertyChange: false,
@@ -19571,7 +19624,8 @@ class UndoRedo {
19571
19624
  case 'freehanddraw':
19572
19625
  case 'freehand-draw':
19573
19626
  this.updateFreehandDraw(obj.previousPointColl, obj.previousSelPointColl);
19574
- parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex', value: { value: parent.pointColl.length } });
19627
+ parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
19628
+ value: { value: parent.pointColl.length } });
19575
19629
  break;
19576
19630
  case 'freehanddrawCustomized':
19577
19631
  this.updateFreehandDrawCustomized(obj.previousObjColl, obj.previousPointColl);
@@ -19702,7 +19756,8 @@ class UndoRedo {
19702
19756
  case 'freehanddraw':
19703
19757
  case 'freehand-draw':
19704
19758
  this.updateFreehandDraw(obj.currentPointColl, obj.currentSelPointColl);
19705
- parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex', value: { value: parent.pointColl.length } });
19759
+ parent.notify('freehand-draw', { prop: 'setCurrentFreehandDrawIndex',
19760
+ value: { value: parent.pointColl.length } });
19706
19761
  break;
19707
19762
  case 'freehanddrawCustomized':
19708
19763
  this.updateFreehandDrawCustomized(obj.currentObjColl, obj.currentPointColl);
@@ -20531,6 +20586,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
20531
20586
  /** @hidden */
20532
20587
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20533
20588
  this.shapeColl = [];
20589
+ /** @hidden */
20590
+ this.isKBDNavigation = false;
20534
20591
  ImageEditor_1.Inject(Crop, Draw, Selection, Transform, Export, ToolbarModule);
20535
20592
  ImageEditor_1.Inject(UndoRedo);
20536
20593
  ImageEditor_1.Inject(Filter);
@@ -21285,7 +21342,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21285
21342
  this.aspectWidth = this.aspectHeight = null;
21286
21343
  this.isResize = false;
21287
21344
  this.drawingShape = null;
21288
- this.isShapeDrawing = this.noPushUndo = this.isUndoRedoStack = false;
21345
+ this.isShapeDrawing = this.noPushUndo = this.isUndoRedoStack = this.isKBDNavigation = false;
21289
21346
  this.shapeColl = [];
21290
21347
  const obj = { initialZoomValue: false };
21291
21348
  this.notify('draw', { prop: 'getInitialZoomValue', onPropertyChange: false, value: { obj: obj } });
@@ -21351,15 +21408,16 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
21351
21408
  *
21352
21409
  * @param {string} type - Specifies a format of image to be saved.
21353
21410
  * @param {string} fileName – Specifies a file name to be saved
21411
+ * @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.
21354
21412
  *
21355
21413
  * @remarks
21356
21414
  * The supported file types are JPG, JPEG, PNG, and SVG.
21357
21415
  *
21358
21416
  * @returns {void}.
21359
21417
  */
21360
- export(type, fileName) {
21418
+ export(type, fileName, imageQuality) {
21361
21419
  this.applyShapes();
21362
- this.notify('export', { prop: 'export', onPropertyChange: false, value: { type: type, fileName: fileName } });
21420
+ this.notify('export', { prop: 'export', onPropertyChange: false, value: { type: type, fileName: fileName, imgQuality: imageQuality } });
21363
21421
  }
21364
21422
  /**
21365
21423
  * Perform selection in an image editor. The selection helps to crop an image.
@@ -22839,7 +22897,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22839
22897
  * @returns {void}.
22840
22898
  */
22841
22899
  updateArrow(type, id) {
22900
+ let isObjPushed = false;
22901
+ const collLength = this.objColl.length;
22842
22902
  this.notify('shape', { prop: 'pushActItemIntoObj' });
22903
+ if (collLength !== this.objColl.length) {
22904
+ isObjPushed = true;
22905
+ }
22843
22906
  const prevCropObj = extend({}, this.cropObj, {}, true);
22844
22907
  const object = { currObj: {} };
22845
22908
  const objt = { shapeSettingsObj: {} };
@@ -22850,7 +22913,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22850
22913
  prevObj.objColl = extend([], this.objColl, [], true);
22851
22914
  prevObj.pointColl = extend([], this.pointColl, [], true);
22852
22915
  prevObj.afterCropActions = extend([], this.afterCropActions, [], true);
22853
- this.objColl.pop();
22916
+ if (isObjPushed) {
22917
+ this.objColl.pop();
22918
+ }
22854
22919
  if (type === 'startArrow') {
22855
22920
  this.activeObj.start = this.getTextFromId(id);
22856
22921
  }
@@ -22894,7 +22959,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22894
22959
  */
22895
22960
  updateFontFamily(id) {
22896
22961
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
22962
+ let isObjPushed = false;
22963
+ const collLength = this.objColl.length;
22897
22964
  this.notify('shape', { prop: 'pushActItemIntoObj' });
22965
+ if (collLength !== this.objColl.length) {
22966
+ isObjPushed = true;
22967
+ }
22898
22968
  const objColl = extend([], this.objColl, [], true);
22899
22969
  const prevCropObj = extend({}, this.cropObj, {}, true);
22900
22970
  const objt = { shapeSettingsObj: {} };
@@ -22910,7 +22980,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22910
22980
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
22911
22981
  value: { obj: selPointCollObj } });
22912
22982
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
22913
- this.objColl.pop();
22983
+ if (isObjPushed) {
22984
+ this.objColl.pop();
22985
+ }
22914
22986
  if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
22915
22987
  this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
22916
22988
  value: { obj: this.activeObj, isTextArea: true } });
@@ -22970,7 +23042,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22970
23042
  updateFontSize(text) {
22971
23043
  const itemText = text;
22972
23044
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
23045
+ let isObjPushed = false;
23046
+ const collLength = this.objColl.length;
22973
23047
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23048
+ if (collLength !== this.objColl.length) {
23049
+ isObjPushed = true;
23050
+ }
22974
23051
  const prevCropObj = extend({}, this.cropObj, {}, true);
22975
23052
  const objt = { shapeSettingsObj: {} };
22976
23053
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
@@ -22985,7 +23062,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
22985
23062
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
22986
23063
  value: { obj: selPointCollObj } });
22987
23064
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
22988
- this.objColl.pop();
23065
+ if (isObjPushed) {
23066
+ this.objColl.pop();
23067
+ }
22989
23068
  if (this.textArea.style.display === 'block' || this.textArea.style.display === 'inline-block') {
22990
23069
  this.notify('shape', { prop: 'updateFontRatio', onPropertyChange: false,
22991
23070
  value: { obj: this.activeObj, isTextArea: true } });
@@ -23073,7 +23152,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23073
23152
  */
23074
23153
  updateFontColor(value) {
23075
23154
  this.notify('selection', { prop: 'setInitialTextEdit', value: { bool: false } });
23155
+ let isObjPushed = false;
23156
+ const collLength = this.objColl.length;
23076
23157
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23158
+ if (collLength !== this.objColl.length) {
23159
+ isObjPushed = true;
23160
+ }
23077
23161
  const prevCropObj = extend({}, this.cropObj, {}, true);
23078
23162
  const objt = { shapeSettingsObj: {} };
23079
23163
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: objt } });
@@ -23088,7 +23172,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23088
23172
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23089
23173
  value: { obj: selPointCollObj } });
23090
23174
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23091
- this.objColl.pop();
23175
+ if (isObjPushed) {
23176
+ this.objColl.pop();
23177
+ }
23092
23178
  if (this.textArea.style.display === 'none') {
23093
23179
  this.activeObj.strokeSettings.strokeColor = value;
23094
23180
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null,
@@ -23265,7 +23351,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23265
23351
  const obj = { shapeSettingsObj: {} };
23266
23352
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
23267
23353
  const shapeSettings = obj['shapeSettingsObj'];
23354
+ let isObjPushed = false;
23355
+ const collLength = this.objColl.length;
23268
23356
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23357
+ if (collLength !== this.objColl.length) {
23358
+ isObjPushed = true;
23359
+ }
23269
23360
  const prevCropObj = extend({}, this.cropObj, {}, true);
23270
23361
  const object = { currObj: {} };
23271
23362
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23277,7 +23368,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23277
23368
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23278
23369
  value: { obj: selPointCollObj } });
23279
23370
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23280
- this.objColl.pop();
23371
+ if (isObjPushed) {
23372
+ this.objColl.pop();
23373
+ }
23281
23374
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10);
23282
23375
  if (this.activeObj.shape === 'rectangle' || this.activeObj.shape === 'ellipse') {
23283
23376
  this.activeObj.strokeSettings.strokeWidth = parseInt(id, 10) - 1;
@@ -23319,7 +23412,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23319
23412
  const shapeSettings = objt['shapeSettingsObj'];
23320
23413
  if (this.activeObj.shape && (this.activeObj.shape !== 'path' || (this.activeObj.shape === 'path' &&
23321
23414
  this.activeObj.pointColl.length > 0))) {
23415
+ let isObjPushed = false;
23416
+ const collLength = this.objColl.length;
23322
23417
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23418
+ if (collLength !== this.objColl.length) {
23419
+ isObjPushed = true;
23420
+ }
23323
23421
  const prevCropObj = extend({}, this.cropObj, {}, true);
23324
23422
  const object = { currObj: {} };
23325
23423
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23331,7 +23429,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23331
23429
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23332
23430
  value: { obj: selPointCollObj } });
23333
23431
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23334
- this.objColl.pop();
23432
+ if (isObjPushed) {
23433
+ this.objColl.pop();
23434
+ }
23335
23435
  this.activeObj.strokeSettings.strokeColor = value;
23336
23436
  this.notify('shape', { prop: 'setStrokeSettings', value: { strokeSettings: null, strokeColor: this.activeObj.strokeSettings.strokeColor, fillColor: null, strokeWidth: null } });
23337
23437
  if (!this.togglePen) {
@@ -23366,7 +23466,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23366
23466
  const obj = { shapeSettingsObj: {} };
23367
23467
  this.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: obj } });
23368
23468
  const shapeSettings = obj['shapeSettingsObj'];
23469
+ let isObjPushed = false;
23470
+ const collLength = this.objColl.length;
23369
23471
  this.notify('shape', { prop: 'pushActItemIntoObj' });
23472
+ if (collLength !== this.objColl.length) {
23473
+ isObjPushed = true;
23474
+ }
23370
23475
  const prevCropObj = extend({}, this.cropObj, {}, true);
23371
23476
  const object = { currObj: {} };
23372
23477
  this.notify('filter', { prop: 'getCurrentObj', onPropertyChange: false, value: { object: object } });
@@ -23378,7 +23483,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
23378
23483
  this.notify('freehand-draw', { prop: 'getSelPointColl', onPropertyChange: false,
23379
23484
  value: { obj: selPointCollObj } });
23380
23485
  prevObj.selPointColl = extend([], selPointCollObj['selPointColl'], [], true);
23381
- this.objColl.pop();
23486
+ if (isObjPushed) {
23487
+ this.objColl.pop();
23488
+ }
23382
23489
  this.activeObj.strokeSettings.fillColor = value;
23383
23490
  this.notify('shape', { prop: 'setStrokeSettings',
23384
23491
  value: { strokeSettings: null, strokeColor: null, fillColor: this.activeObj.strokeSettings.fillColor,
@@ -24940,7 +25047,7 @@ class ToolbarModule {
24940
25047
  const toolbarItems = [];
24941
25048
  if (isOkBtn) {
24942
25049
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
24943
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
25050
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
24944
25051
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
24945
25052
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
24946
25053
  }
@@ -25022,7 +25129,7 @@ class ToolbarModule {
25022
25129
  }
25023
25130
  if (isApplyOption) {
25024
25131
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
25025
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
25132
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
25026
25133
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
25027
25134
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
25028
25135
  }
@@ -25166,7 +25273,7 @@ class ToolbarModule {
25166
25273
  }
25167
25274
  widthAspectRatio(e) {
25168
25275
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25169
- if (e.keyCode === 109) {
25276
+ if (e.keyCode === 109 || e.keyCode === 9) {
25170
25277
  return;
25171
25278
  }
25172
25279
  const parent = this.parent;
@@ -25210,7 +25317,7 @@ class ToolbarModule {
25210
25317
  }
25211
25318
  heightAspectRatio(e) {
25212
25319
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
25213
- if (e.keyCode === 109) {
25320
+ if (e.keyCode === 109 || e.keyCode === 9) {
25214
25321
  return;
25215
25322
  }
25216
25323
  const parent = this.parent;
@@ -25278,7 +25385,8 @@ class ToolbarModule {
25278
25385
  placeholder: isResize ? null : height, format: '###.## px' })
25279
25386
  });
25280
25387
  if (!this.isAspectRatio) {
25281
- toolbarItems.push({ id: id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center', tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button' });
25388
+ toolbarItems.push({ id: id + '_aspectratio', prefixIcon: 'e-icons e-lock', align: 'Center',
25389
+ tooltipText: this.l10n.getConstant('AspectRatio'), type: 'Button', tabIndex: 0 });
25282
25390
  this.isAspectRatio = true;
25283
25391
  }
25284
25392
  else {
@@ -25287,7 +25395,7 @@ class ToolbarModule {
25287
25395
  }
25288
25396
  if (!Browser.isDevice) {
25289
25397
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
25290
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
25398
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
25291
25399
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
25292
25400
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
25293
25401
  }
@@ -25926,7 +26034,7 @@ class ToolbarModule {
25926
26034
  { id: 'svg', text: 'SVG' }
25927
26035
  ];
25928
26036
  const inputObj = new TextBox({
25929
- placeholder: this.l10n.getConstant('ImageName'),
26037
+ placeholder: this.l10n.getConstant('ImageName')
25930
26038
  });
25931
26039
  inputObj.appendTo('#' + id + '_imgNametext');
25932
26040
  const qualityContainer = document.getElementById(id + '_imgQualitydiv');
@@ -26096,7 +26204,7 @@ class ToolbarModule {
26096
26204
  else {
26097
26205
  imageNameLabel = document.getElementById(id + '_imageNameLabel');
26098
26206
  }
26099
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config */
26207
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
26100
26208
  tempCanvas.toBlob((function (blob) {
26101
26209
  fileSize = Math.floor(blob.size / 1024);
26102
26210
  if (fileSize > 1000) {
@@ -26176,7 +26284,7 @@ class ToolbarModule {
26176
26284
  }
26177
26285
  if (!Browser.isDevice) {
26178
26286
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
26179
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
26287
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
26180
26288
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
26181
26289
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
26182
26290
  }
@@ -26253,7 +26361,7 @@ class ToolbarModule {
26253
26361
  parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
26254
26362
  if (obj['shape'] !== 'path') {
26255
26363
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
26256
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
26364
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
26257
26365
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
26258
26366
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
26259
26367
  }
@@ -26860,7 +26968,7 @@ class ToolbarModule {
26860
26968
  }
26861
26969
  if (!Browser.isDevice) {
26862
26970
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
26863
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
26971
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
26864
26972
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
26865
26973
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
26866
26974
  }
@@ -27155,6 +27263,15 @@ class ToolbarModule {
27155
27263
  args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'z-order', 'duplicate', 'remove'];
27156
27264
  }
27157
27265
  this.initShapesToolbarItem(args.toolbarItems);
27266
+ if (parent.activeObj.shape === 'image') {
27267
+ const actObj = extend({}, parent.activeObj, {}, true);
27268
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
27269
+ parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
27270
+ parent.activeObj = actObj;
27271
+ parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj,
27272
+ isCropRatio: null, points: null, isPreventDrag: true } });
27273
+ this.renderQAT(false);
27274
+ }
27158
27275
  break;
27159
27276
  case 'text':
27160
27277
  if (Browser.isDevice) {
@@ -27238,8 +27355,46 @@ class ToolbarModule {
27238
27355
  parent.notify('draw', { prop: 'render-image', value: { isMouseWheel: null, isPreventClearRect: null, isFrame: true } });
27239
27356
  break;
27240
27357
  }
27241
- this.currToolbar = type;
27242
27358
  this.refreshDropDownBtn(isCropping);
27359
+ this.updateKBDNavigation(type);
27360
+ this.currToolbar = type;
27361
+ }
27362
+ updateKBDNavigation(type) {
27363
+ const parent = this.parent;
27364
+ const id = parent.element.id;
27365
+ if (!parent.isKBDNavigation || this.currToolbar === type) {
27366
+ return;
27367
+ }
27368
+ if (this.isToolbar()) {
27369
+ const tbar = parent.element.querySelectorAll('#' + id + '_toolbar')[0];
27370
+ let tbarInitialChild;
27371
+ let tbarInitialBtn;
27372
+ if (tbar) {
27373
+ tbarInitialChild = tbar.querySelector('.e-toolbar-center');
27374
+ if (!tbarInitialChild || !tbarInitialChild.children[0]) {
27375
+ return;
27376
+ }
27377
+ tbarInitialBtn = tbarInitialChild.children[0].querySelector('.e-btn');
27378
+ let tempElem = tbarInitialChild.children[1];
27379
+ if (tempElem) {
27380
+ tempElem = tempElem.children[0];
27381
+ }
27382
+ if (tempElem) {
27383
+ tempElem = tempElem.children[0];
27384
+ }
27385
+ if (type === 'resize' && tempElem) {
27386
+ tbarInitialBtn = tempElem;
27387
+ }
27388
+ if (tbarInitialBtn) {
27389
+ if (type === 'main') {
27390
+ setTimeout(() => tbarInitialBtn.focus(), 50);
27391
+ }
27392
+ else {
27393
+ tbarInitialBtn.focus();
27394
+ }
27395
+ }
27396
+ }
27397
+ }
27243
27398
  }
27244
27399
  performCropTransformClick(shape, isTransform) {
27245
27400
  const parent = this.parent;
@@ -27305,7 +27460,7 @@ class ToolbarModule {
27305
27460
  }
27306
27461
  if (!Browser.isDevice) {
27307
27462
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
27308
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
27463
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
27309
27464
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
27310
27465
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
27311
27466
  }
@@ -27358,7 +27513,7 @@ class ToolbarModule {
27358
27513
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
27359
27514
  toolbarItems.push({ id: id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
27360
27515
  tooltipText: this.l10n.getConstant('Default'), align: 'Center',
27361
- 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>' });
27516
+ 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>' });
27362
27517
  }
27363
27518
  if (isNullOrUndefined(parent.toolbar) || !isCustomized || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
27364
27519
  toolbarItems.push({ id: id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
@@ -27431,7 +27586,7 @@ class ToolbarModule {
27431
27586
  }
27432
27587
  if (!Browser.isDevice) {
27433
27588
  toolbarItems.push({ id: id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
27434
- tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
27589
+ tooltipText: this.l10n.getConstant('OK'), align: 'Right', tabIndex: 0 });
27435
27590
  toolbarItems.push({ id: id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
27436
27591
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
27437
27592
  }
@@ -29686,8 +29841,10 @@ class ToolbarModule {
29686
29841
  }
29687
29842
  parent.notify('selection', { prop: 'setSliderActive', onPropertyChange: false, value: { bool: false } });
29688
29843
  if (type === 'transparency') {
29689
- parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
29690
- parent.element.querySelector('#' + parent.element.id + '_transparency').click();
29844
+ setTimeout(() => {
29845
+ parent.notify('undo-redo', { prop: 'updateUndoRedoStack', onPropertyChange: false });
29846
+ parent.element.querySelector('#' + parent.element.id + '_transparency').click();
29847
+ }, 50);
29691
29848
  }
29692
29849
  }
29693
29850
  });