-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat(env): support iframe with relative window/document #8897
Conversation
Build Stats
|
I m mostly onboard apart naming. getWindow at this point is the window where fabric lives and would need to reflect that. Instatiating a fabric element across an iframe seems so weird to me and dangerous. Would that work? Should those be method of the canvas rather than utilities? |
good point |
|
Also let's add disclaimers about cross origin work probably being impossible. An env per canvas seems to much. |
this is why I think we should have an env scoped to canvas. That way when everything belongs to same domain. |
I think best to do it in 2 steps. This PR as is and another one for the scoped env concept. |
I think this is good enough as a first step |
https://codesandbox.io/p/sandbox/fabric-nextjs-sandbox-forked-sy6726 |
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.
Naming is left
I would like to add tests but I don't know how to tests that an iframe receives events etc. |
We can do later with that new test suite probably. I didn't have time to write proper tests but seems exactly useful for those kind of high level interactions |
Do not open follow up prs for this concept because if this works, all we need is just docs. My initial comment still stand
getWindow => getFabricWindow |
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.
would like to see a different naming scheme that makes the function apart.
The difference between elementDocument ( i think intented as element's document ) and the documentElement ( the root node of the document ) is too subtle
renamed used for instead of for/of |
This reverts commit a180281.
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.
renamed, noisy diff
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 am pretty sure this is not correct
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.
but it is outdated anyways.
What is it?
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 don't remember.
Is probably some primitive way to fire events before JSDOM or maybe we still use it.
Motivation
closes #4805
Description
Changes the event targets to the window/document containing the canvas element of the fabric canvas so it should work inside multiple iframes
Changes
Gist
In Action
https://codesandbox.io/p/sandbox/fabric-nextjs-sandbox-forked-6pkg55
With images: https://codesandbox.io/p/sandbox/fabric-nextjs-sandbox-forked-7y55kw?file=%2FREADME.md
Parcel.Sandbox.-.Google.Chrome.2023-05-07.20-53-06_Trim.mp4