Skip to content

Commit

Permalink
Merge pull request #31 from tomusborne/release/1.1.2
Browse files Browse the repository at this point in the history
Release/1.1.2
  • Loading branch information
tomusborne authored Jul 9, 2020
2 parents 17f4710 + ee2bf08 commit 0f7cde0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion dist/blocks.build.js

Large diffs are not rendered by default.

36 changes: 15 additions & 21 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,35 +83,29 @@ function generateblocks_get_block_data( $content, $data = array(), $depth = 0 )
* @since 1.1
*/
function generateblocks_get_parsed_content( $content = '' ) {
$parsed_content = wp_cache_get( 'generateblocks_parsed_content' );

if ( ! $parsed_content ) {
if ( ! function_exists( 'has_blocks' ) ) {
return;
}

if ( ! $content && has_blocks( get_the_ID() ) ) {
global $post;

if ( ! is_object( $post ) ) {
return;
}

$content = $post->post_content;
}
if ( ! function_exists( 'has_blocks' ) ) {
return;
}

$content = apply_filters( 'generateblocks_do_content', $content );
if ( ! $content && has_blocks( get_the_ID() ) ) {
global $post;

if ( ! function_exists( 'parse_blocks' ) ) {
if ( ! is_object( $post ) ) {
return;
}

$parsed_content = parse_blocks( $content );
$content = $post->post_content;
}

wp_cache_set( 'generateblocks_parsed_content', $parsed_content );
$content = apply_filters( 'generateblocks_do_content', $content );

if ( ! function_exists( 'parse_blocks' ) ) {
return;
}

return $parsed_content;
$content = parse_blocks( $content );

return $content;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything.
* Author: Tom Usborne
* Author URI: https://tomusborne.com
* Version: 1.1.1
* Version: 1.1.2
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: generateblocks
Expand All @@ -17,8 +17,8 @@
exit; // Exit if accessed directly.
}

define( 'GENERATEBLOCKS_VERSION', '1.1.1' );
define( 'GENERATEBLOCKS_CSS_VERSION', '1.0.2' );
define( 'GENERATEBLOCKS_VERSION', '1.1.2' );
define( 'GENERATEBLOCKS_CSS_VERSION', '1.0.4' );
define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) );
define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) );

Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: blocks, gutenberg, container, headline, grid, columns, page builder, wysiw
Requires at least: 5.0
Tested up to: 5.4
Requires PHP: 5.6
Stable tag: 1.1.1
Stable tag: 1.1.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -75,6 +75,11 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener

== Changelog ==

= 1.1.2 =
* Fix: Set background image selector default if undefined
* Fix: Set background image opacity default if undefined
* Tweak: Remove parsed content caching

= 1.1.1 =
* Fix: Undefined index notice when using background images

Expand Down
19 changes: 10 additions & 9 deletions src/blocks/container/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ class GenerateBlockContainer extends Component {
align,
} = attributes;

// Attribute defaults added to an object late don't get defaults.
if ( 'undefined' === typeof attributes.bgOptions.selector ) {
attributes.bgOptions.selector = 'element';
}

if ( 'undefined' === typeof attributes.bgOptions.opacity ) {
attributes.bgOptions.opacity = 1;
}

const minHeightUnits = [
{
name: _x( 'Pixel', 'A size unit for CSS markup' ),
Expand Down Expand Up @@ -1343,17 +1352,9 @@ class GenerateBlockContainer extends Component {
bgOptions: {
...bgOptions,
opacity: value,
selector: 'pseudo-element',
},
} );

if ( 'pseudo-element' !== bgOptions.selector ) {
setAttributes( {
bgOptions: {
...bgOptions,
selector: 'pseudo-element',
},
} );
}
} }
min={ 0 }
max={ 1 }
Expand Down

0 comments on commit 0f7cde0

Please sign in to comment.