@syncfusion/ej2-image-editor 21.2.6 → 21.2.10

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.
@@ -6212,7 +6212,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
6212
6212
  if (this.disabled) {
6213
6213
  this.element.setAttribute('class', 'e-disabled');
6214
6214
  }
6215
- this.trigger('fileOpened', fileOpened);
6215
+ if (this.isImageLoaded && this.element.style.opacity !== '0.5') {
6216
+ this.trigger('fileOpened', fileOpened);
6217
+ }
6216
6218
  if (this.zoomSettings.zoomFactor !== 1 || !isNullOrUndefined(this.zoomSettings.zoomPoint)) {
6217
6219
  this.zoom(this.zoomSettings.zoomFactor, this.zoomSettings.zoomPoint);
6218
6220
  }
@@ -6456,10 +6458,33 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
6456
6458
  }
6457
6459
  fileSelect(inputElement, args) {
6458
6460
  if (!this.disabled) {
6459
- showSpinner(this.element);
6460
- this.element.style.opacity = '0.5';
6461
6461
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6462
6462
  const filesData = args.target.files[0];
6463
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6464
+ const fileData = filesData;
6465
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6466
+ !isNullOrUndefined(fileData.name.split('.')[1]) &&
6467
+ fileData.name.split('.')[1].toLowerCase() !== 'jpg' &&
6468
+ fileData.name.split('.')[1].toLowerCase() !== 'jpeg' &&
6469
+ fileData.name.split('.')[1].toLowerCase() !== 'png' &&
6470
+ fileData.name.split('.')[1].toLowerCase() !== 'svg') {
6471
+ return;
6472
+ }
6473
+ showSpinner(this.element);
6474
+ this.element.style.opacity = '0.5';
6475
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6476
+ !isNullOrUndefined(fileData.name.split('.')[1])) {
6477
+ const fileType = this.toPascalCase(fileData.name.split('.')[1]);
6478
+ if (fileType === 'JPG' || fileType === 'Jpg') {
6479
+ this.fileType = 'Jpeg';
6480
+ }
6481
+ else {
6482
+ this.fileType = fileType;
6483
+ }
6484
+ }
6485
+ else {
6486
+ this.fileType = null;
6487
+ }
6463
6488
  if (this.isImageLoaded) {
6464
6489
  this.isImageLoaded = false;
6465
6490
  this.reset();
@@ -8089,17 +8114,19 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
8089
8114
  if (this.degree === 0 || this.degree === 180) {
8090
8115
  if (!isNullOrUndefined(this.activeObj.shape)) {
8091
8116
  this.setZoomDimension(-0.1, this.activeObj);
8092
- if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8093
- this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8094
- this.activeObj.activePoint.endY) {
8095
- zoomOut.classList.add('e-disabled');
8096
- zoomOut.parentElement.classList.add('e-overlay');
8097
- isDisabled = true;
8098
- }
8099
- else {
8100
- zoomOut.classList.remove('e-disabled');
8101
- zoomOut.parentElement.classList.remove('e-overlay');
8102
- isDisabled = false;
8117
+ if (!isNullOrUndefined(zoomOut)) {
8118
+ if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8119
+ this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8120
+ this.activeObj.activePoint.endY) {
8121
+ zoomOut.classList.add('e-disabled');
8122
+ zoomOut.parentElement.classList.add('e-overlay');
8123
+ isDisabled = true;
8124
+ }
8125
+ else {
8126
+ zoomOut.classList.remove('e-disabled');
8127
+ zoomOut.parentElement.classList.remove('e-overlay');
8128
+ isDisabled = false;
8129
+ }
8103
8130
  }
8104
8131
  }
8105
8132
  else {
@@ -13281,10 +13308,24 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
13281
13308
  else {
13282
13309
  this.fileName = 'ImageEditor';
13283
13310
  }
13311
+ if (!isNullOrUndefined(data.split('.')) &&
13312
+ !isNullOrUndefined(data.split('.')[2])) {
13313
+ const fileType = this.toPascalCase(data.split('.')[2]);
13314
+ if (fileType === 'JPG' || fileType === 'Jpg') {
13315
+ this.fileType = 'Jpeg';
13316
+ }
13317
+ else {
13318
+ this.fileType = fileType;
13319
+ }
13320
+ }
13321
+ else {
13322
+ this.fileType = null;
13323
+ }
13284
13324
  this.imageOnLoad(data);
13285
13325
  }
13286
13326
  else {
13287
13327
  this.fileName = 'ImageEditor';
13328
+ this.fileType = null;
13288
13329
  this.lowerCanvas = document.querySelector('#' + this.element.id + '_lowerCanvas');
13289
13330
  this.upperCanvas = document.querySelector('#' + this.element.id + '_upperCanvas');
13290
13331
  this.lowerContext = this.lowerCanvas.getContext('2d');
@@ -13434,7 +13475,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
13434
13475
  if (!isNullOrUndefined(document.getElementById(this.element.id + '_quickAccessToolbarArea'))) {
13435
13476
  document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
13436
13477
  }
13478
+ this.isImageLoaded = false;
13437
13479
  this.updateCanvas();
13480
+ this.isImageLoaded = true;
13438
13481
  this.refreshDropDownBtn(false);
13439
13482
  this.enableDisableToolbarBtn();
13440
13483
  }