Skip to content

Commit 0bc5938

Browse files
release: version 2.0.12
- Fix Custom CSS not working with certain selectors - Disable Author Block for WordPress 5.9 or above; use Core’s block instead - Small Dynamic Text enhancements - Add separator alignment option in Countdown block - Fix Category not shown on Featured Post in Posts Lock - Fix Alignment control breaking in Section & Posts block
2 parents acd1245 + 1a70bdc commit 0bc5938

File tree

25 files changed

+179
-64
lines changed

25 files changed

+179
-64
lines changed

.github/workflows/tastewp.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: InstaWP WordPress Testing
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
create-wp-for-testing:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: instawp/wordpress-testing-automation@main
13+
with:
14+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
15+
INSTAWP_TOKEN: ${{ secrets.INSTAWP_TOKEN }}
16+
INSTAWP_TEMPLATE_SLUG: otter-qa
17+
REPO_ID: 46
18+
INSTAWP_ACTION: create-site-template

inc/css/blocks/class-countdown-css.php

+15
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,21 @@ public function render_css( $block ) {
298298
)
299299
);
300300

301+
$css->add_item(
302+
array(
303+
'selector' => ' .otter-countdown__container .otter-countdown__display .otter-countdown__display-area[name="separator"] .otter-countdown__label',
304+
'properties' => array(
305+
array(
306+
'property' => 'display',
307+
'default' => 'none',
308+
'condition' => function( $attrs ) {
309+
return isset( $attrs['separatorAlignment'] ) && 'center' === $attrs['separatorAlignment'];
310+
},
311+
),
312+
),
313+
)
314+
);
315+
301316
$style = $css->generate();
302317

303318
return $style;

inc/render/class-posts-grid-block.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function render( $attributes ) {
119119
}
120120

121121
if ( 'meta' === $element ) {
122-
if ( ( isset( $attributes['displayMeta'] ) && $attributes['displayMeta'] ) && ( ( isset( $attributes['displayDate'] ) && $attributes['displayDate'] ) || ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) ) ) {
122+
if ( ( isset( $attributes['displayMeta'] ) && $attributes['displayMeta'] ) && ( ( isset( $attributes['displayDate'] ) && $attributes['displayDate'] ) || ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) || ( isset( $attributes['displayComments'] ) && $attributes['displayComments'] ) || ( isset( $attributes['displayPostCategory'] ) && $attributes['displayPostCategory'] ) ) ) {
123123
$list_items_markup .= '<p class="o-posts-grid-post-meta">';
124124

125125
if ( isset( $attributes['displayDate'] ) && $attributes['displayDate'] ) {
@@ -277,6 +277,14 @@ protected function render_featured_post( $post, $attributes ) {
277277
$html .= '<div class="o-posts-grid-post-body' . ( $thumbnail && $attributes['displayFeaturedImage'] ? '' : ' is-full' ) . '">';
278278

279279
foreach ( $attributes['template'] as $element ) {
280+
if ( 'category' === $element ) {
281+
if ( isset( $attributes['displayCategory'] ) && isset( $category[0] ) && $attributes['displayCategory'] ) {
282+
$html .= sprintf(
283+
'<span class="o-posts-grid-post-category">%1$s</span>',
284+
esc_html( $category[0]->cat_name )
285+
);
286+
}
287+
}
280288

281289
if ( 'title' === $element ) {
282290
if ( isset( $attributes['displayTitle'] ) && $attributes['displayTitle'] ) {

src/blocks/blocks/about-author/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ registerBlockType( name, {
2626
],
2727
edit,
2828
save: () => null,
29+
supports: {
30+
inserter: Boolean( window.themeisleGutenberg.isLegacyPre59 ),
31+
html: false
32+
},
2933
example: {}
3034
});

src/blocks/blocks/button-group/group/inspector.js

+1-17
Original file line numberDiff line numberDiff line change
@@ -164,23 +164,7 @@ const Inspector = ({
164164
]}
165165
onChange={ onAlignmentChange }
166166
hideLabels
167-
style={{
168-
button: {
169-
color: 'black',
170-
boxShadow: 'none',
171-
borderRadius: '0px'
172-
},
173-
active: {
174-
color: 'white',
175-
backgroundColor: 'black',
176-
boxShadow: 'none',
177-
borderRadius: '0px'
178-
},
179-
group: {
180-
marginLeft: '0px',
181-
marginRight: '0px'
182-
}
183-
}}
167+
hasIcon
184168
/>
185169
</ResponsiveControl>
186170
</PanelBody>

src/blocks/blocks/countdown/block.json

+3
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@
143143
"borderRadiusType": {
144144
"type": "string",
145145
"default": "linked"
146+
},
147+
"separatorAlignment": {
148+
"type": "string"
146149
}
147150
},
148151
"supports": {

src/blocks/blocks/countdown/edit.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ const Edit = ({
133133
}`,
134134
`.otter-countdown__display-area[name="separator"] .otter-countdown__value {
135135
color: ${ attributes.separatorColor };
136-
}`
136+
}`,
137+
'center' === attributes.separatorAlignment ? `
138+
.otter-countdown__display-area[name="separator"] .otter-countdown__label {
139+
display: none;
140+
}
141+
` : ''
137142
]);
138-
}, [ attributes.valueColor, attributes.labelColor, attributes.separatorColor ]);
143+
}, [ attributes.valueColor, attributes.labelColor, attributes.separatorColor, attributes.separatorAlignment ]);
139144

