-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix compatibility issues with shortcodes in blocks and Gutenberg 18.1+ #517
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
|
||
use function DevHub\is_parsed_post_type; | ||
|
||
add_filter( 'render_block', __NAMESPACE__ . '\filter_handbook_meta_link_block', 10, 2 ); | ||
add_filter( 'render_block_data', __NAMESPACE__ . '\modify_header_template_part' ); | ||
|
||
/** | ||
|
@@ -52,33 +51,6 @@ function get_block_content_by_home_url( $block_content, $replacement_home_url = | |
); | ||
} | ||
|
||
/** | ||
* Filters an article meta block and conditionally removes it. | ||
* | ||
* @param string $block_content | ||
* @param array $block | ||
* @return string | ||
*/ | ||
function filter_handbook_meta_link_block( $block_content, $block ) { | ||
if ( 'wporg/handbook-meta-link' === $block['blockName'] ) { | ||
// Not all handbooks come from GitHub. | ||
$local_handbooks = array( 'apis-handbook', 'plugin-handbook', 'theme-handbook' ); | ||
$post_type = get_post_type(); | ||
|
||
if ( in_array( $post_type, $local_handbooks ) ) { | ||
return ''; | ||
} | ||
|
||
// The block editor handbook doesn't have a changelog. | ||
// We only know it's the changelog because of the linkURL attribute. | ||
if ( 'blocks-handbook' === $post_type && '[article_changelog_link]' === $block['attrs']['linkURL'] ) { | ||
return ''; | ||
} | ||
Comment on lines
-72
to
-76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic replaced by the switch here |
||
} | ||
|
||
return $block_content; | ||
} | ||
|
||
/** | ||
* Update header template based on current query. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
source/wp-content/themes/wporg-developer-2023/patterns/article-meta-block-editor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Title: Article Meta for the Block Editor GitHub handbook | ||
* Slug: wporg-developer-2023/article-meta-block-editor | ||
* Inserter: no | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|40"},"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"},"blockGap":"var:preset|spacing|20"},"border":{"top":{"color":"var:preset|color|light-grey-1","width":"1px"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left","verticalAlignment":"top"},"className":"entry-meta"} --> | ||
<div class="wp-block-group entry-meta" style="border-top-color:var(--wp--preset--color--light-grey-1);border-top-width:1px;margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);padding-top:var(--wp--preset--spacing--40)"> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'First published', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700">[last_updated]</p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date {"displayType":"modified"} /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
|
||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'Edit article', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph {"className":"external-link"} --> | ||
<p class="external-link"><a href="[article_edit_link]"> | ||
<?php echo wp_kses_post( | ||
sprintf( | ||
/* translators: %s: article title */ | ||
__( 'Improve it on GitHub<span class="screen-reader-text">: %s</span>', 'wporg' ), | ||
'[article_title]' | ||
) | ||
); ?> | ||
</a></p> | ||
<!-- /wp:paragraph --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
</div> | ||
<!-- /wp:group --> |
78 changes: 78 additions & 0 deletions
78
source/wp-content/themes/wporg-developer-2023/patterns/article-meta-github.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* Title: Article Meta for GitHub handbooks | ||
* Slug: wporg-developer-2023/article-meta-github | ||
* Inserter: no | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|40"},"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"},"blockGap":"var:preset|spacing|20"},"border":{"top":{"color":"var:preset|color|light-grey-1","width":"1px"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left","verticalAlignment":"top"},"className":"entry-meta"} --> | ||
<div class="wp-block-group entry-meta" style="border-top-color:var(--wp--preset--color--light-grey-1);border-top-width:1px;margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);padding-top:var(--wp--preset--spacing--40)"> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'First published', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700">[last_updated]</p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:post-date {"displayType":"modified"} /--> | ||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
|
||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'Edit article', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph {"className":"external-link"} --> | ||
<p class="external-link"><a href="[article_edit_link]"> | ||
<?php echo wp_kses_post( | ||
sprintf( | ||
/* translators: %s: article title */ | ||
__( 'Improve it on GitHub<span class="screen-reader-text">: %s</span>', 'wporg' ), | ||
'[article_title]' | ||
) | ||
); ?> | ||
</a></p> | ||
<!-- /wp:paragraph --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"> | ||
|
||
<!-- wp:paragraph {"style":{"typography":{"fontStyle":"normal","fontWeight":"700"}}} --> | ||
<p style="font-style:normal;font-weight:700"><?php esc_html_e( 'Changelog', 'wporg' ); ?></p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph {"className":"external-link"} --> | ||
<p class="external-link"><a href="[article_changelog_link]"> | ||
<?php echo wp_kses_post( | ||
sprintf( | ||
/* translators: %s: article title */ | ||
__( 'See list of changes<span class="screen-reader-text">: %s</span>', 'wporg' ), | ||
'[article_title]' | ||
) | ||
); ?> | ||
</a></p> | ||
<!-- /wp:paragraph --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
</div> | ||
<!-- /wp:group --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
source/wp-content/themes/wporg-developer-2023/src/article-meta-date/block.json
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
source/wp-content/themes/wporg-developer-2023/src/article-meta-date/block.php
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
source/wp-content/themes/wporg-developer-2023/src/article-meta-date/index.js
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
source/wp-content/themes/wporg-developer-2023/templates/single-handbook-block-editor.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- wp:template-part {"slug":"header-alt","className":"has-display-contents"} /--> | ||
|
||
<!-- wp:template-part {"slug":"search-wide","className":"has-display-contents"} /--> | ||
|
||
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"right":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space"}}},"layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group alignfull" style="padding-right:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)"> | ||
|
||
<!-- wp:group {"align":"left","className":"has-three-columns","layout":{"type":"flex","flexWrap":"wrap","orientation":"vertical"}} --> | ||
<div class="wp-block-group alignleft has-three-columns"> | ||
|
||
<!-- wp:group {"tagName":"main","className":"alignwide","style":{"spacing":{"margin":{"top":"var:preset|spacing|20"}}}} --> | ||
<main class="wp-block-group alignwide" style="margin-top:var(--wp--preset--spacing--20)"> | ||
|
||
<!-- wp:group {"tagName":"article","style":{"spacing":{"margin":{"top":"0px"}}}} --> | ||
<article class="wp-block-group" style="margin-top:0px"> | ||
<!-- wp:post-title {"level":1,"style":{"spacing":{"margin":{"bottom":"40px"}}}} /--> | ||
|
||
<!-- wp:pattern {"slug":"wporg-developer-2023/article-sidebar"} /--> | ||
|
||
<!-- wp:post-content /--> | ||
|
||
<!-- wp:pattern {"slug":"wporg-developer-2023/article-meta-block-editor"} /--> | ||
|
||
<!-- wp:pattern {"slug":"wporg-developer-2023/handbook-pagination"} /--> | ||
|
||
</article> | ||
<!-- /wp:group --> | ||
|
||
</main> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:wporg/sidebar-container {"hasBackToTop":false,"inlineBreakpoint": "768px"} --> | ||
|
||
<!-- wp:wporg/chapter-list /--> | ||
|
||
<!-- /wp:wporg/sidebar-container --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
</div> | ||
<!-- /wp:group --> | ||
|
||
<!-- wp:template-part {"slug":"footer"} /--> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic replaced by reverting the removal of the
single-handbook-github.html
template