Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wp upgrade/5.7 base compatibility #329

Draft
wants to merge 110 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
1a5cffd
fixed bu blocks compatibility issue on wp 5.7
sksaju Mar 9, 2023
802c0b3
fixed stats block issue on wp 5.7
sksaju Mar 13, 2023
cb09d70
refacor edict component for listcle block
sksaju Mar 17, 2023
77c3ec1
fixed background component
sksaju Mar 18, 2023
c09bd5f
fixed drawer block issue
sksaju Mar 18, 2023
147da95
fixed ledin block
sksaju Mar 18, 2023
b063874
fixed modal block
sksaju Mar 18, 2023
ea49255
fixed pullquote block issue
sksaju Mar 18, 2023
01c390a
fixed sharetools component issue
sksaju Mar 18, 2023
adb41b1
fix issue with Aside Block classnames not output
acketon Mar 23, 2023
90e61fa
rebuild
acketon Mar 23, 2023
d862ffb
Merge pull request #318 from bu-ist/fix/blocks-dont-appear-in-wp-5.7
acketon Mar 24, 2023
47aaeeb
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/stats-block…
acketon Mar 24, 2023
511a15e
rebuild
acketon Mar 24, 2023
14d56be
Merge pull request #327 from bu-ist/fix/invalid-hook-call-error-invar…
acketon Mar 24, 2023
bd18af7
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/stats-block…
acketon Mar 24, 2023
8bbad3c
rebuild
acketon Mar 24, 2023
df91776
Merge pull request #319 from bu-ist/fix/stats-block-issue-on-wp5.7
acketon Mar 24, 2023
b4660f3
fixed block not registered console error
sksaju Mar 30, 2023
d3214fc
Merge pull request #333 from bu-ist/fix/block-not-registered-console-…
acketon Mar 31, 2023
7c76dce
fix layout by adding a shim div to force blocks to have height via pa…
acketon Mar 31, 2023
cab50be
rebuild
acketon Mar 31, 2023
488bb9a
fixes #331 <URLInput> fields lack a border in 5.7
acketon Mar 31, 2023
1a05446
Merge pull request #335 from bu-ist/fix/331-url-input-field-styles-in…
acketon Mar 31, 2023
c6a9d48
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/325-photo-e…
acketon Mar 31, 2023
f292fe0
Merge pull request #334 from bu-ist/fix/325-photo-essay-block-styles-…
acketon Mar 31, 2023
bcee945
add sample block
acketon Jun 6, 2023
87ba7bf
sample block
acketon Jun 6, 2023
b6e2f91
convert buniverse block to API 2
acketon Jun 6, 2023
73e755b
update buniverse to block API 2
acketon Jun 6, 2023
afa5910
rebuild
acketon Jun 6, 2023
c1faaab
remove sample block
acketon Jun 6, 2023
7089083
update comment
acketon Jun 6, 2023
0ec302f
update description of block
acketon Jun 6, 2023
4b97b09
convert edit class to edit function as `useBlockProps` requires a fun…
acketon Jun 7, 2023
dbb3760
update block to api 2 and `useBlockProps`
acketon Jun 7, 2023
a2bad42
rebuild
acketon Jun 7, 2023
c76fe3e
adjust editor styles to fix floating issues
acketon Jun 7, 2023
dd20180
update button block to blockapi 2 and fix alignment issues
acketon Jun 7, 2023
3f5ff40
formatting
acketon Jun 7, 2023
38726b6
fix indenting
acketon Jun 7, 2023
3e2fcf5
update to blockapi2
acketon Jun 12, 2023
482730f
fix broken center alignment
acketon Jun 12, 2023
f91f675
upgrade to blockapi 2 and clean up styling for 5.7 in the editor
acketon Jun 12, 2023
3623117
rebuild
acketon Jun 12, 2023
0005cf2
update
acketon Jun 12, 2023
933bb0e
update to block api 2 and fix drawer block alignment styles in the ed…
acketon Jun 14, 2023
1c053e3
increase specificity to fix BU Today issues
acketon Jun 14, 2023
f6b710d
update modal block to block api 2 and fix alignment styles
acketon Jun 14, 2023
d843cf8
update to blockAPI 2 and fix alignment issues
acketon Jun 15, 2023
14be96d
update
acketon Jun 15, 2023
a17caf5
remove
acketon Jun 15, 2023
4dc91da
update
acketon Jun 15, 2023
d482bd0
fix default color of stat donut chart svg fill color
acketon Jun 16, 2023
2bd24ef
update to block api 2 and fix alignment issues
acketon Jun 16, 2023
fa40366
rebuild
acketon Jun 16, 2023
b40975d
rebuild
acketon Jun 16, 2023
e038c2b
update default light & dark color values to work with WP 5.7
acketon Jul 27, 2023
35b70fb
rebuild
acketon Jul 27, 2023
07d0ade
update
acketon Jul 27, 2023
a3d5030
Merge pull request #350 from bu-ist/fix/adjust-default-colors-to-avoi…
acketon Jul 28, 2023
b79a6fc
updates
acketon Jul 28, 2023
6e645a4
update
acketon Jul 28, 2023
a94e906
update
acketon Jul 28, 2023
fdc5a7f
update
acketon Jul 28, 2023
ae2358d
update
acketon Jul 28, 2023
9d0ac32
update
acketon Jul 28, 2023
304687f
update
acketon Jul 28, 2023
1b9c578
update
acketon Jul 28, 2023
f716419
Merge pull request #339 from bu-ist/fix/blockapi2-update-buniverse-block
acketon Jul 31, 2023
e51704d
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/blockapi2-u…
acketon Jul 31, 2023
974d7be
Merge pull request #343 from bu-ist/fix/blockapi2-update-button-block
acketon Jul 31, 2023
31da0f7
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/blockapi2-u…
acketon Jul 31, 2023
1d89c3e
Merge pull request #342 from bu-ist/fix/blockapi2-update-aside-block
acketon Jul 31, 2023
ecf3fb6
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/blockapi2-u…
acketon Jul 31, 2023
51bacc2
Merge pull request #345 from bu-ist/fix/blockapi2-update-collapsible-…
acketon Jul 31, 2023
971e0ae
update
acketon Jul 31, 2023
57badfe
Merge branch 'wp-upgrade/5.7-base-compatibility' of https://github.co…
acketon Jul 31, 2023
3efb417
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/blockapi2-u…
acketon Jul 31, 2023
5be9d86
Merge pull request #346 from bu-ist/fix/blockapi2-update-drawer-block
acketon Jul 31, 2023
088e38e
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/blockapi2-u…
acketon Jul 31, 2023
673aeb9
Merge pull request #347 from bu-ist/fix/blockapi2-update-modal-block
acketon Jul 31, 2023
a060816
update
acketon Jul 31, 2023
b2d90a2
Merge branch 'wp-upgrade/5.7-base-compatibility' into fix/blockapi2-u…
acketon Jul 31, 2023
12c1869
Merge pull request #348 from bu-ist/fix/blockapi2-update-stats-block
acketon Jul 31, 2023
75eacb4
quick, terrible fix to address broken styles when block is floated an…
acketon Aug 2, 2023
274afb4
rebuild
acketon Aug 2, 2023
79dda52
Merge pull request #351 from bu-ist/fix/5.7-drawer-floated-default-wi…
acketon Aug 2, 2023
1f0f085
rebuild
acketon Aug 21, 2023
f00d09d
fix styles targeting in 5.7 to restore click-to-tweet styles
acketon Aug 22, 2023
8eb8df9
color and bug fixes to make it easier for child themes to override
acketon Aug 22, 2023
777d947
rebuild
acketon Aug 22, 2023
4c1748d
rebuild
acketon Aug 22, 2023
0210fce
Merge pull request #352 from bu-ist/bug/5.7-fix-tweet-highlight-styli…
acketon Aug 22, 2023
b2aa053
add deprecated file and version
acketon Aug 22, 2023
f2c33cd
build
acketon Aug 22, 2023
972089b
only output markup if there is content for that. Eliminates empty Hea…
acketon Aug 23, 2023
a3cf979
disable generated anchors in Headline block
acketon Aug 23, 2023
c5635a1
update
acketon Aug 23, 2023
1ae2d08
Merge pull request #353 from bu-ist/bug/listicle-empty-markup
acketon Aug 23, 2023
b93c61b
Merge pull request #354 from bu-ist/bug/315-disable-headline-block-ge…
acketon Aug 23, 2023
2d727a3
initial prototype
acketon Aug 25, 2023
4f8adf0
cleanup
acketon Aug 25, 2023
1ad69b3
update
acketon Aug 25, 2023
f93b8e6
remove test code
acketon Aug 25, 2023
750a5f5
rename
acketon Aug 25, 2023
16de4f1
fix bug in param name
acketon Aug 25, 2023
84a763f
fix bug where you can’t enter a space into the button since button el…
acketon Jun 7, 2024
948dd18
fix bug where id is not generated if user turns on AutoID’s but doesn…
acketon Jun 7, 2024
5b368cf
Merge pull request #356 from bu-ist/bug/355-wp5.7-collapsible-block-g…
acketon Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# Changelog

