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 'pluginId' argument to emit function for non-null origin iframes #110

Open
LukeFinch opened this issue Jun 8, 2022 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@LukeFinch
Copy link

When using the event handlers in an iframe that points to another domain, you're required to specify the plugin id (or wildcard with '*')

Could the emit function accept an optional argument to specify the pluginId?
window.parent.postMessage( { pluginMessage: [name, ...args], pluginId: '*', }, '*' )

https://www.figma.com/plugin-docs/creating-ui/#non-null-origin-iframes

@LukeFinch LukeFinch changed the title Add 'pluginId' argument to emit function for non-null iframes Add 'pluginId' argument to emit function for non-null origin iframes Jun 9, 2022
@yuanqing yuanqing added the enhancement New feature or request label Jun 9, 2022
@yagudaev
Copy link

I think this has to be set globally.

// ui.ts
emit.configure({ nonNullOrigin: true })

It is also useful for some messages to be shared between plugins I suppose, where flexibility like this would be useful. I'd explicitly specify the pluginid for security reasons still.

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

No branches or pull requests

3 participants