@@ -26,7 +26,7 @@ import Resize, {
26
26
} from "../column/resize" ;
27
27
import {
28
28
ContentTypeDroppedCreateEventParamsInterface ,
29
- ContentTypeRemovedEventParamsInterface
29
+ ContentTypeRemovedEventParamsInterface ,
30
30
} from "../content-type-events.types" ;
31
31
import ObservableUpdater from "../observable-updater" ;
32
32
import PreviewCollection from "../preview-collection" ;
@@ -39,7 +39,6 @@ import {OptionsInterface} from "Magento_PageBuilder/js/content-type-menu/option.
39
39
import HideShowOption from "Magento_PageBuilder/js/content-type-menu/hide-show-option" ;
40
40
import ContentTypeInterface from "Magento_PageBuilder/js/content-type.types" ;
41
41
42
-
43
42
/**
44
43
* @api
45
44
*/
@@ -149,7 +148,7 @@ export default class Preview extends PreviewCollection {
149
148
*/
150
149
public onOptionEdit ( ) : void {
151
150
const numCols = this . contentType . getChildren ( ) ( ) . length ;
152
- //count the number of non empty columns
151
+ // count the number of non empty columns
153
152
let numEmptyColumns = 0 ;
154
153
this . contentType . getChildren ( ) ( ) . forEach (
155
154
( column : ContentTypeCollectionInterface < ColumnPreview > ) => {
@@ -158,13 +157,12 @@ export default class Preview extends PreviewCollection {
158
157
}
159
158
} ) ;
160
159
161
- this . contentType . dataStore . set ( ' non_empty_column_count' , numCols - numEmptyColumns ) ;
162
- this . contentType . dataStore . set ( ' max_grid_size' , getMaxGridSize ( ) ) ;
163
- this . contentType . dataStore . set ( ' initial_grid_size' , this . contentType . dataStore . get ( ' grid_size' ) ) ;
160
+ this . contentType . dataStore . set ( " non_empty_column_count" , numCols - numEmptyColumns ) ;
161
+ this . contentType . dataStore . set ( " max_grid_size" , getMaxGridSize ( ) ) ;
162
+ this . contentType . dataStore . set ( " initial_grid_size" , this . contentType . dataStore . get ( " grid_size" ) ) ;
164
163
super . openEdit ( ) ;
165
164
}
166
165
167
-
168
166
/**
169
167
* Bind events
170
168
*/
@@ -181,7 +179,7 @@ export default class Preview extends PreviewCollection {
181
179
}
182
180
183
181
events . on ( `form:${ this . contentType . id } :saveAfter` , ( ) => {
184
- if ( this . contentType . dataStore . get ( ' grid_size' ) != this . contentType . dataStore . get ( ' initial_grid_size' ) ) {
182
+ if ( this . contentType . dataStore . get ( " grid_size" ) !== this . contentType . dataStore . get ( " initial_grid_size" ) ) {
185
183
this . updateGridSize ( ) ;
186
184
}
187
185
} ) ;
@@ -191,10 +189,9 @@ export default class Preview extends PreviewCollection {
191
189
* Set default grid size on current column group
192
190
*/
193
191
public setDefaultGridSizeOnColumnGroup ( ) : void {
194
- this . contentType . dataStore . set ( ' grid_size' , getDefaultGridSize ( ) ) ;
192
+ this . contentType . dataStore . set ( " grid_size" , getDefaultGridSize ( ) ) ;
195
193
}
196
194
197
-
198
195
/**
199
196
* Add Columns to the current Column Group
200
197
*
@@ -325,18 +322,6 @@ export default class Preview extends PreviewCollection {
325
322
} ) ;
326
323
}
327
324
328
- /**
329
- * Fire the mount event for content types
330
- *
331
- * @param {ContentTypeInterface[] } contentTypes
332
- */
333
- private fireMountEvent ( ...contentTypes : ContentTypeInterface [ ] ) {
334
- contentTypes . forEach ( ( contentType ) => {
335
- events . trigger ( "contentType:mountAfter" , { id : contentType . id , contentType} ) ;
336
- events . trigger ( contentType . config . name + ":mountAfter" , { id : contentType . id , contentType} ) ;
337
- } ) ;
338
- }
339
-
340
325
/**
341
326
* Handle an existing column being dropped into a new column group
342
327
*
@@ -594,6 +579,18 @@ export default class Preview extends PreviewCollection {
594
579
}
595
580
}
596
581
582
+ /**
583
+ * Fire the mount event for content types
584
+ *
585
+ * @param {ContentTypeInterface[] } contentTypes
586
+ */
587
+ private fireMountEvent ( ...contentTypes : ContentTypeInterface [ ] ) {
588
+ contentTypes . forEach ( ( contentType ) => {
589
+ events . trigger ( "contentType:mountAfter" , { id : contentType . id , contentType} ) ;
590
+ events . trigger ( contentType . config . name + ":mountAfter" , { id : contentType . id , contentType} ) ;
591
+ } ) ;
592
+ }
593
+
597
594
/**
598
595
* Set columns in the group as resizing
599
596
*
0 commit comments