## Unreleased
- Fix #315 - disable autogenerated Anchor ID's in the Headline Block
- Click to Tweet style fixes. Closes #320. Updates the styles to restore the styling for the Click to Tweet feature on Paragraph blocks.
- Stats Block:
- Update to block api 2 and fix alignment issues for WP 5.7
- Change default fill / stroke color of the stats block svg donut chart so it isn't white on white background.
- Editor Styles: Add CSS4 Variable for theme styling: `--bu_blocks-block-bu-stats-editor-floated-width`
- Frontend Styles: Fix issue where stat bar is invisible in themes by default using light/dark color themes. The SVG circle paths needed darker colors so they are visible on a white background like Responsive Framework defaults to.
- Modal Block 5.7 updates:
- Update Block to Block API 2 for 5.7 compatibility
- Change how modalHasSelectedBlock value is determined and move from getEditWrapperProps into the edit function as it wasn't working with Block API 2.
- Editor Styles: adjust editor styles and selectors to match new markup of Block API 2
- Editor Styles: add a new CSS4 Variable `--bu_blocks-block-bu-modal-editor-floated-width` for theme styling
- Related Stories Block 5.7 updates:
- Update block to Block API 2 and fix alignment issues.
- Related Stories Block: invert "Manual Selection" to true for new blocks since most sites don't use YARPP for the automatic related posts feature and this makes the default state of the block appear functional instead of broken without YARPP.
- Refactor how the `isCardStyle` is determined as `className` prop is sometimes undefined in Block API 2 when the block loads.
- Editor Styles: remove a clearfix style on an `:after` psuedo element that the Block Editor needs for it's own core styling.
- Drawer Block 5.7 updates:
- Update Block to Block API 2 for 5.7 compatibility
- Editor Styles: adjust editor styles and selectors to match new markup of Block API 2
- Collapsible Block 5.7 updates:
- Update Block to Block API 2 for 5.7 compatibility
- Adjust how `is-style-preview` class is checked as `props.attributes.classname` is sometimes undefined.
- Editor Styles: adjust editor styles and selectors to match new markup of Block API 2
- Collapsible Control Block:
- Update to Block API 2, styling fixes for 5.7, fix center aligned styles.
- add Editor.scss and Style.scss files that were missing and better styling for the block
- Aside Block 5.7 updates:
- Update Block to Block API 2 for 5.7 compatibility
- It was necessary to refactor the edit function from a class structure to a function component as useBlockProps and Block API 2 won't work with class based components (https://make.wordpress.org/core/2020/11/18/block-api-version-2/#comment-40855)
- Editor Styles: Add CSS4 Variable `--bu_blocks-block-bu-aside-editor-floated-width` so themes can adjust floated width easily
- Editor Styles: Adjust how align left/right styles in the editor are targeted as Block API 2 markup is different from Block API 1 and the previous selectors no longer work.
- Button Block 5.7 updates:
- Update Block to Block API 2 for 5.7 compatibility
- Adjust editor markup to add a proper classname to the wrapping `<p>` tag around the button itself.
- This block still has issues and conflicts with the core button block due to clashing block names. A later fix is needed to address that and carefully update it.
- Editor Styles: adjust editor styles to match new markup classnames
- 5.7 fixes: change default light & dark color values to be slightly off color to avoid conflicts with new `white` and `black` colors. See: https://github.com/WordPress/gutenberg/issues/9357
- BUniverse Block 5.7 updates:
- Update Buniverse Block to Block API 2 for 5.7 compatibility
- Move TextControl for video id from editor to sidebar to aid in styling block when floated
- Editor Styles: Add CSS4 Variable `--bu_blocks-block-bu-buniverse-editor-floated-width` so themes can adjust floated width easily



