figma / code-snippet-editor-plugin

Translate component variants, properties, and more into dynamic code snippets for your design system.
https://www.figma.com/community/plugin/1311777988952403297/code-snippet-editor
MIT License
126 stars 11 forks source link

Unable to retrieve parameters from figma.mixed node.textStyle #53

Closed mikeysouthwell closed 3 months ago

mikeysouthwell commented 3 months ago

I am trying to output text to code using the plugin, but it doesn't work when some of the text is Bold for example. It just says the style is figma.mixed. How do I output this as different text blocks?

I am aware that the current textbox could be easily separated into two (stacked vertically), but often this isn't the case and they need to create a seemless paragraph with normal text and bold text being side-by-side and wrapping inside the frame/autolayout they are contained in. Is there a way to pickup the different sections of the text related to each style being applied or is there a way you can have text boxes fill and wrap inside an autolayout so that they look just like a single textbox?

image

mikeysouthwell commented 3 months ago

There is a discussion on this topic in the Figma forums here and I was wondering if you have a workaround:

https://forum.figma.com/t/ability-to-auto-layout-two-text-nodes-as-one-block-of-text-flowing-continuously/44109

jake-figma commented 3 months ago

Yeah, there isn't a great way to model this because it can get very complicated. You could theoretically have hundreds of styles in the same text node. We are leaving it at what the plugin API provides at the node level, without any text range traversal. The recommendation is to detect the scenario where it is mixed, and render a default style name instead.