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

Support pluginId option in postMessage for non-null origin iframes #7

Open
JustH opened this issue Jan 18, 2022 · 2 comments
Open

Support pluginId option in postMessage for non-null origin iframes #7

JustH opened this issue Jan 18, 2022 · 2 comments

Comments

@JustH
Copy link

JustH commented Jan 18, 2022

Figma introduced the ability to run UIs from a hosted non-null origin iframe https://www.figma.com/plugin-docs/creating-ui/#non-null-origin-iframes

This requires an additional pluginId field in the body of the message, and should also allow passing a url to the second argument of post message.

Proposal would be to update sendRaw to get passed the options from creating the API, and add an option field for "pluginId" and "targetOrigin" that user can pass in.

Happy to put together a PR, but wanted to talk through implementation as well. Another option would be just to make it a boolean in options, ie nonNull: true to have the api setup using figma.pluignId to retrieve the ID, and add 'figma.com' as targetOrigin.

Let me know if you have any thoughts. Thanks!

@mathieudutour
Copy link
Member

mathieudutour commented Jan 19, 2022

Tbh I haven't played with figma plugins in 2 years so I'm a bit out of touch (I don't even remember how this library works 😄 )

Happy to go with either of your options, I'll trust you :)

@kulmajaba
Copy link

I'm late to the party, but in case someone else stumbles upon this issue while looking for options:

I rewrote this library for hosted (non-null origin) plugins with some other configuration options. The new package is published as figma-plugin-api on npm: https://www.npmjs.com/package/figma-plugin-api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants