-
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
Quote v2: add migration #39844
Quote v2: add migration #39844
Conversation
By doing this, we are also deregistering it for the deprecations.
* @param {string} blockName The name of the block to be registered. | ||
* @return {Array} New settings. | ||
*/ | ||
function registerQuoteV2Attributes( blockSettings, blockName ) { |
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.
Had to remove the filter because it was affecting the deprecation, preventing it from having the value
attribute to migrate. The result of this change is that when v2 is enabled, the value
attribute will still be present.
We need to remove the attribute from the block.json
when v2 becomes the default (see).
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 need to remove the attribute from the block.json when v2 becomes the default
I don't think we can remove it until the useMigrateOnLoad
is removed.
setAttributes, | ||
isSelected, | ||
insertBlocksAfter, | ||
clientId, | ||
} ) { | ||
const { citation } = attributes; | ||
|
||
useMigrateOnLoad( attributes, clientId ); |
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 is using the same technique than the list v2 uses https://github.com/WordPress/gutenberg/pull/39799/files#diff-8ca208404bc35d0549ee68bfdb5c87a0d1fa101ddcfad1095d9a3c0e171b0272
Size Change: -55 B (0%) Total Size: 1.22 MB
ℹ️ View Unchanged
|
@youknowriad @ellatrix is there anything else to do here? |
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've noticed that any format (bold) in paragraphs is removed after conversion.
The same happens when transforming from pullquote to quote. |
@@ -29,7 +29,7 @@ const transforms = { | |||
query: { | |||
content: { | |||
type: 'string', | |||
source: 'text', |
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've commited this here because it's the same fix I did for the migration. Thought it doesn't deserve a separate PR.
Co-authored-by: Riad Benguella <[email protected]>
@youknowriad the formats are now working. I've also pushed the same fix for the Pullquote to Quote transform in this PR (f3cac07). |
Co-authored-by: Riad Benguella <[email protected]>
Part of #15486
Related #25892
What?
This PR adds the migration from quote v1 to quote v2.
Why?
We need to support existing content.
How?
Testing Instructions
Verify that the deprecation works:
to-quote-v2.mp4
Verify that templates provided to CPT are migrated:
gutenberg.php
:template-quote.mp4