@syncfusion/ej2-image-editor 23.1.39 → 23.1.43
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 +23 -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 +179 -38
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +178 -37
- 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 +11 -11
- package/src/image-editor/action/transform.js +13 -6
- package/src/image-editor/action/undo-redo.js +2 -1
- 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
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 23.1.
|
|
3
|
+
* version : 23.1.43
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. 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@23.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-image-editor@23.1.41",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-tGyYeBSDLs5I0zRQRV8PHFgimntBbPnUy/FdpKhOj6UFTQ61fipkGwqIzqD5vtIPpEmj2vUoYHCh77AiREmxgQ==",
|
|
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-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-23.1.
|
|
27
|
-
"_shasum": "
|
|
26
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-23.1.41.tgz",
|
|
27
|
+
"_shasum": "552569e987ed362b286001ec7b6b2f59c595e1f6",
|
|
28
28
|
"_spec": "@syncfusion/ej2-image-editor@*",
|
|
29
29
|
"_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
|
|
30
30
|
"author": {
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"bundleDependencies": false,
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@syncfusion/ej2-base": "~23.1.
|
|
36
|
-
"@syncfusion/ej2-buttons": "~23.1.
|
|
37
|
-
"@syncfusion/ej2-inputs": "~23.1.
|
|
38
|
-
"@syncfusion/ej2-navigations": "~23.1.
|
|
39
|
-
"@syncfusion/ej2-popups": "~23.1.
|
|
40
|
-
"@syncfusion/ej2-splitbuttons": "~23.1.
|
|
35
|
+
"@syncfusion/ej2-base": "~23.1.41",
|
|
36
|
+
"@syncfusion/ej2-buttons": "~23.1.43",
|
|
37
|
+
"@syncfusion/ej2-inputs": "~23.1.43",
|
|
38
|
+
"@syncfusion/ej2-navigations": "~23.1.43",
|
|
39
|
+
"@syncfusion/ej2-popups": "~23.1.43",
|
|
40
|
+
"@syncfusion/ej2-splitbuttons": "~23.1.43"
|
|
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": "23.1.
|
|
70
|
+
"version": "23.1.43",
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
73
73
|
}
|
|
@@ -268,7 +268,8 @@ var Transform = /** @class */ (function () {
|
|
|
268
268
|
parent.rotateFlipColl = obj['collection'];
|
|
269
269
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
270
270
|
this.isPreventSelect = true;
|
|
271
|
-
parent.
|
|
271
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
272
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
272
273
|
this.isPreventSelect = false;
|
|
273
274
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
274
275
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
@@ -535,7 +536,8 @@ var Transform = /** @class */ (function () {
|
|
|
535
536
|
parent.rotateFlipColl = obj['collection'];
|
|
536
537
|
if (parent.cropObj.activeObj.shape && !this.isPreventSelect) {
|
|
537
538
|
this.isPreventSelect = true;
|
|
538
|
-
parent.
|
|
539
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
540
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
539
541
|
this.isPreventSelect = false;
|
|
540
542
|
parent.setProperties({ zoomSettings: { zoomFactor: 1 } }, true);
|
|
541
543
|
this.prevZoomValue = parent.zoomSettings.zoomFactor;
|
|
@@ -2087,13 +2089,17 @@ var Transform = /** @class */ (function () {
|
|
|
2087
2089
|
}
|
|
2088
2090
|
else if (parent.img.srcWidth === parent.baseImgCanvas.width && parent.img.srcHeight === parent.baseImgCanvas.height) {
|
|
2089
2091
|
parent.currSelectionPoint = null;
|
|
2090
|
-
parent.
|
|
2092
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
2093
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
2091
2094
|
}
|
|
2092
2095
|
if (isNullOrUndefined(parent.currSelectionPoint)) {
|
|
2093
|
-
parent.
|
|
2096
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
2097
|
+
value: { type: 'custom', startX: parent.img.destLeft, startY: parent.img.destTop,
|
|
2098
|
+
width: parent.img.destWidth, height: parent.img.destHeight } });
|
|
2094
2099
|
}
|
|
2095
2100
|
else {
|
|
2096
|
-
parent.
|
|
2101
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
2102
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
2097
2103
|
}
|
|
2098
2104
|
width = parent.activeObj.activePoint.width * widthRatio;
|
|
2099
2105
|
height = parent.activeObj.activePoint.height * heightRatio;
|
|
@@ -2101,7 +2107,8 @@ var Transform = /** @class */ (function () {
|
|
|
2101
2107
|
var sy = (parent.activeObj.activePoint.startY + (parent.activeObj.activePoint.height / 2)) - (height / 2);
|
|
2102
2108
|
parent.transform.defaultZoomFactor = 0;
|
|
2103
2109
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: true } });
|
|
2104
|
-
parent.
|
|
2110
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
2111
|
+
value: { type: 'custom', startX: sx, startY: sy, width: width, height: height } });
|
|
2105
2112
|
parent.notify('draw', { prop: 'setResizeSelect', value: { bool: false } });
|
|
2106
2113
|
parent.isCropToolbar = true;
|
|
2107
2114
|
parent.crop();
|
|
@@ -348,7 +348,8 @@ var UndoRedo = /** @class */ (function () {
|
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
parent.updateCropTransformItems();
|
|
351
|
-
parent.
|
|
351
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
352
|
+
value: { type: 'custom', startX: null, startY: null, width: null, height: null } });
|
|
352
353
|
if (parent.isCircleCrop) {
|
|
353
354
|
parent.isCircleCrop = false;
|
|
354
355
|
this.tempCurrSelPoint = extend({}, parent.currSelectionPoint, {}, true);
|
|
@@ -774,7 +774,14 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
|
|
|
774
774
|
initialize(): void;
|
|
775
775
|
private createDropUploader;
|
|
776
776
|
private dlgCloseBtnClick;
|
|
777
|
-
|
|
777
|
+
/**
|
|
778
|
+
* Show dialog popup for unsupported files.
|
|
779
|
+
*
|
|
780
|
+
* @param { string } type - Specifies the type of error.
|
|
781
|
+
* @hidden
|
|
782
|
+
* @returns {void}.
|
|
783
|
+
*/
|
|
784
|
+
showDialogPopup(type?: string): void;
|
|
778
785
|
/**
|
|
779
786
|
*
|
|
780
787
|
* This Method will add events to component (element, event, method, current reference)
|
|
@@ -1172,7 +1179,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
|
|
|
1172
1179
|
*
|
|
1173
1180
|
* @returns {boolean}.
|
|
1174
1181
|
*/
|
|
1175
|
-
drawFrame(frameType: FrameType, color
|
|
1182
|
+
drawFrame(frameType: FrameType, color?: string, gradientColor?: string, size?: number, inset?: number, offset?: number, borderRadius?: number, frameLineStyle?: FrameLineStyle, lineCount?: number): boolean;
|
|
1176
1183
|
private toolbarTemplateFn;
|
|
1177
1184
|
private quickAccessToolbarTemplateFn;
|
|
1178
1185
|
private templateParser;
|
|
@@ -21,7 +21,7 @@ import { Component, NotifyPropertyChanges, Property, addClass, removeClass, exte
|
|
|
21
21
|
import { Event, EventHandler, getComponent, isNullOrUndefined, getUniqueID } from '@syncfusion/ej2-base';
|
|
22
22
|
import { Dialog, createSpinner } from '@syncfusion/ej2-popups';
|
|
23
23
|
import { Complex, Browser, ChildProperty, compile as templateCompiler, compile } from '@syncfusion/ej2-base';
|
|
24
|
-
import { ToolbarModule, Crop, Draw, Filter, FreehandDrawing, Selection, Shape, Transform, UndoRedo, Export, ShapeType } from './../index';
|
|
24
|
+
import { ToolbarModule, Crop, Draw, Filter, FreehandDrawing, Selection, Shape, Transform, UndoRedo, Export, FrameLineStyle, ShapeType } from './../index';
|
|
25
25
|
import { ZoomTrigger, ImageFinetuneOption } from './../index';
|
|
26
26
|
import { Uploader } from '@syncfusion/ej2-inputs';
|
|
27
27
|
/**
|
|
@@ -306,6 +306,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
306
306
|
* @private
|
|
307
307
|
*/
|
|
308
308
|
ImageEditor.prototype.onPropertyChanged = function (newProperties, oldProperties) {
|
|
309
|
+
var indexObj;
|
|
309
310
|
for (var _i = 0, _a = Object.keys(newProperties); _i < _a.length; _i++) {
|
|
310
311
|
var prop = _a[_i];
|
|
311
312
|
switch (prop) {
|
|
@@ -329,9 +330,11 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
329
330
|
break;
|
|
330
331
|
case 'height':
|
|
331
332
|
this.element.style.height = newProperties.height;
|
|
333
|
+
this.update();
|
|
332
334
|
break;
|
|
333
335
|
case 'width':
|
|
334
336
|
this.element.style.width = newProperties.width;
|
|
337
|
+
this.update();
|
|
335
338
|
break;
|
|
336
339
|
case 'theme':
|
|
337
340
|
if (newProperties.theme) {
|
|
@@ -343,6 +346,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
343
346
|
}
|
|
344
347
|
this.upperContext.strokeStyle = this.themeColl[this.theme]['primaryColor'];
|
|
345
348
|
this.upperContext.fillStyle = this.themeColl[this.theme]['secondaryColor'];
|
|
349
|
+
if (isBlazor()) {
|
|
350
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
354
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
355
|
+
}
|
|
346
356
|
}
|
|
347
357
|
break;
|
|
348
358
|
case 'finetuneSettings':
|
|
@@ -354,8 +364,13 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
354
364
|
case 'locale':
|
|
355
365
|
if (newProperties.locale) {
|
|
356
366
|
this.notify('toolbar', { prop: 'setLocale', onPropertyChange: false, value: { locale: newProperties.locale } });
|
|
357
|
-
|
|
358
|
-
|
|
367
|
+
if (isBlazor()) {
|
|
368
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
372
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
373
|
+
}
|
|
359
374
|
}
|
|
360
375
|
break;
|
|
361
376
|
case 'allowUndoRedo':
|
|
@@ -365,18 +380,47 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
365
380
|
else {
|
|
366
381
|
this.allowUndoRedo = false;
|
|
367
382
|
}
|
|
368
|
-
|
|
369
|
-
|
|
383
|
+
if (isBlazor()) {
|
|
384
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
388
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
389
|
+
}
|
|
370
390
|
break;
|
|
371
391
|
case 'showQuickAccessToolbar':
|
|
372
392
|
if (newProperties.showQuickAccessToolbar) {
|
|
373
393
|
this.showQuickAccessToolbar = true;
|
|
374
|
-
|
|
375
|
-
|
|
394
|
+
if (!isBlazor()) {
|
|
395
|
+
this.notify('toolbar', { prop: 'create-qa-toolbar', onPropertyChange: false });
|
|
396
|
+
}
|
|
397
|
+
indexObj = { freehandSelectedIndex: null };
|
|
398
|
+
this.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
|
|
399
|
+
if (this.activeObj.shape) {
|
|
400
|
+
if (isBlazor()) {
|
|
401
|
+
this.updateToolbar(this.element, 'quickAccessToolbar', this.activeObj.shape);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: null } });
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else if (indexObj['freehandSelectedIndex']) {
|
|
408
|
+
if (isBlazor()) {
|
|
409
|
+
this.updateToolbar(this.element, 'quickAccessToolbar', 'pen');
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
this.notify('toolbar', { prop: 'renderQAT', onPropertyChange: false, value: { isPenEdit: true } });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
376
415
|
}
|
|
377
416
|
else {
|
|
378
417
|
this.showQuickAccessToolbar = false;
|
|
379
|
-
|
|
418
|
+
if (isBlazor()) {
|
|
419
|
+
this.updateToolbar(this.element, 'destroyQuickAccessToolbar');
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
423
|
+
}
|
|
380
424
|
}
|
|
381
425
|
break;
|
|
382
426
|
case 'zoomSettings':
|
|
@@ -386,12 +430,22 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
386
430
|
if (isNullOrUndefined(this.zoomSettings.zoomTrigger)) {
|
|
387
431
|
this.zoomSettings.zoomTrigger = (ZoomTrigger.MouseWheel | ZoomTrigger.Pinch | ZoomTrigger.Toolbar |
|
|
388
432
|
ZoomTrigger.Commands);
|
|
389
|
-
|
|
390
|
-
|
|
433
|
+
if (isBlazor()) {
|
|
434
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
438
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
439
|
+
}
|
|
391
440
|
}
|
|
392
441
|
else if ((newProperties.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
|
|
393
|
-
|
|
394
|
-
|
|
442
|
+
if (isBlazor()) {
|
|
443
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
447
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
448
|
+
}
|
|
395
449
|
}
|
|
396
450
|
break;
|
|
397
451
|
case 'selectionSettings':
|
|
@@ -403,6 +457,38 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
403
457
|
}
|
|
404
458
|
}
|
|
405
459
|
break;
|
|
460
|
+
case 'toolbar':
|
|
461
|
+
if (newProperties.toolbar) {
|
|
462
|
+
this.toolbar = newProperties.toolbar;
|
|
463
|
+
if (isBlazor()) {
|
|
464
|
+
this.updateToolbar(this.element, 'imageLoaded');
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
468
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
case 'toolbarTemplate':
|
|
473
|
+
if (newProperties.toolbarTemplate) {
|
|
474
|
+
if (!isBlazor()) {
|
|
475
|
+
this.notify('toolbar', { prop: 'destroy-bottom-toolbar', onPropertyChange: false });
|
|
476
|
+
this.notify('toolbar', { prop: 'destroy-top-toolbar', onPropertyChange: false });
|
|
477
|
+
this.element.appendChild(this.createElement('div', {
|
|
478
|
+
id: this.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
479
|
+
}));
|
|
480
|
+
this.toolbarTemplateFn();
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
break;
|
|
484
|
+
case 'quickAccessToolbarTemplate':
|
|
485
|
+
if (newProperties.quickAccessToolbarTemplate) {
|
|
486
|
+
if (!isBlazor()) {
|
|
487
|
+
this.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
488
|
+
this.quickAccessToolbarTemplateFn();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
break;
|
|
406
492
|
}
|
|
407
493
|
}
|
|
408
494
|
};
|
|
@@ -487,15 +573,20 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
487
573
|
var uploadObj = new Uploader({
|
|
488
574
|
dropArea: document.getElementsByClassName('e-canvas-wrapper')[0],
|
|
489
575
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
576
|
+
multiple: false,
|
|
490
577
|
selected: function (args) {
|
|
491
578
|
if (args.event.type === 'change' || args.event.type === 'drop') {
|
|
492
579
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
493
580
|
var type = args.filesData[0].type;
|
|
494
|
-
|
|
581
|
+
var errType = 'unsupported';
|
|
582
|
+
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) && (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg')) {
|
|
495
583
|
_this.notify('draw', { prop: 'fileSelect', value: { inputElement: _this.element.querySelector('#' + _this.element.id + '_dropfileUpload'), args: args } });
|
|
496
584
|
}
|
|
497
585
|
else {
|
|
498
|
-
|
|
586
|
+
if (args.event.type === 'drop' && args.event.dataTransfer.files.length > 1) {
|
|
587
|
+
errType = 'multi-select-image';
|
|
588
|
+
}
|
|
589
|
+
_this.showDialogPopup(errType);
|
|
499
590
|
}
|
|
500
591
|
}
|
|
501
592
|
}
|
|
@@ -505,20 +596,39 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
505
596
|
ImageEditor.prototype.dlgCloseBtnClick = function () {
|
|
506
597
|
getComponent(document.getElementById(this.element.id + '_dialog'), 'dialog').destroy();
|
|
507
598
|
};
|
|
508
|
-
|
|
599
|
+
/**
|
|
600
|
+
* Show dialog popup for unsupported files.
|
|
601
|
+
*
|
|
602
|
+
* @param { string } type - Specifies the type of error.
|
|
603
|
+
* @hidden
|
|
604
|
+
* @returns {void}.
|
|
605
|
+
*/
|
|
606
|
+
ImageEditor.prototype.showDialogPopup = function (type) {
|
|
607
|
+
var content = '';
|
|
509
608
|
this.element.querySelector('#' + this.element.id + '_dialog').style.display = 'block';
|
|
510
|
-
var headerObj
|
|
511
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
512
|
-
var contentObj = { key: 'AlertDialogContent' };
|
|
513
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
514
|
-
var supportObj = { key: 'SupportText' };
|
|
515
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
609
|
+
var headerObj;
|
|
516
610
|
var okObj = { key: 'OK' };
|
|
517
611
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: okObj } });
|
|
612
|
+
if (type === 'multi-select-image') {
|
|
613
|
+
headerObj = { key: 'ImageErrorDialogHeader' };
|
|
614
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
615
|
+
var contentObj = { key: 'ImageErrorDialogContent' };
|
|
616
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
617
|
+
content = '<span>' + contentObj['value'] + '</span>';
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
headerObj = { key: 'AlertDialogHeader' };
|
|
621
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: headerObj } });
|
|
622
|
+
var contentObj = { key: 'AlertDialogContent' };
|
|
623
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
624
|
+
var supportObj = { key: 'SupportText' };
|
|
625
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
626
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b> JPG, PNG, and SVG</b></span>';
|
|
627
|
+
}
|
|
518
628
|
var dialog = new Dialog({
|
|
519
629
|
header: headerObj['value'],
|
|
520
630
|
closeOnEscape: true,
|
|
521
|
-
content:
|
|
631
|
+
content: content,
|
|
522
632
|
target: document.getElementById('target'),
|
|
523
633
|
width: '285px',
|
|
524
634
|
isModal: true,
|
|
@@ -964,6 +1074,8 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
964
1074
|
ImageEditor.prototype.select = function (type, startX, startY, width, height) {
|
|
965
1075
|
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
966
1076
|
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
1077
|
+
this.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
1078
|
+
value: { type: type, startX: startX, startY: startY, width: width, height: height } });
|
|
967
1079
|
};
|
|
968
1080
|
/**
|
|
969
1081
|
* Enable or disable a freehand drawing option in an Image Editor.
|
|
@@ -1386,10 +1498,18 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1386
1498
|
ImageEditor.prototype.drawFrame = function (frameType, color, gradientColor, size, inset, offset, borderRadius, frameLineStyle, lineCount) {
|
|
1387
1499
|
var isFrame = false;
|
|
1388
1500
|
var obj = { frameChangeEventArgs: null };
|
|
1501
|
+
color = color ? color : '#fff';
|
|
1502
|
+
gradientColor = gradientColor ? gradientColor : '';
|
|
1503
|
+
size = size ? size : 20;
|
|
1504
|
+
inset = inset ? inset : 0;
|
|
1505
|
+
offset = offset ? offset : 0;
|
|
1506
|
+
borderRadius = borderRadius ? borderRadius : 0;
|
|
1507
|
+
frameLineStyle = frameLineStyle ? frameLineStyle : FrameLineStyle.Solid;
|
|
1508
|
+
lineCount = lineCount ? lineCount : 0;
|
|
1389
1509
|
var prevFrameSettings = { type: this.toPascalCase(this.frameObj.type), color: this.frameObj.color,
|
|
1390
1510
|
gradientColor: this.frameObj.gradientColor, size: this.frameObj.size, inset: this.frameObj.inset,
|
|
1391
|
-
offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
|
|
1392
|
-
lineCount: this.frameObj.amount };
|
|
1511
|
+
offset: this.frameObj.offset, borderRadius: this.frameObj.radius,
|
|
1512
|
+
frameLineStyle: this.toPascalCase(this.frameObj.border), lineCount: this.frameObj.amount };
|
|
1393
1513
|
extend(this.tempFrameObj, this.frameObj);
|
|
1394
1514
|
this.tempFrameZoomLevel = this.transform.zoomFactor;
|
|
1395
1515
|
this.frameDestPoints = extend({}, this.img, {}, true);
|
|
@@ -1397,6 +1517,7 @@ var ImageEditor = /** @class */ (function (_super) {
|
|
|
1397
1517
|
this.notify('toolbar', { prop: 'frameToolbarClick' });
|
|
1398
1518
|
}
|
|
1399
1519
|
else {
|
|
1520
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1400
1521
|
this.performFrameClick();
|
|
1401
1522
|
}
|
|
1402
1523
|
this.frameObj.type = frameType.toLowerCase();
|
|
@@ -156,7 +156,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
156
156
|
AlertDialogHeader: 'Unsupported file',
|
|
157
157
|
AlertDialogContent: 'The dropped file is unsupported.',
|
|
158
158
|
Yes: 'Yes',
|
|
159
|
-
No: 'No'
|
|
159
|
+
No: 'No',
|
|
160
|
+
ImageErrorDialogHeader: 'Image Selection Error',
|
|
161
|
+
ImageErrorDialogContent: 'Please select only one image to open.'
|
|
160
162
|
};
|
|
161
163
|
this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
|
|
162
164
|
};
|
|
@@ -366,7 +368,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
366
368
|
id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
|
|
367
369
|
}));
|
|
368
370
|
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
369
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
371
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
|
|
370
372
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
371
373
|
this.defToolbarItems = [];
|
|
372
374
|
}
|
|
@@ -383,6 +385,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
383
385
|
tooltipText: this.l10n.getConstant('Browse'),
|
|
384
386
|
template: new Uploader({
|
|
385
387
|
allowedExtensions: '.jpg, .jpeg, .png,.svg',
|
|
388
|
+
multiple: false,
|
|
386
389
|
selected: function () {
|
|
387
390
|
if (!parent.disabled) {
|
|
388
391
|
if (Browser.isDevice) {
|
|
@@ -456,7 +459,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
456
459
|
var parent = this.parent;
|
|
457
460
|
if (parent.showQuickAccessToolbar) {
|
|
458
461
|
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
459
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) };
|
|
462
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg', multiple: false }) };
|
|
460
463
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
461
464
|
this.defToolbarItems = [];
|
|
462
465
|
}
|
|
@@ -543,7 +546,7 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
543
546
|
var parent = this.parent;
|
|
544
547
|
var toolbarItems = [];
|
|
545
548
|
if (!isOkBtn || isResize) {
|
|
546
|
-
toolbarItems.push({ id: parent.element.id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: '.jpg, .jpeg, .png,.svg' }) });
|
|
549
|
+
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 }) });
|
|
547
550
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
548
551
|
}
|
|
549
552
|
if (parent.allowUndoRedo && !isResize) {
|
|
@@ -969,7 +972,13 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
969
972
|
}
|
|
970
973
|
};
|
|
971
974
|
ToolbarModule.prototype.fileSelect = function (inputElement, args) {
|
|
972
|
-
|
|
975
|
+
var type = inputElement.files[0].type.split('/')[1];
|
|
976
|
+
if (type === 'png' || type === 'jpg' || type === 'jpeg' || type === 'svg' || type === 'svg+xml') {
|
|
977
|
+
this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
this.parent.showDialogPopup();
|
|
981
|
+
}
|
|
973
982
|
};
|
|
974
983
|
ToolbarModule.prototype.renderAnnotationBtn = function (isContextualToolbar) {
|
|
975
984
|
var _this = this;
|
|
@@ -1375,7 +1384,9 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
1375
1384
|
}
|
|
1376
1385
|
}
|
|
1377
1386
|
if (document.getElementById(parent.element.id + '_cropBtn')) {
|
|
1378
|
-
parent.
|
|
1387
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
1388
|
+
value: { type: document.getElementById(parent.element.id + '_cropBtn').textContent.toLowerCase(),
|
|
1389
|
+
startX: null, startY: null, width: null, height: null } });
|
|
1379
1390
|
}
|
|
1380
1391
|
}
|
|
1381
1392
|
});
|
|
@@ -3291,7 +3302,8 @@ var ToolbarModule = /** @class */ (function () {
|
|
|
3291
3302
|
var text = args.item.id;
|
|
3292
3303
|
this.currentToolbar = 'crop';
|
|
3293
3304
|
parent.currSelectionPoint = null;
|
|
3294
|
-
parent.select
|
|
3305
|
+
parent.notify('draw', { prop: 'select', onPropertyChange: false,
|
|
3306
|
+
value: { type: text, startX: null, startY: null, width: null, height: null } });
|
|
3295
3307
|
this.enableDisableTbrBtn();
|
|
3296
3308
|
parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
|
|
3297
3309
|
};
|