Stackable – Page Builder Gutenberg Blocks - Version 2.17.3

Version Description

  • Fixed: Removed unnecessary scripts from loading in the frontend
Download this release

Release Info

Developer bfintal
Plugin Icon 128x128 Stackable – Page Builder Gutenberg Blocks
Version 2.17.3
Comparing to
See all releases

Code changes from version 2.17.2 to 2.17.3

Files changed (4) hide show
  1. dist/dummy-block-registration.js +1545 -0
  2. plugin.php +2 -2
  3. readme.txt +4 -1
  4. src/init.php +3 -0
dist/dummy-block-registration.js ADDED
@@ -0,0 +1,1545 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * This file is a dummy file that doesn't do anything except
3
+ * does a fake registration of every Stackable block so that
4
+ * the WordPress plugin directory detects them and lists them
5
+ * in the Stackable plugin page.
6
+ *
7
+ * This file is auto-generated from the build process.
8
+ */
9
+
10
+ registerBlockType( 'undefined', {
11
+ ...metadata,
12
+ icon: AccordionIcon,
13
+ attributes: schema,
14
+ example,
15
+
16
+ deprecated,
17
+ edit,
18
+ save,
19
+
20
+ supports: {
21
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
22
+ anchor: true,
23
+ html: false,
24
+ },
25
+
26
+ // Stackable modules.
27
+ modules: {
28
+ 'advanced-general': true,
29
+ 'advanced-block-spacing': true,
30
+ 'advanced-custom-attributes': true,
31
+ // 'advanced-column-spacing': {
32
+ // columnGap: false,
33
+ // },
34
+ 'advanced-responsive': true,
35
+ // 'block-background': true,
36
+ // 'block-separators': true,
37
+ // 'block-title': true,
38
+ 'content-align': true,
39
+ 'block-designs': true,
40
+ 'custom-css': {
41
+ default: applyFilters( 'stackable.cta.custom-css.default', '' ),
42
+ },
43
+ },
44
+ } )
45
+ registerBlockType( 'undefined', {
46
+ ...metadata,
47
+ icon: BlockquoteIcon,
48
+ supports: {
49
+ align: [ 'center', 'wide', 'full' ],
50
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
51
+ anchor: true,
52
+ },
53
+ attributes: schema,
54
+ example,
55
+
56
+ deprecated,
57
+ edit,
58
+ save,
59
+
60
+ // Stackable modules.
61
+ modules: {
62
+ 'advanced-general': true,
63
+ 'advanced-block-spacing': true,
64
+ 'advanced-column-spacing': {
65
+ columnGap: false,
66
+ paddings: false,
67
+ },
68
+ 'advanced-custom-attributes': true,
69
+ 'advanced-responsive': true,
70
+ 'block-background': {
71
+ importantBackgroundSize: true,
72
+ },
73
+ 'block-separators': true,
74
+ // 'block-title': true,
75
+ 'content-align': true,
76
+ 'block-designs': true,
77
+ 'container-link': true,
78
+ 'custom-css': {
79
+ default: applyFilters( 'stackable.blockquote.custom-css.default', '' ),
80
+ },
81
+ },
82
+ } )
83
+ registerBlockType( 'undefined', {
84
+ ...metadata,
85
+ icon: BlogPostsIcon,
86
+ supports: {
87
+ align: [ 'center', 'wide', 'full' ],
88
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
89
+ anchor: true,
90
+ },
91
+ attributes: schema,
92
+ example,
93
+
94
+ save,
95
+ edit,
96
+ deprecated,
97
+
98
+ // Stackable modules.
99
+ modules: {
100
+ 'advanced-general': true,
101
+ 'advanced-block-spacing': true,
102
+ 'advanced-column-spacing': {
103
+ verticalColumnAlign: true,
104
+ verticalContentAlign: false,
105
+ paddings: false,
106
+ },
107
+ 'advanced-custom-attributes': true,
108
+ 'advanced-responsive': true,
109
+ 'block-background': {
110
+ importantBackgroundSize: true,
111
+ },
112
+ 'block-separators': true,
113
+ 'block-title': {
114
+ blockTitleMarginBottomImportant: true,
115
+ blockDescriptionMarginBottomImportant: true,
116
+ },
117
+ 'content-align': true,
118
+ 'block-designs': true,
119
+ 'custom-css': {
120
+ default: applyFilters( 'stackable.blog-posts.custom-css.default', '' ),
121
+ },
122
+ },
123
+ } )
124
+ registerBlockType( 'undefined', {
125
+ ...metadata,
126
+ icon: ButtonIcon,
127
+ attributes: schema,
128
+ example,
129
+ supports: {
130
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
131
+ anchor: true,
132
+ },
133
+
134
+ deprecated,
135
+ edit,
136
+ save,
137
+
138
+ // Stackable modules.
139
+ modules: {
140
+ 'advanced-general': true,
141
+ 'advanced-block-spacing': true,
142
+ 'advanced-custom-attributes': true,
143
+ 'advanced-responsive': true,
144
+ 'block-background': {
145
+ importantBackgroundSize: true,
146
+ },
147
+ 'block-separators': true,
148
+ // 'block-title': true,
149
+ 'content-align': true,
150
+ 'block-designs': true,
151
+ 'custom-css': {
152
+ default: applyFilters( 'stackable.button.custom-css.default', '' ),
153
+ },
154
+ },
155
+ }
156
+
157
+ // Change the main class name since we're using `ugb-button` for the button element.
158
+ addFilter( 'stackable.button.mainClassName', 'stackable/button', () => {
159
+ return 'ugb-button-wrapper'
160
+ } )
161
+
162
+ // If the alignment was changed, but the design doesn't support it, go back to the basic design to allow the alignment change.
163
+ addFilter( 'stackable.button.setAttributes', 'stackable/button/contentAlign', ( attributes, blockProps ) => {
164
+ if ( typeof attributes.contentAlign === 'undefined' ) {
165
+ return attributes
166
+ }
167
+
168
+ if ( ! [ '', 'basic' ].includes( blockProps.attributes.design ) ) {
169
+ attributes.design = 'basic'
170
+ }
171
+
172
+ return attributes
173
+ } )
174
+
175
+ // If the design was changed, but the design doesn't support alignment, reset the alignment attribute.
176
+ addFilter( 'stackable.button.setAttributes', 'stackable/button/design', attributes => {
177
+ if ( typeof attributes.design === 'undefined' ) {
178
+ return attributes
179
+ }
180
+
181
+ if ( ! [ '', 'basic' ].includes( attributes.design ) ) {
182
+ attributes.contentAlign = ''
183
+ }
184
+
185
+ return attributes
186
+ } ) )
187
+ registerBlockType( 'undefined', {
188
+ ...metadata,
189
+ icon: CTAIcon,
190
+ attributes: schema,
191
+ example,
192
+ supports: {
193
+ align: [ 'center', 'wide', 'full' ],
194
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
195
+ anchor: true,
196
+ },
197
+
198
+ deprecated,
199
+ edit,
200
+ save,
201
+
202
+ // Stackable modules.
203
+ modules: {
204
+ 'advanced-general': true,
205
+ 'advanced-block-spacing': true,
206
+ 'advanced-column-spacing': {
207
+ columnGap: false,
208
+ paddings: false,
209
+ verticalContentAlignImportant: true,
210
+ },
211
+ 'advanced-custom-attributes': true,
212
+ 'advanced-responsive': true,
213
+ 'block-background': {
214
+ importantBackgroundSize: true,
215
+ },
216
+ 'block-separators': true,
217
+ // 'block-title': true,
218
+ 'container-link': true,
219
+ 'content-align': true,
220
+ 'block-designs': true,
221
+ 'custom-css': {
222
+ default: applyFilters( 'stackable.cta.custom-css.default', '' ),
223
+ },
224
+ },
225
+ } )
226
+ registerBlockType( 'undefined', {
227
+ ...metadata,
228
+ icon: CardIcon,
229
+ attributes: schema,
230
+ example,
231
+ supports: {
232
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
233
+ anchor: true,
234
+ },
235
+
236
+ deprecated,
237
+ edit,
238
+ save,
239
+
240
+ // Stackable modules.
241
+ modules: {
242
+ 'advanced-general': true,
243
+ 'advanced-block-spacing': true,
244
+ 'advanced-column-spacing': {
245
+ paddings: false,
246
+ verticalColumnAlign: true,
247
+ },
248
+ 'advanced-custom-attributes': true,
249
+ 'advanced-responsive': true,
250
+ 'block-background': {
251
+ importantBackgroundSize: true,
252
+ },
253
+ 'block-separators': true,
254
+ 'block-title': {
255
+ blockTitleMarginBottomImportant: true,
256
+ blockDescriptionMarginBottomImportant: true,
257
+ },
258
+ 'content-align': true,
259
+ 'block-designs': true,
260
+ 'container-link': true,
261
+ 'custom-css': {
262
+ default: applyFilters( 'stackable.card.custom-css.default', '' ),
263
+ },
264
+ },
265
+ }
266
+ // For column spacings, use advanced paddings & vertical align on the content area only.
267
+ addFilter( 'stackable.card.advanced-column-spacing.vertical-align.selector', 'stackable/card', () => '.ugb-card__content' ) )
268
+ registerBlockType( 'undefined', {
269
+ ...metadata,
270
+ icon: ColumnsIcon,
271
+ attributes: schema,
272
+ example,
273
+
274
+ supports: {
275
+ html: false,
276
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
277
+ anchor: true,
278
+ },
279
+
280
+ edit,
281
+ save,
282
+
283
+ modules: {
284
+ 'advanced-general': true,
285
+ 'advanced-block-spacing': true,
286
+ 'advanced-custom-attributes': true,
287
+ 'advanced-responsive': true,
288
+ 'block-background': {
289
+ importantBackgroundSize: true,
290
+ },
291
+ 'block-separators': true,
292
+ 'block-title': true,
293
+ 'content-align': true,
294
+ 'custom-css': {
295
+ default: applyFilters( 'stackable.columns.custom-css.default', '' ),
296
+ },
297
+ },
298
+ }
299
+
300
+ // If the design was changed, check if we surpass the max columns.
301
+ addFilter( 'stackable.columns.setAttributes', 'stackable/columns/design', ( attributes, blockProps ) => {
302
+ if ( typeof attributes.design === 'undefined' ) {
303
+ return attributes
304
+ }
305
+
306
+ const blockAttributes = blockProps.attributes
307
+
308
+ if ( attributes.design !== 'grid' && blockAttributes.columns > 6 ) {
309
+ attributes.columns = 6
310
+ }
311
+
312
+ return attributes
313
+ } )
314
+
315
+ // If the design was changed, change the number of columns to make the layout's
316
+ // effect more apparent.
317
+ addFilter( 'stackable.columns.setAttributes', 'stackable/columns/design', ( attributes, blockProps ) => {
318
+ if ( typeof attributes.design === 'undefined' ) {
319
+ return attributes
320
+ }
321
+
322
+ const blockAttributes = blockProps.attributes
323
+
324
+ if ( attributes.design !== 'plain' && blockAttributes.columns < 4 ) {
325
+ attributes.columns = 4
326
+ }
327
+
328
+ return attributes
329
+ } ) )
330
+ registerBlockType( 'undefined', {
331
+ ...metadata,
332
+ icon: ContainerIcon,
333
+ supports: {
334
+ anchor: true,
335
+ align: [ 'center', 'wide', 'full' ],
336
+ html: false,
337
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
338
+ // Add EditorsKit block navigator toolbar.
339
+ editorsKitBlockNavigator: true,
340
+ },
341
+ deprecated,
342
+ edit,
343
+ save,
344
+ attributes: schema,
345
+ example,
346
+
347
+ // Stackable modules.
348
+ modules: {
349
+ 'advanced-general': true,
350
+ 'advanced-block-spacing': true,
351
+ 'advanced-column-spacing': {
352
+ columnGap: false,
353
+ paddings: false,
354
+ },
355
+ 'advanced-custom-attributes': true,
356
+ 'advanced-responsive': true,
357
+ 'block-background': {
358
+ importantBackgroundSize: true,
359
+ },
360
+ 'block-separators': true,
361
+ // 'block-title': true,
362
+ 'container-link': {
363
+ classFilter: 'wrapperClasses',
364
+ },
365
+ 'content-align': true,
366
+ 'custom-css': {
367
+ default: applyFilters( 'stackable.container.custom-css.default', '' ),
368
+ },
369
+ },
370
+ }
371
+
372
+ // Remove the default way of how the column spacing -> vertical align works since we are using another method in `style.js`
373
+ addFilter( 'stackable.container.advanced-column-spacing.vertical-align', 'stackable/container', () => ( {} ) ) )
374
+ registerBlockType( 'undefined', {
375
+ ...metadata,
376
+ icon: CountUpIcon,
377
+ attributes: schema,
378
+ example,
379
+
380
+ supports: {
381
+ align: [ 'center', 'wide', 'full' ],
382
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
383
+ anchor: true,
384
+ },
385
+
386
+ deprecated,
387
+ edit,
388
+ save,
389
+
390
+ // Stackable modules.
391
+ modules: {
392
+ 'advanced-general': true,
393
+ 'advanced-block-spacing': true,
394
+ 'advanced-column-spacing': {
395
+ verticalColumnAlign: true,
396
+ paddings: false,
397
+ },
398
+ 'advanced-custom-attributes': true,
399
+ 'advanced-responsive': true,
400
+ 'block-background': {
401
+ importantBackgroundSize: true,
402
+ },
403
+ 'block-separators': true,
404
+ 'block-title': {
405
+ blockTitleMarginBottomImportant: true,
406
+ blockDescriptionMarginBottomImportant: true,
407
+ },
408
+ 'container-link': true,
409
+ 'content-align': true,
410
+ 'block-designs': true,
411
+ 'custom-css': {
412
+ default: applyFilters( 'stackable.count-up.custom-css.default', '' ),
413
+ },
414
+ },
415
+ } )
416
+ registerBlockType( 'undefined', {
417
+ ...metadata,
418
+ icon: StackableIcon,
419
+ attributes: schema,
420
+ example: {
421
+ attributes: {
422
+ previewMode: true,
423
+ },
424
+ },
425
+
426
+ supports: {
427
+ customClassName: false,
428
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
429
+ },
430
+
431
+ edit,
432
+ save,
433
+ }
434
+
435
+ const mountDesignLibrary = () => {
436
+ // Content only editing mode shouldn't have a button.
437
+ if ( isContentOnlyMode ) {
438
+ return
439
+ }
440
+
441
+ if ( disabledBlocks.includes( name ) ) {
442
+ return
443
+ }
444
+
445
+ let timeout = null
446
+ const unsubscribe = subscribe( () => {
447
+ const toolbar = document.querySelector( '.edit-post-header-toolbar' )
448
+ if ( ! toolbar ) {
449
+ return
450
+ }
451
+
452
+ const buttonDiv = document.createElement( 'div' )
453
+ buttonDiv.classList.add( 'ugb-insert-library-button__wrapper' )
454
+
455
+ if ( ! toolbar.querySelector( '.ugb-insert-library-button__wrapper' ) ) {
456
+ render( <InsertLibraryButton />, buttonDiv )
457
+ toolbar.appendChild( buttonDiv )
458
+ }
459
+
460
+ if ( timeout ) {
461
+ clearTimeout( timeout )
462
+ }
463
+
464
+ timeout = setTimeout( () => {
465
+ if ( document.querySelector( '.ugb-insert-library-button__wrapper' ) ) {
466
+ unsubscribe()
467
+ }
468
+ }, 0 )
469
+ } )
470
+ }
471
+
472
+ domReady( mountDesignLibrary ) )
473
+ registerBlockType( 'undefined', {
474
+ ...metadata,
475
+ icon: DividerIcon,
476
+ attributes: schema,
477
+ example,
478
+ supports: {
479
+ align: [ 'center', 'wide', 'full' ],
480
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
481
+ anchor: true,
482
+ },
483
+
484
+ edit,
485
+ save,
486
+ deprecated,
487
+
488
+ // Stackable modules.
489
+ modules: {
490
+ 'advanced-block-spacing': true,
491
+ 'advanced-custom-attributes': true,
492
+ 'advanced-responsive': true,
493
+ 'content-align': true,
494
+ 'custom-css': {
495
+ default: applyFilters( 'stackable.divider.custom-css.default', '' ),
496
+ },
497
+ },
498
+ }
499
+
500
+ addFilter( 'stackable.divider.setAttributes', 'stackable/divider/defaults', ( attributes, blockProps ) => {
501
+ const blockAttributes = blockProps.attributes
502
+
503
+ if ( typeof attributes.design !== 'undefined' && attributes.design !== 'basic' ) {
504
+ return {
505
+ ...attributes,
506
+ height: attributes.design === 'asterisks' ? 14 : 7,
507
+ width: attributes.design === 'dots' || attributes.design === 'asterisks' ? 10 : blockAttributes.width,
508
+ }
509
+ } else if ( attributes.design === 'basic' ) {
510
+ return {
511
+ ...attributes,
512
+ height: 1,
513
+ width: 50,
514
+ }
515
+ }
516
+
517
+ return attributes
518
+ } ) )
519
+ registerBlockType( 'undefined', {
520
+ ...metadata,
521
+ icon: ExpandIcon,
522
+ attributes: schema,
523
+ example,
524
+ supports: {
525
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
526
+ anchor: true,
527
+ },
528
+
529
+ deprecated,
530
+ edit,
531
+ save,
532
+
533
+ // Stackable modules.
534
+ modules: {
535
+ 'advanced-general': true,
536
+ 'advanced-block-spacing': true,
537
+ 'advanced-custom-attributes': true,
538
+ // 'advanced-column-spacing': {
539
+ // columnGap: false,
540
+ // height: false,
541
+ // verticalContentAlign: false,
542
+ // paddingSelector: '.ugb-block-content',
543
+ // },
544
+ 'advanced-responsive': true,
545
+ // 'block-background': true,
546
+ // 'block-separators': true,
547
+ // 'block-title': true,
548
+ 'content-align': true,
549
+ 'custom-css': {
550
+ default: applyFilters( 'stackable.expand.custom-css.default', '' ),
551
+ },
552
+ },
553
+ } )
554
+ registerBlockType( 'undefined', {
555
+ ...metadata,
556
+ icon: FeatureGridIcon,
557
+ attributes: schema,
558
+ example,
559
+ supports: {
560
+ align: [ 'wide' ],
561
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
562
+ anchor: true,
563
+ },
564
+
565
+ deprecated,
566
+ edit,
567
+ save,
568
+
569
+ // Stackable modules.
570
+ modules: {
571
+ 'advanced-general': true,
572
+ 'advanced-block-spacing': true,
573
+ 'advanced-column-spacing': {
574
+ verticalColumnAlign: true,
575
+ paddings: false,
576
+ },
577
+ 'advanced-custom-attributes': true,
578
+ 'advanced-responsive': true,
579
+ 'block-background': {
580
+ importantBackgroundSize: true,
581
+ },
582
+ 'block-separators': true,
583
+ 'block-title': {
584
+ blockTitleMarginBottomImportant: true,
585
+ blockDescriptionMarginBottomImportant: true,
586
+ },
587
+ 'container-link': true,
588
+ 'content-align': true,
589
+ 'block-designs': true,
590
+ 'custom-css': {
591
+ default: applyFilters( 'stackable.feature-grid.custom-css.default', '' ),
592
+ },
593
+ },
594
+ }
595
+
596
+ // If the alignment was changed, but the design doesn't support it, go back to the basic design to allow the alignment change.
597
+ addFilter( 'stackable.feature-grid.setAttributes', 'stackable/feature-grid/imageShape', attributes => {
598
+ if ( typeof attributes.imageShape !== 'undefined' ) {
599
+ return {
600
+ ...attributes,
601
+ image1Shape: '',
602
+ image2Shape: '',
603
+ image3Shape: '',
604
+ image4Shape: '',
605
+ image1ShapeFlipX: '',
606
+ image1ShapeFlipY: '',
607
+ image1ShapeStretch: '',
608
+ image2ShapeFlipX: '',
609
+ image2ShapeFlipY: '',
610
+ image2ShapeStretch: '',
611
+ image3ShapeFlipX: '',
612
+ image3ShapeFlipY: '',
613
+ image3ShapeStretch: '',
614
+ image4ShapeFlipX: '',
615
+ image4ShapeFlipY: '',
616
+ image4ShapeStretch: '',
617
+ }
618
+ }
619
+
620
+ if ( typeof attributes.imageShapeFlipX !== 'undefined' ) {
621
+ return {
622
+ ...attributes,
623
+ image1ShapeFlipX: '',
624
+ image2ShapeFlipX: '',
625
+ image3ShapeFlipX: '',
626
+ image4ShapeFlipX: '',
627
+ }
628
+ }
629
+
630
+ if ( typeof attributes.imageShapeFlipY !== 'undefined' ) {
631
+ return {
632
+ ...attributes,
633
+ image1ShapeFlipY: '',
634
+ image2ShapeFlipY: '',
635
+ image3ShapeFlipY: '',
636
+ image4ShapeFlipY: '',
637
+ }
638
+ }
639
+
640
+ if ( typeof attributes.imageShapeStretch !== 'undefined' ) {
641
+ return {
642
+ ...attributes,
643
+ image1ShapeStretch: '',
644
+ image2ShapeStretch: '',
645
+ image3ShapeStretch: '',
646
+ image4ShapeStretch: '',
647
+ }
648
+ }
649
+
650
+ if ( typeof attributes.columnBackgroundColor !== 'undefined' || typeof attributes.columnBackgroundColorType !== 'undefined' ) {
651
+ return {
652
+ ...attributes,
653
+ column1BackgroundColor: '',
654
+ column2BackgroundColor: '',
655
+ column3BackgroundColor: '',
656
+ column4BackgroundColor: '',
657
+ }
658
+ }
659
+
660
+ return attributes
661
+ } ) )
662
+ registerBlockType( 'undefined', {
663
+ ...metadata,
664
+ icon: FeatureIcon,
665
+ supports: {
666
+ align: [ 'center', 'wide', 'full' ],
667
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
668
+ anchor: true,
669
+ },
670
+
671
+ deprecated,
672
+ edit,
673
+ save,
674
+
675
+ attributes: schema,
676
+ example,
677
+
678
+ // Stackable modules.
679
+ modules: {
680
+ 'advanced-general': true,
681
+ 'advanced-block-spacing': true,
682
+ // 'advanced-column-spacing': {
683
+ // columnGap: false,
684
+ // },
685
+ 'advanced-custom-attributes': true,
686
+ 'advanced-responsive': true,
687
+ 'block-background': {
688
+ importantBackgroundSize: true,
689
+ },
690
+ 'block-separators': true,
691
+ // 'block-title': true,
692
+ 'container-link': {
693
+ // We will generate our own container link filter based on selected design.
694
+ customFilters: true,
695
+ },
696
+ 'content-align': true,
697
+ 'block-designs': true,
698
+ 'custom-css': {
699
+ default: applyFilters( 'stackable.feature.custom-css.default', '' ),
700
+ },
701
+ },
702
+ }
703
+
704
+ addFilter( 'stackable.feature.itemclasses', 'custom', ( classes, props ) => {
705
+ const {
706
+ showContainerLink = false,
707
+ design = 'plain',
708
+ } = props.attributes
709
+
710
+ return {
711
+ ...classes,
712
+ 'ugb-container-link': showContainerLink && [ 'plain', 'basic', 'half' ].includes( design ),
713
+ }
714
+ } )
715
+
716
+ addFilter( 'stackable.feature.contentclasses', 'custom', ( classes, props ) => {
717
+ const {
718
+ showContainerLink = false,
719
+ design = 'plain',
720
+ } = props.attributes
721
+
722
+ return {
723
+ ...classes,
724
+ 'ugb-container-link': showContainerLink && ! [ 'plain', 'basic', 'half' ].includes( design ),
725
+ }
726
+ } ) )
727
+ registerBlockType( 'undefined', {
728
+ ...metadata,
729
+ icon: HeaderIcon,
730
+ supports: {
731
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
732
+ anchor: true,
733
+ },
734
+ attributes: schema,
735
+ example,
736
+
737
+ deprecated,
738
+ edit,
739
+ save,
740
+
741
+ // Stackable modules.
742
+ modules: {
743
+ 'advanced-general': true,
744
+ 'advanced-block-spacing': true,
745
+ 'advanced-column-spacing': {
746
+ columnGap: false,
747
+ paddings: false,
748
+ verticalContentAlignImportant: true,
749
+ },
750
+ 'advanced-custom-attributes': true,
751
+ 'advanced-responsive': true,
752
+ 'block-background': {
753
+ importantBackgroundSize: true,
754
+ },
755
+ 'block-separators': true,
756
+ // 'block-title': true,
757
+ 'container-link': true,
758
+ 'content-align': true,
759
+ 'block-designs': true,
760
+ 'custom-css': {
761
+ default: applyFilters( 'stackable.header.custom-css.default', '' ),
762
+ },
763
+ },
764
+ } )
765
+ registerBlockType( 'undefined', {
766
+ ...metadata,
767
+ icon: HeadingIcon,
768
+ attributes: schema,
769
+ example,
770
+ supports: {
771
+ align: [ 'center', 'wide', 'full' ],
772
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
773
+ anchor: true,
774
+ },
775
+
776
+ edit,
777
+ save,
778
+ deprecated,
779
+
780
+ // Stackable modules.
781
+ modules: {
782
+ 'advanced-general': true,
783
+ 'advanced-block-spacing': true,
784
+ 'advanced-custom-attributes': true,
785
+ 'advanced-responsive': true,
786
+ 'content-align': true,
787
+ 'custom-css': {
788
+ default: applyFilters( 'stackable.heading.custom-css.default', '' ),
789
+ },
790
+ },
791
+ } )
792
+ registerBlockType( 'undefined', {
793
+ ...metadata,
794
+ icon: IconListIcon,
795
+ attributes: schema,
796
+ example,
797
+ supports: {
798
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
799
+ anchor: true,
800
+ },
801
+
802
+ deprecated,
803
+ edit,
804
+ save,
805
+
806
+ // Stackable modules.
807
+ modules: {
808
+ 'advanced-general': true,
809
+ 'advanced-block-spacing': true,
810
+ // 'advanced-column-spacing': true,
811
+ 'advanced-custom-attributes': true,
812
+ 'advanced-responsive': true,
813
+ 'block-background': {
814
+ importantBackgroundSize: true,
815
+ },
816
+ 'block-separators': true,
817
+ 'block-title': {
818
+ blockTitleMarginBottomImportant: true,
819
+ blockDescriptionMarginBottomImportant: true,
820
+ },
821
+ 'content-align': true,
822
+ 'block-designs': true,
823
+ 'custom-css': {
824
+ default: applyFilters( 'stackable.icon-list.custom-css.default', '' ),
825
+ },
826
+ },
827
+ }
828
+
829
+ // If the user changes the icon in the inspector, change all icons
830
+ addFilter( 'stackable.icon-list.setAttributes', 'stackable/icon-list/icon', ( attributes, blockProps ) => {
831
+ if ( typeof attributes.icon === 'undefined' ) {
832
+ return attributes
833
+ }
834
+
835
+ range( 1, 21 ).forEach( index => {
836
+ if ( blockProps.attributes[ `icon${ index }` ] ) {
837
+ attributes[ `icon${ index }` ] = undefined
838
+ }
839
+ } )
840
+
841
+ return attributes
842
+ } ) )
843
+ registerBlockType( 'undefined', {
844
+ ...metadata,
845
+ icon: IconIcon,
846
+ attributes: schema,
847
+ example,
848
+ supports: {
849
+ align: [ 'center', 'wide', 'full' ],
850
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
851
+ anchor: true,
852
+ },
853
+
854
+ edit,
855
+ save,
856
+ deprecated,
857
+
858
+ // Stackable modules.
859
+ modules: {
860
+ 'advanced-general': true,
861
+ 'advanced-block-spacing': true,
862
+ 'advanced-column-spacing': {
863
+ paddings: false,
864
+ },
865
+ 'advanced-custom-attributes': true,
866
+ 'advanced-responsive': true,
867
+ 'block-background': {
868
+ importantBackgroundSize: true,
869
+ },
870
+ 'block-separators': true,
871
+ 'block-title': {
872
+ blockTitleMarginBottomImportant: true,
873
+ blockDescriptionMarginBottomImportant: true,
874
+ },
875
+ 'content-align': true,
876
+ 'block-designs': true,
877
+ 'custom-css': {
878
+ default: applyFilters( 'stackable.icon.custom-css.default', '' ),
879
+ },
880
+ },
881
+ } )
882
+ registerBlockType( 'undefined', {
883
+ ...metadata,
884
+ icon: ImageBoxIcon,
885
+ supports: {
886
+ align: [ 'center', 'wide', 'full' ],
887
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
888
+ anchor: true,
889
+ },
890
+ attributes: schema,
891
+ example,
892
+
893
+ deprecated,
894
+ edit,
895
+ save,
896
+
897
+ // Stackable modules.
898
+ modules: {
899
+ 'advanced-general': true,
900
+ 'advanced-block-spacing': true,
901
+ 'advanced-column-spacing': {
902
+ paddings: false,
903
+ verticalContentAlignImportant: true,
904
+ },
905
+ 'advanced-custom-attributes': true,
906
+ 'advanced-responsive': true,
907
+ 'block-background': {
908
+ importantBackgroundSize: true,
909
+ },
910
+ 'block-separators': true,
911
+ 'block-title': {
912
+ blockTitleMarginBottomImportant: true,
913
+ blockDescriptionMarginBottomImportant: true,
914
+ },
915
+ 'content-align': true,
916
+ 'block-designs': true,
917
+ 'custom-css': {
918
+ default: applyFilters( 'stackable.image-box.custom-css.default', '' ),
919
+ },
920
+ },
921
+ }
922
+
923
+ // The "height" option is really the "columnHeight" option. @see edit.js
924
+ // Disable the default column height.
925
+ addFilter( 'stackable.image-box.advanced-column-spacing.styles', 'stackable/image-box/column-height', styles => {
926
+ styles.desktopTablet[ '> .ugb-inner-block > .ugb-block-content > *' ] = {
927
+ minHeight: undefined,
928
+ }
929
+ styles.tabletOnly[ '> .ugb-inner-block > .ugb-block-content > *' ] = {
930
+ minHeight: undefined,
931
+ }
932
+ styles.mobile[ '> .ugb-inner-block > .ugb-block-content > *' ] = {
933
+ minHeight: undefined,
934
+ }
935
+
936
+ return styles
937
+ } ) )
938
+ registerBlockType( 'undefined', {
939
+ ...metadata,
940
+ icon: NotificationIcon,
941
+ attributes: schema,
942
+ example,
943
+ supports: {
944
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
945
+ anchor: true,
946
+ },
947
+
948
+ deprecated,
949
+ edit,
950
+ save,
951
+
952
+ // Stackable modules.
953
+ modules: {
954
+ 'advanced-general': true,
955
+ 'advanced-block-spacing': true,
956
+ 'advanced-column-spacing': {
957
+ columnGap: false,
958
+ paddings: false,
959
+ },
960
+ 'advanced-custom-attributes': true,
961
+ 'advanced-responsive': true,
962
+ 'block-background': {
963
+ importantBackgroundSize: true,
964
+ },
965
+ // 'block-separators': true,
966
+ // 'block-title': true,
967
+ 'container-link': true,
968
+ 'content-align': true,
969
+ 'block-designs': true,
970
+ 'custom-css': {
971
+ default: applyFilters( 'stackable.notification.custom-css.default', '' ),
972
+ },
973
+ },
974
+ }
975
+
976
+ addFilter( 'stackable.notification.setAttributes', 'stackable/notification/notifType', attributes => {
977
+ if ( typeof attributes.notifType === 'undefined' ) {
978
+ return attributes
979
+ }
980
+
981
+ return {
982
+ ...attributes,
983
+ columnBackgroundColor: '',
984
+ columnBackgroundColorOpacity: '',
985
+ iconColor: '',
986
+ titleColor: '',
987
+ descriptionColor: '',
988
+ buttonBackgroundColor: '',
989
+ columnBorderColor: '',
990
+ }
991
+ } )
992
+
993
+ // When background opacity is set or when the background color is reset, revert background color to notification color.
994
+ addFilter( 'stackable.notification.setAttributes', 'stackable/notification/opacity', ( attributes, blockProps ) => {
995
+ const setColumnBackgroundColor = attributes.hasOwnProperty( 'columnBackgroundColor' )
996
+ if ( typeof attributes.columnBackgroundColorOpacity === 'undefined' && ! setColumnBackgroundColor ) {
997
+ return attributes
998
+ }
999
+
1000
+ // If a new background color is set, do not revert to notification color.
1001
+ if ( setColumnBackgroundColor && typeof attributes.columnBackgroundColor !== 'undefined' ) {
1002
+ return attributes
1003
+ }
1004
+
1005
+ const {
1006
+ notifType = 'success',
1007
+ columnBackgroundColor = '',
1008
+ } = blockProps.attributes
1009
+
1010
+ const NOTIFY_BACKGROUND_COLORS = {
1011
+ success: '#40ba7b',
1012
+ error: '#d9534f',
1013
+ info: '#2091e1',
1014
+ warning: '#ffdd57',
1015
+ }
1016
+
1017
+ return {
1018
+ ...attributes,
1019
+ columnBackgroundColor: columnBackgroundColor && ! setColumnBackgroundColor ? columnBackgroundColor : NOTIFY_BACKGROUND_COLORS[ notifType ],
1020
+ }
1021
+ } ) )
1022
+ registerBlockType( 'undefined', {
1023
+ ...metadata,
1024
+ icon: NumberBoxIcon,
1025
+ attributes: schema,
1026
+ example,
1027
+ supports: {
1028
+ align: [ 'center', 'wide', 'full' ],
1029
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1030
+ anchor: true,
1031
+ },
1032
+ deprecated,
1033
+ save,
1034
+ edit,
1035
+
1036
+ // Stackable modules.
1037
+ modules: {
1038
+ 'advanced-general': true,
1039
+ 'advanced-block-spacing': true,
1040
+ 'advanced-column-spacing': {
1041
+ verticalColumnAlign: true,
1042
+ paddings: false,
1043
+ },
1044
+ 'advanced-custom-attributes': true,
1045
+ 'advanced-responsive': true,
1046
+ 'block-background': {
1047
+ importantBackgroundSize: true,
1048
+ },
1049
+ 'block-separators': true,
1050
+ 'block-title': {
1051
+ blockTitleMarginBottomImportant: true,
1052
+ blockDescriptionMarginBottomImportant: true,
1053
+ },
1054
+ 'content-align': true,
1055
+ 'block-designs': true,
1056
+ 'container-link': true,
1057
+ 'custom-css': {
1058
+ default: applyFilters( 'stackable.number-box.custom-css.default', '' ),
1059
+ },
1060
+ },
1061
+ } )
1062
+ registerBlockType( 'undefined', {
1063
+ ...metadata,
1064
+ icon: PricingBoxIcon,
1065
+ attributes: schema,
1066
+ example,
1067
+ supports: {
1068
+ align: [ 'wide' ],
1069
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1070
+ anchor: true,
1071
+ },
1072
+
1073
+ deprecated,
1074
+ edit,
1075
+ save,
1076
+
1077
+ // Stackable modules.
1078
+ modules: {
1079
+ 'advanced-general': true,
1080
+ 'advanced-block-spacing': true,
1081
+ 'advanced-column-spacing': {
1082
+ verticalColumnAlign: true,
1083
+ paddings: false,
1084
+ },
1085
+ 'advanced-custom-attributes': true,
1086
+ 'advanced-responsive': true,
1087
+ 'block-background': {
1088
+ importantBackgroundSize: true,
1089
+ },
1090
+ 'block-separators': true,
1091
+ 'block-title': {
1092
+ blockTitleMarginBottomImportant: true,
1093
+ blockDescriptionMarginBottomImportant: true,
1094
+ },
1095
+ 'content-align': true,
1096
+ 'block-designs': true,
1097
+ 'container-link': true,
1098
+ 'custom-css': {
1099
+ default: applyFilters( 'stackable.pricing-box.custom-css.default', '' ),
1100
+ },
1101
+ },
1102
+ }
1103
+
1104
+ // Reset some attributes if some global attributes are set.
1105
+ addFilter( 'stackable.pricing-box.setAttributes', 'stackable/pricing-box/imageShape', attributes => {
1106
+ if ( typeof attributes.imageShape !== 'undefined' ) {
1107
+ return {
1108
+ ...attributes,
1109
+ image1Shape: '',
1110
+ image2Shape: '',
1111
+ image3Shape: '',
1112
+ image1ShapeFlipX: '',
1113
+ image1ShapeFlipY: '',
1114
+ image1ShapeStretch: '',
1115
+ image2ShapeFlipX: '',
1116
+ image2ShapeFlipY: '',
1117
+ image2ShapeStretch: '',
1118
+ image3ShapeFlipX: '',
1119
+ image3ShapeFlipY: '',
1120
+ image3ShapeStretch: '',
1121
+ }
1122
+ }
1123
+
1124
+ if ( typeof attributes.imageShapeFlipX !== 'undefined' ) {
1125
+ return {
1126
+ ...attributes,
1127
+ image1ShapeFlipX: '',
1128
+ image2ShapeFlipX: '',
1129
+ image3ShapeFlipX: '',
1130
+ }
1131
+ }
1132
+
1133
+ if ( typeof attributes.imageShapeFlipY !== 'undefined' ) {
1134
+ return {
1135
+ ...attributes,
1136
+ image1ShapeFlipY: '',
1137
+ image2ShapeFlipY: '',
1138
+ image3ShapeFlipY: '',
1139
+ }
1140
+ }
1141
+
1142
+ if ( typeof attributes.imageShapeStretch !== 'undefined' ) {
1143
+ return {
1144
+ ...attributes,
1145
+ image1ShapeStretch: '',
1146
+ image2ShapeStretch: '',
1147
+ image3ShapeStretch: '',
1148
+ }
1149
+ }
1150
+
1151
+ if ( typeof attributes.columnBackgroundColor !== 'undefined' || typeof attributes.columnBackgroundColorType !== 'undefined' ) {
1152
+ return {
1153
+ ...attributes,
1154
+ column1BackgroundColor: '',
1155
+ column2BackgroundColor: '',
1156
+ column3BackgroundColor: '',
1157
+ }
1158
+ }
1159
+
1160
+ return attributes
1161
+ } ) )
1162
+ registerBlockType( 'undefined', {
1163
+ ...metadata,
1164
+ icon: SeparatorIcon,
1165
+ attributes: schema,
1166
+ example,
1167
+ supports: {
1168
+ align: [ 'full' ],
1169
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1170
+ anchor: true,
1171
+ },
1172
+ deprecated,
1173
+ save,
1174
+ edit,
1175
+
1176
+ // Stackable modules.
1177
+ modules: {
1178
+ 'advanced-general': true,
1179
+ 'advanced-responsive': true,
1180
+ 'advanced-block-spacing': {
1181
+ enableMarginRight: false,
1182
+ enableMarginLeft: false,
1183
+ enablePaddingRight: false,
1184
+ enablePaddingLeft: false,
1185
+ height: false,
1186
+ width: false,
1187
+ horizontalContentAlign: false,
1188
+ verticalContentAlign: false,
1189
+ modifyStyles: false,
1190
+ paddingUnits: [ 'px', 'em' ],
1191
+ },
1192
+ 'advanced-custom-attributes': true,
1193
+ 'custom-css': {
1194
+ default: applyFilters( 'stackable.separator.custom-css.default', '' ),
1195
+ },
1196
+ },
1197
+ } )
1198
+ registerBlockType( 'undefined', {
1199
+ ...metadata,
1200
+ icon: SpacerIcon,
1201
+ attributes: schema,
1202
+ example,
1203
+ supports: {
1204
+ align: [ 'center', 'full' ],
1205
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1206
+ anchor: true,
1207
+ },
1208
+
1209
+ deprecated,
1210
+ edit,
1211
+ save,
1212
+
1213
+ // Stackable modules.
1214
+ modules: {
1215
+ 'block-separators': {
1216
+ enableBringToFront: false,
1217
+ },
1218
+ 'advanced-custom-attributes': true,
1219
+ 'advanced-responsive': true,
1220
+ 'custom-css': {
1221
+ default: applyFilters( 'stackable.spacer.custom-css.default', '' ),
1222
+ },
1223
+ },
1224
+ }
1225
+
1226
+ // Change the spacer height if a separator is turned on and the height is small.
1227
+ addFilter( 'stackable.spacer.setAttributes', 'stackable/spacer/separator-padding', ( attributes, blockProps ) => {
1228
+ const {
1229
+ showTopSeparator = false,
1230
+ showBottomSeparator = false,
1231
+ height = '',
1232
+ } = blockProps.attributes
1233
+ const numSeparatorsBefore = ( showTopSeparator ? 1 : 0 ) + ( showBottomSeparator ? 1 : 0 )
1234
+
1235
+ let turnedOnSeparator = false
1236
+ if ( typeof attributes.showTopSeparator !== 'undefined' ) {
1237
+ if ( attributes.showTopSeparator ) {
1238
+ turnedOnSeparator = true
1239
+ }
1240
+ }
1241
+ if ( typeof attributes.showBottomSeparator !== 'undefined' ) {
1242
+ if ( attributes.showBottomSeparator ) {
1243
+ turnedOnSeparator = true
1244
+ }
1245
+ }
1246
+ if ( turnedOnSeparator ) {
1247
+ const currentHeight = ! height ? 0 : height
1248
+ if ( numSeparatorsBefore === 0 && currentHeight < 200 ) {
1249
+ attributes.height = 200
1250
+ attributes.heightUnit = 'px'
1251
+ } else if ( numSeparatorsBefore === 1 && currentHeight < 400 ) {
1252
+ attributes.height = 400
1253
+ attributes.heightUnit = 'px'
1254
+ }
1255
+ }
1256
+ return attributes
1257
+ } ) )
1258
+ registerBlockType( 'undefined', {
1259
+ ...metadata,
1260
+ icon: TeamMemberIcon,
1261
+ attributes: schema,
1262
+ example,
1263
+ supports: {
1264
+ align: [ 'wide' ],
1265
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1266
+ anchor: true,
1267
+ },
1268
+
1269
+ deprecated,
1270
+ edit,
1271
+ save,
1272
+
1273
+ // Stackable modules.
1274
+ modules: {
1275
+ 'advanced-general': true,
1276
+ 'advanced-block-spacing': true,
1277
+ 'advanced-column-spacing': {
1278
+ paddings: false,
1279
+ },
1280
+ 'advanced-custom-attributes': true,
1281
+ 'advanced-responsive': true,
1282
+ 'block-background': {
1283
+ importantBackgroundSize: true,
1284
+ },
1285
+ 'block-separators': true,
1286
+ 'block-title': {
1287
+ blockTitleMarginBottomImportant: true,
1288
+ blockDescriptionMarginBottomImportant: true,
1289
+ },
1290
+ 'content-align': true,
1291
+ 'block-designs': true,
1292
+ 'container-link': true,
1293
+ 'custom-css': {
1294
+ default: applyFilters( 'stackable.team-member.custom-css.default', '' ),
1295
+ },
1296
+ },
1297
+ }
1298
+
1299
+ // Reset some attributes if some global attributes are set.
1300
+ addFilter( 'stackable.team-member.setAttributes', 'stackable/team-member/imageShape', attributes => {
1301
+ if ( typeof attributes.imageShape !== 'undefined' ) {
1302
+ return {
1303
+ ...attributes,
1304
+ image1Shape: '',
1305
+ image2Shape: '',
1306
+ image3Shape: '',
1307
+ image1ShapeFlipX: '',
1308
+ image1ShapeFlipY: '',
1309
+ image1ShapeStretch: '',
1310
+ image2ShapeFlipX: '',
1311
+ image2ShapeFlipY: '',
1312
+ image2ShapeStretch: '',
1313
+ image3ShapeFlipX: '',
1314
+ image3ShapeFlipY: '',
1315
+ image3ShapeStretch: '',
1316
+ }
1317
+ }
1318
+
1319
+ if ( typeof attributes.imageShapeFlipX !== 'undefined' ) {
1320
+ return {
1321
+ ...attributes,
1322
+ image1ShapeFlipX: '',
1323
+ image2ShapeFlipX: '',
1324
+ image3ShapeFlipX: '',
1325
+ }
1326
+ }
1327
+
1328
+ if ( typeof attributes.imageShapeFlipY !== 'undefined' ) {
1329
+ return {
1330
+ ...attributes,
1331
+ image1ShapeFlipY: '',
1332
+ image2ShapeFlipY: '',
1333
+ image3ShapeFlipY: '',
1334
+ }
1335
+ }
1336
+
1337
+ if ( typeof attributes.imageShapeStretch !== 'undefined' ) {
1338
+ return {
1339
+ ...attributes,
1340
+ image1ShapeStretch: '',
1341
+ image2ShapeStretch: '',
1342
+ image3ShapeStretch: '',
1343
+ }
1344
+ }
1345
+
1346
+ if ( typeof attributes.columnBackgroundColor !== 'undefined' || typeof attributes.columnBackgroundColorType !== 'undefined' ) {
1347
+ return {
1348
+ ...attributes,
1349
+ column1BackgroundColor: '',
1350
+ column2BackgroundColor: '',
1351
+ column3BackgroundColor: '',
1352
+ }
1353
+ }
1354
+
1355
+ return attributes
1356
+ } ) )
1357
+ registerBlockType( 'undefined', {
1358
+ ...metadata,
1359
+ icon: TestimonialIcon,
1360
+ attributes: schema,
1361
+ example,
1362
+ supports: {
1363
+ align: [ 'wide' ],
1364
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1365
+ anchor: true,
1366
+ },
1367
+
1368
+ deprecated,
1369
+ edit,
1370
+ save,
1371
+
1372
+ // Stackable modules.
1373
+ modules: {
1374
+ 'advanced-general': true,
1375
+ 'advanced-block-spacing': true,
1376
+ 'advanced-column-spacing': {
1377
+ verticalColumnAlign: true,
1378
+ paddings: false,
1379
+ },
1380
+ 'advanced-custom-attributes': true,
1381
+ 'advanced-responsive': true,
1382
+ 'block-background': {
1383
+ importantBackgroundSize: true,
1384
+ },
1385
+ 'block-separators': true,
1386
+ 'block-title': {
1387
+ blockTitleMarginBottomImportant: true,
1388
+ blockDescriptionMarginBottomImportant: true,
1389
+ },
1390
+ 'content-align': true,
1391
+ 'block-designs': true,
1392
+ 'container-link': true,
1393
+ 'custom-css': {
1394
+ default: applyFilters( 'stackable.testimonial.custom-css.default', '' ),
1395
+ },
1396
+ },
1397
+ }
1398
+
1399
+ // Reset some attributes if some global attributes are set.
1400
+ addFilter( 'stackable.testimonial.setAttributes', 'stackable/testimonial/imageShape', attributes => {
1401
+ if ( typeof attributes.imageShape !== 'undefined' ) {
1402
+ return {
1403
+ ...attributes,
1404
+ image1Shape: '',
1405
+ image2Shape: '',
1406
+ image3Shape: '',
1407
+ image1ShapeFlipX: '',
1408
+ image1ShapeFlipY: '',
1409
+ image1ShapeStretch: '',
1410
+ image2ShapeFlipX: '',
1411
+ image2ShapeFlipY: '',
1412
+ image2ShapeStretch: '',
1413
+ image3ShapeFlipX: '',
1414
+ image3ShapeFlipY: '',
1415
+ image3ShapeStretch: '',
1416
+ }
1417
+ }
1418
+
1419
+ if ( typeof attributes.imageShapeFlipX !== 'undefined' ) {
1420
+ return {
1421
+ ...attributes,
1422
+ image1ShapeFlipX: '',
1423
+ image2ShapeFlipX: '',
1424
+ image3ShapeFlipX: '',
1425
+ }
1426
+ }
1427
+
1428
+ if ( typeof attributes.imageShapeFlipY !== 'undefined' ) {
1429
+ return {
1430
+ ...attributes,
1431
+ image1ShapeFlipY: '',
1432
+ image2ShapeFlipY: '',
1433
+ image3ShapeFlipY: '',
1434
+ }
1435
+ }
1436
+
1437
+ if ( typeof attributes.imageShapeStretch !== 'undefined' ) {
1438
+ return {
1439
+ ...attributes,
1440
+ image1ShapeStretch: '',
1441
+ image2ShapeStretch: '',
1442
+ image3ShapeStretch: '',
1443
+ }
1444
+ }
1445
+
1446
+ if ( typeof attributes.columnBackgroundColor !== 'undefined' || typeof attributes.columnBackgroundColorType !== 'undefined' ) {
1447
+ return {
1448
+ ...attributes,
1449
+ column1BackgroundColor: '',
1450
+ column2BackgroundColor: '',
1451
+ column3BackgroundColor: '',
1452
+ }
1453
+ }
1454
+
1455
+ return attributes
1456
+ } ) )
1457
+ registerBlockType( 'undefined', {
1458
+ ...metadata,
1459
+ icon: TextIcon,
1460
+ attributes: schema,
1461
+ example,
1462
+ supports: {
1463
+ align: [ 'center', 'wide', 'full' ],
1464
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1465
+ anchor: true,
1466
+ },
1467
+
1468
+ edit,
1469
+ save,
1470
+ deprecated,
1471
+
1472
+ // Stackable modules.
1473
+ modules: {
1474
+ 'advanced-general': true,
1475
+ 'advanced-block-spacing': true,
1476
+ 'advanced-column-spacing': {
1477
+ paddings: false,
1478
+ },
1479
+ 'advanced-custom-attributes': true,
1480
+ 'advanced-responsive': true,
1481
+ 'block-background': {
1482
+ importantBackgroundSize: true,
1483
+ },
1484
+ 'block-separators': true,
1485
+ 'content-align': true,
1486
+ 'block-designs': true,
1487
+ 'custom-css': {
1488
+ default: applyFilters( 'stackable.text.custom-css.default', '' ),
1489
+ },
1490
+ },
1491
+ }
1492
+
1493
+ // If the design was changed, force turn on the title.
1494
+ addFilter( 'stackable.text.setAttributes', 'stackable/text/design', ( attributes, blockProps ) => {
1495
+ if ( typeof attributes.design === 'undefined' ) {
1496
+ return attributes
1497
+ }
1498
+
1499
+ const blockAttributes = blockProps.attributes
1500
+
1501
+ if ( attributes.design === 'side-title-1' || attributes.design === 'side-title-2' ) {
1502
+ if ( blockAttributes.design !== 'side-title-1' && blockAttributes.design !== 'side-title-2' ) {
1503
+ attributes.showTitle = true
1504
+ }
1505
+ }
1506
+
1507
+ return attributes
1508
+ } ) )
1509
+ registerBlockType( 'undefined', {
1510
+ ...metadata,
1511
+ icon: VideoPopupIcon,
1512
+ attributes: schema,
1513
+ example,
1514
+ supports: {
1515
+ align: [ 'center', 'wide', 'full' ],
1516
+ inserter: ! disabledBlocks.includes( name ), // Hide if disabled.
1517
+ anchor: true,
1518
+ },
1519
+
1520
+ deprecated,
1521
+ edit,
1522
+ save,
1523
+
1524
+ // Stackable modules.
1525
+ modules: {
1526
+ 'advanced-general': true,
1527
+ 'advanced-block-spacing': true,
1528
+ // 'advanced-column-spacing': true,
1529
+ 'advanced-custom-attributes': true,
1530
+ 'advanced-responsive': true,
1531
+ 'block-background': {
1532
+ importantBackgroundSize: true,
1533
+ },
1534
+ 'block-separators': true,
1535
+ 'block-title': {
1536
+ blockTitleMarginBottomImportant: true,
1537
+ blockDescriptionMarginBottomImportant: true,
1538
+ },
1539
+ // 'content-align': true,
1540
+ 'block-designs': true,
1541
+ 'custom-css': {
1542
+ default: applyFilters( 'stackable.video-popup.custom-css.default', '' ),
1543
+ },
1544
+ },
1545
+ } )
plugin.php CHANGED
@@ -7,7 +7,7 @@
7
  * Author: Gambit Technologies, Inc
