Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 08d9a43
Author: Henner S <[email protected]>
Date:   Mon Feb 27 11:25:50 2023 +0700

    9.5.0

    - [Block] Changed the regex to add back `inner-container` in Group.
    - [Block] Fixed fatal error when visiting 404 page due to body class addition.
  • Loading branch information
hrsetyono committed Mar 12, 2023
1 parent 86d849b commit 41a979e
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 56 deletions.
2 changes: 1 addition & 1 deletion dist/h-gutenberg.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill'), 'version' => '5b880ad15458a0490822d8c67d9355e5');
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill'), 'version' => '5314f074c095261f70fa194783092cda');
2 changes: 1 addition & 1 deletion dist/h-gutenberg.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/h-gutenberg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions edje-wp-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* License: MIT
* Author: Pixel Studio
* Author URI: https://pixelstudio.id
* Version: 9.4.2
* Version: 9.5.0
*/

if (!defined('WPINC')) { die; } // exit if accessed directly

// Constant
define('H_VERSION', '9.4.2');
define('H_VERSION', '9.5.0');
define('H_BASE', basename(dirname(__FILE__)).'/'.basename(__FILE__));

define('H_DIR', __DIR__); // for require
Expand Down
2 changes: 1 addition & 1 deletion module-gutenberg/core-design.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function _h_render_negative_spacer($content, $block) {
*/
function _h_render_group_inner_container($content, $block) {
// Abort if still the old group
if (strpos($content, '__inner-container')) { return $content; }
if (strpos($content, '$<div class="wp-block-group.+><div class="wp-block-group__inner-container')) { return $content; }

$content = preg_replace(
'/(wp-block-group.+>)(.+)(<\/div>$)/Uis',
Expand Down
3 changes: 2 additions & 1 deletion module-gutenberg/core-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
register_block_style('core/image', [ 'name' => 'h-thumbnail-tall', 'label' => 'Thumbnail Tall' ]);

register_block_style('core/media-text', [ 'name' => 'h-larger-image', 'label' => 'Larger Image' ]);

register_block_style('core/media-text', [ 'name' => 'h-smaller-image', 'label' => 'Smaller Image' ]);

register_block_style('core/cover', [ 'name' => 'h-below-header', 'label' => 'Below Header' ]);
Expand Down Expand Up @@ -68,6 +67,8 @@ function _h_render_responsive_cover($content, $block) {
*/
function _h_body_class_cover_below_header($classes) {
global $post;
if (!$post) { return $classes; }

preg_match('/wp-block-cover.+is-style-h-below-header/', $post->post_content, $matches);

if ($matches) {
Expand Down
13 changes: 1 addition & 12 deletions module-gutenberg/src/h-gutenberg.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ wp.hooks.addFilter('blocks.registerBlockType', 'h/set_default_alignment', (setti

// Group and Cover defaults to full
case 'core/group':
case 'core/cover':
settings.supports = {
...settings.supports,
...{
Expand All @@ -109,18 +110,6 @@ wp.hooks.addFilter('blocks.registerBlockType', 'h/set_default_alignment', (setti
};
break;

case 'core/cover':
settings.attributes = {
...settings.attributes,
...{
align: {
type: 'string',
default: 'full',
},
},
};
break;

default:
break;
}
Expand Down
74 changes: 37 additions & 37 deletions module-gutenberg/src/h-gutenberg.sass
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ $acf-bg: #f3f3f4
.editor-styles-wrapper
background-color: var(--siteBg)

.is-root-container,
.wp-block-group,
.wp-block-cover__inner-container,
.wp-block-media-text__content,
.wp-block-column
> * + *
margin-top: var(--blockGap)

.has-text-color,
.has-inline-color
color: var(--textColor, var(--text))
Expand All @@ -11,20 +19,20 @@ $acf-bg: #f3f3f4
background-color: var(--bgColor)

.wp-block
max-width: var(--blogWidth)
max-width: var(--contentSize)

.wp-block-columns &
max-width: none

b, strong
font-weight: 700
&[data-align="wide"]
max-width: calc(var(--wideSize) - 100px)

// Fixed reusable block being constrained to narrow size
&.is-reusable
max-width: none
// Fixed reusable block being constrained to narrow size
div.editor-styles-wrapper .wp-block.is-reusable
max-width: none

&[data-align="wide"]
max-width: calc(var(--siteWidth) - 100px)
.block-library-block__reusable-block-container > .wp-block
max-width: none

// Fixed bug where Wide column is almost full when on smaller screen
.wp-block[data-type="core/group"][data-align=full]>div>.wp-block-group>.wp-block-group__inner-container>.block-editor-inner-blocks
Expand Down Expand Up @@ -58,7 +66,7 @@ $acf-bg: #f3f3f4
color: var(--text, #333)

p.is-style-h-no-spacing
margin-bottom: calc(var(--blockGap) * -1) !important
margin-top: 0 !important

// empty paragraph
[data-is-placeholder-visible="true"]
Expand Down Expand Up @@ -139,10 +147,8 @@ div.editor-styles-wrapper [data-type="core/heading"]
padding-bottom: var(--blockGap)

.wp-block-group.is-style-h-large-spacing
padding-top: var(--wideGap)
padding-bottom: var(--wideGap)


padding-top: var(--blockWideGap)
padding-bottom: var(--blockWideGap)

///// IMAGE
Expand Down Expand Up @@ -295,44 +301,38 @@ div.editor-styles-wrapper [data-type="core/heading"]
.wp-block-cover.is-light .wp-block-cover__inner-container
color: var(--textInvert, white)

// Change the custom position to be within --siteWidth
// Change the custom position to be within --wideSize
.wp-block-cover .wp-block-cover__inner-container
display: flex
flex-direction: column
align-items: var(--alignX, center)
justify-content: var(--alignY, center)
width: var(--siteWidth, 1120px) !important
width: var(--wideSize, 1120px) !important

// cover is bugged to not have alignment
> *
width: 100%
max-width: var(--blogWidth, 650px)

.alignwide
max-width: var(--siteWidth, 1120px)

.wp-block-cover__inner-container
min-width: var(--blogWidth, 650px)
width: 100%
max-width: var(--wideSize, 1120px)


///// GROUP
// Center the [ + ] box when displaying empty group
// Center the [+] box when displaying empty group
.wp-block-group[data-type="core/group"] > .block-list-appender
margin-right: auto
margin-left: auto

.wp-block-group
&:not(.has-background)
border: 1px dashed var(--textDim, #888)
border: 1px dashed var(--grayDark, #888)

> *
max-width: var(--blogWidth, 650px)
max-width: var(--contentSize, 650px)
margin-right: auto
margin-left: auto

> *[data-align="wide"]
max-width: var(--siteWidth, 1000px)
max-width: var(--wideSize, 1000px)


///// FILE
Expand Down Expand Up @@ -364,7 +364,7 @@ div.editor-styles-wrapper [data-type="core/heading"]
border-radius: 0

.wp-block-columns.is-style-h-wide-gap
column-gap: var(--wideGap)
column-gap: var(--blockWideGap)

///// CODE
Expand All @@ -385,16 +385,16 @@ pre.wp-block-code

///// SEPARATOR
[data-type="core/separator"]
[data-block]
padding-top: 0.5rem
padding-bottom: 0.5rem
.wp-block[data-type="core/separator"]
padding-top: 0.5rem
padding-bottom: 0.5rem

///// SPACER
.wp-block-spacer.is-style-h-negative
.wp-block-spacer
border: 1px dashed var(--gray)

.wp-block-spacer.is-style-h-negative
&::before
content: ""
background: url('./minus.svg') no-repeat center center
Expand All @@ -408,7 +408,7 @@ pre.wp-block-code
position: relative
border: none
padding: var(--blockGap)
padding-right: var(--wideGap)
padding-right: var(--blockWideGap)
box-shadow: var(--shadowThin)

&::before
Expand Down Expand Up @@ -448,7 +448,7 @@ pre.wp-block-code
--x2: 100%

position: relative
max-width: calc(var(--siteWidth) / 2 - var(--gap))
max-width: calc(var(--wideSize) / 2 - var(--gap))
transform: translateX(calc(-20% - var(--gap)))

border: none
Expand Down Expand Up @@ -490,7 +490,7 @@ pre.wp-block-code
// Center
&.has-text-align-center
transform: none
max-width: var(--blogWidth)
max-width: var(--contentSize)

cite
top: 0
Expand Down Expand Up @@ -532,7 +532,7 @@ pre.wp-block-code
// the top spacing should follow Group sizing
&.alignwide,
&.alignfull
--blockGap: var(--wideGap)
--blockGap: var(--blockWideGap)

li
clear: both
Expand Down

0 comments on commit 41a979e

Please sign in to comment.