MCPcopy Index your code
hub / github.com/figma/plugin-samples / handleCurrentSelection

Function handleCurrentSelection

snippet-saver/code.js:66–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66function handleCurrentSelection() {
67 const node = figma.currentPage.selection[0];
68 try {
69 const nodePluginData = node ? node.getPluginData(PLUGIN_DATA_KEY) : null;
70 const nodeId = node ? node.id : null;
71 const nodeType = node ? node.type : null;
72 figma.ui.postMessage({
73 type: "SELECTION",
74 nodeId,
75 nodeType,
76 nodePluginData,
77 });
78 return nodePluginData;
79 } catch (e) {
80 // no ui open. ignore this.
81 }
82}

Callers 1

code.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected