@syncfusion/ej2-image-editor 27.2.3 → 28.1.33
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/README.md +2 -2
- package/dist/ej2-image-editor.umd.min.js +3 -3
- package/dist/ej2-image-editor.umd.min.js.map +1 -1
- package/dist/es6/ej2-image-editor.es2015.js +377 -52
- package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
- package/dist/es6/ej2-image-editor.es5.js +385 -52
- package/dist/es6/ej2-image-editor.es5.js.map +1 -1
- package/dist/global/ej2-image-editor.min.js +3 -3
- package/dist/global/ej2-image-editor.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +13 -13
- package/src/image-editor/action/draw.d.ts +4 -0
- package/src/image-editor/action/draw.js +97 -11
- package/src/image-editor/action/export.js +1 -1
- package/src/image-editor/action/shape.d.ts +1 -1
- package/src/image-editor/action/shape.js +22 -15
- package/src/image-editor/action/transform.js +1 -0
- package/src/image-editor/base/enum.d.ts +8 -2
- package/src/image-editor/base/enum.js +6 -0
- package/src/image-editor/base/image-editor-model.d.ts +51 -0
- package/src/image-editor/base/image-editor.d.ts +79 -2
- package/src/image-editor/base/image-editor.js +223 -12
- package/src/image-editor/renderer/toolbar.js +35 -12
- package/styles/bds-lite.css +863 -0
- package/styles/bds-lite.scss +13 -0
- package/styles/bds.css +969 -0
- package/styles/bds.scss +14 -0
- package/styles/bootstrap-dark-lite.css +5 -3
- package/styles/bootstrap-dark.css +5 -3
- package/styles/bootstrap-lite.css +5 -3
- package/styles/bootstrap.css +5 -3
- package/styles/bootstrap4-lite.css +5 -3
- package/styles/bootstrap4.css +5 -3
- package/styles/bootstrap5-dark-lite.css +5 -3
- package/styles/bootstrap5-dark.css +5 -3
- package/styles/bootstrap5-lite.css +5 -3
- package/styles/bootstrap5.3-lite.css +5 -3
- package/styles/bootstrap5.3.css +5 -3
- package/styles/bootstrap5.css +5 -3
- package/styles/fabric-dark-lite.css +5 -3
- package/styles/fabric-dark.css +5 -3
- package/styles/fabric-lite.css +5 -3
- package/styles/fabric.css +5 -3
- package/styles/fluent-dark-lite.css +5 -3
- package/styles/fluent-dark.css +5 -3
- package/styles/fluent-lite.css +5 -3
- package/styles/fluent.css +5 -3
- package/styles/fluent2-lite.css +5 -3
- package/styles/fluent2.css +5 -3
- package/styles/highcontrast-light-lite.css +5 -3
- package/styles/highcontrast-light.css +5 -3
- package/styles/highcontrast-lite.css +5 -3
- package/styles/highcontrast.css +5 -3
- package/styles/image-editor/_layout.scss +13 -3
- package/styles/image-editor/_tailwind3-definition.scss +29 -0
- package/styles/image-editor/bds.css +969 -0
- package/styles/image-editor/bds.scss +14 -0
- package/styles/image-editor/bootstrap-dark.css +5 -3
- package/styles/image-editor/bootstrap.css +5 -3
- package/styles/image-editor/bootstrap4.css +5 -3
- package/styles/image-editor/bootstrap5-dark.css +5 -3
- package/styles/image-editor/bootstrap5.3.css +5 -3
- package/styles/image-editor/bootstrap5.css +5 -3
- package/styles/image-editor/fabric-dark.css +5 -3
- package/styles/image-editor/fabric.css +5 -3
- package/styles/image-editor/fluent-dark.css +5 -3
- package/styles/image-editor/fluent.css +5 -3
- package/styles/image-editor/fluent2.css +5 -3
- package/styles/image-editor/highcontrast-light.css +5 -3
- package/styles/image-editor/highcontrast.css +5 -3
- package/styles/image-editor/icons/_tailwind3.scss +259 -0
- package/styles/image-editor/material-dark.css +5 -3
- package/styles/image-editor/material.css +5 -3
- package/styles/image-editor/material3-dark.css +5 -3
- package/styles/image-editor/material3.css +5 -3
- package/styles/image-editor/tailwind-dark.css +5 -3
- package/styles/image-editor/tailwind.css +5 -3
- package/styles/image-editor/tailwind3.css +860 -0
- package/styles/image-editor/tailwind3.scss +14 -0
- package/styles/material-dark-lite.css +5 -3
- package/styles/material-dark.css +5 -3
- package/styles/material-lite.css +5 -3
- package/styles/material.css +5 -3
- package/styles/material3-dark-lite.css +5 -3
- package/styles/material3-dark.css +5 -3
- package/styles/material3-lite.css +5 -3
- package/styles/material3.css +5 -3
- package/styles/tailwind-dark-lite.css +5 -3
- package/styles/tailwind-dark.css +5 -3
- package/styles/tailwind-lite.css +5 -3
- package/styles/tailwind.css +5 -3
- package/styles/tailwind3-lite.css +755 -0
- package/styles/tailwind3-lite.scss +13 -0
- package/styles/tailwind3.css +860 -0
- package/styles/tailwind3.scss +14 -0
|
@@ -1000,6 +1000,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1000
1000
|
this.tempPointColl = {};
|
|
1001
1001
|
this.imageBackgroundColor = '';
|
|
1002
1002
|
this.allowRedactStraighten = true;
|
|
1003
|
+
this.isNullExtension = true;
|
|
1003
1004
|
this.parent = parent;
|
|
1004
1005
|
this.addEventListener();
|
|
1005
1006
|
}
|
|
@@ -1277,6 +1278,9 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1277
1278
|
case 'setTempStrokeWidth':
|
|
1278
1279
|
this.tempStrokeWidth = args.value['strokeWidth'];
|
|
1279
1280
|
break;
|
|
1281
|
+
case 'setNullExtension':
|
|
1282
|
+
this.isNullExtension = args.value['extension'];
|
|
1283
|
+
break;
|
|
1280
1284
|
}
|
|
1281
1285
|
};
|
|
1282
1286
|
Draw.prototype.getModuleName = function () {
|
|
@@ -1301,6 +1305,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
1301
1305
|
this.isInitialLoading = this.isErrorImage = this.isNewPath = this.isResizeSelect = false;
|
|
1302
1306
|
this.isShapeTextInserted = false;
|
|
1303
1307
|
this.isImageApply = false;
|
|
1308
|
+
this.isNullExtension = true;
|
|
1304
1309
|
this.initZoomValue = null;
|
|
1305
1310
|
this.tempFilter = '';
|
|
1306
1311
|
this.origDim = { width: 0, height: 0 };
|
|
@@ -2482,8 +2487,8 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
2482
2487
|
var angle = Math.atan2(this.dy, this.dx);
|
|
2483
2488
|
var isStartArrowSolid = actObj.start === 'arrowSolid';
|
|
2484
2489
|
var isEndArrowSolid = actObj.end === 'arrowSolid';
|
|
2485
|
-
var isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
|
|
2486
2490
|
var isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
|
|
2491
|
+
var isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
|
|
2487
2492
|
if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
|
|
2488
2493
|
(!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
|
|
2489
2494
|
this.shapeLine(canvasDraw, startX, startY, endX, endY);
|
|
@@ -4813,7 +4818,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4813
4818
|
}
|
|
4814
4819
|
var obj = { defToolbarItems: null };
|
|
4815
4820
|
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
|
|
4816
|
-
if (obj['defToolbarItems'].length === 0 &&
|
|
4821
|
+
if (obj['defToolbarItems'] && obj['defToolbarItems'].length === 0 &&
|
|
4817
4822
|
(isNullOrUndefined(document.getElementById(id + '_toolbar'))) &&
|
|
4818
4823
|
parent.element.querySelector('#' + id + '_toolbarArea')) {
|
|
4819
4824
|
var height = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
|
|
@@ -4843,7 +4848,7 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4843
4848
|
this.fileType = 'Jpeg';
|
|
4844
4849
|
fileType = 'jpeg';
|
|
4845
4850
|
}
|
|
4846
|
-
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg') {
|
|
4851
|
+
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg' && fileType !== 'webp') {
|
|
4847
4852
|
this.fileType = null;
|
|
4848
4853
|
}
|
|
4849
4854
|
}
|
|
@@ -4948,19 +4953,96 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
4948
4953
|
dialog.appendTo('#' + parent.element.id + '_dialog');
|
|
4949
4954
|
};
|
|
4950
4955
|
Draw.prototype.restoreOldImage = function () {
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4956
|
+
var _this = this;
|
|
4957
|
+
var parent = this.parent;
|
|
4958
|
+
var dropArea = document.getElementById(this.parent.element.id + '_dropArea');
|
|
4959
|
+
var extension = parent.getExtensionArray();
|
|
4960
|
+
var openURLType = typeof this.openURL;
|
|
4961
|
+
if (openURLType !== 'string') {
|
|
4962
|
+
this.openImageData(dropArea);
|
|
4963
|
+
return;
|
|
4964
|
+
}
|
|
4965
|
+
var fileType = this.getFileExtensionFromURL(this.openURL).toLowerCase();
|
|
4966
|
+
if (fileType) {
|
|
4967
|
+
fileType = (fileType === 'jpg' || fileType === 'jpeg') ? 'jpeg' : fileType;
|
|
4968
|
+
}
|
|
4969
|
+
var isAllowedFileType = (fileType ? (extension.indexOf(fileType) > -1 ||
|
|
4970
|
+
(fileType === 'jpeg' && (parent.uploadSettings.allowedExtensions.indexOf('jpg') > -1 ||
|
|
4971
|
+
parent.uploadSettings.allowedExtensions.indexOf('jpeg') > -1))) : false) || this.isNullExtension;
|
|
4972
|
+
if (this.openURL.indexOf('data:image/') > -1 && this.openURL.indexOf('base64') > -1) {
|
|
4973
|
+
this.openImageData(dropArea, true);
|
|
4974
|
+
}
|
|
4975
|
+
else if (parent.uploadSettings.minFileSize || parent.uploadSettings.maxFileSize) {
|
|
4976
|
+
this.getImageSizeFromURL(this.openURL.toString(), function (imageSizeMB) {
|
|
4977
|
+
var isInvalidSize = (parent.uploadSettings.minFileSize && imageSizeMB < parent.uploadSettings.minFileSize) ||
|
|
4978
|
+
(parent.uploadSettings.maxFileSize && imageSizeMB > parent.uploadSettings.maxFileSize);
|
|
4979
|
+
_this.handleFileSize(!isAllowedFileType || isInvalidSize, dropArea, !isAllowedFileType);
|
|
4980
|
+
});
|
|
4954
4981
|
}
|
|
4955
4982
|
else {
|
|
4983
|
+
this.handleFileSize(!isAllowedFileType, dropArea, !isAllowedFileType);
|
|
4984
|
+
}
|
|
4985
|
+
};
|
|
4986
|
+
Draw.prototype.handleFileSize = function (isError, dropArea, fileTypeError) {
|
|
4987
|
+
var parent = this.parent;
|
|
4988
|
+
if (isError) {
|
|
4989
|
+
this.errorLoading();
|
|
4990
|
+
parent.showDialogPopup('unsupported', fileTypeError);
|
|
4991
|
+
if (dropArea && !parent.isImageLoaded) {
|
|
4992
|
+
dropArea.style.display = 'block';
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
else {
|
|
4996
|
+
if (dropArea) {
|
|
4997
|
+
dropArea.style.display = 'none';
|
|
4998
|
+
}
|
|
4999
|
+
if (this.parent.isImageLoaded) {
|
|
5000
|
+
this.reset();
|
|
5001
|
+
}
|
|
4956
5002
|
this.openNewImage();
|
|
4957
5003
|
}
|
|
4958
5004
|
};
|
|
4959
|
-
Draw.prototype.
|
|
4960
|
-
var
|
|
4961
|
-
|
|
4962
|
-
|
|
5005
|
+
Draw.prototype.openImageData = function (dropArea, isBase64) {
|
|
5006
|
+
var parent = this.parent;
|
|
5007
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
5008
|
+
var proxy = this;
|
|
5009
|
+
var canvas = parent.createElement('canvas');
|
|
5010
|
+
var ctx = canvas.getContext('2d');
|
|
5011
|
+
if (!parent.uploadSettings.minFileSize && !parent.uploadSettings.maxFileSize) {
|
|
5012
|
+
this.handleFileSize(false, dropArea, false);
|
|
5013
|
+
return;
|
|
5014
|
+
}
|
|
5015
|
+
if (isBase64) {
|
|
5016
|
+
var img_1 = new Image();
|
|
5017
|
+
img_1.src = this.openURL;
|
|
5018
|
+
img_1.onload = function () {
|
|
5019
|
+
ctx.canvas.width = img_1.width;
|
|
5020
|
+
ctx.canvas.height = img_1.height;
|
|
5021
|
+
ctx.drawImage(img_1, 0, 0);
|
|
5022
|
+
proxy.getImageSize(canvas, dropArea);
|
|
5023
|
+
};
|
|
4963
5024
|
}
|
|
5025
|
+
else {
|
|
5026
|
+
canvas.width = this.openURL.width;
|
|
5027
|
+
canvas.height = this.openURL.height;
|
|
5028
|
+
ctx.putImageData(this.openURL, 0, 0);
|
|
5029
|
+
this.getImageSize(canvas, dropArea);
|
|
5030
|
+
}
|
|
5031
|
+
};
|
|
5032
|
+
Draw.prototype.getImageSize = function (canvas, dropArea) {
|
|
5033
|
+
var parent = this.parent;
|
|
5034
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5035
|
+
canvas.toBlob((function (blob) {
|
|
5036
|
+
if ((parent.uploadSettings.minFileSize && blob.size < parent.uploadSettings.minFileSize) ||
|
|
5037
|
+
(parent.uploadSettings.maxFileSize && blob.size > parent.uploadSettings.maxFileSize)) {
|
|
5038
|
+
this.handleFileSize(true, dropArea, false);
|
|
5039
|
+
}
|
|
5040
|
+
else {
|
|
5041
|
+
this.handleFileSize(false, dropArea, false);
|
|
5042
|
+
}
|
|
5043
|
+
}).bind(this), 'image/jpeg', 1);
|
|
5044
|
+
};
|
|
5045
|
+
Draw.prototype.open = function (data) {
|
|
4964
5046
|
if (!this.parent.disabled) {
|
|
4965
5047
|
this.openURL = data;
|
|
4966
5048
|
this.restoreOldImage();
|
|
@@ -5003,7 +5085,11 @@ var Draw = /** @__PURE__ @class */ (function () {
|
|
|
5003
5085
|
var fileExtensionArray = fileData.name.split('.');
|
|
5004
5086
|
fileExtension = fileExtensionArray[fileExtensionArray.length - 1].toLowerCase();
|
|
5005
5087
|
}
|
|
5006
|
-
|
|
5088
|
+
var extension = parent.getExtensionArray();
|
|
5089
|
+
var isJPG = ((fileExtension === 'jpg' || fileExtension === 'jpeg') && (parent.uploadSettings.allowedExtensions.indexOf('jpg') > -1 || parent.uploadSettings.allowedExtensions.indexOf('jpeg') > -1));
|
|
5090
|
+
if ((fileExtension && (extension.indexOf(fileExtension) === -1 && !isJPG)) ||
|
|
5091
|
+
((parent.uploadSettings.minFileSize && fileData.size < parent.uploadSettings.minFileSize) ||
|
|
5092
|
+
(parent.uploadSettings.maxFileSize && fileData.size > parent.uploadSettings.maxFileSize))) {
|
|
5007
5093
|
this.errorLoading();
|
|
5008
5094
|
return;
|
|
5009
5095
|
}
|
|
@@ -6327,7 +6413,7 @@ var Export = /** @__PURE__ @class */ (function () {
|
|
|
6327
6413
|
this.imageQuality = imgQuality ? imgQuality : null;
|
|
6328
6414
|
}
|
|
6329
6415
|
var tempCanvas = this.exportToCanvas();
|
|
6330
|
-
var imagetype = type
|
|
6416
|
+
var imagetype = (type === 'jpeg' ? 'image/jpeg' : (type === 'webp' ? 'image/webp' : 'image/png'));
|
|
6331
6417
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
6332
6418
|
tempCanvas.toBlob(function (blob) {
|
|
6333
6419
|
var blobUrl = URL.createObjectURL(blob);
|
|
@@ -15066,20 +15152,6 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15066
15152
|
parent.isPublicMethod = false;
|
|
15067
15153
|
}
|
|
15068
15154
|
};
|
|
15069
|
-
Shape.prototype.setTransformColl = function (transformCollection) {
|
|
15070
|
-
var parent = this.parent;
|
|
15071
|
-
parent.activeObj.rotateFlipColl = [];
|
|
15072
|
-
if (transformCollection) {
|
|
15073
|
-
for (var i = 0; i < transformCollection.length; i++) {
|
|
15074
|
-
if (transformCollection[i].degree) {
|
|
15075
|
-
parent.activeObj.rotateFlipColl.push(transformCollection[i].degree);
|
|
15076
|
-
}
|
|
15077
|
-
else {
|
|
15078
|
-
parent.activeObj.rotateFlipColl.push(transformCollection[i].flip.toLowerCase());
|
|
15079
|
-
}
|
|
15080
|
-
}
|
|
15081
|
-
}
|
|
15082
|
-
};
|
|
15083
15155
|
Shape.prototype.drawShapeImageEvent = function (shapeChangingArgs, isSelect) {
|
|
15084
15156
|
var parent = this.parent;
|
|
15085
15157
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
|
|
@@ -15103,6 +15175,20 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
15103
15175
|
}
|
|
15104
15176
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
15105
15177
|
};
|
|
15178
|
+
Shape.prototype.setTransformColl = function (transformCollection) {
|
|
15179
|
+
var parent = this.parent;
|
|
15180
|
+
parent.activeObj.rotateFlipColl = [];
|
|
15181
|
+
if (transformCollection) {
|
|
15182
|
+
for (var i = 0; i < transformCollection.length; i++) {
|
|
15183
|
+
if (transformCollection[i].degree) {
|
|
15184
|
+
parent.activeObj.rotateFlipColl.push(transformCollection[i].degree);
|
|
15185
|
+
}
|
|
15186
|
+
else {
|
|
15187
|
+
parent.activeObj.rotateFlipColl.push(transformCollection[i].flip.toLowerCase());
|
|
15188
|
+
}
|
|
15189
|
+
}
|
|
15190
|
+
}
|
|
15191
|
+
};
|
|
15106
15192
|
Shape.prototype.drawShapeTextEvent = function (shapeChangingArgs) {
|
|
15107
15193
|
var parent = this.parent;
|
|
15108
15194
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
|
|
@@ -16114,6 +16200,13 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
16114
16200
|
};
|
|
16115
16201
|
Shape.prototype.renderTextArea = function (x, y, actObj) {
|
|
16116
16202
|
var parent = this.parent;
|
|
16203
|
+
var shapeObj = { shapeSettingsObj: {} };
|
|
16204
|
+
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: shapeObj } });
|
|
16205
|
+
var shapeSettings = shapeObj['shapeSettingsObj'];
|
|
16206
|
+
var shapeChangingArgs = { cancel: false, action: 'text-edit', previousShapeSettings: shapeSettings,
|
|
16207
|
+
currentShapeSettings: shapeSettings };
|
|
16208
|
+
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
16209
|
+
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
|
|
16117
16210
|
var degree = this.getRotDegOfShape(parent.activeObj);
|
|
16118
16211
|
this.transformTextArea();
|
|
16119
16212
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
@@ -16712,7 +16805,7 @@ var Shape = /** @__PURE__ @class */ (function () {
|
|
|
16712
16805
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
16713
16806
|
var fileData = filesData;
|
|
16714
16807
|
var fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
|
|
16715
|
-
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
16808
|
+
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp'].indexOf(fileExtension) === -1) {
|
|
16716
16809
|
this.refreshActiveObj();
|
|
16717
16810
|
return;
|
|
16718
16811
|
}
|
|
@@ -19964,6 +20057,7 @@ var Transform = /** @__PURE__ @class */ (function () {
|
|
|
19964
20057
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
19965
20058
|
}
|
|
19966
20059
|
}
|
|
20060
|
+
parent.updateDropInfoContent(parent.element.querySelector('.e-ie-drop-info'));
|
|
19967
20061
|
var tempFilter = this.lowerContext.filter;
|
|
19968
20062
|
var canvasWrapper = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
19969
20063
|
if (canvasWrapper) {
|
|
@@ -21811,6 +21905,25 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
21811
21905
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21812
21906
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21813
21907
|
};
|
|
21908
|
+
/**
|
|
21909
|
+
* Defines the settings for restricting uploaded images.
|
|
21910
|
+
*/
|
|
21911
|
+
var UploadSettings = /** @__PURE__ @class */ (function (_super) {
|
|
21912
|
+
__extends(UploadSettings, _super);
|
|
21913
|
+
function UploadSettings() {
|
|
21914
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
21915
|
+
}
|
|
21916
|
+
__decorate([
|
|
21917
|
+
Property(null)
|
|
21918
|
+
], UploadSettings.prototype, "allowedExtensions", void 0);
|
|
21919
|
+
__decorate([
|
|
21920
|
+
Property(null)
|
|
21921
|
+
], UploadSettings.prototype, "minFileSize", void 0);
|
|
21922
|
+
__decorate([
|
|
21923
|
+
Property(null)
|
|
21924
|
+
], UploadSettings.prototype, "maxFileSize", void 0);
|
|
21925
|
+
return UploadSettings;
|
|
21926
|
+
}(ChildProperty));
|
|
21814
21927
|
/**
|
|
21815
21928
|
* This interface is used to specify settings for finetuning operations on images, including brightness, contrast, hue, saturation, exposure, opacity, and blur. It includes properties for setting minimum and maximum values for each of these options, as well as a default value.
|
|
21816
21929
|
*/
|
|
@@ -22285,6 +22398,24 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22285
22398
|
this.quickAccessToolbarTemplateFn();
|
|
22286
22399
|
}
|
|
22287
22400
|
break;
|
|
22401
|
+
case 'uploadSettings':
|
|
22402
|
+
if (newProperties.uploadSettings) {
|
|
22403
|
+
this.uploadSettings = newProperties.uploadSettings;
|
|
22404
|
+
if (!this.uploadSettings.allowedExtensions) {
|
|
22405
|
+
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp';
|
|
22406
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: true } });
|
|
22407
|
+
}
|
|
22408
|
+
else {
|
|
22409
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: false } });
|
|
22410
|
+
}
|
|
22411
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
22412
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
22413
|
+
}
|
|
22414
|
+
else {
|
|
22415
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: true } });
|
|
22416
|
+
}
|
|
22417
|
+
this.updateDropInfoContent(this.element.querySelector('.e-ie-drop-info'));
|
|
22418
|
+
break;
|
|
22288
22419
|
}
|
|
22289
22420
|
}
|
|
22290
22421
|
};
|
|
@@ -22319,6 +22450,12 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22319
22450
|
this.notify('toolbar', { prop: 'create-toolbar', onPropertyChange: false });
|
|
22320
22451
|
this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
|
|
22321
22452
|
}
|
|
22453
|
+
if (!this.uploadSettings.allowedExtensions) {
|
|
22454
|
+
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp';
|
|
22455
|
+
}
|
|
22456
|
+
else {
|
|
22457
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: false } });
|
|
22458
|
+
}
|
|
22322
22459
|
this.createCanvas();
|
|
22323
22460
|
if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
|
|
22324
22461
|
this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
|
|
@@ -22368,17 +22505,28 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22368
22505
|
};
|
|
22369
22506
|
ImageEditor.prototype.createDropUploader = function () {
|
|
22370
22507
|
var _this = this;
|
|
22508
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
22509
|
+
var proxy = this;
|
|
22371
22510
|
var uploadObj = new Uploader({
|
|
22372
22511
|
dropArea: this.element.getElementsByClassName('e-canvas-wrapper')[0],
|
|
22373
|
-
allowedExtensions:
|
|
22512
|
+
allowedExtensions: this.uploadSettings.allowedExtensions,
|
|
22374
22513
|
multiple: false,
|
|
22375
22514
|
selected: function (args) {
|
|
22376
22515
|
if (args.event.type === 'change' || args.event.type === 'drop') {
|
|
22377
22516
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
22378
22517
|
var type = args.filesData[0].type;
|
|
22379
22518
|
var errType = 'unsupported';
|
|
22519
|
+
var extension = _this.getExtensionArray();
|
|
22520
|
+
var isAllowedFileType = (extension.indexOf(type) > -1 ||
|
|
22521
|
+
(type === 'jpeg' && (proxy.uploadSettings.allowedExtensions.indexOf('jpg') > -1 ||
|
|
22522
|
+
proxy.uploadSettings.allowedExtensions.indexOf('jpeg') > -1)));
|
|
22523
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
22524
|
+
var size = args.filesData[0].size;
|
|
22525
|
+
var isInvalidSize = (proxy.uploadSettings.minFileSize && size < proxy.uploadSettings.minFileSize) ||
|
|
22526
|
+
(proxy.uploadSettings.maxFileSize && size > proxy.uploadSettings.maxFileSize);
|
|
22380
22527
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22381
|
-
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) &&
|
|
22528
|
+
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) && isAllowedFileType &&
|
|
22529
|
+
!isInvalidSize) {
|
|
22382
22530
|
_this.notify('draw', { prop: 'fileSelect', value: { inputElement: _this.element.querySelector('#' + _this.element.id + '_dropfileUpload'), args: args } });
|
|
22383
22531
|
}
|
|
22384
22532
|
else {
|
|
@@ -22386,7 +22534,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22386
22534
|
if (args.event.type === 'drop' && args.event.dataTransfer.files.length > 1) {
|
|
22387
22535
|
errType = 'multi-select-image';
|
|
22388
22536
|
}
|
|
22389
|
-
_this.showDialogPopup(errType);
|
|
22537
|
+
_this.showDialogPopup(errType, !isAllowedFileType);
|
|
22390
22538
|
}
|
|
22391
22539
|
}
|
|
22392
22540
|
}
|
|
@@ -22400,10 +22548,11 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22400
22548
|
* Show dialog popup for unsupported files.
|
|
22401
22549
|
*
|
|
22402
22550
|
* @param { string } type - Specifies the type of error.
|
|
22551
|
+
* @param { boolean } fileTypeError - Specifies the error is due to file type.
|
|
22403
22552
|
* @hidden
|
|
22404
22553
|
* @returns {void}.
|
|
22405
22554
|
*/
|
|
22406
|
-
ImageEditor.prototype.showDialogPopup = function (type) {
|
|
22555
|
+
ImageEditor.prototype.showDialogPopup = function (type, fileTypeError) {
|
|
22407
22556
|
var content = '';
|
|
22408
22557
|
this.element.querySelector('#' + this.element.id + '_dialog').style.display = 'block';
|
|
22409
22558
|
var headerObj;
|
|
@@ -22423,16 +22572,38 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22423
22572
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
22424
22573
|
var supportObj = { key: 'SupportText' };
|
|
22425
22574
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22575
|
+
var extension = this.getExtensionString();
|
|
22576
|
+
var fileSizeObj = { key: 'MinMaxSizeAlert' };
|
|
22577
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
22426
22578
|
var andObj = { key: 'And' };
|
|
22427
22579
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22428
|
-
|
|
22580
|
+
var size = void 0;
|
|
22581
|
+
if (this.uploadSettings.minFileSize && this.uploadSettings.maxFileSize) {
|
|
22582
|
+
size = ' ' + fileSizeObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.minFileSize) + ' </b> ' + andObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.maxFileSize) + ' </b> ';
|
|
22583
|
+
}
|
|
22584
|
+
else if (this.uploadSettings.minFileSize) {
|
|
22585
|
+
fileSizeObj['key'] = 'MinSizeAlert';
|
|
22586
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
22587
|
+
size = ' ' + fileSizeObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.minFileSize) + ' </b> ';
|
|
22588
|
+
}
|
|
22589
|
+
else if (this.uploadSettings.maxFileSize) {
|
|
22590
|
+
fileSizeObj['key'] = 'MaxSizeAlert';
|
|
22591
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
22592
|
+
size = ' ' + fileSizeObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.maxFileSize) + ' </b> ';
|
|
22593
|
+
}
|
|
22594
|
+
if (fileTypeError) {
|
|
22595
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b>' + extension + '</b>' + '</span>';
|
|
22596
|
+
}
|
|
22597
|
+
else if (size) {
|
|
22598
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + size + '</span>';
|
|
22599
|
+
}
|
|
22429
22600
|
}
|
|
22430
22601
|
var dialog = new Dialog({
|
|
22431
22602
|
header: headerObj['value'],
|
|
22432
22603
|
closeOnEscape: true,
|
|
22433
22604
|
content: content,
|
|
22434
22605
|
target: document.getElementById('target'),
|
|
22435
|
-
width: '285px',
|
|
22606
|
+
width: Browser.isDevice ? '285px' : '400px',
|
|
22436
22607
|
isModal: true,
|
|
22437
22608
|
animationSettings: { effect: 'Zoom' },
|
|
22438
22609
|
close: this.dlgCloseBtnClick.bind(this),
|
|
@@ -22444,6 +22615,99 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22444
22615
|
});
|
|
22445
22616
|
dialog.appendTo('#' + this.element.id + '_dialog');
|
|
22446
22617
|
};
|
|
22618
|
+
/**
|
|
22619
|
+
* Returns bytes in string format.
|
|
22620
|
+
*
|
|
22621
|
+
* @param { number } bytes - Specifies the bytes.
|
|
22622
|
+
*
|
|
22623
|
+
* @hidden
|
|
22624
|
+
* @returns {string}.
|
|
22625
|
+
*/
|
|
22626
|
+
ImageEditor.prototype.formatSizeUnits = function (bytes) {
|
|
22627
|
+
var byte = '';
|
|
22628
|
+
if (bytes >= 1073741824) {
|
|
22629
|
+
byte = (bytes / 1073741824).toFixed(2) + ' GB';
|
|
22630
|
+
}
|
|
22631
|
+
else if (bytes >= 1048576) {
|
|
22632
|
+
byte = (bytes / 1048576).toFixed(2) + ' MB';
|
|
22633
|
+
}
|
|
22634
|
+
else if (bytes >= 1024) {
|
|
22635
|
+
byte = (bytes / 1024).toFixed(2) + ' KB';
|
|
22636
|
+
}
|
|
22637
|
+
else if (bytes > 1) {
|
|
22638
|
+
byte = bytes + ' bytes';
|
|
22639
|
+
}
|
|
22640
|
+
else if (bytes === 1) {
|
|
22641
|
+
byte = bytes + ' byte';
|
|
22642
|
+
}
|
|
22643
|
+
else {
|
|
22644
|
+
byte = '0 bytes';
|
|
22645
|
+
}
|
|
22646
|
+
return byte;
|
|
22647
|
+
};
|
|
22648
|
+
/**
|
|
22649
|
+
* Returns allowed file type extensions in string[].
|
|
22650
|
+
*
|
|
22651
|
+
* @hidden
|
|
22652
|
+
* @returns {string[]}.
|
|
22653
|
+
*/
|
|
22654
|
+
ImageEditor.prototype.getExtensionArray = function () {
|
|
22655
|
+
var validExtensions = ['jpeg', 'jpg', 'png', 'svg', 'webp'];
|
|
22656
|
+
var split = this.uploadSettings.allowedExtensions.split(',');
|
|
22657
|
+
var extension = [];
|
|
22658
|
+
for (var _i = 0, split_1 = split; _i < split_1.length; _i++) {
|
|
22659
|
+
var ext = split_1[_i];
|
|
22660
|
+
var trimmedExt = ext.trim();
|
|
22661
|
+
for (var _a = 0, validExtensions_1 = validExtensions; _a < validExtensions_1.length; _a++) {
|
|
22662
|
+
var valid = validExtensions_1[_a];
|
|
22663
|
+
if (trimmedExt.indexOf(valid) !== -1) {
|
|
22664
|
+
extension.push(valid);
|
|
22665
|
+
break;
|
|
22666
|
+
}
|
|
22667
|
+
}
|
|
22668
|
+
}
|
|
22669
|
+
return extension;
|
|
22670
|
+
};
|
|
22671
|
+
/**
|
|
22672
|
+
* Returns allowed file type extensions in string.
|
|
22673
|
+
*
|
|
22674
|
+
* @hidden
|
|
22675
|
+
* @returns {string}.
|
|
22676
|
+
*/
|
|
22677
|
+
ImageEditor.prototype.getExtensionString = function () {
|
|
22678
|
+
var andObj = { key: 'And' };
|
|
22679
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22680
|
+
var extension = this.getExtensionArray();
|
|
22681
|
+
var words = '';
|
|
22682
|
+
for (var i = 0; i < extension.length; i++) {
|
|
22683
|
+
if (i === extension.length - 1 && extension.length > 1 &&
|
|
22684
|
+
!((extension[i] === 'jpeg' || extension[i] === 'jpg') &&
|
|
22685
|
+
(words.indexOf('JPG') > -1))) {
|
|
22686
|
+
words += ' ' + andObj['value'];
|
|
22687
|
+
}
|
|
22688
|
+
switch (extension[i]) {
|
|
22689
|
+
case 'jpeg':
|
|
22690
|
+
case 'jpg':
|
|
22691
|
+
if (words.indexOf('JPG') === -1) {
|
|
22692
|
+
words += ' JPG,';
|
|
22693
|
+
}
|
|
22694
|
+
break;
|
|
22695
|
+
case 'png':
|
|
22696
|
+
words += ' PNG,';
|
|
22697
|
+
break;
|
|
22698
|
+
case 'svg':
|
|
22699
|
+
words += ' SVG,';
|
|
22700
|
+
break;
|
|
22701
|
+
case 'webp':
|
|
22702
|
+
words += ' WebP,';
|
|
22703
|
+
break;
|
|
22704
|
+
}
|
|
22705
|
+
if (i === extension.length - 1) {
|
|
22706
|
+
words = words.slice(0, -1);
|
|
22707
|
+
}
|
|
22708
|
+
}
|
|
22709
|
+
return words;
|
|
22710
|
+
};
|
|
22447
22711
|
/**
|
|
22448
22712
|
*
|
|
22449
22713
|
* This Method will add events to component (element, event, method, current reference)
|
|
@@ -22518,10 +22782,6 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22518
22782
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: dropObj } });
|
|
22519
22783
|
var browseObj = { key: 'BrowseText' };
|
|
22520
22784
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: browseObj } });
|
|
22521
|
-
var supportObj = { key: 'SupportText' };
|
|
22522
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22523
|
-
var andObj = { key: 'And' };
|
|
22524
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22525
22785
|
var dropAreaElement = this.createElement('div', { id: this.element.id + '_dropArea', className: 'e-ie-drop-area', attrs: { style: 'position: relative;' } });
|
|
22526
22786
|
var dropIconElement = this.createElement('span', { className: 'e-ie-drop-icon e-icons e-image', attrs: { style: 'position: absolute;' } });
|
|
22527
22787
|
var dropContentElement = this.createElement('span', { className: 'e-ie-drop-content', attrs: { style: 'position: absolute; display: none;' } });
|
|
@@ -22537,7 +22797,7 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
22537
22797
|
dropAnchorElement.href = '';
|
|
22538
22798
|
minDropAnchorElem.href = '';
|
|
22539
22799
|
var dropInfoElement = this.createElement('span', { className: 'e-ie-drop-info', attrs: { position: 'absolute' } });
|
|
22540
|
-
dropInfoElement
|
|
22800
|
+
this.updateDropInfoContent(dropInfoElement);
|
|
22541
22801
|
var dropUploader = dropAreaElement.appendChild(this.createElement('input', {
|
|
22542
22802
|
id: this.element.id + '_dropfileUpload', className: 'e-fileUpload e-image-upload'
|
|
22543
22803
|
}));
|
|
@@ -24471,6 +24731,45 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
24471
24731
|
}
|
|
24472
24732
|
return items;
|
|
24473
24733
|
};
|
|
24734
|
+
/**
|
|
24735
|
+
* Updates drop area content dynamically.
|
|
24736
|
+
*
|
|
24737
|
+
* @param { HTMLElement } dropInfoElement - Specifies the drop area element.
|
|
24738
|
+
* @hidden
|
|
24739
|
+
* @returns {void}.
|
|
24740
|
+
*/
|
|
24741
|
+
ImageEditor.prototype.updateDropInfoContent = function (dropInfoElement) {
|
|
24742
|
+
if (!dropInfoElement) {
|
|
24743
|
+
return;
|
|
24744
|
+
}
|
|
24745
|
+
var supportObj = { key: 'SupportText' };
|
|
24746
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
24747
|
+
var words = this.getExtensionString();
|
|
24748
|
+
var fileSizeObj = { key: 'MinMaxSize' };
|
|
24749
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
24750
|
+
var andObj = { key: 'And' };
|
|
24751
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
24752
|
+
var size;
|
|
24753
|
+
if (this.uploadSettings.minFileSize && this.uploadSettings.maxFileSize) {
|
|
24754
|
+
size = ' ' + fileSizeObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.minFileSize) + ' ' + andObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.maxFileSize);
|
|
24755
|
+
}
|
|
24756
|
+
else if (this.uploadSettings.minFileSize) {
|
|
24757
|
+
fileSizeObj['key'] = 'MinSize';
|
|
24758
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
24759
|
+
size = ' ' + fileSizeObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.minFileSize);
|
|
24760
|
+
}
|
|
24761
|
+
else if (this.uploadSettings.maxFileSize) {
|
|
24762
|
+
fileSizeObj['key'] = 'MaxSize';
|
|
24763
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
24764
|
+
size = ' ' + fileSizeObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.maxFileSize);
|
|
24765
|
+
}
|
|
24766
|
+
if (size) {
|
|
24767
|
+
dropInfoElement.textContent = supportObj['value'] + words + size;
|
|
24768
|
+
}
|
|
24769
|
+
else {
|
|
24770
|
+
dropInfoElement.textContent = supportObj['value'] + words;
|
|
24771
|
+
}
|
|
24772
|
+
};
|
|
24474
24773
|
/**
|
|
24475
24774
|
* Handles the OK button operation
|
|
24476
24775
|
*
|
|
@@ -26126,7 +26425,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26126
26425
|
Fluent2Dark: { primaryColor: '#115ea3', secondaryColor: '#fff' },
|
|
26127
26426
|
Fluent2Highcontrast: { primaryColor: '#1aebff', secondaryColor: '#fff' },
|
|
26128
26427
|
'Bootstrap5.3': { primaryColor: '#0d6efd', secondaryColor: '#fff' },
|
|
26129
|
-
'Bootstrap5.3Dark': { primaryColor: '#0d6efd', secondaryColor: '#fff' }
|
|
26428
|
+
'Bootstrap5.3Dark': { primaryColor: '#0d6efd', secondaryColor: '#fff' },
|
|
26429
|
+
Tailwind3: { primaryColor: '#4f46e5', secondaryColor: '#ffffff' },
|
|
26430
|
+
Tailwind3Dark: { primaryColor: '#6366f1', secondaryColor: '#ffffff03' }
|
|
26130
26431
|
};
|
|
26131
26432
|
};
|
|
26132
26433
|
/**
|
|
@@ -26206,6 +26507,9 @@ var ImageEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26206
26507
|
__decorate([
|
|
26207
26508
|
Complex({}, FontFamily)
|
|
26208
26509
|
], ImageEditor.prototype, "fontFamily", void 0);
|
|
26510
|
+
__decorate([
|
|
26511
|
+
Complex({}, UploadSettings)
|
|
26512
|
+
], ImageEditor.prototype, "uploadSettings", void 0);
|
|
26209
26513
|
__decorate([
|
|
26210
26514
|
Event()
|
|
26211
26515
|
], ImageEditor.prototype, "beforeSave", void 0);
|
|
@@ -26297,6 +26601,8 @@ var FileType;
|
|
|
26297
26601
|
FileType["Jpeg"] = "Jpeg";
|
|
26298
26602
|
/** The SVG file type. */
|
|
26299
26603
|
FileType["Svg"] = "Svg";
|
|
26604
|
+
/** The WebP file type. */
|
|
26605
|
+
FileType["WebP"] = "WebP";
|
|
26300
26606
|
})(FileType || (FileType = {}));
|
|
26301
26607
|
/**
|
|
26302
26608
|
* An enumeration representing the direction of an image editor operation.
|
|
@@ -26387,6 +26693,10 @@ var Theme;
|
|
|
26387
26693
|
Theme["Fluent2"] = "Fluent2";
|
|
26388
26694
|
/** The dark variant of the Fluent 2.0 UI theme. */
|
|
26389
26695
|
Theme["Fluent2Dark"] = "Fluent2Dark";
|
|
26696
|
+
/** The Tailwind 3 UI theme. */
|
|
26697
|
+
Theme["Tailwind3"] = "Tailwind3";
|
|
26698
|
+
/** The dark variant of the Tailwind 3 UI theme. */
|
|
26699
|
+
Theme["Tailwind3Dark"] = "Tailwind3Dark";
|
|
26390
26700
|
})(Theme || (Theme = {}));
|
|
26391
26701
|
/**
|
|
26392
26702
|
* An enum representing the available toolbar commands in the image editor.
|
|
@@ -26731,6 +27041,14 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
26731
27041
|
ConfirmDialogContent: 'Do you want to save the changes you made to the image?',
|
|
26732
27042
|
AlertDialogHeader: 'Unsupported file',
|
|
26733
27043
|
AlertDialogContent: 'The selected file is unsupported.',
|
|
27044
|
+
MinMaxSize: 'with file size between',
|
|
27045
|
+
MinMaxSizeAlert: 'File size between',
|
|
27046
|
+
MinSize: 'with minimum file size of',
|
|
27047
|
+
MinSizeAlert: 'A minimum file size of',
|
|
27048
|
+
MaxSize: 'with maximum file size of',
|
|
27049
|
+
MaxSizeAlert: 'A maximum file size of',
|
|
27050
|
+
To: 'to',
|
|
27051
|
+
Bytes: 'bytes',
|
|
26734
27052
|
Yes: 'Yes',
|
|
26735
27053
|
No: 'No',
|
|
26736
27054
|
ImageErrorDialogHeader: 'Image Selection Error',
|
|
@@ -26974,7 +27292,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
26974
27292
|
id: id + '_toolbarArea', className: 'e-toolbar-area'
|
|
26975
27293
|
}));
|
|
26976
27294
|
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
26977
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions:
|
|
27295
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) };
|
|
26978
27296
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
26979
27297
|
this.defToolbarItems = [];
|
|
26980
27298
|
}
|
|
@@ -26988,7 +27306,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
26988
27306
|
align: 'Left', type: 'Input',
|
|
26989
27307
|
tooltipText: this.l10n.getConstant('Browse'),
|
|
26990
27308
|
template: new Uploader({
|
|
26991
|
-
allowedExtensions:
|
|
27309
|
+
allowedExtensions: parent.uploadSettings.allowedExtensions,
|
|
26992
27310
|
multiple: false,
|
|
26993
27311
|
selected: function () {
|
|
26994
27312
|
var toolbar = document.getElementById(id + '_toolbar');
|
|
@@ -27075,7 +27393,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
27075
27393
|
var id = parent.element.id;
|
|
27076
27394
|
if (parent.showQuickAccessToolbar) {
|
|
27077
27395
|
var toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
27078
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions:
|
|
27396
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) };
|
|
27079
27397
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
27080
27398
|
this.defToolbarItems = [];
|
|
27081
27399
|
}
|
|
@@ -27173,11 +27491,11 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
27173
27491
|
var toolbarItems = [];
|
|
27174
27492
|
if (!isOkBtn || isResize) {
|
|
27175
27493
|
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Open') > -1)) {
|
|
27176
|
-
toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions:
|
|
27494
|
+
toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) });
|
|
27177
27495
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
27178
27496
|
}
|
|
27179
27497
|
else if (Browser.isDevice && (parent.toolbar && parent.toolbar.indexOf('Open') === -1)) {
|
|
27180
|
-
toolbarItems.push({ visible: false, id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions:
|
|
27498
|
+
toolbarItems.push({ visible: false, id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) });
|
|
27181
27499
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
27182
27500
|
}
|
|
27183
27501
|
}
|
|
@@ -27728,18 +28046,30 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
27728
28046
|
}
|
|
27729
28047
|
};
|
|
27730
28048
|
ToolbarModule.prototype.fileSelect = function (inputElement, args) {
|
|
28049
|
+
var parent = this.parent;
|
|
27731
28050
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27732
28051
|
var type = inputElement.files[0].type.split('/')[1];
|
|
27733
|
-
var filesTypes =
|
|
28052
|
+
var filesTypes = this.parent.getExtensionArray();
|
|
28053
|
+
var isJPG = ((type === 'jpg' || type === 'jpeg') &&
|
|
28054
|
+
(parent.uploadSettings.allowedExtensions.indexOf('jpg') > -1 ||
|
|
28055
|
+
parent.uploadSettings.allowedExtensions.indexOf('jpeg') > -1));
|
|
27734
28056
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27735
28057
|
this.fileName = inputElement.files[0].name.split('.')[0];
|
|
27736
28058
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28059
|
+
var size = inputElement.files[0].size;
|
|
28060
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27737
28061
|
this.parent.notify('toolbar', { prop: 'setInitialSize', value: { value: inputElement.files[0].size } });
|
|
27738
|
-
if (filesTypes.indexOf(type) > -1)
|
|
28062
|
+
if ((filesTypes.indexOf(type) > -1 || isJPG || (type.indexOf('svg') > -1 && filesTypes.indexOf('svg') > -1)) &&
|
|
28063
|
+
(!this.parent.uploadSettings.minFileSize || size > this.parent.uploadSettings.minFileSize) &&
|
|
28064
|
+
(!this.parent.uploadSettings.maxFileSize || size < this.parent.uploadSettings.maxFileSize)) {
|
|
27739
28065
|
this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
|
|
27740
28066
|
}
|
|
27741
28067
|
else {
|
|
27742
|
-
this.parent.
|
|
28068
|
+
if (!this.parent.isImageLoaded && !Browser.isDevice) {
|
|
28069
|
+
this.destroyTopToolbar();
|
|
28070
|
+
this.createToolbar();
|
|
28071
|
+
}
|
|
28072
|
+
this.parent.showDialogPopup('unsupported', !((filesTypes.indexOf(type) > -1 || isJPG || (type.indexOf('svg') > -1 && filesTypes.indexOf('svg') > -1))));
|
|
27743
28073
|
}
|
|
27744
28074
|
};
|
|
27745
28075
|
ToolbarModule.prototype.triggerTbarClickEvent = function (args) {
|
|
@@ -28246,7 +28576,8 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28246
28576
|
var items = [
|
|
28247
28577
|
{ id: 'jpeg', text: 'JPEG' },
|
|
28248
28578
|
{ id: 'png', text: 'PNG' },
|
|
28249
|
-
{ id: 'svg', text: 'SVG' }
|
|
28579
|
+
{ id: 'svg', text: 'SVG' },
|
|
28580
|
+
{ id: 'webp', text: 'WebP' }
|
|
28250
28581
|
];
|
|
28251
28582
|
var inputObj = new TextBox({
|
|
28252
28583
|
placeholder: this.l10n.getConstant('ImageName')
|
|
@@ -28278,7 +28609,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28278
28609
|
var ddbElem = document.getElementById(id + '_saveDropdownbtn');
|
|
28279
28610
|
if (ddbElem) {
|
|
28280
28611
|
var spanElem_1 = document.createElement('span');
|
|
28281
|
-
spanElem_1.innerHTML = this.fileType.toUpperCase();
|
|
28612
|
+
spanElem_1.innerHTML = this.fileType === 'Webp' ? 'Webp' : this.fileType.toUpperCase();
|
|
28282
28613
|
if (ddbElem) {
|
|
28283
28614
|
ddbElem.appendChild(spanElem_1);
|
|
28284
28615
|
}
|
|
@@ -28442,8 +28773,10 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28442
28773
|
this.fileSize = fileSize;
|
|
28443
28774
|
}).bind(this), 'image/jpeg', quality);
|
|
28444
28775
|
}
|
|
28445
|
-
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
|
|
28776
|
+
else if (!isNullOrUndefined(fileType) && (fileType.toLowerCase() === 'png' || fileType.toLowerCase() === 'webp')) {
|
|
28777
|
+
var type = 'image/' + fileType.toLowerCase();
|
|
28446
28778
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28779
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28447
28780
|
tempCanvas.toBlob((function (blob) {
|
|
28448
28781
|
fileSize = Math.floor(blob.size / 1024);
|
|
28449
28782
|
if (fileSize > 1000) {
|
|
@@ -28459,7 +28792,7 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
28459
28792
|
canvas.style.display = 'none';
|
|
28460
28793
|
}
|
|
28461
28794
|
this.fileSize = fileSize;
|
|
28462
|
-
}).bind(this),
|
|
28795
|
+
}).bind(this), type, 1);
|
|
28463
28796
|
}
|
|
28464
28797
|
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
28465
28798
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
@@ -33101,5 +33434,5 @@ var ToolbarModule = /** @__PURE__ @class */ (function () {
|
|
|
33101
33434
|
return ToolbarModule;
|
|
33102
33435
|
}());
|
|
33103
33436
|
|
|
33104
|
-
export { ArrowheadType, Crop, Direction, Draw, Export, FileType, Filter, FinetuneSettings, FontFamily, FrameLineStyle, FrameType, FreehandDrawing, ImageEditor, ImageEditorCommand, ImageFilterOption, ImageFinetuneOption, RedactType, Selection, SelectionSettings, Shape, ShapeType, Theme, ToolbarModule, Transform, UndoRedo, ZoomSettings, ZoomTrigger };
|
|
33437
|
+
export { ArrowheadType, Crop, Direction, Draw, Export, FileType, Filter, FinetuneSettings, FontFamily, FrameLineStyle, FrameType, FreehandDrawing, ImageEditor, ImageEditorCommand, ImageFilterOption, ImageFinetuneOption, RedactType, Selection, SelectionSettings, Shape, ShapeType, Theme, ToolbarModule, Transform, UndoRedo, UploadSettings, ZoomSettings, ZoomTrigger };
|
|
33105
33438
|
//# sourceMappingURL=ej2-image-editor.es5.js.map
|