Support pluginId option in postMessage for non-null origin iframes
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!
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 :)
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