Skip to content

Commit e4fb73e

Browse files
committed
MAGETWO-54779: [GitHub] Image size for Product Watermarks can't be set #5270
- modifying js file for simplicity as per code review
1 parent 952534c commit e4fb73e

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,25 @@
55

66
define([
77
'jquery',
8-
'underscore',
98
'Magento_Ui/js/lib/validation/utils',
109
'Magento_Ui/js/form/element/abstract',
1110
'Magento_Ui/js/lib/validation/validator'
12-
], function ($, _, utils, Abstract, validator) {
11+
], function ($, utils, Abstract, validator) {
1312
'use strict';
1413

1514
validator.addRule(
1615
'validate-image-size-range',
1716
function (value) {
18-
var numValue,
19-
dataAttrRange = /^(\d+)x(\d+)?$/,
20-
result = false,
17+
var dataAttrRange = /^(\d+)x(\d+)$/,
2118
m;
2219

2320
if (utils.isEmptyNoTrim(value)) {
2421
return true;
2522
}
26-
numValue = utils.parseNumber(value);
27-
28-
if (isNaN(numValue)) {
29-
return false;
30-
}
3123

3224
m = dataAttrRange.exec(value);
3325

34-
if (m) {
35-
if (m.length === 3) {
36-
result = m[1] && m[2];
37-
}
38-
}
39-
40-
return result;
26+
return m && m.length === 3 && m[1] > 0 && m[2] > 0;
4127
},
4228
$.mage.__('The value is not within the specified format eg: 200x300')
4329
);

0 commit comments

Comments
 (0)