@syncfusion/ej2-image-editor 21.1.35 → 21.1.37

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 21.1.35
3
+ * version : 21.1.37
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-image-editor@*",
3
- "_id": "@syncfusion/ej2-image-editor@20.15.0",
3
+ "_id": "@syncfusion/ej2-image-editor@21.1.35",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-Xmh+hp6L+IMvA9vK8dkYMdJ7v7Sr/WmeQuh2NNLhaNdjdEl+6EBY7iU6z7AXM4vJg9cy3Q4JMu0D/rPRDS0kPA==",
5
+ "_integrity": "sha512-289P3lrtS50BCk0Qv/bG58TZAGDBxv8uIWbpgQg6bnqxl9Yg/6HwpYeCR0c+v1a3WabbRK69xwAYH/JUnugHZw==",
6
6
  "_location": "/@syncfusion/ej2-image-editor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-image-editor",
24
24
  "/@syncfusion/ej2-vue-image-editor"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-image-editor/-/ej2-image-editor-20.15.0.tgz",
27
- "_shasum": "fbc13db02e3a21783e2b81260218e839b609f3e8",
26
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-21.1.35.tgz",
27
+ "_shasum": "b49ae43cb080b7362e2287e6cad98e7ca5851a6b",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
30
30
  "author": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~21.1.35",
36
- "@syncfusion/ej2-buttons": "~21.1.35",
37
- "@syncfusion/ej2-inputs": "~21.1.35",
38
- "@syncfusion/ej2-navigations": "~21.1.35",
39
- "@syncfusion/ej2-popups": "~21.1.35",
40
- "@syncfusion/ej2-splitbuttons": "~21.1.35"
35
+ "@syncfusion/ej2-base": "~21.1.37",
36
+ "@syncfusion/ej2-buttons": "~21.1.37",
37
+ "@syncfusion/ej2-inputs": "~21.1.37",
38
+ "@syncfusion/ej2-navigations": "~21.1.37",
39
+ "@syncfusion/ej2-popups": "~21.1.37",
40
+ "@syncfusion/ej2-splitbuttons": "~21.1.37"
41
41
  },
42
42
  "deprecated": false,
43
43
  "description": "Essential JS 2 ImageEditor",
@@ -67,7 +67,7 @@
67
67
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
68
68
  },
69
69
  "typings": "index.d.ts",
70
- "version": "21.1.35",
70
+ "version": "21.1.37",
71
71
  "sideEffects": false,
72
72
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
73
73
  }
@@ -326,6 +326,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
326
326
  private isShapeInserted;
327
327
  private isInitialTextEdited;
328
328
  private isShapeTextInserted;
329
+ private isErrorImage;
329
330
  /**
330
331
  * Defines one or more CSS classes that can be used to customize the appearance of an Image Editor component.
331
332
  *
@@ -756,6 +757,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
756
757
  private renderSaveBtn;
757
758
  private cropSelect;
758
759
  private transformSelect;
760
+ private resetZoom;
759
761
  private performTransformation;
760
762
  private updateTransform;
761
763
  private getShapesToolbarItem;
@@ -225,6 +225,7 @@ var ImageEditor = /** @class */ (function (_super) {
225
225
  _this.isShapeInserted = false;
226
226
  _this.isInitialTextEdited = false;
227
227
  _this.isShapeTextInserted = false;
228
+ _this.isErrorImage = false;
228
229
  return _this;
229
230
  }
230
231
  ImageEditor_1 = ImageEditor;
@@ -430,7 +431,8 @@ var ImageEditor = /** @class */ (function (_super) {
430
431
  this.zoomSettings.zoomTrigger = newProperties.zoomSettings.zoomTrigger;
431
432
  }
432
433
  if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
433
- this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar | ZoomTrigger.Commands);
434
+ this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
435
+ ZoomTrigger.Commands);
434
436
  this.refreshToolbar('main');
435
437
  }
436
438
  else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
