[RNMobile] Embed block: Add undo/redo support#33218
Conversation
This will address the case when executing the undo action after setting an URL.
|
Size Change: +5 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
| } | ||
|
|
||
| const embedPreview = getEmbedPreview( attributesUrl ); | ||
| const embedPreview = Platform.select( { |
There was a problem hiding this comment.
Not a blocker, but instead of changing the embedPreview maybe can we use the url that's already passed in to EmbedPreview instead of preview?
There was a problem hiding this comment.
The idea here was to mock the embed preview to imitate the same flow as it would do after fetching a real preview. The important part is to generate a valid value for populating the preview variable, otherwise, the embed preview component is not rendered.
gutenberg/packages/block-library/src/embed/edit.js
Lines 98 to 101 in de3b53f
gutenberg/packages/block-library/src/embed/edit.js
Lines 216 to 217 in de3b53f
ceyhun
left a comment
There was a problem hiding this comment.
Tested on iOS & Android simulators. LGTM 🎉
|
|
I've found the culprit of the issue, actually looks like it's a bug that is also happening in the web version, I've just filed an issue that I plan to resolve soon: EDIT: I implemented the fix in this PR, feel free to take a look, thanks 🙇 ! |
|
As mentioned in the previous comment, the issue will be fixed in a separate PR, so we can merge this 🎊 . |
* Use URL as embed preview in native version * Update styles of embed block * Display URL in embed preview * Rename style in embed preview * Submit embed URL even when the value didn't change This will address the case when executing the undo action after setting an URL.
gutenberg-mobilePR: wordpress-mobile/gutenberg-mobile#3700Description
This PR addresses the undo/redo case of the embed block, for this purpose I modified the preview getter for the native version so now it uses the URL as the content to preview. It's just a temporary workaround to test the embed block functionality until we provide a fallback UI for the first version of this block.
Additionally, I made a small refactor on the native styles and adopt the BEM naming convention.
How has this been tested?
Undo and edit
ADD LINKmessage within the block)Undo/redo
ADD LINKmessage within the block)Screenshots
embed-block-undo-redo.mp4
Types of changes
New feature
Checklist:
*.native.jsfiles for terms that need renaming or removal).