@syncfusion/ej2-image-editor 27.2.5 → 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
|
@@ -971,6 +971,7 @@ class Draw {
|
|
|
971
971
|
this.tempPointColl = {};
|
|
972
972
|
this.imageBackgroundColor = '';
|
|
973
973
|
this.allowRedactStraighten = true;
|
|
974
|
+
this.isNullExtension = true;
|
|
974
975
|
this.parent = parent;
|
|
975
976
|
this.addEventListener();
|
|
976
977
|
}
|
|
@@ -1248,6 +1249,9 @@ class Draw {
|
|
|
1248
1249
|
case 'setTempStrokeWidth':
|
|
1249
1250
|
this.tempStrokeWidth = args.value['strokeWidth'];
|
|
1250
1251
|
break;
|
|
1252
|
+
case 'setNullExtension':
|
|
1253
|
+
this.isNullExtension = args.value['extension'];
|
|
1254
|
+
break;
|
|
1251
1255
|
}
|
|
1252
1256
|
}
|
|
1253
1257
|
getModuleName() {
|
|
@@ -1272,6 +1276,7 @@ class Draw {
|
|
|
1272
1276
|
this.isInitialLoading = this.isErrorImage = this.isNewPath = this.isResizeSelect = false;
|
|
1273
1277
|
this.isShapeTextInserted = false;
|
|
1274
1278
|
this.isImageApply = false;
|
|
1279
|
+
this.isNullExtension = true;
|
|
1275
1280
|
this.initZoomValue = null;
|
|
1276
1281
|
this.tempFilter = '';
|
|
1277
1282
|
this.origDim = { width: 0, height: 0 };
|
|
@@ -2453,8 +2458,8 @@ class Draw {
|
|
|
2453
2458
|
const angle = Math.atan2(this.dy, this.dx);
|
|
2454
2459
|
const isStartArrowSolid = actObj.start === 'arrowSolid';
|
|
2455
2460
|
const isEndArrowSolid = actObj.end === 'arrowSolid';
|
|
2456
|
-
const isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
|
|
2457
2461
|
const isEndCircleOrSquare = actObj.end === 'circle' || actObj.end === 'square';
|
|
2462
|
+
const isStartCircleOrSquare = actObj.start === 'circle' || actObj.start === 'square';
|
|
2458
2463
|
if ((start && (isStartArrowSolid && actObj.end === 'none') || (isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare)) ||
|
|
2459
2464
|
(!start && (isEndArrowSolid && actObj.start === 'none' || !isStartArrowSolid && !isEndCircleOrSquare && !isStartCircleOrSquare))) {
|
|
2460
2465
|
this.shapeLine(canvasDraw, startX, startY, endX, endY);
|
|
@@ -4782,7 +4787,7 @@ class Draw {
|
|
|
4782
4787
|
}
|
|
4783
4788
|
const obj = { defToolbarItems: null };
|
|
4784
4789
|
parent.notify('toolbar', { prop: 'getDefToolbarItems', value: { obj: obj } });
|
|
4785
|
-
if (obj['defToolbarItems'].length === 0 &&
|
|
4790
|
+
if (obj['defToolbarItems'] && obj['defToolbarItems'].length === 0 &&
|
|
4786
4791
|
(isNullOrUndefined(document.getElementById(id + '_toolbar'))) &&
|
|
4787
4792
|
parent.element.querySelector('#' + id + '_toolbarArea')) {
|
|
4788
4793
|
const height = parent.element.querySelector('#' + id + '_toolbarArea').clientHeight;
|
|
@@ -4812,7 +4817,7 @@ class Draw {
|
|
|
4812
4817
|
this.fileType = 'Jpeg';
|
|
4813
4818
|
fileType = 'jpeg';
|
|
4814
4819
|
}
|
|
4815
|
-
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg') {
|
|
4820
|
+
if (fileType !== 'jpeg' && fileType !== 'png' && fileType !== 'svg' && fileType !== 'webp') {
|
|
4816
4821
|
this.fileType = null;
|
|
4817
4822
|
}
|
|
4818
4823
|
}
|
|
@@ -4908,19 +4913,95 @@ class Draw {
|
|
|
4908
4913
|
dialog.appendTo('#' + parent.element.id + '_dialog');
|
|
4909
4914
|
}
|
|
4910
4915
|
restoreOldImage() {
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4916
|
+
const parent = this.parent;
|
|
4917
|
+
const dropArea = document.getElementById(this.parent.element.id + '_dropArea');
|
|
4918
|
+
const extension = parent.getExtensionArray();
|
|
4919
|
+
const openURLType = typeof this.openURL;
|
|
4920
|
+
if (openURLType !== 'string') {
|
|
4921
|
+
this.openImageData(dropArea);
|
|
4922
|
+
return;
|
|
4923
|
+
}
|
|
4924
|
+
let fileType = this.getFileExtensionFromURL(this.openURL).toLowerCase();
|
|
4925
|
+
if (fileType) {
|
|
4926
|
+
fileType = (fileType === 'jpg' || fileType === 'jpeg') ? 'jpeg' : fileType;
|
|
4927
|
+
}
|
|
4928
|
+
const isAllowedFileType = (fileType ? (extension.indexOf(fileType) > -1 ||
|
|
4929
|
+
(fileType === 'jpeg' && (parent.uploadSettings.allowedExtensions.indexOf('jpg') > -1 ||
|
|
4930
|
+
parent.uploadSettings.allowedExtensions.indexOf('jpeg') > -1))) : false) || this.isNullExtension;
|
|
4931
|
+
if (this.openURL.indexOf('data:image/') > -1 && this.openURL.indexOf('base64') > -1) {
|
|
4932
|
+
this.openImageData(dropArea, true);
|
|
4933
|
+
}
|
|
4934
|
+
else if (parent.uploadSettings.minFileSize || parent.uploadSettings.maxFileSize) {
|
|
4935
|
+
this.getImageSizeFromURL(this.openURL.toString(), (imageSizeMB) => {
|
|
4936
|
+
const isInvalidSize = (parent.uploadSettings.minFileSize && imageSizeMB < parent.uploadSettings.minFileSize) ||
|
|
4937
|
+
(parent.uploadSettings.maxFileSize && imageSizeMB > parent.uploadSettings.maxFileSize);
|
|
4938
|
+
this.handleFileSize(!isAllowedFileType || isInvalidSize, dropArea, !isAllowedFileType);
|
|
4939
|
+
});
|
|
4940
|
+
}
|
|
4941
|
+
else {
|
|
4942
|
+
this.handleFileSize(!isAllowedFileType, dropArea, !isAllowedFileType);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
handleFileSize(isError, dropArea, fileTypeError) {
|
|
4946
|
+
const parent = this.parent;
|
|
4947
|
+
if (isError) {
|
|
4948
|
+
this.errorLoading();
|
|
4949
|
+
parent.showDialogPopup('unsupported', fileTypeError);
|
|
4950
|
+
if (dropArea && !parent.isImageLoaded) {
|
|
4951
|
+
dropArea.style.display = 'block';
|
|
4952
|
+
}
|
|
4914
4953
|
}
|
|
4915
4954
|
else {
|
|
4955
|
+
if (dropArea) {
|
|
4956
|
+
dropArea.style.display = 'none';
|
|
4957
|
+
}
|
|
4958
|
+
if (this.parent.isImageLoaded) {
|
|
4959
|
+
this.reset();
|
|
4960
|
+
}
|
|
4916
4961
|
this.openNewImage();
|
|
4917
4962
|
}
|
|
4918
4963
|
}
|
|
4919
|
-
|
|
4920
|
-
const
|
|
4921
|
-
|
|
4922
|
-
|
|
4964
|
+
openImageData(dropArea, isBase64) {
|
|
4965
|
+
const parent = this.parent;
|
|
4966
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4967
|
+
const proxy = this;
|
|
4968
|
+
const canvas = parent.createElement('canvas');
|
|
4969
|
+
const ctx = canvas.getContext('2d');
|
|
4970
|
+
if (!parent.uploadSettings.minFileSize && !parent.uploadSettings.maxFileSize) {
|
|
4971
|
+
this.handleFileSize(false, dropArea, false);
|
|
4972
|
+
return;
|
|
4923
4973
|
}
|
|
4974
|
+
if (isBase64) {
|
|
4975
|
+
const img = new Image();
|
|
4976
|
+
img.src = this.openURL;
|
|
4977
|
+
img.onload = () => {
|
|
4978
|
+
ctx.canvas.width = img.width;
|
|
4979
|
+
ctx.canvas.height = img.height;
|
|
4980
|
+
ctx.drawImage(img, 0, 0);
|
|
4981
|
+
proxy.getImageSize(canvas, dropArea);
|
|
4982
|
+
};
|
|
4983
|
+
}
|
|
4984
|
+
else {
|
|
4985
|
+
canvas.width = this.openURL.width;
|
|
4986
|
+
canvas.height = this.openURL.height;
|
|
4987
|
+
ctx.putImageData(this.openURL, 0, 0);
|
|
4988
|
+
this.getImageSize(canvas, dropArea);
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
getImageSize(canvas, dropArea) {
|
|
4992
|
+
const parent = this.parent;
|
|
4993
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
4994
|
+
canvas.toBlob((function (blob) {
|
|
4995
|
+
if ((parent.uploadSettings.minFileSize && blob.size < parent.uploadSettings.minFileSize) ||
|
|
4996
|
+
(parent.uploadSettings.maxFileSize && blob.size > parent.uploadSettings.maxFileSize)) {
|
|
4997
|
+
this.handleFileSize(true, dropArea, false);
|
|
4998
|
+
}
|
|
4999
|
+
else {
|
|
5000
|
+
this.handleFileSize(false, dropArea, false);
|
|
5001
|
+
}
|
|
5002
|
+
}).bind(this), 'image/jpeg', 1);
|
|
5003
|
+
}
|
|
5004
|
+
open(data) {
|
|
4924
5005
|
if (!this.parent.disabled) {
|
|
4925
5006
|
this.openURL = data;
|
|
4926
5007
|
this.restoreOldImage();
|
|
@@ -4963,7 +5044,11 @@ class Draw {
|
|
|
4963
5044
|
const fileExtensionArray = fileData.name.split('.');
|
|
4964
5045
|
fileExtension = fileExtensionArray[fileExtensionArray.length - 1].toLowerCase();
|
|
4965
5046
|
}
|
|
4966
|
-
|
|
5047
|
+
const extension = parent.getExtensionArray();
|
|
5048
|
+
const isJPG = ((fileExtension === 'jpg' || fileExtension === 'jpeg') && (parent.uploadSettings.allowedExtensions.indexOf('jpg') > -1 || parent.uploadSettings.allowedExtensions.indexOf('jpeg') > -1));
|
|
5049
|
+
if ((fileExtension && (extension.indexOf(fileExtension) === -1 && !isJPG)) ||
|
|
5050
|
+
((parent.uploadSettings.minFileSize && fileData.size < parent.uploadSettings.minFileSize) ||
|
|
5051
|
+
(parent.uploadSettings.maxFileSize && fileData.size > parent.uploadSettings.maxFileSize))) {
|
|
4967
5052
|
this.errorLoading();
|
|
4968
5053
|
return;
|
|
4969
5054
|
}
|
|
@@ -6280,7 +6365,7 @@ class Export {
|
|
|
6280
6365
|
this.imageQuality = imgQuality ? imgQuality : null;
|
|
6281
6366
|
}
|
|
6282
6367
|
const tempCanvas = this.exportToCanvas();
|
|
6283
|
-
const imagetype = type
|
|
6368
|
+
const imagetype = (type === 'jpeg' ? 'image/jpeg' : (type === 'webp' ? 'image/webp' : 'image/png'));
|
|
6284
6369
|
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
6285
6370
|
tempCanvas.toBlob(function (blob) {
|
|
6286
6371
|
const blobUrl = URL.createObjectURL(blob);
|
|
@@ -15003,20 +15088,6 @@ class Shape {
|
|
|
15003
15088
|
parent.isPublicMethod = false;
|
|
15004
15089
|
}
|
|
15005
15090
|
}
|
|
15006
|
-
setTransformColl(transformCollection) {
|
|
15007
|
-
const parent = this.parent;
|
|
15008
|
-
parent.activeObj.rotateFlipColl = [];
|
|
15009
|
-
if (transformCollection) {
|
|
15010
|
-
for (let i = 0; i < transformCollection.length; i++) {
|
|
15011
|
-
if (transformCollection[i].degree) {
|
|
15012
|
-
parent.activeObj.rotateFlipColl.push(transformCollection[i].degree);
|
|
15013
|
-
}
|
|
15014
|
-
else {
|
|
15015
|
-
parent.activeObj.rotateFlipColl.push(transformCollection[i].flip.toLowerCase());
|
|
15016
|
-
}
|
|
15017
|
-
}
|
|
15018
|
-
}
|
|
15019
|
-
}
|
|
15020
15091
|
drawShapeImageEvent(shapeChangingArgs, isSelect) {
|
|
15021
15092
|
const parent = this.parent;
|
|
15022
15093
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
|
|
@@ -15040,6 +15111,20 @@ class Shape {
|
|
|
15040
15111
|
}
|
|
15041
15112
|
parent.notify('selection', { prop: 'isShapeInserted', onPropertyChange: false, value: { bool: true } });
|
|
15042
15113
|
}
|
|
15114
|
+
setTransformColl(transformCollection) {
|
|
15115
|
+
const parent = this.parent;
|
|
15116
|
+
parent.activeObj.rotateFlipColl = [];
|
|
15117
|
+
if (transformCollection) {
|
|
15118
|
+
for (let i = 0; i < transformCollection.length; i++) {
|
|
15119
|
+
if (transformCollection[i].degree) {
|
|
15120
|
+
parent.activeObj.rotateFlipColl.push(transformCollection[i].degree);
|
|
15121
|
+
}
|
|
15122
|
+
else {
|
|
15123
|
+
parent.activeObj.rotateFlipColl.push(transformCollection[i].flip.toLowerCase());
|
|
15124
|
+
}
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
}
|
|
15043
15128
|
drawShapeTextEvent(shapeChangingArgs) {
|
|
15044
15129
|
const parent = this.parent;
|
|
15045
15130
|
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
|
|
@@ -16051,6 +16136,13 @@ class Shape {
|
|
|
16051
16136
|
}
|
|
16052
16137
|
renderTextArea(x, y, actObj) {
|
|
16053
16138
|
const parent = this.parent;
|
|
16139
|
+
const shapeObj = { shapeSettingsObj: {} };
|
|
16140
|
+
parent.notify('selection', { prop: 'updatePrevShapeSettings', onPropertyChange: false, value: { obj: shapeObj } });
|
|
16141
|
+
const shapeSettings = shapeObj['shapeSettingsObj'];
|
|
16142
|
+
const shapeChangingArgs = { cancel: false, action: 'text-edit', previousShapeSettings: shapeSettings,
|
|
16143
|
+
currentShapeSettings: shapeSettings };
|
|
16144
|
+
parent.trigger('shapeChanging', shapeChangingArgs);
|
|
16145
|
+
this.updateShapeChangeEventArgs(shapeChangingArgs.currentShapeSettings, shapeChangingArgs.allowShapeOverflow);
|
|
16054
16146
|
const degree = this.getRotDegOfShape(parent.activeObj);
|
|
16055
16147
|
this.transformTextArea();
|
|
16056
16148
|
parent.notify('toolbar', { prop: 'destroy-qa-toolbar', onPropertyChange: false });
|
|
@@ -16649,7 +16741,7 @@ class Shape {
|
|
|
16649
16741
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
16650
16742
|
const fileData = filesData;
|
|
16651
16743
|
const fileExtension = fileData.name && fileData.name.split('.').pop().toLowerCase();
|
|
16652
|
-
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg'].indexOf(fileExtension) === -1) {
|
|
16744
|
+
if (fileExtension && ['jpg', 'jpeg', 'png', 'svg', 'webp'].indexOf(fileExtension) === -1) {
|
|
16653
16745
|
this.refreshActiveObj();
|
|
16654
16746
|
return;
|
|
16655
16747
|
}
|
|
@@ -19898,6 +19990,7 @@ class Transform {
|
|
|
19898
19990
|
parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
|
|
19899
19991
|
}
|
|
19900
19992
|
}
|
|
19993
|
+
parent.updateDropInfoContent(parent.element.querySelector('.e-ie-drop-info'));
|
|
19901
19994
|
const tempFilter = this.lowerContext.filter;
|
|
19902
19995
|
const canvasWrapper = parent.element.querySelector('#' + parent.element.id + '_canvasWrapper');
|
|
19903
19996
|
if (canvasWrapper) {
|
|
@@ -21730,6 +21823,20 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
21730
21823
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21731
21824
|
};
|
|
21732
21825
|
var ImageEditor_1;
|
|
21826
|
+
/**
|
|
21827
|
+
* Defines the settings for restricting uploaded images.
|
|
21828
|
+
*/
|
|
21829
|
+
class UploadSettings extends ChildProperty {
|
|
21830
|
+
}
|
|
21831
|
+
__decorate([
|
|
21832
|
+
Property(null)
|
|
21833
|
+
], UploadSettings.prototype, "allowedExtensions", void 0);
|
|
21834
|
+
__decorate([
|
|
21835
|
+
Property(null)
|
|
21836
|
+
], UploadSettings.prototype, "minFileSize", void 0);
|
|
21837
|
+
__decorate([
|
|
21838
|
+
Property(null)
|
|
21839
|
+
], UploadSettings.prototype, "maxFileSize", void 0);
|
|
21733
21840
|
/**
|
|
21734
21841
|
* 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.
|
|
21735
21842
|
*/
|
|
@@ -22180,6 +22287,24 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22180
22287
|
this.quickAccessToolbarTemplateFn();
|
|
22181
22288
|
}
|
|
22182
22289
|
break;
|
|
22290
|
+
case 'uploadSettings':
|
|
22291
|
+
if (newProperties.uploadSettings) {
|
|
22292
|
+
this.uploadSettings = newProperties.uploadSettings;
|
|
22293
|
+
if (!this.uploadSettings.allowedExtensions) {
|
|
22294
|
+
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp';
|
|
22295
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: true } });
|
|
22296
|
+
}
|
|
22297
|
+
else {
|
|
22298
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: false } });
|
|
22299
|
+
}
|
|
22300
|
+
this.notify('toolbar', { prop: 'refresh-toolbar', onPropertyChange: false, value: { type: 'main',
|
|
22301
|
+
isApplyBtn: null, isCropping: null, isZooming: null, cType: null } });
|
|
22302
|
+
}
|
|
22303
|
+
else {
|
|
22304
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: true } });
|
|
22305
|
+
}
|
|
22306
|
+
this.updateDropInfoContent(this.element.querySelector('.e-ie-drop-info'));
|
|
22307
|
+
break;
|
|
22183
22308
|
}
|
|
22184
22309
|
}
|
|
22185
22310
|
}
|
|
@@ -22214,6 +22339,12 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22214
22339
|
this.notify('toolbar', { prop: 'create-toolbar', onPropertyChange: false });
|
|
22215
22340
|
this.notify('toolbar', { prop: 'create-contextual-toolbar', onPropertyChange: false });
|
|
22216
22341
|
}
|
|
22342
|
+
if (!this.uploadSettings.allowedExtensions) {
|
|
22343
|
+
this.uploadSettings.allowedExtensions = '.jpg, .jpeg, .png, .svg, .webp';
|
|
22344
|
+
}
|
|
22345
|
+
else {
|
|
22346
|
+
this.notify('draw', { prop: 'setNullExtension', value: { extension: false } });
|
|
22347
|
+
}
|
|
22217
22348
|
this.createCanvas();
|
|
22218
22349
|
if (this.element.offsetWidth > 359 && this.element.querySelector('.e-ie-min-drop-content') && this.element.querySelector('.e-ie-drop-content')) {
|
|
22219
22350
|
this.element.querySelector('.e-ie-min-drop-content').style.display = 'none';
|
|
@@ -22262,17 +22393,28 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22262
22393
|
}
|
|
22263
22394
|
}
|
|
22264
22395
|
createDropUploader() {
|
|
22396
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
22397
|
+
const proxy = this;
|
|
22265
22398
|
const uploadObj = new Uploader({
|
|
22266
22399
|
dropArea: this.element.getElementsByClassName('e-canvas-wrapper')[0],
|
|
22267
|
-
allowedExtensions:
|
|
22400
|
+
allowedExtensions: this.uploadSettings.allowedExtensions,
|
|
22268
22401
|
multiple: false,
|
|
22269
22402
|
selected: (args) => {
|
|
22270
22403
|
if (args.event.type === 'change' || args.event.type === 'drop') {
|
|
22271
22404
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
22272
22405
|
const type = args.filesData[0].type;
|
|
22273
22406
|
let errType = 'unsupported';
|
|
22407
|
+
const extension = this.getExtensionArray();
|
|
22408
|
+
const isAllowedFileType = (extension.indexOf(type) > -1 ||
|
|
22409
|
+
(type === 'jpeg' && (proxy.uploadSettings.allowedExtensions.indexOf('jpg') > -1 ||
|
|
22410
|
+
proxy.uploadSettings.allowedExtensions.indexOf('jpeg') > -1)));
|
|
22411
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
22412
|
+
const size = args.filesData[0].size;
|
|
22413
|
+
const isInvalidSize = (proxy.uploadSettings.minFileSize && size < proxy.uploadSettings.minFileSize) ||
|
|
22414
|
+
(proxy.uploadSettings.maxFileSize && size > proxy.uploadSettings.maxFileSize);
|
|
22274
22415
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22275
|
-
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) &&
|
|
22416
|
+
if ((args.event.type === 'change' || (args.event.type === 'drop' && args.event.dataTransfer.files.length === 1)) && isAllowedFileType &&
|
|
22417
|
+
!isInvalidSize) {
|
|
22276
22418
|
this.notify('draw', { prop: 'fileSelect', value: { inputElement: this.element.querySelector('#' + this.element.id + '_dropfileUpload'), args: args } });
|
|
22277
22419
|
}
|
|
22278
22420
|
else {
|
|
@@ -22280,7 +22422,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22280
22422
|
if (args.event.type === 'drop' && args.event.dataTransfer.files.length > 1) {
|
|
22281
22423
|
errType = 'multi-select-image';
|
|
22282
22424
|
}
|
|
22283
|
-
this.showDialogPopup(errType);
|
|
22425
|
+
this.showDialogPopup(errType, !isAllowedFileType);
|
|
22284
22426
|
}
|
|
22285
22427
|
}
|
|
22286
22428
|
}
|
|
@@ -22294,10 +22436,11 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22294
22436
|
* Show dialog popup for unsupported files.
|
|
22295
22437
|
*
|
|
22296
22438
|
* @param { string } type - Specifies the type of error.
|
|
22439
|
+
* @param { boolean } fileTypeError - Specifies the error is due to file type.
|
|
22297
22440
|
* @hidden
|
|
22298
22441
|
* @returns {void}.
|
|
22299
22442
|
*/
|
|
22300
|
-
showDialogPopup(type) {
|
|
22443
|
+
showDialogPopup(type, fileTypeError) {
|
|
22301
22444
|
let content = '';
|
|
22302
22445
|
this.element.querySelector('#' + this.element.id + '_dialog').style.display = 'block';
|
|
22303
22446
|
let headerObj;
|
|
@@ -22317,16 +22460,38 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22317
22460
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: contentObj } });
|
|
22318
22461
|
const supportObj = { key: 'SupportText' };
|
|
22319
22462
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22463
|
+
const extension = this.getExtensionString();
|
|
22464
|
+
const fileSizeObj = { key: 'MinMaxSizeAlert' };
|
|
22465
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
22320
22466
|
const andObj = { key: 'And' };
|
|
22321
22467
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22322
|
-
|
|
22468
|
+
let size;
|
|
22469
|
+
if (this.uploadSettings.minFileSize && this.uploadSettings.maxFileSize) {
|
|
22470
|
+
size = ' ' + fileSizeObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.minFileSize) + ' </b> ' + andObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.maxFileSize) + ' </b> ';
|
|
22471
|
+
}
|
|
22472
|
+
else if (this.uploadSettings.minFileSize) {
|
|
22473
|
+
fileSizeObj['key'] = 'MinSizeAlert';
|
|
22474
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
22475
|
+
size = ' ' + fileSizeObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.minFileSize) + ' </b> ';
|
|
22476
|
+
}
|
|
22477
|
+
else if (this.uploadSettings.maxFileSize) {
|
|
22478
|
+
fileSizeObj['key'] = 'MaxSizeAlert';
|
|
22479
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
22480
|
+
size = ' ' + fileSizeObj['value'] + ' <b> ' + this.formatSizeUnits(this.uploadSettings.maxFileSize) + ' </b> ';
|
|
22481
|
+
}
|
|
22482
|
+
if (fileTypeError) {
|
|
22483
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + '<b>' + extension + '</b>' + '</span>';
|
|
22484
|
+
}
|
|
22485
|
+
else if (size) {
|
|
22486
|
+
content = '<span>' + contentObj['value'] + ' ' + supportObj['value'] + size + '</span>';
|
|
22487
|
+
}
|
|
22323
22488
|
}
|
|
22324
22489
|
const dialog = new Dialog({
|
|
22325
22490
|
header: headerObj['value'],
|
|
22326
22491
|
closeOnEscape: true,
|
|
22327
22492
|
content: content,
|
|
22328
22493
|
target: document.getElementById('target'),
|
|
22329
|
-
width: '285px',
|
|
22494
|
+
width: Browser.isDevice ? '285px' : '400px',
|
|
22330
22495
|
isModal: true,
|
|
22331
22496
|
animationSettings: { effect: 'Zoom' },
|
|
22332
22497
|
close: this.dlgCloseBtnClick.bind(this),
|
|
@@ -22338,6 +22503,97 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22338
22503
|
});
|
|
22339
22504
|
dialog.appendTo('#' + this.element.id + '_dialog');
|
|
22340
22505
|
}
|
|
22506
|
+
/**
|
|
22507
|
+
* Returns bytes in string format.
|
|
22508
|
+
*
|
|
22509
|
+
* @param { number } bytes - Specifies the bytes.
|
|
22510
|
+
*
|
|
22511
|
+
* @hidden
|
|
22512
|
+
* @returns {string}.
|
|
22513
|
+
*/
|
|
22514
|
+
formatSizeUnits(bytes) {
|
|
22515
|
+
let byte = '';
|
|
22516
|
+
if (bytes >= 1073741824) {
|
|
22517
|
+
byte = (bytes / 1073741824).toFixed(2) + ' GB';
|
|
22518
|
+
}
|
|
22519
|
+
else if (bytes >= 1048576) {
|
|
22520
|
+
byte = (bytes / 1048576).toFixed(2) + ' MB';
|
|
22521
|
+
}
|
|
22522
|
+
else if (bytes >= 1024) {
|
|
22523
|
+
byte = (bytes / 1024).toFixed(2) + ' KB';
|
|
22524
|
+
}
|
|
22525
|
+
else if (bytes > 1) {
|
|
22526
|
+
byte = bytes + ' bytes';
|
|
22527
|
+
}
|
|
22528
|
+
else if (bytes === 1) {
|
|
22529
|
+
byte = bytes + ' byte';
|
|
22530
|
+
}
|
|
22531
|
+
else {
|
|
22532
|
+
byte = '0 bytes';
|
|
22533
|
+
}
|
|
22534
|
+
return byte;
|
|
22535
|
+
}
|
|
22536
|
+
/**
|
|
22537
|
+
* Returns allowed file type extensions in string[].
|
|
22538
|
+
*
|
|
22539
|
+
* @hidden
|
|
22540
|
+
* @returns {string[]}.
|
|
22541
|
+
*/
|
|
22542
|
+
getExtensionArray() {
|
|
22543
|
+
const validExtensions = ['jpeg', 'jpg', 'png', 'svg', 'webp'];
|
|
22544
|
+
const split = this.uploadSettings.allowedExtensions.split(',');
|
|
22545
|
+
const extension = [];
|
|
22546
|
+
for (const ext of split) {
|
|
22547
|
+
const trimmedExt = ext.trim();
|
|
22548
|
+
for (const valid of validExtensions) {
|
|
22549
|
+
if (trimmedExt.indexOf(valid) !== -1) {
|
|
22550
|
+
extension.push(valid);
|
|
22551
|
+
break;
|
|
22552
|
+
}
|
|
22553
|
+
}
|
|
22554
|
+
}
|
|
22555
|
+
return extension;
|
|
22556
|
+
}
|
|
22557
|
+
/**
|
|
22558
|
+
* Returns allowed file type extensions in string.
|
|
22559
|
+
*
|
|
22560
|
+
* @hidden
|
|
22561
|
+
* @returns {string}.
|
|
22562
|
+
*/
|
|
22563
|
+
getExtensionString() {
|
|
22564
|
+
const andObj = { key: 'And' };
|
|
22565
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22566
|
+
const extension = this.getExtensionArray();
|
|
22567
|
+
let words = '';
|
|
22568
|
+
for (let i = 0; i < extension.length; i++) {
|
|
22569
|
+
if (i === extension.length - 1 && extension.length > 1 &&
|
|
22570
|
+
!((extension[i] === 'jpeg' || extension[i] === 'jpg') &&
|
|
22571
|
+
(words.indexOf('JPG') > -1))) {
|
|
22572
|
+
words += ' ' + andObj['value'];
|
|
22573
|
+
}
|
|
22574
|
+
switch (extension[i]) {
|
|
22575
|
+
case 'jpeg':
|
|
22576
|
+
case 'jpg':
|
|
22577
|
+
if (words.indexOf('JPG') === -1) {
|
|
22578
|
+
words += ' JPG,';
|
|
22579
|
+
}
|
|
22580
|
+
break;
|
|
22581
|
+
case 'png':
|
|
22582
|
+
words += ' PNG,';
|
|
22583
|
+
break;
|
|
22584
|
+
case 'svg':
|
|
22585
|
+
words += ' SVG,';
|
|
22586
|
+
break;
|
|
22587
|
+
case 'webp':
|
|
22588
|
+
words += ' WebP,';
|
|
22589
|
+
break;
|
|
22590
|
+
}
|
|
22591
|
+
if (i === extension.length - 1) {
|
|
22592
|
+
words = words.slice(0, -1);
|
|
22593
|
+
}
|
|
22594
|
+
}
|
|
22595
|
+
return words;
|
|
22596
|
+
}
|
|
22341
22597
|
/**
|
|
22342
22598
|
*
|
|
22343
22599
|
* This Method will add events to component (element, event, method, current reference)
|
|
@@ -22412,10 +22668,6 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22412
22668
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: dropObj } });
|
|
22413
22669
|
const browseObj = { key: 'BrowseText' };
|
|
22414
22670
|
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: browseObj } });
|
|
22415
|
-
const supportObj = { key: 'SupportText' };
|
|
22416
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
22417
|
-
const andObj = { key: 'And' };
|
|
22418
|
-
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
22419
22671
|
const dropAreaElement = this.createElement('div', { id: this.element.id + '_dropArea', className: 'e-ie-drop-area', attrs: { style: 'position: relative;' } });
|
|
22420
22672
|
const dropIconElement = this.createElement('span', { className: 'e-ie-drop-icon e-icons e-image', attrs: { style: 'position: absolute;' } });
|
|
22421
22673
|
const dropContentElement = this.createElement('span', { className: 'e-ie-drop-content', attrs: { style: 'position: absolute; display: none;' } });
|
|
@@ -22431,7 +22683,7 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
22431
22683
|
dropAnchorElement.href = '';
|
|
22432
22684
|
minDropAnchorElem.href = '';
|
|
22433
22685
|
const dropInfoElement = this.createElement('span', { className: 'e-ie-drop-info', attrs: { position: 'absolute' } });
|
|
22434
|
-
dropInfoElement
|
|
22686
|
+
this.updateDropInfoContent(dropInfoElement);
|
|
22435
22687
|
const dropUploader = dropAreaElement.appendChild(this.createElement('input', {
|
|
22436
22688
|
id: this.element.id + '_dropfileUpload', className: 'e-fileUpload e-image-upload'
|
|
22437
22689
|
}));
|
|
@@ -24364,6 +24616,45 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
24364
24616
|
}
|
|
24365
24617
|
return items;
|
|
24366
24618
|
}
|
|
24619
|
+
/**
|
|
24620
|
+
* Updates drop area content dynamically.
|
|
24621
|
+
*
|
|
24622
|
+
* @param { HTMLElement } dropInfoElement - Specifies the drop area element.
|
|
24623
|
+
* @hidden
|
|
24624
|
+
* @returns {void}.
|
|
24625
|
+
*/
|
|
24626
|
+
updateDropInfoContent(dropInfoElement) {
|
|
24627
|
+
if (!dropInfoElement) {
|
|
24628
|
+
return;
|
|
24629
|
+
}
|
|
24630
|
+
const supportObj = { key: 'SupportText' };
|
|
24631
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: supportObj } });
|
|
24632
|
+
const words = this.getExtensionString();
|
|
24633
|
+
const fileSizeObj = { key: 'MinMaxSize' };
|
|
24634
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
24635
|
+
const andObj = { key: 'And' };
|
|
24636
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: andObj } });
|
|
24637
|
+
let size;
|
|
24638
|
+
if (this.uploadSettings.minFileSize && this.uploadSettings.maxFileSize) {
|
|
24639
|
+
size = ' ' + fileSizeObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.minFileSize) + ' ' + andObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.maxFileSize);
|
|
24640
|
+
}
|
|
24641
|
+
else if (this.uploadSettings.minFileSize) {
|
|
24642
|
+
fileSizeObj['key'] = 'MinSize';
|
|
24643
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
24644
|
+
size = ' ' + fileSizeObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.minFileSize);
|
|
24645
|
+
}
|
|
24646
|
+
else if (this.uploadSettings.maxFileSize) {
|
|
24647
|
+
fileSizeObj['key'] = 'MaxSize';
|
|
24648
|
+
this.notify('toolbar', { prop: 'getLocaleText', onPropertyChange: false, value: { obj: fileSizeObj } });
|
|
24649
|
+
size = ' ' + fileSizeObj['value'] + ' ' + this.formatSizeUnits(this.uploadSettings.maxFileSize);
|
|
24650
|
+
}
|
|
24651
|
+
if (size) {
|
|
24652
|
+
dropInfoElement.textContent = supportObj['value'] + words + size;
|
|
24653
|
+
}
|
|
24654
|
+
else {
|
|
24655
|
+
dropInfoElement.textContent = supportObj['value'] + words;
|
|
24656
|
+
}
|
|
24657
|
+
}
|
|
24367
24658
|
/**
|
|
24368
24659
|
* Handles the OK button operation
|
|
24369
24660
|
*
|
|
@@ -26019,7 +26310,9 @@ let ImageEditor = ImageEditor_1 = class ImageEditor extends Component {
|
|
|
26019
26310
|
Fluent2Dark: { primaryColor: '#115ea3', secondaryColor: '#fff' },
|
|
26020
26311
|
Fluent2Highcontrast: { primaryColor: '#1aebff', secondaryColor: '#fff' },
|
|
26021
26312
|
'Bootstrap5.3': { primaryColor: '#0d6efd', secondaryColor: '#fff' },
|
|
26022
|
-
'Bootstrap5.3Dark': { primaryColor: '#0d6efd', secondaryColor: '#fff' }
|
|
26313
|
+
'Bootstrap5.3Dark': { primaryColor: '#0d6efd', secondaryColor: '#fff' },
|
|
26314
|
+
Tailwind3: { primaryColor: '#4f46e5', secondaryColor: '#ffffff' },
|
|
26315
|
+
Tailwind3Dark: { primaryColor: '#6366f1', secondaryColor: '#ffffff03' }
|
|
26023
26316
|
};
|
|
26024
26317
|
}
|
|
26025
26318
|
/**
|
|
@@ -26099,6 +26392,9 @@ __decorate([
|
|
|
26099
26392
|
__decorate([
|
|
26100
26393
|
Complex({}, FontFamily)
|
|
26101
26394
|
], ImageEditor.prototype, "fontFamily", void 0);
|
|
26395
|
+
__decorate([
|
|
26396
|
+
Complex({}, UploadSettings)
|
|
26397
|
+
], ImageEditor.prototype, "uploadSettings", void 0);
|
|
26102
26398
|
__decorate([
|
|
26103
26399
|
Event()
|
|
26104
26400
|
], ImageEditor.prototype, "beforeSave", void 0);
|
|
@@ -26188,6 +26484,8 @@ var FileType;
|
|
|
26188
26484
|
FileType["Jpeg"] = "Jpeg";
|
|
26189
26485
|
/** The SVG file type. */
|
|
26190
26486
|
FileType["Svg"] = "Svg";
|
|
26487
|
+
/** The WebP file type. */
|
|
26488
|
+
FileType["WebP"] = "WebP";
|
|
26191
26489
|
})(FileType || (FileType = {}));
|
|
26192
26490
|
/**
|
|
26193
26491
|
* An enumeration representing the direction of an image editor operation.
|
|
@@ -26278,6 +26576,10 @@ var Theme;
|
|
|
26278
26576
|
Theme["Fluent2"] = "Fluent2";
|
|
26279
26577
|
/** The dark variant of the Fluent 2.0 UI theme. */
|
|
26280
26578
|
Theme["Fluent2Dark"] = "Fluent2Dark";
|
|
26579
|
+
/** The Tailwind 3 UI theme. */
|
|
26580
|
+
Theme["Tailwind3"] = "Tailwind3";
|
|
26581
|
+
/** The dark variant of the Tailwind 3 UI theme. */
|
|
26582
|
+
Theme["Tailwind3Dark"] = "Tailwind3Dark";
|
|
26281
26583
|
})(Theme || (Theme = {}));
|
|
26282
26584
|
/**
|
|
26283
26585
|
* An enum representing the available toolbar commands in the image editor.
|
|
@@ -26622,6 +26924,14 @@ class ToolbarModule {
|
|
|
26622
26924
|
ConfirmDialogContent: 'Do you want to save the changes you made to the image?',
|
|
26623
26925
|
AlertDialogHeader: 'Unsupported file',
|
|
26624
26926
|
AlertDialogContent: 'The selected file is unsupported.',
|
|
26927
|
+
MinMaxSize: 'with file size between',
|
|
26928
|
+
MinMaxSizeAlert: 'File size between',
|
|
26929
|
+
MinSize: 'with minimum file size of',
|
|
26930
|
+
MinSizeAlert: 'A minimum file size of',
|
|
26931
|
+
MaxSize: 'with maximum file size of',
|
|
26932
|
+
MaxSizeAlert: 'A maximum file size of',
|
|
26933
|
+
To: 'to',
|
|
26934
|
+
Bytes: 'bytes',
|
|
26625
26935
|
Yes: 'Yes',
|
|
26626
26936
|
No: 'No',
|
|
26627
26937
|
ImageErrorDialogHeader: 'Image Selection Error',
|
|
@@ -26864,7 +27174,7 @@ class ToolbarModule {
|
|
|
26864
27174
|
id: id + '_toolbarArea', className: 'e-toolbar-area'
|
|
26865
27175
|
}));
|
|
26866
27176
|
const toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
26867
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions:
|
|
27177
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) };
|
|
26868
27178
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
26869
27179
|
this.defToolbarItems = [];
|
|
26870
27180
|
}
|
|
@@ -26878,7 +27188,7 @@ class ToolbarModule {
|
|
|
26878
27188
|
align: 'Left', type: 'Input',
|
|
26879
27189
|
tooltipText: this.l10n.getConstant('Browse'),
|
|
26880
27190
|
template: new Uploader({
|
|
26881
|
-
allowedExtensions:
|
|
27191
|
+
allowedExtensions: parent.uploadSettings.allowedExtensions,
|
|
26882
27192
|
multiple: false,
|
|
26883
27193
|
selected: () => {
|
|
26884
27194
|
const toolbar = document.getElementById(id + '_toolbar');
|
|
@@ -26965,7 +27275,7 @@ class ToolbarModule {
|
|
|
26965
27275
|
const id = parent.element.id;
|
|
26966
27276
|
if (parent.showQuickAccessToolbar) {
|
|
26967
27277
|
const toolbarItems = { cssClass: 'e-image-upload', align: 'Left', type: 'Input',
|
|
26968
|
-
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions:
|
|
27278
|
+
tooltipText: this.l10n.getConstant('Browse'), template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) };
|
|
26969
27279
|
if (isNullOrUndefined(this.defToolbarItems)) {
|
|
26970
27280
|
this.defToolbarItems = [];
|
|
26971
27281
|
}
|
|
@@ -27061,11 +27371,11 @@ class ToolbarModule {
|
|
|
27061
27371
|
const toolbarItems = [];
|
|
27062
27372
|
if (!isOkBtn || isResize) {
|
|
27063
27373
|
if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Open') > -1)) {
|
|
27064
|
-
toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions:
|
|
27374
|
+
toolbarItems.push({ id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) });
|
|
27065
27375
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
27066
27376
|
}
|
|
27067
27377
|
else if (Browser.isDevice && (parent.toolbar && parent.toolbar.indexOf('Open') === -1)) {
|
|
27068
|
-
toolbarItems.push({ visible: false, id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions:
|
|
27378
|
+
toolbarItems.push({ visible: false, id: id + '_upload', cssClass: 'e-image-upload', align: 'Left', type: 'Input', template: new Uploader({ allowedExtensions: parent.uploadSettings.allowedExtensions, multiple: false }) });
|
|
27069
27379
|
toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
|
|
27070
27380
|
}
|
|
27071
27381
|
}
|
|
@@ -27615,18 +27925,30 @@ class ToolbarModule {
|
|
|
27615
27925
|
}
|
|
27616
27926
|
}
|
|
27617
27927
|
fileSelect(inputElement, args) {
|
|
27928
|
+
const parent = this.parent;
|
|
27618
27929
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27619
27930
|
const type = inputElement.files[0].type.split('/')[1];
|
|
27620
|
-
const filesTypes =
|
|
27931
|
+
const filesTypes = this.parent.getExtensionArray();
|
|
27932
|
+
const isJPG = ((type === 'jpg' || type === 'jpeg') &&
|
|
27933
|
+
(parent.uploadSettings.allowedExtensions.indexOf('jpg') > -1 ||
|
|
27934
|
+
parent.uploadSettings.allowedExtensions.indexOf('jpeg') > -1));
|
|
27621
27935
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27622
27936
|
this.fileName = inputElement.files[0].name.split('.')[0];
|
|
27623
27937
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27938
|
+
const size = inputElement.files[0].size;
|
|
27939
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27624
27940
|
this.parent.notify('toolbar', { prop: 'setInitialSize', value: { value: inputElement.files[0].size } });
|
|
27625
|
-
if (filesTypes.indexOf(type) > -1)
|
|
27941
|
+
if ((filesTypes.indexOf(type) > -1 || isJPG || (type.indexOf('svg') > -1 && filesTypes.indexOf('svg') > -1)) &&
|
|
27942
|
+
(!this.parent.uploadSettings.minFileSize || size > this.parent.uploadSettings.minFileSize) &&
|
|
27943
|
+
(!this.parent.uploadSettings.maxFileSize || size < this.parent.uploadSettings.maxFileSize)) {
|
|
27626
27944
|
this.parent.notify('draw', { prop: 'fileSelect', value: { inputElement: inputElement, args: args } });
|
|
27627
27945
|
}
|
|
27628
27946
|
else {
|
|
27629
|
-
this.parent.
|
|
27947
|
+
if (!this.parent.isImageLoaded && !Browser.isDevice) {
|
|
27948
|
+
this.destroyTopToolbar();
|
|
27949
|
+
this.createToolbar();
|
|
27950
|
+
}
|
|
27951
|
+
this.parent.showDialogPopup('unsupported', !((filesTypes.indexOf(type) > -1 || isJPG || (type.indexOf('svg') > -1 && filesTypes.indexOf('svg') > -1))));
|
|
27630
27952
|
}
|
|
27631
27953
|
}
|
|
27632
27954
|
triggerTbarClickEvent(args) {
|
|
@@ -28128,7 +28450,8 @@ class ToolbarModule {
|
|
|
28128
28450
|
const items = [
|
|
28129
28451
|
{ id: 'jpeg', text: 'JPEG' },
|
|
28130
28452
|
{ id: 'png', text: 'PNG' },
|
|
28131
|
-
{ id: 'svg', text: 'SVG' }
|
|
28453
|
+
{ id: 'svg', text: 'SVG' },
|
|
28454
|
+
{ id: 'webp', text: 'WebP' }
|
|
28132
28455
|
];
|
|
28133
28456
|
const inputObj = new TextBox({
|
|
28134
28457
|
placeholder: this.l10n.getConstant('ImageName')
|
|
@@ -28160,7 +28483,7 @@ class ToolbarModule {
|
|
|
28160
28483
|
const ddbElem = document.getElementById(id + '_saveDropdownbtn');
|
|
28161
28484
|
if (ddbElem) {
|
|
28162
28485
|
const spanElem = document.createElement('span');
|
|
28163
|
-
spanElem.innerHTML = this.fileType.toUpperCase();
|
|
28486
|
+
spanElem.innerHTML = this.fileType === 'Webp' ? 'Webp' : this.fileType.toUpperCase();
|
|
28164
28487
|
if (ddbElem) {
|
|
28165
28488
|
ddbElem.appendChild(spanElem);
|
|
28166
28489
|
}
|
|
@@ -28323,8 +28646,10 @@ class ToolbarModule {
|
|
|
28323
28646
|
this.fileSize = fileSize;
|
|
28324
28647
|
}).bind(this), 'image/jpeg', quality);
|
|
28325
28648
|
}
|
|
28326
|
-
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'png') {
|
|
28649
|
+
else if (!isNullOrUndefined(fileType) && (fileType.toLowerCase() === 'png' || fileType.toLowerCase() === 'webp')) {
|
|
28650
|
+
const type = 'image/' + fileType.toLowerCase();
|
|
28327
28651
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
28652
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
28328
28653
|
tempCanvas.toBlob((function (blob) {
|
|
28329
28654
|
fileSize = Math.floor(blob.size / 1024);
|
|
28330
28655
|
if (fileSize > 1000) {
|
|
@@ -28340,7 +28665,7 @@ class ToolbarModule {
|
|
|
28340
28665
|
canvas.style.display = 'none';
|
|
28341
28666
|
}
|
|
28342
28667
|
this.fileSize = fileSize;
|
|
28343
|
-
}).bind(this),
|
|
28668
|
+
}).bind(this), type, 1);
|
|
28344
28669
|
}
|
|
28345
28670
|
else if (!isNullOrUndefined(fileType) && fileType.toLowerCase() === 'svg') {
|
|
28346
28671
|
ctx.drawImage(tempCanvas, 0, 0);
|
|
@@ -32953,5 +33278,5 @@ class ToolbarModule {
|
|
|
32953
33278
|
}
|
|
32954
33279
|
}
|
|
32955
33280
|
|
|
32956
|
-
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 };
|
|
33281
|
+
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 };
|
|
32957
33282
|
//# sourceMappingURL=ej2-image-editor.es2015.js.map
|