Use iframes in legacy widget preview.#14643
Conversation
|
What's the status of this one? Looks like it needs a rebase 🙂 |
|
Hi @noisysocks yes we need to rebase this PR. I don't think we should rebase it before #15801 is landed, otherwise we will waste effort. PR #15801 has higher priority. I marked this PR as blocked. |
|
Should we refresh this or close it and make an issue out of it? This is still something we need and a good idea! @adamziel 's idea was that depending on the min browser support we have we could use shadow DOM instead iframes. |
1fbde54 to
53651fa
Compare
|
Size Change: +248 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
| const HEIGHT_MARGIN = 20; | ||
| const [ height, setHeight ] = useState( DEFAULT_HEIGHT ); | ||
| const currentUrl = document.location.href; | ||
| const siteUrl = currentUrl.substr( 0, currentUrl.indexOf( 'wp-admin/' ) ); |
There was a problem hiding this comment.
Anyone aware of any better way of getting site's URL?
There was a problem hiding this comment.
It is available in the REST API index at wp-json.
There was a problem hiding this comment.
Actually there is another place in navigation editor that could also use this correction - let's address both in a separate PR
|
This PR is ready for review now cc @kevin940726 @draganescu @jorgefilipecosta |
draganescu
left a comment
There was a problem hiding this comment.
This renders good enough! ✔️
| } ); | ||
| return ( | ||
| <Disabled> | ||
| <FocusableIframe |
There was a problem hiding this comment.
Why is FocusableIframe used if the onFocus prop is not?



Description
This PR updates legacy widget block to use an iframe for the preview.
Using an iframe allows the preview to be more reliable as we can load frontend styles and scripts there.
How has this been tested?
I used the ultimate social media icons for testing purposes.
After
Before