-
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone aware of any better way of getting site's URL?
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.
It is available in the REST API index at wp-json
.
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.
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 |
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 renders good enough! ✔️
} ); | ||
return ( | ||
<Disabled> | ||
<FocusableIframe |
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.
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