File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed
app/code/Magento/PageBuilder/view/adminhtml/web
js/content-type/video/converter/style
ts/js/content-type/video/converter/style Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import {DataObject} from "../../../../data-store";
8
8
9
9
/**
10
10
* Subtract margin from max-width to fit inside parent container
11
+ * Accepted values are in pixels. If no value is set by user, it's 100%
11
12
*
12
13
* @api
13
14
*/
@@ -33,13 +34,16 @@ export default class MaxWidth implements ConverterInterface {
33
34
* @returns {string | object }
34
35
*/
35
36
public toDom ( name : string , data : DataObject ) : string {
36
- if ( data . max_width !== "" ) {
37
- return data . max_width + "px" ;
37
+ if ( data [ name ] !== "" ) {
38
+ return data [ name ] + "px" ;
38
39
}
39
- const margins = data . margins_and_padding . margin || { } ;
40
- const marginLeft = margins . left ? parseInt ( margins . left as string , 10 ) : 0 ;
41
- const marginRight = margins . right ? parseInt ( margins . right as string , 10 ) : 0 ;
40
+ if ( data . margins_and_padding && data . margins_and_padding !== undefined ) {
41
+ const margins = data . margins_and_padding . margin || { } ;
42
+ const marginLeft = margins . left ? parseInt ( margins . left as string , 10 ) : 0 ;
43
+ const marginRight = margins . right ? parseInt ( margins . right as string , 10 ) : 0 ;
42
44
43
- return "calc(100% - " + ( marginLeft + marginRight ) + "px)" ;
45
+ return "calc(100% - " + ( marginLeft + marginRight ) + "px)" ;
46
+ }
47
+ return "100%" ;
44
48
}
45
49
}
You can’t perform that action at this time.
0 commit comments