Complete the code to select all layers on the current page.
figma.currentPage.selection = figma.currentPage.[1]();The findAll() method returns all nodes on the current page. Assigning the result to selection selects all layers.
Complete the code to remove all locked nodes from the current selection.
figma.currentPage.selection = figma.currentPage.selection.filter(node => node.[1] !== true);The isLocked property indicates if a node is locked. Filtering out locked nodes removes them from selection.
Complete the code to batch rename selected layers by adding a prefix.
figma.currentPage.selection.forEach(node => { node.name = '[1]' + node.name; });Adding the prefix prefix_ before each node's name correctly renames the layers.
Fill both blanks to batch hide all selected layers and then clear the selection.
figma.currentPage.selection.forEach(node => { node.[1] = false; });
figma.currentPage.selection = [2];Setting visible to false hides the layers. Assigning an empty array [] clears the selection.
Fill all three blanks to batch duplicate selected layers, rename duplicates with suffix, and select duplicates.
const duplicates = figma.currentPage.selection.map(node => {
const dup = node.[1]();
dup.name = node.name + '[2]';
node.parent.appendChild(dup);
return dup;
});
figma.currentPage.selection = [3];The clone() method creates a copy of a node. Adding _copy suffix renames it. Assigning duplicates array selects the new nodes.