Skip to content

Instantly share code, notes, and snippets.

@ryonakae
Last active September 18, 2024 01:28
Show Gist options
  • Save ryonakae/6564138a75401a7c3c9be3c73a3a2d02 to your computer and use it in GitHub Desktop.
Save ryonakae/6564138a75401a7c3c9be3c73a3a2d02 to your computer and use it in GitHub Desktop.
FigmaのRun Plugin APIプラグインで使える便利なコードスニペット集
// 現在のページにあるハイパーリンクが設定されているすべてのテキストに下線を引く
function main() {
const textNodes: TextNode[] = figma.currentPage.findAll(node => {
return node.type === 'TEXT' && node.hyperlink !== null
})
textNodes.forEach(async textNode => {
await Promise.all(textNode.getRangeAllFontNames(0, textNode.characters.length).map(figma.loadFontAsync))
textNode.textDecoration = 'UNDERLINE'
})
figma.currentPage.selection = textNodes
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment