@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.
@@ -6256,7 +6256,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6256
6256
  if (this.disabled) {
6257
6257
  this.element.setAttribute('class', 'e-disabled');
6258
6258
  }
6259
- this.trigger('fileOpened', fileOpened);
6259
+ if (this.isImageLoaded && this.element.style.opacity !== '0.5') {
6260
+ this.trigger('fileOpened', fileOpened);
6261
+ }
6260
6262
  if (this.zoomSettings.zoomFactor !== 1 || !isNullOrUndefined(this.zoomSettings.zoomPoint)) {
6261
6263
  this.zoom(this.zoomSettings.zoomFactor, this.zoomSettings.zoomPoint);
6262
6264
  }
@@ -6501,10 +6503,33 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
6501
6503
  };
6502
6504
  ImageEditor.prototype.fileSelect = function (inputElement, args) {
6503
6505
  if (!this.disabled) {
6504
- showSpinner(this.element);
6505
- this.element.style.opacity = '0.5';
6506
6506
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6507
6507
  var filesData = args.target.files[0];
6508
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6509
+ var fileData = filesData;
6510
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6511
+ !isNullOrUndefined(fileData.name.split('.')[1]) &&
6512
+ fileData.name.split('.')[1].toLowerCase() !== 'jpg' &&
6513
+ fileData.name.split('.')[1].toLowerCase() !== 'jpeg' &&
6514
+ fileData.name.split('.')[1].toLowerCase() !== 'png' &&
6515
+ fileData.name.split('.')[1].toLowerCase() !== 'svg') {
6516
+ return;
6517
+ }
6518
+ showSpinner(this.element);
6519
+ this.element.style.opacity = '0.5';
6520
+ if (!isNullOrUndefined(fileData.name.split('.')) &&
6521
+ !isNullOrUndefined(fileData.name.split('.')[1])) {
6522
+ var fileType = this.toPascalCase(fileData.name.split('.')[1]);
6523
+ if (fileType === 'JPG' || fileType === 'Jpg') {
6524
+ this.fileType = 'Jpeg';
6525
+ }
6526
+ else {
6527
+ this.fileType = fileType;
6528
+ }
6529
+ }
6530
+ else {
6531
+ this.fileType = null;
6532
+ }
6508
6533
  if (this.isImageLoaded) {
6509
6534
  this.isImageLoaded = false;
6510
6535
  this.reset();
@@ -8135,17 +8160,19 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
8135
8160
  if (this.degree === 0 || this.degree === 180) {
8136
8161
  if (!isNullOrUndefined(this.activeObj.shape)) {
8137
8162
  this.setZoomDimension(-0.1, this.activeObj);
8138
- if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8139
- this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8140
- this.activeObj.activePoint.endY) {
8141
- zoomOut.classList.add('e-disabled');
8142
- zoomOut.parentElement.classList.add('e-overlay');
8143
- isDisabled = true;
8144
- }
8145
- else {
8146
- zoomOut.classList.remove('e-disabled');
8147
- zoomOut.parentElement.classList.remove('e-overlay');
8148
- isDisabled = false;
8163
+ if (!isNullOrUndefined(zoomOut)) {
8164
+ if (this.destLeft > this.activeObj.activePoint.startX || this.destTop > this.activeObj.activePoint.startY ||
8165
+ this.destLeft + this.destWidth < this.activeObj.activePoint.endX || this.destTop + this.destHeight <
8166
+ this.activeObj.activePoint.endY) {
8167
+ zoomOut.classList.add('e-disabled');
8168
+ zoomOut.parentElement.classList.add('e-overlay');
8169
+ isDisabled = true;
8170
+ }
8171
+ else {
8172
+ zoomOut.classList.remove('e-disabled');
8173
+ zoomOut.parentElement.classList.remove('e-overlay');
8174
+ isDisabled = false;
8175
+ }
8149
8176
  }
8150
8177
  }
8151
8178
  else {
@@ -13328,10 +13355,24 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
13328
13355
  else {
13329
13356
  this.fileName = 'ImageEditor';
13330
13357
  }
13358
+ if (!isNullOrUndefined(data.split('.')) &&
13359
+ !isNullOrUndefined(data.split('.')[2])) {
13360
+ var fileType = this.toPascalCase(data.split('.')[2]);
13361
+ if (fileType === 'JPG' || fileType === 'Jpg') {
13362
+ this.fileType = 'Jpeg';
13363
+ }
13364
+ else {
13365
+ this.fileType = fileType;
13366
+ }
13367
+ }
13368
+ else {
13369
+ this.fileType = null;
13370
+ }
13331
13371
  this.imageOnLoad(data);
13332
13372
  }
13333
13373
  else {
13334
13374
  this.fileName = 'ImageEditor';
13375
+ this.fileType = null;
13335
13376
  this.lowerCanvas = document.querySelector('#' + this.element.id + '_lowerCanvas');
13336
13377
  this.upperCanvas = document.querySelector('#' + this.element.id + '_upperCanvas');
13337
13378
  this.lowerContext = this.lowerCanvas.getContext('2d');
@@ -13481,7 +13522,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
13481
13522
  if (!isNullOrUndefined(document.getElementById(this.element.id + '_quickAccessToolbarArea'))) {
13482
13523
  document.getElementById(this.element.id + '_quickAccessToolbarArea').style.display = 'none';
13483
13524
  }
13525
+ this.isImageLoaded = false;
13484
13526
  this.updateCanvas();
13527
+ this.isImageLoaded = true;
13485
13528
  this.refreshDropDownBtn(false);
13486
13529
  this.enableDisableToolbarBtn();
13487
13530
  }