140145

141146
const blockProps = useBlockProps({

src/blocks/blocks/countdown/inspector.js

+37-15
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,30 @@ const Inspector = ({
220220
}
221221
]}
222222
/>
223+
224+
{ attributes.hasSeparators && (
225+
<SelectControl
226+
label={ __( 'Separator Alignment', 'otter-blocks' ) }
227+
value={ attributes.separatorAlignment }
228+
onChange={ separatorAlignment => {
229+
if ( ! separatorAlignment ) {
230+
setAttributes({ separatorAlignment: undefined });
231+
} else {
232+
setAttributes({ separatorAlignment });
233+
}
234+
}}
235+
options={[
236+
{
237+
label: __( 'Default', 'otter-blocks' ),
238+
value: ''
239+
},
240+
{
241+
label: __( 'Center', 'otter-blocks' ),
242+
value: 'center'
243+
}
244+
]}
245+
/>
246+
) }
223247
</PanelBody>
224248

225249
<PanelBody
@@ -334,21 +358,19 @@ const Inspector = ({
334358
]}
335359
/>
336360

337-
{
338-
'none' !== attributes.borderStyle && (
339-
<ResponsiveControl
340-
label={ __( 'Width', 'otter-blocks' ) }
341-
>
342-
<RangeControl
343-
value={ responsiveGetAttributes([ attributes.borderWidth, attributes.borderWidthTablet, attributes.borderWidthMobile ]) ?? 2 }
344-
onChange={ value => responsiveSetAttributes( value, [ 'borderWidth', 'borderWidthTablet', 'borderWidthMobile' ]) }
345-
min={ 0 }
346-
max={ 50 }
347-
allowReset
348-
/>
349-
</ResponsiveControl>
350-
)
351-
}
361+
{ 'none' !== attributes.borderStyle && (
362+
<ResponsiveControl
363+
label={ __( 'Width', 'otter-blocks' ) }
364+
>
365+
<RangeControl
366+
value={ responsiveGetAttributes([ attributes.borderWidth, attributes.borderWidthTablet, attributes.borderWidthMobile ]) ?? 2 }
367+
onChange={ value => responsiveSetAttributes( value, [ 'borderWidth', 'borderWidthTablet', 'borderWidthMobile' ]) }
368+
min={ 0 }
369+
max={ 50 }
370+
allowReset
371+
/>
372+
</ResponsiveControl>
373+
) }
352374

353375

354376
<BoxControl

src/blocks/blocks/countdown/style.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@
9999

100100
&[name="separator"] {
101101
.otter-countdown__label {
102-
display: none;
102+
opacity: 0%;
103+
text-overflow: clip;
104+
word-break: normal;
103105
}
104106
border: unset;
105107
background-color: transparent;
@@ -108,6 +110,8 @@
108110
}
109111

110112
.otter-countdown__value {
113+
display: flex;
114+
justify-content: center;
111115
font-size: var( --value-font-size );
112116
font-weight: var( --value-font-weight );
113117
line-height: 1.2;

src/blocks/blocks/countdown/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Attributes = {
5959
paddingTablet: PaddingType
6060
valueFontWeight: string
6161
labelFontWeight: string
62+
seperatorAlignment: 'center'
6263
} & LegacyAttrs;
6364

6465
export type CountdownProps = BlockProps<Attributes>

src/blocks/blocks/lottie/placeholder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const BlockPlaceholder = ({
3939
return (
4040
<Placeholder
4141
label={ __( 'Lottie', 'otter-blocks' ) }
42-
instructions={ __( 'Add Lottie animations and files to your website.', 'otter-blocks' ) }
42+
instructions={ __( 'Add Lottie animations and files to your website. You need to use a .json file.', 'otter-blocks' ) }
4343
icon={ <BlockIcon icon={ video } /> }
4444
className={ className }
4545
>

src/blocks/blocks/posts/components/layout/featured.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { applyFilters } from '@wordpress/hooks';
1717
import Thumbnail from './thumbnail.js';
1818

1919
import {
20+
PostsCategory,
2021
PostsDescription,
2122
PostsMeta,
2223
PostsTitle
@@ -26,7 +27,8 @@ const FeaturedPost = ({
2627
post,
2728
attributes,
2829
author,
29-
category
30+
category,
31+
categoriesList
3032
}) => {
3133
if ( ! post ) {
3234
return '';
@@ -48,6 +50,8 @@ const FeaturedPost = ({
4850
<div className="o-posts-grid-post-body">
4951
{ attributes.template.map( element => {
5052
switch ( element ) {
53+
case 'category':
54+
return <PostsCategory attributes={ attributes } element={ element } category={ category } categoriesList={ categoriesList }/>;
5155
case 'title':
5256
return <PostsTitle attributes={ attributes } element={ element } post={ post } />;
5357
case 'meta':

src/blocks/blocks/posts/components/layout/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export const PostsTitle = ({ attributes, element, post }) => {
121121
};
122122

123123
export const PostsMeta = ({ attributes, element, post, author, category }) => {
124-
if ( attributes.displayMeta && ( attributes.displayDate || attributes.displayAuthor ) ) {
124+
if ( attributes.displayMeta && ( attributes.displayDate || attributes.displayAuthor || attributes.displayComments || attributes.displayPostCategory ) ) {
125125
return (
126126
<p key={ element } className="o-posts-grid-post-meta">
127127
{ ( attributes.displayDate ) && (

src/blocks/blocks/posts/edit.js

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ const Edit = ({
232232
attributes={ attributes }
233233
post={ posts?.[0] }
234234
category={ categoriesList[0] }
235+
categoriesList={ categoriesList }
235236
author={ authors[0] }
236237
/>
237238
) }

src/blocks/components/toogle-group-control/editor.scss

+20
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@
55
justify-content: center;
66
width: 100%;
77

8+
&.has-icon {
9+
margin-left: 0px;
10+
margin-right: 0px;
11+
12+
.components-button {
13+
&.is-primary {
14+
color: #fff;
15+
background-color: #000;
16+
box-shadow: none;
17+
border-radius: 0;
18+
}
19+
20+
&.is-secondary {
21+
color: #000;
22+
box-shadow: none;
23+
border-radius: 0px;
24+
}
25+
}
26+
}
27+
828
.o-toggle-option {
929
&:root {
1030
--o-toogle-btn-rad: 0px;

src/blocks/components/toogle-group-control/index.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
*/
1717
import './editor.scss';
1818

19-
2019
/**
2120
* A group of buttons that actions as a toggle
2221
*
@@ -30,19 +29,22 @@ const ToogleGroupControl = ({
3029
hideLabels,
3130
hideTooltip,
3231
showBottomLabels,
33-
style
32+
hasIcon = false
3433
}) => {
3534
return (
3635
<ButtonGroup
37-
className="o-toggle-group-control"
38-
style={ style?.group }
36+
className={ classNames(
37+
'o-toggle-group-control',
38+
{
39+
'has-icon': hasIcon
40+
}
41+
) }
3942
>
4043
{ options?.map( option => {
4144
return (
4245
<div
4346
key={ option?.value }
4447
className="o-toggle-option"
45-
style={ style?.option }
4648
>
4749
<Button
4850
isPrimary={ value == option?.value }
@@ -51,12 +53,11 @@ const ToogleGroupControl = ({
5153
label={ option?.label }
5254
onClick={ () => onChange( option?.value )}
5355
showTooltip={ Boolean( hideTooltip ) }
54-
style={ value == option?.value ? ( style.active ?? style?.button ) : style?.button }
5556
>
5657
{ option?.label && ! Boolean( hideLabels ) && ! Boolean( showBottomLabels ) ? option?.label : '' }
5758
</Button>
5859

59-
<p style={ style?.label }>{ option?.label && ! Boolean( hideLabels ) && Boolean( showBottomLabels ) ? option?.label : '' }</p>
60+
<p>{ option?.label && ! Boolean( hideLabels ) && Boolean( showBottomLabels ) ? option?.label : '' }</p>
6061
</div>
6162
);
6263
}) }

src/blocks/plugins/dynamic-content/autocompleter.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ import { addFilter } from '@wordpress/hooks';
1515
*/
1616
import options from './options.js';
1717

18-
const autocompleteOptions = [];
18+
let autocompleteOptions = [];
1919

2020
Object.keys( options ).forEach( option => autocompleteOptions.push( ...options[option].options ) );
2121

22+
autocompleteOptions = [ ...autocompleteOptions.filter( i => true !== i.isDisabled ), ...autocompleteOptions.filter( i => true === i.isDisabled ) ];
23+
2224
const dynamicValue = {
2325
name: 'dynamic-value',
2426
triggerPrefix: '%',

src/blocks/plugins/dynamic-content/components/inline-controls.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const InlineControls = ({
4343
attrs[ o ] = obj[ o ];
4444
});
4545

46-
attrs = Object.fromEntries( Object.entries( attrs ).filter( ([ _, v ]) => ( null !== v && '' !== v ) ) );
46+
attrs = Object.fromEntries( Object.entries( attrs ).filter( ([ _, v ]) => ( null !== v && '' !== v && undefined !== v ) ) );
4747

4848
setAttributes({ ...attrs });
4949
};

0 commit comments

Comments
 (0)