@@ -1327,11 +1329,9 @@ var ImageEditor = /** @class */ (function (_super) {
1327
1329
  this.performTransformation(args.item.id);
1328
1330
  this.updateCurrentUndoRedoColl('ok');
1329
1331
  };
1330
- ImageEditor.prototype.performTransformation = function (text) {
1331
- var tempZoomFactor = this.defaultZoomFactor;
1332
- var isUndoRedo = this.isUndoRedo;
1333
- var prevCropObj = extend({}, this.cropObj, {}, true);
1332
+ ImageEditor.prototype.resetZoom = function () {
1334
1333
  if (this.defaultZoomFactor !== 0) {
1334
+ var isUndoRedo = this.isUndoRedo;
1335
1335
  this.transformCurrentObj = this.getCurrentObj();
1336
1336
  this.transformCurrentObj.objColl = extend([], this.objColl, null, true);
1337
1337
  this.transformCurrentObj.pointColl = extend({}, this.pointColl, null, true);
@@ -1345,6 +1345,12 @@ var ImageEditor = /** @class */ (function (_super) {
1345
1345
  }
1346
1346
  this.isUndoRedo = isUndoRedo;
1347
1347
  }
1348
+ };
1349
+ ImageEditor.prototype.performTransformation = function (text) {
1350
+ var tempZoomFactor = this.defaultZoomFactor;
1351
+ var isUndoRedo = this.isUndoRedo;
1352
+ var prevCropObj = extend({}, this.cropObj, {}, true);
1353
+ this.resetZoom();
1348
1354
  this.updateTransform(text);
1349
1355
  if (tempZoomFactor !== 0) {
1350
1356
  this.isUndoRedo = true;
@@ -2328,7 +2334,6 @@ var ImageEditor = /** @class */ (function (_super) {
2328
2334
  isDisabledFilter = true;
2329
2335
  }
2330
2336
  this.enableDisableToolbarBtn();
2331
- var previousObj = void 0;
2332
2337
  var duplicateObj = void 0;
2333
2338
  var objColl = void 0;
2334
2339
  if (!this.disabled) {
@@ -2378,11 +2383,6 @@ var ImageEditor = /** @class */ (function (_super) {
2378
2383
  this.currentToolbar = 'main';
2379
2384
  break;
2380
2385
  case 'crop':
2381
- previousObj = this.getCurrentObj();
2382
- previousObj.objColl = extend([], this.objColl, [], true);
2383
- previousObj.pointColl = extend([], this.pointColl, [], true);
2384
- previousObj.afterCropActions = this.afterCropActions;
2385
- this.previousCropCurrentObj = previousObj;
2386
2386
  if (!isNullOrUndefined(this.currSelectionPoint)) {
2387
2387
  if (this.currObjType.isUndoAction) {
2388
2388
  this.refreshUndoRedoColl();
@@ -4448,48 +4448,63 @@ var ImageEditor = /** @class */ (function (_super) {
4448
4448
  this.inMemoryCanvas.width = imageData.width;
4449
4449
  this.inMemoryCanvas.height = imageData.height;
4450
4450
  this.inMemoryContext.putImageData(imageData, 0, 0);
4451
+ var ctx;
4451
4452
  var noFilter = document.querySelector('#' + this.element.id + '_defaultCanvas');
4452
- var ctx = noFilter.getContext('2d');
4453
- noFilter.style.width = '100px';
4454
- noFilter.style.height = '100px';
4455
- ctx.filter = this.updateAdjustment('default', null, true);
4456
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4453
+ if (!isNullOrUndefined(noFilter)) {
4454
+ ctx = noFilter.getContext('2d');
4455
+ noFilter.style.width = '100px';
4456
+ noFilter.style.height = '100px';
4457
+ ctx.filter = this.updateAdjustment('default', null, true);
4458
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4459
+ }
4457
4460
  var chrome = document.querySelector('#' + this.element.id + '_chromeCanvas');
4458
- ctx = chrome.getContext('2d');
4459
- chrome.style.width = '100px';
4460
- chrome.style.height = '100px';
4461
- ctx.filter = this.updateAdjustment('chrome', null, true);
4462
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4461
+ if (!isNullOrUndefined(chrome)) {
4462
+ ctx = chrome.getContext('2d');
4463
+ chrome.style.width = '100px';
4464
+ chrome.style.height = '100px';
4465
+ ctx.filter = this.updateAdjustment('chrome', null, true);
4466
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4467
+ }
4463
4468
  var cold = document.querySelector('#' + this.element.id + '_coldCanvas');
4464
- ctx = cold.getContext('2d');
4465
- cold.style.width = '100px';
4466
- cold.style.height = '100px';
4467
- ctx.filter = this.updateAdjustment('cold', null, true);
4468
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4469
+ if (!isNullOrUndefined(cold)) {
4470
+ ctx = cold.getContext('2d');
4471
+ cold.style.width = '100px';
4472
+ cold.style.height = '100px';
4473
+ ctx.filter = this.updateAdjustment('cold', null, true);
4474
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4475
+ }
4469
4476
  var warm = document.querySelector('#' + this.element.id + '_warmCanvas');
4470
- ctx = warm.getContext('2d');
4471
- warm.style.width = '100px';
4472
- warm.style.height = '100px';
4473
- ctx.filter = this.updateAdjustment('warm', null, true);
4474
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4477
+ if (!isNullOrUndefined(warm)) {
4478
+ ctx = warm.getContext('2d');
4479
+ warm.style.width = '100px';
4480
+ warm.style.height = '100px';
4481
+ ctx.filter = this.updateAdjustment('warm', null, true);
4482
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4483
+ }
4475
4484
  var grayscale = document.querySelector('#' + this.element.id + '_grayscaleCanvas');
4476
- ctx = grayscale.getContext('2d');
4477
- grayscale.style.width = '100px';
4478
- grayscale.style.height = '100px';
4479
- ctx.filter = this.updateAdjustment('grayscale', null, true);
4480
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4485
+ if (!isNullOrUndefined(grayscale)) {
4486
+ ctx = grayscale.getContext('2d');
4487
+ grayscale.style.width = '100px';
4488
+ grayscale.style.height = '100px';
4489
+ ctx.filter = this.updateAdjustment('grayscale', null, true);
4490
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4491
+ }
4481
4492
  var sepia = document.querySelector('#' + this.element.id + '_sepiaCanvas');
4482
- ctx = sepia.getContext('2d');
4483
- sepia.style.width = '100px';
4484
- sepia.style.height = '100px';
4485
- ctx.filter = this.updateAdjustment('sepia', null, true);
4486
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4493
+ if (!isNullOrUndefined(sepia)) {
4494
+ ctx = sepia.getContext('2d');
4495
+ sepia.style.width = '100px';
4496
+ sepia.style.height = '100px';
4497
+ ctx.filter = this.updateAdjustment('sepia', null, true);
4498
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4499
+ }
4487
4500
  var invert = document.querySelector('#' + this.element.id + '_invertCanvas');
4488
- ctx = invert.getContext('2d');
4489
- invert.style.width = '100px';
4490
- invert.style.height = '100px';
4491
- ctx.filter = this.updateAdjustment('invert', null, true);
4492
- ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4501
+ if (!isNullOrUndefined(invert)) {
4502
+ ctx = invert.getContext('2d');
4503
+ invert.style.width = '100px';
4504
+ invert.style.height = '100px';
4505
+ ctx.filter = this.updateAdjustment('invert', null, true);
4506
+ ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
4507
+ }
4493
4508
  };
4494
4509
  ImageEditor.prototype.callUpdateCurrentTransformedState = function () {
4495
4510
  var tempObjColl = extend([], this.objColl, [], true);
@@ -6258,7 +6273,7 @@ var ImageEditor = /** @class */ (function (_super) {
6258
6273
  _this.currObjType.isUndoZoom = false;
6259
6274
  _this.lowerCanvas.style.display = 'block';
6260
6275
  }
6261
- _this.isUndoRedo = false;
6276
+ _this.isUndoRedo = _this.isErrorImage = false;
6262
6277
  if (Browser.isDevice) {
6263
6278
  if (_this.isToolbar() && (!isNullOrUndefined(document.getElementById(_this.element.id + '_toolbar'))) &&
6264
6279
  (!isNullOrUndefined(getComponent(document.getElementById(_this.element.id + '_toolbar'), 'toolbar')))) {
@@ -6279,6 +6294,10 @@ var ImageEditor = /** @class */ (function (_super) {
6279
6294
  _this.initToolbarItem(false, false, null);
6280
6295
  }
6281
6296
  };
6297
+ this.baseImg.onerror = function () {
6298
+ hideSpinner(_this.element);
6299
+ _this.isErrorImage = true;
6300
+ };
6282
6301
  };
6283
6302
  ImageEditor.prototype.refreshActiveObj = function () {
6284
6303
  this.activeObj = {};
@@ -6746,7 +6765,8 @@ var ImageEditor = /** @class */ (function (_super) {
6746
6765
  else if (!isShape && !isNullOrUndefined(activeObj.shape)) {
6747
6766
  this.activeObj = activeObj;
6748
6767
  var index = this.getCurrentIndex();
6749
- if ((!isNullOrUndefined(index) && JSON.stringify(this.activeObj.activePoint) === JSON.stringify(this.objColl[index].activePoint))) {
6768
+ if ((!isNullOrUndefined(index) &&
6769
+ JSON.stringify(this.activeObj.activePoint) === JSON.stringify(this.objColl[index].activePoint))) {
6750
6770
  this.objColl.splice(index, 1);
6751
6771
  }
6752
6772
  else if (isNullOrUndefined(this.activeObj.currIndex)) {
@@ -13245,7 +13265,28 @@ var ImageEditor = /** @class */ (function (_super) {
13245
13265
  * @returns {ImageData}.
13246
13266
  */
13247
13267
  ImageEditor.prototype.getImageData = function () {
13268
+ if (!isNullOrUndefined(this.activeObj.shape)) {
13269
+ this.performCancel();
13270
+ }
13271
+ var currentObj;
13272
+ if (this.defaultZoomFactor > 0) {
13273
+ currentObj = this.getCurrentObj();
13274
+ currentObj.objColl = extend([], this.objColl, [], true);
13275
+ currentObj.pointColl = extend([], this.pointColl, [], true);
13276
+ currentObj.afterCropActions = extend([], this.afterCropActions, [], true);
13277
+ }
13278
+ this.resetZoom();
13248
13279
  var data = this.lowerContext.getImageData(this.destLeft, this.destTop, this.destWidth, this.destHeight);
13280
+ if (!isNullOrUndefined(currentObj)) {
13281
+ this.setCurrentObj(currentObj);
13282
+ this.objColl = extend([], currentObj.objColl, [], true);
13283
+ this.pointColl = extend([], currentObj.pointColl, [], true);
13284
+ this.freehandCounter = this.pointColl.length;
13285
+ this.lowerContext.filter = 'none';
13286
+ this.zoomObjColl();
13287
+ this.zoomFreehandDrawColl();
13288
+ this.lowerContext.filter = currentObj.filter;
13289
+ }
13249
13290
  return data;
13250
13291
  };
13251
13292
  /**
@@ -13268,12 +13309,15 @@ var ImageEditor = /** @class */ (function (_super) {
13268
13309
  }
13269
13310
  if (this.defToolbarItems.length === 0 &&
13270
13311
  (isNullOrUndefined(document.getElementById(this.element.id + '_toolbar')))) {
13271
- this.toolbarHeight = 0;
13272
- }
13273
- if (isNullOrUndefined(this.toolbarTemplate)) {
13274
- this.reset();
13275
- this.update();
13312
+ if (isNullOrUndefined(this.toolbarTemplate)) {
13313
+ this.toolbarHeight = 0;
13314
+ }
13315
+ else if (!isNullOrUndefined(this.element.querySelector('#' + this.element.id + '_toolbarArea'))) {
13316
+ this.toolbarHeight = this.element.querySelector('#' + this.element.id + '_toolbarArea').clientHeight;
13317
+ }
13276
13318
  }
13319
+ this.reset();
13320
+ this.update();
13277
13321
  this.degree = 0;
13278
13322
  this.zoomFactor = 0;
13279
13323
  this.isImageLoaded = false;
@@ -13315,7 +13359,7 @@ var ImageEditor = /** @class */ (function (_super) {
13315
13359
  * @returns {void}.
13316
13360
  */
13317
13361
  ImageEditor.prototype.reset = function () {
13318
- if (!this.disabled) {
13362
+ if (!this.disabled && !this.isErrorImage) {
13319
13363
  this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
13320
13364
  this.inMemoryContext.clearRect(0, 0, this.lowerCanvas.height, this.lowerCanvas.width);
13321
13365
  this.lowerContext.clearRect(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
@@ -13386,7 +13430,7 @@ var ImageEditor = /** @class */ (function (_super) {
13386
13430
  this.rotatedDestPoints = { startX: 0, startY: 0, width: 0, height: 0 };
13387
13431
  this.croppedDegree = 0;
13388
13432
  this.freehandDrawHoveredIndex = this.freehandDrawSelectedIndex = null;
13389
- this.isFreehandDrawingPoint = this.isFreehandDrawEditing = false;
13433
+ this.isFreehandDrawingPoint = this.isFreehandDrawEditing = this.isErrorImage = false;
13390
13434
  this.tempFreeHandDrawEditingStyles = { strokeColor: null, fillColor: null, strokeWidth: null };
13391
13435
  this.totalPannedInternalPoint = { x: 0, y: 0 };
13392
13436
  this.totalPannedClientPoint = { x: 0, y: 0 };
@@ -13541,6 +13585,11 @@ var ImageEditor = /** @class */ (function (_super) {
13541
13585
  */
13542
13586
  ImageEditor.prototype.select = function (type, startX, startY, width, height) {
13543
13587
  if (!this.disabled && this.isImageLoaded) {
13588
+ var previousObj = this.getCurrentObj();
13589
+ previousObj.objColl = extend([], this.objColl, [], true);
13590
+ previousObj.pointColl = extend([], this.pointColl, [], true);
13591
+ previousObj.afterCropActions = this.afterCropActions;
13592
+ this.previousCropCurrentObj = previousObj;
13544
13593
  if (this.zoomFactor > 0 && !isNullOrUndefined(this.activeObj.shape) && this.activeObj.shape.split('-')[0] === 'crop' && isNullOrUndefined(this.currentSelectionPoint)) {
13545
13594
  this.currentSelectionPoint = extend({}, this.activeObj, {}, true);
13546
13595
  }