Say the end user has a Text (Area Text) node on the page with three paragraphs. Am I right that as a user I can’t select the middle paragraph and in my plugin, glean the start/end range numbers of that text in order to manipulate that substring of text?
Further, it doesn’t appear to be possible to format that text with HTML/CSS. Please confirm that HTML/CSS is only supported in UI provided by the plugin itself and not for styling the end user’s design content.
I’m interested in user being able to select a substring of text within a Text node and have my plugin indent by a user-specified amount but it would seem I’d have to do this with space characters and probably can’t for a sub-selection anyway but rather, only for the entire Text node.
Thank you for confirming my assessment of the latest API.
Correct. The moment a user executes the plugin (e.g., by clicking on the plugin in the plugins panel), the “text editing mode” deactivates, i.e., the text node will be selected, but selections inside the node are no longer existent.
Correct. You could, of course, parse CSS and apply it, but given your use-case, that doesn’t seem applicable. Overall, XD’s text node styling isn’t as powerful as HTML/CSS, meaning a direct “translation” is impossible.
I believe there are several options here. First of all, you could let the user select the text range inside your plugin UI.
After that, it might be easier to
split the text area into multiple ones (create new ones and update their content and position/size), surrounding the specified range
move and resize the text area containing the text to achieve the desired indention.
Using spaces, you’ll probably run into a lot of messy cases with line breaks you’ll have to fix, etc., meaning that this is probably not your desired outcome (that, however, is up to you, of course)