Complete the code to export selected layers as PNG in Figma plugin.
figma.currentPage.selection.forEach(node => node.exportAsync({ format: '[1]' }))PNG is a common format for exporting images with transparency, suitable for handoff.
Complete the code to generate a JSON with node names and their widths for handoff.
const sizes = figma.currentPage.selection.map(node => ({ name: node.name, width: node.[1] }))Width property gives the horizontal size of the node, useful for layout handoff.
Fix the error in the code to export all selected nodes as SVG files.
for (const node of figma.currentPage.selection) { const svg = await node.exportAsync({ format: '[1]' }) figma.ui.postMessage({ svg }) }
SVG is the correct format for vector graphics export.
Fill both blanks to create a plugin that exports selected nodes as PNG and sends their names to UI.
const exports = []; for (const node of figma.currentPage.selection) { const image = await node.exportAsync({ format: '[1]' }); exports.push({ name: node.[2], image }); } figma.ui.postMessage(exports);
We export as PNG and send the node's name for identification in the UI.
Fill all three blanks to create a plugin snippet that exports selected nodes as JPG, collects their heights, and sends data to UI.
const data = await Promise.all(figma.currentPage.selection.map(async node => ({
image: await node.exportAsync({ format: '[1]' }),
height: node.[2],
label: node.[3]
})));
figma.ui.postMessage(data);JPG is used for export, height property for vertical size, and name for labeling nodes.