-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor, document, and fix image block deprecations #52081
Conversation
Size Change: +155 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
|
||
export default deprecated; | ||
export default [ v5, v4, v3, v2, v1 ]; |
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.
Is this order right? I thought older deprecations came first?
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.
Nope, the newer ones should come first because they will be checked first. Having them in reverse chronological order means that you won't have to check every deprecation to confirm if it's a valid block, just the latest ones.
Flaky tests detected in 9f0c9b5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5404788986
|
@@ -6,7 +6,7 @@ | |||
"align": "left", | |||
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==", | |||
"alt": "", | |||
"caption": "" | |||
"caption": [] |
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 and v2 were incorrectly marked as strings when they were actually an array at the time.
default: '', | ||
}, | ||
caption: { | ||
type: 'array', |
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 and v2 were incorrectly marked as strings when the attributes at the time were actually an array.
* | ||
* @see https://github.com/WordPress/gutenberg/pull/4898 | ||
*/ | ||
const v1 = { |
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.
See https://github.com/WordPress/gutenberg/blob/fcd0b6355b5ac2a7bf24cb39e5a5ffecd09f4880/blocks/library/image/index.js for the definition at the time the v1 deprecation was added.
* | ||
* @see https://github.com/WordPress/gutenberg/pull/6496 | ||
*/ | ||
const v2 = { |
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.
See https://github.com/WordPress/gutenberg/blob/eabf6821c76d56bbbc00dd70f6d539b9199fbe67/core-blocks/image/index.js for the definition at the time the v2 deprecation was added.
* | ||
* @see https://github.com/WordPress/gutenberg/pull/7721 | ||
*/ | ||
const v3 = { |
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.
See https://github.com/WordPress/gutenberg/blob/f9e82d00668ec88a2cc355fb33e441f85393728e/packages/block-library/src/image/index.js for the definition at the time the v3 deprecation was added.
* | ||
* @see https://github.com/WordPress/gutenberg/pull/38657 | ||
*/ | ||
const v4 = { |
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.
See https://github.com/WordPress/gutenberg/blob/0ca97366d0e6c2020dde9015bace9d9c1c970a1d/packages/block-library/src/image/block.json for the definition at the time the v4 deprecation was added.
* | ||
* @see https://github.com/WordPress/gutenberg/pull/31366 | ||
*/ | ||
const v5 = { |
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.
See https://github.com/WordPress/gutenberg/blob/0bf26503cbea0f51f403107dcf6bcda856766b5f/packages/block-library/src/image/block.json for the definition at the time the v5 deprecation was added.
}, | ||
}, | ||
supports: { | ||
anchor: true, |
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 was incorrectly using the blockSupports
variable that had been modified. The only support at the time of this deprecation was anchor
.
}, | ||
height: { | ||
type: 'number', | ||
}, |
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.
There were additional properties added to the blockAttributes
variable that didn't exist when this block deprecation was added.
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 for all the hard work on this. Great job.
* Refactor, document, and fix image block deprecations * Fix v5 attributes & supports * Fix v1 & v2 deprecation tests * Rename deprecated test descriptions
Noting that in order to cherry-pick #52286 cleanly for 6.3, I had to add this PR to the release branch beforehand. It looks like a simple refactor so shouldn't cause any issues but please let me know if you have any concerns about it! |
* Post and Comment Template blocks: Change render_block_context priority to 1 (#52364) * Footnotes: fix lingering format boundary attr (#52439) * Footnotes: Fix incorrect anchor position in Firefox (#52425) * Scope CSS rules for the wp admin reset to js support only. (#52376) * Fix: Patterns & template parts: remove "apply globally" option from block settings (#52160) * Advanced styles panel: add an early return * Update index.js * Minor styling changes * Use array of features --------- Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> * make the body of the editor minimmum viewport height so that smaller contents maintain clickability (#52406) * Patterns: Add renaming, duplication, and deletion options (#52270) * Patterns: Update manage pattern links to go to site editor if available (#52403) * [Patterns] Separate sync status into a filter control (#52303) Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> Co-authored-by: Glen Davies <glen.davies@automattic.com> * Patterns: Add missing decoding entities processing in Patterns and Template/Parts pages (#52449) * Fix document title icon appearance (#52424) * Quote block: Add transform to paragraph (#51809) * Add ungroup transform as transform to p * Lint * Update test and snapshot. --------- Co-authored-by: Juan Aldasoro <juanfraa@gmail.com> * remove sidebar group descriptions (#52453) * Patterns: alternative grid layout to improve keyboard accessibility (#52357) * add sync tooltip (#52458) * Patterns: Update section heading levels (#52273) * Ensure that the unsaved title is not persisted when reopening the modal (#52473) * Iframe: avoid asset parsing & fix script localisation (#52405) * Iframe: avoid asset parsing & fix script localisation * Add e2e test for script localisation * Update descriptions (#52468) * Footnotes: show in inserter and placehold (#52445) * Footnotes: show in inserter and placehold * Fix placeholder block membrane; fix copy; add icon, label --------- Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> * Fix: Focus loss on navigation link label editing on Firefox. (#52428) * Update tooltip (#52465) * Refactor, document, and fix image block deprecations (#52081) * Refactor, document, and fix image block deprecations * Fix v5 attributes & supports * Fix v1 & v2 deprecation tests * Rename deprecated test descriptions * Respect custom aspect ratio (#52286) * add image width and height via css inline style, update width and height attrs to be string * keep width and height as attributes too, keep the attributes as numbers * updates image fixtures * RichText/Footnotes: make getRichTextValues work with InnerBlocks.Content (#52241) * RichText/Footnotes: make getRichTextValues work with InnerBlocks.Content --------- Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> * Footnotes: save numbering through the entity provider (#52423) * Footnotes: save numbering through the entity provider * Add sup so no styling is needed at all * Migrate old format * Restore old styles, fix nested attribute queries * Fix anchor selection * Migrate markup in entity provider instead * Fix tests * Fix typo * Fix comment --------- Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> * Revert "Post editor: Require confirmation before removing Footnotes (#52277)" (#52486) This reverts commit e6426ea. * List block: Fix selected type option (#52472) * Library - make pattern title clickable (#51898) * Use button inside title * Remove href * Preserve roving tab index * Fix link colors to match trunk $gray-600 * Remove redundant var * Amend colors as per review * remove old files again --------- Co-authored-by: scruffian <ben@scruffian.com> * remove status icon (#52457) * Rename block theme activation nonce variable. (#52398) --------- Co-authored-by: Bernie Reiter <96308+ockham@users.noreply.github.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: Andrea Fercia <a.fercia@gmail.com> Co-authored-by: Carolina Nymark <myazalea@hotmail.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Andrei Draganescu <me@andreidraganescu.info> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> Co-authored-by: Glen Davies <glen.davies@automattic.com> Co-authored-by: James Koster <james@jameskoster.co.uk> Co-authored-by: Rich Tabor <hi@richtabor.com> Co-authored-by: Juan Aldasoro <juanfraa@gmail.com> Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Co-authored-by: Jorge Costa <jorge.costa@developer.pt> Co-authored-by: Alex Lende <alex+github.com@lende.xyz> Co-authored-by: Héctor <27339341+priethor@users.noreply.github.com> Co-authored-by: Petter Walbø Johnsgård <petter@dekode.no> Co-authored-by: Dave Smith <getdavemail@gmail.com> Co-authored-by: scruffian <ben@scruffian.com> Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
Yeah, this was in preparation for those changes for easier reviews. It should all be good. |
* Refactor, document, and fix image block deprecations * Fix v5 attributes & supports * Fix v1 & v2 deprecation tests * Rename deprecated test descriptions
What?
Cleans up the image block deprecations and fixes some of the attributes/supports for older versions.
Why?
I found that some of the image block deprecations were wrong because block attributes and supports were being reused.
Naming the deprecations by version with documentation, I think, is easier to understand. It's also the recommended way to add deprecations in the documentation.
I figure it's better to just copy and paste the current state of the block without relying on variables so folks don't accidentally update them again in the future.
How?
v1
,v2
, etc.Testing Instructions
Should be covered by the image block fixtures tests, but you could also manually create a block for each version and see that they accurately get updated to the latest version.
Testing Instructions for Keyboard
N/A
Screenshots or screencast
N/A