Need NODES (all) save to one IMAGE
I know, that i can group nodes, and group export to image…
But group with original nodes are not good for me, don’t want doing manipulation with original user nodes
Excelent if i take selection nodes, create temp group with clone selection nodes, export image and remove temp group
You can clone each node by calling node.clone()
, push this cloned node to an array and then put this array into figma.group(nodesArray, parentNode)
to create a group from them. group · Figma Developers
Property ‘clone’ does not exist on type ‘SceneNode’.
switch (msg.type) {
case MessageTypes.select:
const { currentPage } = figma
const selectedNode = currentPage.selection;
if (selectedNode.length > 0) {
const clonedNodes: SceneNodec] = o]
selectedNode.forEach(node => clonedNodes.push(node.clone()))
const group = figma.group(clonedNodes, currentPage)
}
break;
case MessageTypes.cancel:
figma.closePlugin();
break;
}
Not work
selectedNode.forEach(node => clonedNodes.push(JSON.parse(JSON.stringify(node.clone()))))
You are right, thank you very much!
Ts ignore help me and nodes success cloned and grouped
// @ts-ignore
selectedNode.forEach(node => clonedNodes.push(node.clone()))
@ts-ignore will disable TS for the rest of the file. Maybe you can do: (node as ComponentNode).clone()
This topic was automatically closed after 15 days. New replies are no longer allowed.