8
  * Author URI: http://gambit.ph
9
  * Text Domain: stackable-ultimate-gutenberg-blocks
10
- * Version: 2.17.2
11
  *
12
  * @package Stackable
13
  */
@@ -23,7 +23,7 @@ if ( function_exists( 'sugb_fs' ) ) {
23
  }
24
 
25
  defined( 'STACKABLE_SHOW_PRO_NOTICES' ) || define( 'STACKABLE_SHOW_PRO_NOTICES', true );
26
- defined( 'STACKABLE_VERSION' ) || define( 'STACKABLE_VERSION', '2.17.2' );
27
  defined( 'STACKABLE_FILE' ) || define( 'STACKABLE_FILE', __FILE__ );
28
  defined( 'STACKABLE_I18N' ) || define( 'STACKABLE_I18N', 'stackable-ultimate-gutenberg-blocks' );
29
  // Plugin slug.
7
  * Author: Gambit Technologies, Inc
8
  * Author URI: http://gambit.ph
9
  * Text Domain: stackable-ultimate-gutenberg-blocks
10
+ * Version: 2.17.3
11
  *
12
  * @package Stackable
13
  */
23
  }
24
 
25
  defined( 'STACKABLE_SHOW_PRO_NOTICES' ) || define( 'STACKABLE_SHOW_PRO_NOTICES', true );
