@configuratorware/configurator-frontendgui 1.32.3 → 1.32.5
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/App/Modules/Designer/Components/ImageEditDialog/ImageUpload.js +1 -1
- package/App/Reducers/ImageGallery/Selectors.js +3 -2
- package/App/Services/DesignDataService.js +14 -1
- package/App/configuration.js +2 -2
- package/package.json +4 -4
- package/src/App/Modules/Designer/Components/ImageEditDialog/ImageUpload.js +1 -2
- package/src/App/Reducers/ImageGallery/Selectors.js +4 -2
- package/src/App/Services/DesignDataService.js +13 -0
- package/src/App/configuration.js +1 -14
|
@@ -242,7 +242,7 @@ var ImageEditDialog = /*#__PURE__*/function (_React$Component) {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
var extension = file.name.toLowerCase().match(/\.([0-9a-z]+)$/i)[1];
|
|
245
|
-
var allowedFormats = (0, _configuration.getConf)('designer.allowedImageUploadFormats');
|
|
245
|
+
var allowedFormats = (0, _configuration.getConf)('designer.allowedImageUploadFormats').split(',');
|
|
246
246
|
|
|
247
247
|
if (allowedFormats.indexOf(extension) === -1) {
|
|
248
248
|
error = (0, _i18n.t)('fileUpload.uploadFormatError', {
|
|
@@ -170,9 +170,10 @@ var showVectorizeImageQuality = function showVectorizeImageQuality(imageToAnalys
|
|
|
170
170
|
|
|
171
171
|
if (imageToAnalyse) {
|
|
172
172
|
var pixelsInTheImage = (0, _get["default"])(imageToAnalyse, 'original.width', 0) * (0, _get["default"])(imageToAnalyse, 'original.height', 0);
|
|
173
|
-
var
|
|
173
|
+
var vectorFormats = ['ai', 'pdf', 'svg', 'eps', 'ps', 'ept'];
|
|
174
|
+
var hasVectorFormat = vectorFormats.indexOf((0, _get["default"])(imageToAnalyse, 'original.format', '').toLowerCase()) > -1;
|
|
174
175
|
var pixelsOfReference = minimumPixelAmount || (0, _configuration.getConf)('vectorizeImageQuality');
|
|
175
|
-
return !
|
|
176
|
+
return !hasVectorFormat && pixelsInTheImage < pixelsOfReference;
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
return false;
|
|
@@ -450,6 +450,8 @@ var applySvgContentOperations = function applySvgContentOperations(preview, oper
|
|
|
450
450
|
|
|
451
451
|
if (svgTags && svgTags[0]) {
|
|
452
452
|
var svgTag = svgTags[0];
|
|
453
|
+
var percentageHeight = /height=["']\d+%["']/;
|
|
454
|
+
var percentageWidth = /width=["']\d+%["']/;
|
|
453
455
|
|
|
454
456
|
if (svgTag.indexOf('viewBox=') === -1) {
|
|
455
457
|
svgContent = svgContent.replace('<svg', "<svg viewBox=\"0 0 ".concat(preview.width, " ").concat(preview.height, "\""));
|
|
@@ -462,7 +464,18 @@ var applySvgContentOperations = function applySvgContentOperations(preview, oper
|
|
|
462
464
|
if (svgTag.indexOf('width=') === -1) {
|
|
463
465
|
svgContent = svgContent.replace('<svg', "<svg width=\"".concat(preview.width, "px\""));
|
|
464
466
|
}
|
|
465
|
-
|
|
467
|
+
|
|
468
|
+
if (percentageHeight.test(svgTag)) {
|
|
469
|
+
svgContent = svgContent.replace(percentageHeight, "height=\"".concat(preview.height, "px\""));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (percentageWidth.test(svgTag)) {
|
|
473
|
+
svgContent = svgContent.replace(percentageWidth, "width=\"".concat(preview.width, "px\""));
|
|
474
|
+
}
|
|
475
|
+
} // remove doctype if present
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
svgContent = svgContent.replace(/<!DOCTYPE(?:(?!>)[\s\S])*>/gi, '');
|
|
466
479
|
|
|
467
480
|
if (operations && operations.vectorize && operations.vectorizeColorsMap && Object.keys(operations.vectorizeColorsMap).length) {
|
|
468
481
|
var colorRegex = new RegExp("(".concat(Object.keys(operations.vectorizeColorsMap).join('|'), ")"), 'ig');
|
package/App/configuration.js
CHANGED
|
@@ -178,8 +178,8 @@ var applicationConfiguration = {
|
|
|
178
178
|
// the default canvas dpi as project specific option
|
|
179
179
|
maxColorAmount: 10,
|
|
180
180
|
// the default max number of colors in the colorizing feature
|
|
181
|
-
allowedImageUploadFormats:
|
|
182
|
-
|
|
181
|
+
allowedImageUploadFormats: 'jpg,jpeg,svg,png,pdf,bmp,tif,tiff,eps,ai,gif' // the image formats users can upload to designareas / designer items
|
|
182
|
+
|
|
183
183
|
},
|
|
184
184
|
vectorizeImageQuality: 45000,
|
|
185
185
|
renderPreviewImagesForCheckout: true,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.5",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/polyfill": "^7.12.1",
|
|
9
|
-
"@configuratorware/scripts": "1.32.
|
|
9
|
+
"@configuratorware/scripts": "1.32.5",
|
|
10
10
|
"@hot-loader/react-dom": "^17.0.1",
|
|
11
11
|
"@material-ui/core": "^4.12.2",
|
|
12
12
|
"@material-ui/icons": "^4.11.2",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"react-router-dom": "^5.2.0",
|
|
40
40
|
"react-swipeable": "^5.5.1",
|
|
41
41
|
"react-zoom-pan-pinch": "^2.1.3",
|
|
42
|
-
"redhotmagma-graphics-editor": "1.32.
|
|
43
|
-
"redhotmagma-visualization": "1.32.
|
|
42
|
+
"redhotmagma-graphics-editor": "1.32.5",
|
|
43
|
+
"redhotmagma-visualization": "1.32.5",
|
|
44
44
|
"redux": "^4.1.0",
|
|
45
45
|
"redux-logger": "^3.0.6",
|
|
46
46
|
"redux-persist": "^5.10.0",
|
|
@@ -209,8 +209,7 @@ class ImageEditDialog extends React.Component {
|
|
|
209
209
|
|
|
210
210
|
const extension = file.name.toLowerCase().match(/\.([0-9a-z]+)$/i)[1];
|
|
211
211
|
|
|
212
|
-
const allowedFormats = getConf('designer.allowedImageUploadFormats');
|
|
213
|
-
|
|
212
|
+
const allowedFormats = getConf('designer.allowedImageUploadFormats').split(',');
|
|
214
213
|
if (allowedFormats.indexOf(extension) === -1) {
|
|
215
214
|
error = t('fileUpload.uploadFormatError', { formats: allowedFormats.join(', ').toUpperCase() });
|
|
216
215
|
}
|
|
@@ -119,10 +119,12 @@ export const showVectorizeImageQuality = (imageToAnalyse, minimumPixelAmount = n
|
|
|
119
119
|
if (imageToAnalyse) {
|
|
120
120
|
const pixelsInTheImage =
|
|
121
121
|
get(imageToAnalyse, 'original.width', 0) * get(imageToAnalyse, 'original.height', 0);
|
|
122
|
-
const
|
|
122
|
+
const vectorFormats = ['ai', 'pdf', 'svg', 'eps', 'ps', 'ept'];
|
|
123
|
+
const hasVectorFormat =
|
|
124
|
+
vectorFormats.indexOf(get(imageToAnalyse, 'original.format', '').toLowerCase()) > -1;
|
|
123
125
|
const pixelsOfReference = minimumPixelAmount || getConf('vectorizeImageQuality');
|
|
124
126
|
|
|
125
|
-
return !
|
|
127
|
+
return !hasVectorFormat && pixelsInTheImage < pixelsOfReference;
|
|
126
128
|
}
|
|
127
129
|
return false;
|
|
128
130
|
};
|
|
@@ -397,6 +397,8 @@ export const applySvgContentOperations = (preview, operations, svgContent) => {
|
|
|
397
397
|
|
|
398
398
|
if (svgTags && svgTags[0]) {
|
|
399
399
|
const svgTag = svgTags[0];
|
|
400
|
+
const percentageHeight = /height=["']\d+%["']/;
|
|
401
|
+
const percentageWidth = /width=["']\d+%["']/;
|
|
400
402
|
|
|
401
403
|
if (svgTag.indexOf('viewBox=') === -1) {
|
|
402
404
|
svgContent = svgContent.replace('<svg', `<svg viewBox="0 0 ${preview.width} ${preview.height}"`);
|
|
@@ -409,8 +411,19 @@ export const applySvgContentOperations = (preview, operations, svgContent) => {
|
|
|
409
411
|
if (svgTag.indexOf('width=') === -1) {
|
|
410
412
|
svgContent = svgContent.replace('<svg', `<svg width="${preview.width}px"`);
|
|
411
413
|
}
|
|
414
|
+
|
|
415
|
+
if (percentageHeight.test(svgTag)) {
|
|
416
|
+
svgContent = svgContent.replace(percentageHeight, `height="${preview.height}px"`);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (percentageWidth.test(svgTag)) {
|
|
420
|
+
svgContent = svgContent.replace(percentageWidth, `width="${preview.width}px"`);
|
|
421
|
+
}
|
|
412
422
|
}
|
|
413
423
|
|
|
424
|
+
// remove doctype if present
|
|
425
|
+
svgContent = svgContent.replace(/<!DOCTYPE[^>]*>/gis, '');
|
|
426
|
+
|
|
414
427
|
if (
|
|
415
428
|
operations &&
|
|
416
429
|
operations.vectorize &&
|
package/src/App/configuration.js
CHANGED
|
@@ -193,20 +193,7 @@ let applicationConfiguration = {
|
|
|
193
193
|
designer: {
|
|
194
194
|
dpi: 300, // the default canvas dpi as project specific option
|
|
195
195
|
maxColorAmount: 10, // the default max number of colors in the colorizing feature
|
|
196
|
-
allowedImageUploadFormats:
|
|
197
|
-
// the image formats users can upload to designareas / designer items
|
|
198
|
-
'jpg',
|
|
199
|
-
'jpeg',
|
|
200
|
-
'svg',
|
|
201
|
-
'png',
|
|
202
|
-
'pdf',
|
|
203
|
-
'bmp',
|
|
204
|
-
'tif',
|
|
205
|
-
'tiff',
|
|
206
|
-
'eps',
|
|
207
|
-
'ai',
|
|
208
|
-
'gif',
|
|
209
|
-
],
|
|
196
|
+
allowedImageUploadFormats: 'jpg,jpeg,svg,png,pdf,bmp,tif,tiff,eps,ai,gif', // the image formats users can upload to designareas / designer items
|
|
210
197
|
},
|
|
211
198
|
|
|
212
199
|
vectorizeImageQuality: 45000,
|