-
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
Refactor zoom-out iframe scale #59618
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
computeIFrameScale( | ||
{ width: 1000, scale: 0.45 }, | ||
{ width: 400, scale: 0.9 }, | ||
contentWidth | ||
) |
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 think this reads better enough that you don't need a comment anymore.
Math.min( p0.y, p1.y ), | ||
twoPointLinearFn( p0, p1, x ), | ||
Math.max( p0.y, p1.y ) |
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.
Order of the points doesn't matter since this has a min and max now.
// TODO: `marginBottom` doesn't work in Firefox. We need another way to do this. | ||
iframeDocument.documentElement.style.marginBottom = `${ bottomFrameSize }px`; |
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 found a Firefox bug, but didn't think it was worth fixing here.
scale = 1, | ||
frameSize = 0, |
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.
These are the main things that needed to be restored since this component is exported from the package.
Size Change: +30 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
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.
Makes sense to me.
Co-authored-by: ajlende <ajlende@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org>
I think by moving the zoom out mode work to the |
Yes, but I wouldn't say it's as simple as reverting this change. What we're calling Once those changes are made the logic can move to wherever the new view exists. The logic isn't exported from the package so it would be a non-breaking change. But currently the visuals are tied up with the current EDIT: To clarify things a bit more... The solution to getting things working in the post editor is to make the zoom out view work similarly to the mobile/device views—it shouldn't be tied directly to the
|
What?
Refactors the changes from #59342 to maintain backwards compatibility with the old
IFrame
component and simplifies/documents some code.Why?
I noticed that we changed a public API in #59342. The API is
__unstable
, but I figure those components would follow the same rules for backwards compatibility as__experimental
since the addition ofprivateApis
.This also removes the need for the iframe to need to know about the
zoom-out
mode which I think is slightly better for code organization.How?
Testing Instructions
See that the scaling for zoom-out mode works as it did before.
Testing Instructions for Keyboard
Screenshots or screencast