Skip to content
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

Add support for running an srcDoc style iFrame #410

Merged
merged 7 commits into from
Sep 23, 2022

Conversation

glendaviesnz
Copy link
Contributor

As noted here, there are some instances where iFraming react-easy-crop causes the styles and events to be lost as they are always attached to the global window and document.

This PR changes the Cropper componentDidMount method to instead get the document and window references from the current containerRef if it is defined.

The PR also adds an iFramed version of the component to the example page to allow for testing. This can be accessed via http://localhost:3001/?iframed=true.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 22, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 996534c:

Sandbox Source
react-easy-crop Configuration

examples/src/iframe.tsx Outdated Show resolved Hide resolved
@glendaviesnz
Copy link
Contributor Author

@ValentinH have just left this as draft for now so you can check if you are happy with the general approach or not - if you are I will sort the remaining type issues and add some extra tests before getting a full review.

@ValentinH ValentinH marked this pull request as ready for review September 22, 2022 05:32
@ValentinH ValentinH marked this pull request as draft September 22, 2022 05:32
@ValentinH ValentinH added bug Something isn't working patch Increment the patch version when merged labels Sep 22, 2022
@glendaviesnz glendaviesnz marked this pull request as ready for review September 23, 2022 00:08
@glendaviesnz
Copy link
Contributor Author

@ValentinH I think it should be good to go. All the existing e2e tests pass with the change in place, and I added one additional test to make sure the styles get applied to the iframe doc - let me know if you think we need any additional tests on top of this.

@ValentinH
Copy link
Owner

All good!

@ValentinH ValentinH merged commit 6cc485a into ValentinH:main Sep 23, 2022
@github-actions
Copy link

🚀 PR was released in v4.5.1 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Sep 23, 2022
@glendaviesnz
Copy link
Contributor Author

Big thanks for the quick turnaround on this @ValentinH!

@glendaviesnz glendaviesnz deleted the add/iframe-support branch September 26, 2022 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch Increment the patch version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants