@syncfusion/ej2-image-editor 23.1.38 → 23.1.41
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.
- package/CHANGELOG.md +24 -0
- package/dist/ej2-image-editor.umd.min.js +2 -2
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +216 -43
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +215 -42
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +2 -2
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/image-editor/action/draw.js +5 -1
- package/src/image-editor/action/freehand-draw.js +5 -4
- package/src/image-editor/action/transform.js +13 -6
- package/src/image-editor/action/undo-redo.js +2 -1
- package/src/image-editor/base/enum.d.ts +28 -1
- package/src/image-editor/base/enum.js +27 -0
- package/src/image-editor/base/image-editor.d.ts +9 -2
- package/src/image-editor/base/image-editor.js +145 -24
- package/src/image-editor/renderer/toolbar.js +19 -7
|
@@ -4288,7 +4288,11 @@ class Draw {
|
|
|
4288
4288
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
4289
4289
|
filesData = fileData = args.filesData[0].rawFile;
|
|
4290
4290
|
}
|
|
4291
|
-
let fileExtension
|
|
4291
|
+
let fileExtension;
|
|
4292
|
+
if (fileData.name) {
|
|
4293
|
+
let fileExtensionArray = fileData.name.split('.');
|
|
4294
|
+
fileExtension = fileExtensionArray[fileExtensionArray.length - 1].toLowerCase();
|
|
4295
|
+
}
|
|
4292
4296
|
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
4293
4297
|
this.errorLoading();
|
|
4294
4298
|
return;
|
|
@@ -6257,7 +6261,7 @@ class FreehandDrawing {
|
|
|
6257
6261
|
EventHandler.add(canvas, 'mousemove touchmove', this.freehandMoveHandler, this);
|
|
6258
6262
|
const shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
|
|
6259
6263
|
startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
|
|
6260
|
-
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.
|
|
6264
|
+
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
|
|
6261
6265
|
points: null };
|
|
6262
6266
|
const shapeChangingArgs = { action: 'draw-start', previousShapeSettings: shapeSettings,
|
|
6263
6267
|
currentShapeSettings: shapeSettings };
|
|
@@ -6314,7 +6318,7 @@ class FreehandDrawing {
|
|
|
6314
6318
|
currentText: null, previousFilter: null, isCircleCrop: null } });
|
|
6315
6319
|
const shapeSettings = { id: 'pen_' + (this.currFHDIdx + 1), type: ShapeType.FreehandDraw,
|
|
6316
6320
|
startX: this.freehandDownPoint.x, startY: this.freehandDownPoint.y,
|
|
6317
|
-
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.
|
|
6321
|
+
strokeColor: this.parent.activeObj.strokeSettings.strokeColor, strokeWidth: this.penStrokeWidth,
|
|
6318
6322
|
points: this.parent.pointColl[this.currFHDIdx].points };
|
|
6319
6323
|
const shapeChangingArgs = { action: 'draw-end', previousShapeSettings: shapeSettings,
|
|
6320
6324
|
currentShapeSettings: shapeSettings };
|
|
@@ -6335,6 +6339,7 @@ class FreehandDrawing {
|
|
|
6335
6339
|
y = e.touches[0].clientY - rect.top;
|
|
6336
6340
|
}
|
|
6337
6341
|
if (this.isFreehandDrawing) {
|
|
6342
|
+
this.upperContext.fillStyle = this.parent.activeObj.strokeSettings.strokeColor;
|
|
6338
6343
|
this.processPoint(x, y, false, this.upperContext);
|
|
6339
6344
|
}
|
|
6340
6345
|
}
|
|
@@ -7071,7 +7076,7 @@ class FreehandDrawing {
|
|
|
7071
7076
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7072
7077
|
parent.dotNetRef.invokeMethodAsync('ShapeEventAsync', 'OnShape', shapeChangingArgs).then((shapeChangingArgs) => {
|
|
7073
7078
|
parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7074
|
-
|
|
7079
|
+
this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
7075
7080
|
if (this.fhdSelID) {
|
|
7076
7081
|
parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7077
7082
|
parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
@@ -7087,7 +7092,7 @@ class FreehandDrawing {
|
|
|
7087
7092
|
else {
|
|
7088
7093
|
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
7089
7094
|
parent.activeObj.strokeSettings.strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7090
|
-
|
|
7095
|
+
this.penStrokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
7091
7096
|
if (this.fhdSelID) {
|
|
7092
7097
|
parent.pointColl[this.fhdSelIdx].strokeColor = shapeChangingArgs.currentShapeSettings.strokeColor;
|
|
7093
7098
|
parent.pointColl[this.fhdSelIdx].strokeWidth = shapeChangingArgs.currentShapeSettings.strokeWidth;
|
|
@@ -15249,7 +15254,8 @@ class Transform {
|
|
|
15249
15254
|
parent.rotateFlipColl = obj['collection'];
|
|
15250
15255
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
15251
15256
|
this.isPreventSelect = true;
|
|
15252
|
-
parent.
|
|
15257
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
15258
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
15253
15259
|
this.isPreventSelect = false;
|
|
15254
15260
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
15255
15261
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
@@ -15515,7 +15521,8 @@ class Transform {
|
|
|
15515
15521
|
parent.rotateFlipColl = obj['collection'];
|
|
15516
15522
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
15517
15523
|
this.isPreventSelect = true;
|
|
15518
|
-
parent.
|
|
15524
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
15525
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
15519
15526
|
this.isPreventSelect = false;
|
|
15520
15527
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
15521
15528
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
@@ -17064,13 +17071,17 @@ class Transform {
|
|
|
17064
17071
|
}
|
|
17065
17072
|
else if (parent.img.srcWidth === parent.baseImgCanvas.width && parent.img.srcHeight === parent.baseImgCanvas.height) {
|
|
17066
17073
|
parent.currSelectionPoint = null;
|
|
17067
|
-
parent.
|
|
17074
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17075
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
17068
17076
|
}
|
|
17069
17077
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
17070
|
-
parent.
|
|
17078
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17079
|
+
value: { type: 'custom', startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
17080
|
+
width: parent.img.destWidth, height: parent.img.destHeight } });
|
|
17071
17081
|
}
|
|
17072
17082
|
else {
|
|
17073
|
-
parent.
|
|
17083
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17084
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
17074
17085
|
}
|
|
17075
17086
|
width = parent.activeObj.activePoint.width * widthRatio;
|
|
17076
17087
|
height = parent.activeObj.activePoint.height * heightRatio;
|
|
@@ -17078,7 +17089,8 @@ class Transform {
|
|
|
17078
17089
|
const sy = (parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2)) - (height / 2);
|
|
17079
17090
|
parent.transform.defaultZoomFactor = 0;
|
|
17080
17091
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: true } });
|
|
17081
|
-
parent.
|
|
17092
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17093
|
+
value: { type: 'custom', startX: sx, startY: sy, width: width, height: height } });
|
|
17082
17094
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: false } });
|
|
17083
17095
|
parent.isCropToolbar = true;
|
|
17084
17096
|
parent.crop();
|
|
@@ -17543,7 +17555,8 @@ class UndoRedo {
|
|
|
17543
17555
|
}
|
|
17544
17556
|
}
|
|
17545
17557
|
parent.updateCropTransformItems();
|
|
17546
|
-
parent.
|
|
17558
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
17559
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
17547
17560
|
if (parent.isCircleCrop) {
|
|
17548
17561
|
parent.isCircleCrop = false;
|
|
17549
17562
|
this.tempCurrSelPoint = extend({}, parent.currSelectionPoint, {}, true);
|
|
@@ -18390,6 +18403,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18390
18403
|
* @private
|
|
18391
18404
|
*/
|
|
18392
18405
|
onPropertyChanged(newProperties, oldProperties) {
|
|
18406
|
+
let indexObj;
|
|
18393
18407
|
for (const prop of Object.keys(newProperties)) {
|
|
18394
18408
|
switch (prop) {
|
|
18395
18409
|
case 'cssClass':
|
|
@@ -18412,9 +18426,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18412
18426
|
break;
|
|
18413
18427
|
case 'height':
|
|
18414
18428
|
this.element.style.height = newProperties.height;
|
|
18429
|
+
this.update();
|
|
18415
18430
|
break;
|
|
18416
18431
|
case 'width':
|
|
18417
18432
|
this.element.style.width = newProperties.width;
|
|
18433
|
+
this.update();
|
|
18418
18434
|
break;
|
|
18419
18435
|
case 'theme':
|
|
18420
18436
|
if (newProperties.theme) {
|
|
@@ -18426,6 +18442,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18426
18442
|
}
|
|
18427
18443
|
this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
|
|
18428
18444
|
this.upperContext.fillStyle = this.themeColl[this.theme]['secondaryColor'];
|
|
18445
|
+
if (isBlazor()) {
|
|
18446
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18447
|
+
}
|
|
18448
|
+
else {
|
|
18449
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18450
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18451
|
+
}
|
|
18429
18452
|
}
|
|
18430
18453
|
break;
|
|
18431
18454
|
case 'finetuneSettings':
|
|
@@ -18437,8 +18460,13 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18437
18460
|
case 'locale':
|
|
18438
18461
|
if (newProperties.locale) {
|
|
18439
18462
|
this.notify('toolbar', { prop: 'setLocale', onPropertyChange: false, value: { locale: newProperties.locale } });
|
|
18440
|
-
|
|
18441
|
-
|
|
18463
|
+
if (isBlazor()) {
|
|
18464
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18465
|
+
}
|
|
18466
|
+
else {
|
|
18467
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18468
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18469
|
+
}
|
|
18442
18470
|
}
|
|
18443
18471
|
break;
|
|
18444
18472
|
case 'allowUndoRedo':
|
|
@@ -18448,18 +18476,47 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18448
18476
|
else {
|
|
18449
18477
|
this.allowUndoRedo = false;
|
|
18450
18478
|
}
|
|
18451
|
-
|
|
18452
|
-
|
|
18479
|
+
if (isBlazor()) {
|
|
18480
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18481
|
+
}
|
|
18482
|
+
else {
|
|
18483
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18484
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18485
|
+
}
|
|
18453
18486
|
break;
|
|
18454
18487
|
case 'showQuickAccessToolbar':
|
|
18455
18488
|
if (newProperties.showQuickAccessToolbar) {
|
|
18456
18489
|
this.showQuickAccessToolbar = true;
|
|
18457
|
-
|
|
18458
|
-
|
|
18490
|
+
if (!isBlazor()) {
|
|
18491
|
+
this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
|
|
18492
|
+
}
|
|
18493
|
+
indexObj = { freehandSelectedIndex: null };
|
|
18494
|
+
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
18495
|
+
if (this.activeObj.shape) {
|
|
18496
|
+
if (isBlazor()) {
|
|
18497
|
+
this.updateToolbar(this.element, 'quickAccessToolbar', this.activeObj.shape);
|
|
18498
|
+
}
|
|
18499
|
+
else {
|
|
18500
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
18501
|
+
}
|
|
18502
|
+
}
|
|
18503
|
+
else if (indexObj['freehandSelectedIndex']) {
|
|
18504
|
+
if (isBlazor()) {
|
|
18505
|
+
this.updateToolbar(this.element, 'quickAccessToolbar', 'pen');
|
|
18506
|
+
}
|
|
18507
|
+
else {
|
|
18508
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
18509
|
+
}
|
|
18510
|
+
}
|
|
18459
18511
|
}
|
|
18460
18512
|
else {
|
|
18461
18513
|
this.showQuickAccessToolbar = false;
|
|
18462
|
-
|
|
18514
|
+
if (isBlazor()) {
|
|
18515
|
+
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
18516
|
+
}
|
|
18517
|
+
else {
|
|
18518
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
18519
|
+
}
|
|
18463
18520
|
}
|
|
18464
18521
|
break;
|
|
18465
18522
|
case 'zoomSettings':
|
|
@@ -18469,12 +18526,22 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18469
18526
|
if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
|
|
18470
18527
|
this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
|
|
18471
18528
|
ZoomTrigger.Commands);
|
|
18472
|
-
|
|
18473
|
-
|
|
18529
|
+
if (isBlazor()) {
|
|
18530
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18531
|
+
}
|
|
18532
|
+
else {
|
|
18533
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18534
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18535
|
+
}
|
|
18474
18536
|
}
|
|
18475
18537
|
else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
18476
|
-
|
|
18477
|
-
|
|
18538
|
+
if (isBlazor()) {
|
|
18539
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18540
|
+
}
|
|
18541
|
+
else {
|
|
18542
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18543
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18544
|
+
}
|
|
18478
18545
|
}
|
|
18479
18546
|
break;
|
|
18480
18547
|
case 'selectionSettings':
|
|
@@ -18486,6 +18553,38 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18486
18553
|
}
|
|
18487
18554
|
}
|
|
18488
18555
|
break;
|
|
18556
|
+
case 'toolbar':
|
|
18557
|
+
if (newProperties.toolbar) {
|
|
18558
|
+
this.toolbar = newProperties.toolbar;
|
|
18559
|
+
if (isBlazor()) {
|
|
18560
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
18561
|
+
}
|
|
18562
|
+
else {
|
|
18563
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
18564
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
18565
|
+
}
|
|
18566
|
+
}
|
|
18567
|
+
break;
|
|
18568
|
+
case 'toolbarTemplate':
|
|
18569
|
+
if (newProperties.toolbarTemplate) {
|
|
18570
|
+
if (!isBlazor()) {
|
|
18571
|
+
this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
|
|
18572
|
+
this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
|
|
18573
|
+
this.element.appendChild(this.createElement('div', {
|
|
18574
|
+
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
18575
|
+
}));
|
|
18576
|
+
this.toolbarTemplateFn();
|
|
18577
|
+
}
|
|
18578
|
+
}
|
|
18579
|
+
break;
|
|
18580
|
+
case 'quickAccessToolbarTemplate':
|
|
18581
|
+
if (newProperties.quickAccessToolbarTemplate) {
|
|
18582
|
+
if (!isBlazor()) {
|
|
18583
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
18584
|
+
this.quickAccessToolbarTemplateFn();
|
|
18585
|
+
}
|
|
18586
|
+
}
|
|
18587
|
+
break;
|
|
18489
18588
|
}
|
|
18490
18589
|
}
|
|
18491
18590
|
}
|
|
@@ -18569,15 +18668,20 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18569
18668
|
const uploadObj = new Uploader({
|
|
18570
18669
|
dropArea: document.getElementsByClassName('e-canvas-wrapper')[0],
|
|
18571
18670
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
18671
|
+
multiple: false,
|
|
18572
18672
|
selected: (args) => {
|
|
18573
18673
|
if (args.event.type === 'change' || args.event.type === 'drop') {
|
|
18574
18674
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18575
18675
|
const type = args.filesData[0].type;
|
|
18576
|
-
|
|
18676
|
+
let errType = 'unsupported';
|
|
18677
|
+
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) && (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg')) {
|
|
18577
18678
|
this.notify('draw', { prop: 'fileSelect', value: { inputElement: this.element.querySelector('#' + this.element.id + '_dropfileUpload'), args: args } });
|
|
18578
18679
|
}
|
|
18579
18680
|
else {
|
|
18580
|
-
|
|
18681
|
+
if (args.event.type === 'drop' && args.event.dataTransfer.files.length > 1) {
|
|
18682
|
+
errType = 'multi-select-image';
|
|
18683
|
+
}
|
|
18684
|
+
this.showDialogPopup(errType);
|
|
18581
18685
|
}
|
|
18582
18686
|
}
|
|
18583
18687
|
}
|
|
@@ -18587,20 +18691,39 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
18587
18691
|
dlgCloseBtnClick() {
|
|
18588
18692
|
getComponent(document.getElementById(this.element.id + '_dialog'), 'dialog').destroy();
|
|
18589
18693
|
}
|
|
18590
|
-
|
|
18694
|
+
/**
|
|
18695
|
+
* Show dialog popup for unsupported files.
|
|
18696
|
+
*
|
|
18697
|
+
* @param { string } type - Specifies the type of error.
|
|
18698
|
+
* @hidden
|
|
18699
|
+
* @returns {void}.
|
|
18700
|
+
*/
|
|
18701
|
+
showDialogPopup(type) {
|
|
18702
|
+
let content = '';
|
|
18591
18703
|
this.element.querySelector('#' + this.element.id + '_dialog').style.display = 'block';
|
|
18592
|
-
|
|
18593
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
18594
|
-
const contentObj = { key: 'AlertDialogContent' };
|
|
18595
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
18596
|
-
const supportObj = { key: 'SupportText' };
|
|
18597
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
18704
|
+
let headerObj;
|
|
18598
18705
|
const okObj = { key: 'OK' };
|
|
18599
18706
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: okObj } });
|
|
18707
|
+
if (type === 'multi-select-image') {
|
|
18708
|
+
headerObj = { key: 'ImageErrorDialogHeader' };
|
|
18709
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
18710
|
+
const contentObj = { key: 'ImageErrorDialogContent' };
|
|
18711
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
18712
|
+
content = '<span>' + contentObj['value'] + '</span>';
|
|
18713
|
+
}
|
|
18714
|
+
else {
|
|
18715
|
+
headerObj = { key: 'AlertDialogHeader' };
|
|
18716
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
18717
|
+
const contentObj = { key: 'AlertDialogContent' };
|
|
18718
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
18719
|
+
const supportObj = { key: 'SupportText' };
|
|
18720
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
18721
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, and SVG</b></span>';
|
|
18722
|
+
}
|
|
18600
18723
|
const dialog = new Dialog({
|
|
18601
18724
|
header: headerObj['value'],
|
|
18602
18725
|
closeOnEscape: true,
|
|
18603
|
-
content:
|
|
18726
|
+
content: content,
|
|
18604
18727
|
target: document.getElementById('target'),
|
|
18605
18728
|
width: '285px',
|
|
18606
18729
|
isModal: true,
|
|
@@ -19045,6 +19168,8 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
19045
19168
|
select(type, startX, startY, width, height) {
|
|
19046
19169
|
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
19047
19170
|
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
19171
|
+
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
19172
|
+
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
19048
19173
|
}
|
|
19049
19174
|
/**
|
|
19050
19175
|
* Enable or disable a freehand drawing option in an Image Editor.
|
|
@@ -19466,11 +19591,19 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
19466
19591
|
*/
|
|
19467
19592
|
drawFrame(frameType, color, gradientColor, size, inset, offset, borderRadius, frameLineStyle, lineCount) {
|
|
19468
19593
|
let isFrame = false;
|
|
19469
|
-
|
|
19594
|
+
const obj = { frameChangeEventArgs: null };
|
|
19595
|
+
color = color ? color : '#fff';
|
|
19596
|
+
gradientColor = gradientColor ? gradientColor : '';
|
|
19597
|
+
size = size ? size : 20;
|
|
19598
|
+
inset = inset ? inset : 0;
|
|
19599
|
+
offset = offset ? offset : 0;
|
|
19600
|
+
borderRadius = borderRadius ? borderRadius : 0;
|
|
19601
|
+
frameLineStyle = frameLineStyle ? frameLineStyle : FrameLineStyle.Solid;
|
|
19602
|
+
lineCount = lineCount ? lineCount : 0;
|
|
19470
19603
|
const prevFrameSettings = { type: this.toPascalCase(this.frameObj.type), color: this.frameObj.color,
|
|
19471
19604
|
gradientColor: this.frameObj.gradientColor, size: this.frameObj.size, inset: this.frameObj.inset,
|
|
19472
|
-
offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
|
|
19473
|
-
lineCount: this.frameObj.amount };
|
|
19605
|
+
offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
|
|
19606
|
+
frameLineStyle: this.toPascalCase(this.frameObj.border), lineCount: this.frameObj.amount };
|
|
19474
19607
|
extend(this.tempFrameObj, this.frameObj);
|
|
19475
19608
|
this.tempFrameZoomLevel = this.transform.zoomFactor;
|
|
19476
19609
|
this.frameDestPoints = extend({}, this.img, {}, true);
|
|
@@ -19478,6 +19611,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
19478
19611
|
this.notify('toolbar', { prop: 'frameToolbarClick' });
|
|
19479
19612
|
}
|
|
19480
19613
|
else {
|
|
19614
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19481
19615
|
this.performFrameClick();
|
|
19482
19616
|
}
|
|
19483
19617
|
this.frameObj.type = frameType.toLowerCase();
|
|
@@ -21127,6 +21261,33 @@ var ImageEditorCommand;
|
|
|
21127
21261
|
ImageEditorCommand["RotateRight"] = "RotateRight";
|
|
21128
21262
|
ImageEditorCommand["FlipHorizontal"] = "FlipHorizontal";
|
|
21129
21263
|
ImageEditorCommand["FlipVertical"] = "FlipVertical";
|
|
21264
|
+
ImageEditorCommand["Undo"] = "Undo";
|
|
21265
|
+
ImageEditorCommand["Redo"] = "Redo";
|
|
21266
|
+
ImageEditorCommand["None"] = "None";
|
|
21267
|
+
ImageEditorCommand["Mat"] = "Mat";
|
|
21268
|
+
ImageEditorCommand["Bevel"] = "Bevel";
|
|
21269
|
+
ImageEditorCommand["Inset"] = "Inset";
|
|
21270
|
+
ImageEditorCommand["Hook"] = "Hook";
|
|
21271
|
+
ImageEditorCommand["Finetune"] = "Finetune";
|
|
21272
|
+
ImageEditorCommand["Filter"] = "Filter";
|
|
21273
|
+
ImageEditorCommand["Frame"] = "Frame";
|
|
21274
|
+
ImageEditorCommand["Resize"] = "Resize";
|
|
21275
|
+
ImageEditorCommand["HorizontalFlip"] = "HorizontalFlip";
|
|
21276
|
+
ImageEditorCommand["VerticalFlip"] = "VerticalFlip";
|
|
21277
|
+
ImageEditorCommand["Brightness"] = "Brightness";
|
|
21278
|
+
ImageEditorCommand["Contrast"] = "Contrast";
|
|
21279
|
+
ImageEditorCommand["Hue"] = "Hue";
|
|
21280
|
+
ImageEditorCommand["Saturation"] = "Saturation";
|
|
21281
|
+
ImageEditorCommand["Opacity"] = "Opacity";
|
|
21282
|
+
ImageEditorCommand["Blur"] = "Blur";
|
|
21283
|
+
ImageEditorCommand["Exposure"] = "Exposure";
|
|
21284
|
+
ImageEditorCommand["Default"] = "Default";
|
|
21285
|
+
ImageEditorCommand["Chrome"] = "Chrome";
|
|
21286
|
+
ImageEditorCommand["Cold"] = "Cold";
|
|
21287
|
+
ImageEditorCommand["Warm"] = "Warm";
|
|
21288
|
+
ImageEditorCommand["Grayscale"] = "Grayscale";
|
|
21289
|
+
ImageEditorCommand["Sepia"] = "Sepia";
|
|
21290
|
+
ImageEditorCommand["Invert"] = "Invert";
|
|
21130
21291
|
})(ImageEditorCommand || (ImageEditorCommand = {}));
|
|
21131
21292
|
/**
|
|
21132
21293
|
* An enumeration of available image filter options.
|
|
@@ -21384,7 +21545,9 @@ class ToolbarModule {
|
|
|
21384
21545
|
AlertDialogHeader: 'Unsupported file',
|
|
21385
21546
|
AlertDialogContent: 'The dropped file is unsupported.',
|
|
21386
21547
|
Yes: 'Yes',
|
|
21387
|
-
No: 'No'
|
|
21548
|
+
No: 'No',
|
|
21549
|
+
ImageErrorDialogHeader: 'Image Selection Error',
|
|
21550
|
+
ImageErrorDialogContent: 'Please select only one image to open.'
|
|
21388
21551
|
};
|
|
21389
21552
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
21390
21553
|
}
|
|
@@ -21593,7 +21756,7 @@ class ToolbarModule {
|
|
|
21593
21756
|
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
21594
21757
|
}));
|
|
21595
21758
|
const toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
21596
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
21759
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
|
|
21597
21760
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
21598
21761
|
this.defToolbarItems = [];
|
|
21599
21762
|
}
|
|
@@ -21610,6 +21773,7 @@ class ToolbarModule {
|
|
|
21610
21773
|
tooltipText: this.l10n.getConstant('Browse'),
|
|
21611
21774
|
template: new Uploader({
|
|
21612
21775
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
21776
|
+
multiple: false,
|
|
21613
21777
|
selected: () => {
|
|
21614
21778
|
if (!parent.disabled) {
|
|
21615
21779
|
if (Browser.isDevice) {
|
|
@@ -21683,7 +21847,7 @@ class ToolbarModule {
|
|
|
21683
21847
|
const parent = this.parent;
|
|
21684
21848
|
if (parent.showQuickAccessToolbar) {
|
|
21685
21849
|
const toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
21686
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
21850
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
|
|
21687
21851
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
21688
21852
|
this.defToolbarItems = [];
|
|
21689
21853
|
}
|
|
@@ -21768,7 +21932,7 @@ class ToolbarModule {
|
|
|
21768
21932
|
const parent = this.parent;
|
|
21769
21933
|
const toolbarItems = [];
|
|
21770
21934
|
if (!isOkBtn || isResize) {
|
|
21771
|
-
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) });
|
|
21935
|
+
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) });
|
|
21772
21936
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
21773
21937
|
}
|
|
21774
21938
|
if (parent.allowUndoRedo && !isResize) {
|
|
@@ -22193,7 +22357,13 @@ class ToolbarModule {
|
|
|
22193
22357
|
}
|
|
22194
22358
|
}
|
|
22195
22359
|
fileSelect(inputElement, args) {
|
|
22196
|
-
|
|
22360
|
+
const type = inputElement.files[0].type.split('/')[1];
|
|
22361
|
+
if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg') {
|
|
22362
|
+
this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
|
|
22363
|
+
}
|
|
22364
|
+
else {
|
|
22365
|
+
this.parent.showDialogPopup();
|
|
22366
|
+
}
|
|
22197
22367
|
}
|
|
22198
22368
|
renderAnnotationBtn(isContextualToolbar) {
|
|
22199
22369
|
const parent = this.parent;
|
|
@@ -22596,7 +22766,9 @@ class ToolbarModule {
|
|
|
22596
22766
|
}
|
|
22597
22767
|
}
|
|
22598
22768
|
if (document.getElementById(parent.element.id + '_cropBtn')) {
|
|
22599
|
-
parent.
|
|
22769
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
22770
|
+
value: { type: document.getElementById(parent.element.id + '_cropBtn').textContent.toLowerCase(),
|
|
22771
|
+
startX: null, startY: null, width: null, height: null } });
|
|
22600
22772
|
}
|
|
22601
22773
|
}
|
|
22602
22774
|
});
|
|
@@ -24505,7 +24677,8 @@ class ToolbarModule {
|
|
|
24505
24677
|
const text = args.item.id;
|
|
24506
24678
|
this.currentToolbar = 'crop';
|
|
24507
24679
|
parent.currSelectionPoint = null;
|
|
24508
|
-
parent.select
|
|
24680
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
24681
|
+
value: { type: text, startX: null, startY: null, width: null, height: null } });
|
|
24509
24682
|
this.enableDisableTbrBtn();
|
|
24510
24683
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
24511
24684
|
}
|