26
+ defined( 'STACKABLE_VERSION' ) || define( 'STACKABLE_VERSION', '2.17.3' );
27
  defined( 'STACKABLE_FILE' ) || define( 'STACKABLE_FILE', __FILE__ );
28
  defined( 'STACKABLE_I18N' ) || define( 'STACKABLE_I18N', 'stackable-ultimate-gutenberg-blocks' );
29
  // Plugin slug.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: blocks, gutenberg, gutenberg blocks, page builder, WordPress blocks
4
  Requires at least: 5.5.4
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 2.17.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -204,6 +204,9 @@ Nope. Stackable only works with Gutenberg, the new WordPress editor.
204
 
205
  == Changelog ==
206
 
 
 
 
207
  = 2.17.2 =
208
  * New: WordPress 5.8 compatibility
209
  * New: You can now use Stackable blocks in the new Page Template editor
4
  Requires at least: 5.5.4
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 2.17.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
204
 
205
  == Changelog ==
206
 
207
+ = 2.17.3 =
208
+ * Fixed: Removed unnecessary scripts from loading in the frontend
209
+
210
  = 2.17.2 =
211
  * New: WordPress 5.8 compatibility
212
  * New: You can now use Stackable blocks in the new Page Template editor
src/init.php CHANGED
@@ -68,6 +68,9 @@ if ( ! function_exists( 'stackable_block_editor_assets' ) ) {
68
  * @since 0.1
69
  */
70
  function stackable_block_editor_assets() {
 
 
 
71
 
72
  // Enqueue CodeMirror for Custom CSS.
73
  wp_enqueue_code_editor( array(
68
  * @since 0.1
69
  */
70
  function stackable_block_editor_assets() {
71
+ if ( ! is_admin() ) {
72
+ return;
73
+ }
74
 
75
  // Enqueue CodeMirror for Custom CSS.
76
  wp_enqueue_code_editor( array(