Drag svg from Figma plugin and drop to Figma file.
Like they did https://www.figma.com/community/plugin/884531262241804656/Drag-%26-Drop
I’m wanna develop this type of feature in my plugin.
Drag svg from Figma plugin and drop to Figma file.
Like they did https://www.figma.com/community/plugin/884531262241804656/Drag-%26-Drop
I’m wanna develop this type of feature in my plugin.
Is this a question? 🤔
sorry yeah
Can you explain further? This depends heavily on the plugin that you’re using.
Please look back at my question again. And actually, Figma not allowing to create SVG Instance directly.
I got this error “‘postMessage’ on ‘Window’: SVGSVGElement object could not be cloned.”
in my plugin.
Use the “Drop” event in code.js
.
Check out the following official examples:
Since you are using Typescript, you need to respect its syntax and also return false
:
figma.on('drop', (event: DropEvent) => {
// Your code
return false
})
Also add a condition for line 9 (on which you supposedly have an error) as in the example I gave you a link to:
github.comThank you so much for your help. It’s working now. But one typescript error still showing
if (node.appendChild) {
node.appendChild(newNode);
}
Showing this “Property ‘appendChild’ does not exist on type 'DocumentNode | PageNode | SliceNode | FrameNode… etc”
This condition is just written in order to bypass the error you indicated.
Okay thank you
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.