-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Footnotes: fix published preview #53072
Conversation
return $prepared_post; | ||
} | ||
|
||
add_filter( 'rest_pre_insert_post', 'wp_check_post_test', 10, 2 ); |
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.
We should also think here if we should add this filter. The only issue this filter addresses is previewing footnotes of a published post when the only thing you do is updating the footnotes (meta), without touching the post content. This is a minor issue within a minor issue imo, so I'm tempted to leave this filter out, which makes the fix cleaner.
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.
I think this makes sense until we have a generalised solution for meta (WordPress/wordpress-develop#4859 / https://core.trac.wordpress.org/ticket/20564).
Size Change: +51 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 23a3f7e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5692941771
|
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.
I know it feels like we keep plugging holes with hooks, but this makes sense to me, doesn't feel too invasive, and indeed fixes the issues. Nice work.
return $prepared_post; | ||
} | ||
|
||
add_filter( 'rest_pre_insert_post', 'wp_check_post_test', 10, 2 ); |
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.
I think this makes sense until we have a generalised solution for meta (WordPress/wordpress-develop#4859 / https://core.trac.wordpress.org/ticket/20564).
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.
Thanks, the fix is working well for me! Code changes look good.
* Footnotes: fix published preview * remove var dump * Fix php lint * PHP lint * Address feedback * Add e2e test
I just cherry-picked this PR to the update/second-round-6-3-rc3 branch to get it included in the next release: bb9bc10 |
* Top toolbar: Fix issues with save button overlap, and plugin buttons (#53101) * Shorten the width of the top toolbar overlay and make doc title smaller. * Add a scrim and a margin to handle plugin buttons better. * Remove block tools back compat component schedule for deprecated in 6.3 (#53115) * Removes usage of BlockToolsBackCompat * Remove unwanted BlockTools from Nav sidebar * Footnotes/RichText: fix getRichTextValues for deeply nested blocks (#53034) * Defer to preceding handlers in command palette keyboard shortcut (#53001) * Image block: fix image size at wide and full width (#53184) * Fix regression with Edit site Navigate regions (#52940) * Make the navigabel region wrap the inert sidebar. * Adjust animation. * Fix not expanding pattern in page editor (#53169) --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> * Footnotes: fix published preview (#53072) * Footnotes: fix published preview * remove var dump * Fix php lint * PHP lint * Address feedback * Add e2e test * Footnotes: disable for synced patterns and prevent duplication for pages in site editor (#53003) * Initial commit: - Prevent footnote creation withing core/block - Only insert a footnote if one isn't found in the entity block list * Try grabbing controlled blocks from parent post content block * Cache `selectedClientId` Get hasParentCoreBlocks using separate useSelect call. * Rename hasParentCoreBlocks to isBlockWithinPattern Add comments * Removing while loop since we're already fetching the post content parent in the `getBlockParentsByBlockName` call above * Reinstating while loop because it can deal with nested blocks --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> * Footnotes: add missing _ in revision field filter (#53135) * Footnotes: add missing _ in revision field filter * Use correct hook name * Revert prefixing callback names * don't display BlockContextualToolbar at all in contentonly locking (#53110) * Render the footer conditionally in the global styles sidebar component so that any side effects from the footer wrapper are not rendered, e.g., styles and what not (#53204) Ensure that the precise bottom margin persists if the footer isn't rendered * Pattern: Add getBlockRootClientId call (#53206) --------- Co-authored-by: Joen A <1204802+jasmussen@users.noreply.github.com> Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: Mitchell Austin <mr.fye@oneandthesame.net> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Andrea Fercia <a.fercia@gmail.com> Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Andrei Draganescu <me@andreidraganescu.info>
What?
We should think hard if we really want to fix this imo minor issue. The only thing that is broken is previews for published posts.
Why?
How?
Adds filters to temporarily patch up the issues.
Testing Instructions
Publish a post with footnotes. Now change some footnotes and preview. Footnote changes should be in the preview. Change it again and preview to test if updating the revision works. Also test just updating footnotes without any post content.
Testing Instructions for Keyboard
Screenshots or screencast