-
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
[RNMobile] Add convert to regular blocks action to Reusable block #31012
[RNMobile] Add convert to regular blocks action to Reusable block #31012
Conversation
Size Change: +1.17 kB (0%) Total Size: 1.47 MB
ℹ️ View Unchanged
|
sprintf( | ||
/* translators: %s: name of the reusable block */ | ||
__( '%s converted to regular blocks' ), | ||
reusableBlock?.title?.raw || blockTitle |
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.
If the reusable block's title is not defined it will fallback to "Reusable block".
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 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 created the fix in this PR.
clearSelectedBlock(); | ||
// Convert action is executed at the end of the current JavaScript execution block | ||
// to prevent issues related to undo/redo actions. | ||
setImmediate( () => |
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 tested these changes in a test branch (rnmobile/try/reusable-block-feature
) where it also includes the changes of Update Reusable block to use the inner block PR and I spotted that on Android the following flow wasn't working:
- Convert a reusable block to regular blocks
- Undo the changes
- Convert again the same reusable block to regular blocks
- The conversion is not being done ❌
For this reason, I decided to add the following changes to fix it:
- Unselect the block to prevent potential issues when the reusable block is replaced by the regular blocks.
- Execute the convert action at the end of the current JS execution block by using
setImmediate
. I tried to investigate the root cause of this issue but I didn't manage to find it. As far as I checked after the convert action is executed, calling the selectorgetBlock
with the reusable block's client id always returnsnull
🤷♂️ .
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.
LGTM! Followed the test cases on both iOS and Android.
gutenberg-mobile
PR: wordpress-mobile/gutenberg-mobile#3397Description
An action for converting a reusable block to regular blocks has been added in the block actions menu.
NOTE: Reusable block is only available in development mode.
How has this been tested?
Undo/redo
It's important that we verify that the undo/redo actions work as expected when converting to regular blocks.
Screenshots
reusable-block-convert-regular-blocks.mp4
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).