API setting or method to prevent text from changing when pasting in the design or setting in code


When I set the text on a text field the quotes are changed to fancy quotes and two dashes in a row are changed to a single dash. There might be other changes. Reformatting text appears to be on purpose but in my case I’d like the text to stay the same.

Is there an API to prevent this or a way to set the text via an API to prevent reformatting?

Steps to reproduce:

  1. Add a text field to an artboard
  2. Paste the following text
  3. Select a different object (so the change is committed)


<meta charset="utf-8"/>
--next item;

Expected results
Text is exactly the same

Actual Results
Some characters are changed. Quotes are changed to fancy quotes and -- is changed to single dash -.



@Velara this sounds more like an XD feature request/bug report for XD rather than plugin APIs. Currently, there is no API to prevent this behavior. Do you have some use cases for this?

1 Like


I was using a text field for verifying a string value that my plugin was creating sort of as a unit test. When I pasted that string and later ran a diff on it it kept saying that there were changes to the string value. So I double checked my code was correct and then remembered that some word processing environments will modify for you (normal quotes to fancy quotes since users typically don’t know how to type fancy quotes). So I thought maybe there is a preference I can enable or disable using the plugin API. But it probably belongs as a feature request. You can delete this post.

PS I decided to store the value in the pluginData.



@Velara Using pluginData would be a great workaround - thanks for exploring that option