## 0.3.7
- Photo Essay: add tall 2 by 2 image layout and full frame single layouts for photo essay
Expand Down
980 changes: 979 additions & 1 deletion dist/blocks.build.js

Large diffs are not rendered by default.

41,676 changes: 41,656 additions & 20 deletions dist/blocks.editor.build.css

Large diffs are not rendered by default.

42,915 changes: 42,896 additions & 19 deletions dist/blocks.style.build.css

Large diffs are not rendered by default.

42,915 changes: 42,896 additions & 19 deletions docs/blocks.style.build.css

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions package-lock.json

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

35 changes: 26 additions & 9 deletions src/block-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,41 @@
* @author Boston University: Interactive Design <[email protected]>
*/

const { select } = wp.data;
const { applyFilters } = wp.hooks;
const { registerPlugin } = wp.plugins;
const { getBlockTypes } = wp.blocks;

/**
* Disables support for the blocks in this plugin for all but the `post` and `page` post types.
*
* Runs once the dom is loaded in order to avoid a race condition.
*
* @returns {null} Nothing to return
*/
wp.domReady( function() {

const UnregisterBlocks = () => {
// Bail if the default support has been filtered off.
if ( wp.hooks.applyFilters( 'buBlocks.blockSupport.disableDefault', false ) ) {
return;
if ( applyFilters( 'buBlocks.blockSupport.disableDefault', false ) ) {
return null;
}

// Create a filterable array of post types to restrict the blocks to.
const postTypes = wp.hooks.applyFilters( 'buBlocks.blockSupport.postTypes', [ 'post', 'page' ] );
const postTypes = applyFilters( 'buBlocks.blockSupport.postTypes', [ 'post', 'page' ] );

// Get the current post type.
const currentPostType = wp.data.select( 'core/editor' ).getCurrentPost().type;
const currentPostType = select( 'core/editor' ).getCurrentPostType();

// Bail if the current post type is in the array of post types to restrict the blocks to.
if ( postTypes.includes( currentPostType ) ) {
return;
return null;
}

// A filterable list of the blocks registered by this plugin.
// Alternatively, a setting added to each block could be used
// to filter the list of all blocks. For example:
// const blocks = select( 'core/blocks' ).getBlockTypes();
// const buBlocks = blocks.filter( block => block.plugin === 'bu-blocks' );
const buBlocks = wp.hooks.applyFilters( 'buBlocks.blockSupport.blocks', [
const buBlocks = applyFilters( 'buBlocks.blockSupport.blocks', [
'editorial/aside',
'editorial-preset/aside',
'bu/buniverse',
Expand All @@ -52,8 +58,19 @@ wp.domReady( function() {
'bu/stats',
] );

const registeredBlocks = getBlockTypes().map( item => item.name );

// Unregister the blocks.
buBlocks.forEach( block => {
wp.blocks.unregisterBlockType( block );
if ( registeredBlocks.includes( block ) ) {
wp.blocks.unregisterBlockType( block );
}
} );

// Return null to avoid rendering anything.
return null;
};

registerPlugin( 'unregister-bu-blocks', {
render: UnregisterBlocks,
} );
9 changes: 7 additions & 2 deletions src/blocks/aside/aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ const { registerBlockType } = wp.blocks;
const {
getColorClassName,
InnerBlocks,
useBlockProps,
} = ( 'undefined' === typeof wp.blockEditor ) ? wp.editor : wp.blockEditor;

// Internal dependencies.
import edit from './edit.js';

// Register the block.
const asideBlock = registerBlockType( 'editorial/aside', {

apiVersion: 2,
title: __( 'Aside' ),
description: __( 'Add an aside with related information. Accepts image, headline, paragraph, and button blocks as children.' ),
icon: blockIcons('aside'),
Expand All @@ -53,8 +54,12 @@ const asideBlock = registerBlockType( 'editorial/aside', {
{ [ getColorClassName( 'background', themeColor ) ]: getColorClassName( 'background', themeColor ) }
);

const blockProps = useBlockProps.save( {
className: classes,
});

return (
<aside className={ classes }>
<aside {...blockProps}>
<InnerBlocks.Content />
</aside>
);
Expand Down
17 changes: 9 additions & 8 deletions src/blocks/aside/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,28 @@ const {
InspectorControls,
PanelColorSettings,
withColors,
useBlockProps
} = ( 'undefined' === typeof wp.blockEditor ) ? wp.editor : wp.blockEditor;

class BUAsideEdit extends Component {
constructor() {
super( ...arguments );
}
const BUAsideEdit = ( props ) => {

render() {
const {
attributes,
className,
themeColor,
setThemeColor,
presetTemplate,
} = this.props;
} = props;

const classes = classnames(
className,
{ [ `has-${themeColor.slug}-background` ]: themeColor.slug }
);

const blockProps = useBlockProps( {
className: classes,
});

return (
<Fragment>
<InspectorControls>
Expand All @@ -54,15 +56,14 @@ class BUAsideEdit extends Component {
] }
/>
</InspectorControls>
<aside className={ classes }>
<aside {...blockProps}>
<InnerBlocks
allowedBlocks={ allowedBlocks() }
template={ presetTemplate }
/>
</aside>
</Fragment>
);
}
}

export default compose( [
Expand Down
64 changes: 41 additions & 23 deletions src/blocks/aside/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,56 @@
* which makes it higher in priority.
*/

.editor-block-list__block[data-align="right"][data-type="editorial/aside"] > .editor-block-list__block-edit,
.editor-block-list__block[data-align="left"][data-type="editorial/aside"] > .editor-block-list__block-edit,
.editor-block-list__block[data-align="right"][data-type="editorial-preset/aside"] > .editor-block-list__block-edit,
.editor-block-list__block[data-align="left"][data-type="editorial-preset/aside"] > .editor-block-list__block-edit,
.block-editor-block-list__block[data-align="right"][data-type="editorial/aside"] > .block-editor-block-list__block-edit,
.block-editor-block-list__block[data-align="left"][data-type="editorial/aside"] > .block-editor-block-list__block-edit,
.block-editor-block-list__block[data-align="right"][data-type="editorial-preset/aside"] > .block-editor-block-list__block-edit,
.block-editor-block-list__block[data-align="left"][data-type="editorial-preset/aside"] > .block-editor-block-list__block-edit {
width: calc(100% / 3);
/**
* Define CSS variables to allow child themes
* to alter these values easily if needed.
**/
:root {
--bu_blocks-block-bu-aside-editor-floated-width: calc(100% / 3);
}

div[data-type="editorial/aside"] .wp-block-editorial-aside {
// Remove default float left on Aside from frontend styles.
aside[data-type="editorial/aside"].wp-block-editorial-aside {
float: none;
}

.editor-block-list__block[data-align="right"] .wp-block-editorial-aside .editor-block-list__block-edit,
.editor-block-list__block[data-align="left"] .wp-block-editorial-aside .editor-block-list__block-edit,
.block-editor-block-list__block[data-align="right"] .wp-block-editorial-aside .block-editor-block-list__block-edit,
.block-editor-block-list__block[data-align="left"] .wp-block-editorial-aside .block-editor-block-list__block-edit {
float: none;
margin-left: 0;
margin-right: 0;
[data-align="right"],
[data-align="left"] {
> [data-type="editorial/aside"].wp-block-editorial-aside {
width: var(--bu_blocks-block-bu-aside-editor-floated-width);
}
}

[data-align="right"] {
> [data-type="editorial/aside"].wp-block-editorial-aside {
float: right;
}
}

.editor-block-list__block[data-align="left"] .wp-block-editorial-aside .editor-block-list__block,
.editor-block-list__block[data-align="right"] .wp-block-editorial-aside .editor-block-list__block,
.block-editor-block-list__block[data-align="left"] .wp-block-editorial-aside .block-editor-block-list__block,
.block-editor-block-list__block[data-align="right"] .wp-block-editorial-aside .block-editor-block-list__block {
padding-left: 16px;
padding-right: 16px;
[data-align="left"] {
> [data-type="editorial/aside"].wp-block-editorial-aside {
float: left;
}
}


// .editor-block-list__block[data-align="right"] .wp-block-editorial-aside .editor-block-list__block-edit,
// .editor-block-list__block[data-align="left"] .wp-block-editorial-aside .editor-block-list__block-edit,
// .block-editor-block-list__block[data-align="right"] .wp-block-editorial-aside .block-editor-block-list__block-edit,
// .block-editor-block-list__block[data-align="left"] .wp-block-editorial-aside .block-editor-block-list__block-edit {
// float: none;
// margin-left: 0;
// margin-right: 0;
// }

// .editor-block-list__block[data-align="left"] .wp-block-editorial-aside .editor-block-list__block,
// .editor-block-list__block[data-align="right"] .wp-block-editorial-aside .editor-block-list__block,
// .block-editor-block-list__block[data-align="left"] .wp-block-editorial-aside .block-editor-block-list__block,
// .block-editor-block-list__block[data-align="right"] .wp-block-editorial-aside .block-editor-block-list__block {
// padding-left: 16px;
// padding-right: 16px;
// }

.wp-block-editorial-aside.has-dark-background {
.wp-block-heading h2 {
color: $color-grayscale-f;
Expand Down
Loading