figma / plugin-typings

Typings for the Figma Plugin API
MIT License
195 stars 45 forks source link

TextNode support add a hyperlink #29

Closed ChenSWD closed 2 years ago

ChenSWD commented 3 years ago

I want to add a hyperlink to text,but I can't find a function to set

james04321 commented 2 years ago

This is already supported by the hyperlink property, or using setRangeHyperlink():

https://www.figma.com/plugin-docs/api/TextSublayer/#hyperlink https://www.figma.com/plugin-docs/api/TextSublayer/#setrangehyperlink

To demonstrate, select any text node, and run:

figma.currentPage.selection[0].hyperlink = { type: 'URL', value: 'https://www.google.com' }