File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ define([
26
26
draggingInside : 'dragging-inside' ,
27
27
draggingOutside : 'dragging-outside'
28
28
} ,
29
+ // listed in ascending order
30
+ elementWidthModifierClasses : {
31
+ '_micro-ui' : 130 ,
32
+ '_compact-ui' : 440
33
+ } ,
29
34
translations : {
30
35
allowedFileTypes : $t ( 'Allowed file types' ) ,
31
36
dragImageHere : $t ( 'Drag image here' ) ,
@@ -155,16 +160,18 @@ define([
155
160
* Adds the appropriate ui state class to the upload control area based on the current rendered size
156
161
*/
157
162
updateResponsiveClasses : function ( ) {
163
+ var modifierClass ;
164
+
158
165
if ( ! this . $uploadArea . is ( ':visible' ) ) {
159
166
return ;
160
167
}
161
168
162
- this . $uploadArea . removeClass ( '_micro-ui _compact-ui' ) ;
169
+ this . $uploadArea . removeClass ( Object . keys ( this . elementWidthModifierClasses ) . join ( ' ' ) ) ;
163
170
164
- if ( this . $uploadArea . width ( ) < 130 ) {
165
- this . $uploadArea . addClass ( '_micro-ui' ) ;
166
- } else if ( this . $uploadArea . width ( ) < 440 ) {
167
- this . $uploadArea . addClass ( '_compact-ui' ) ;
171
+ for ( modifierClass in this . elementWidthModifierClasses ) {
172
+ if ( this . $uploadArea . width ( ) < this . elementWidthModifierClasses [ modifierClass ] ) {
173
+ this . $uploadArea . addClass ( modifierClass ) ;
174
+ }
168
175
}
169
176
}
170
177
} ) ;
You can’t perform that action at this time.
0 commit comments