Setting RichValue with multiple line text
I need to set/replace some values into a richText field, and I'm having a problem with the line endings.
I am able to set the text, looping through the span objects, but I end up with a single paragraph, all of the line endings are gone.
Even just setting the value to itself, without the code to do the text replacements, doesn't work:
var spans = event.richValue;
event.richValue = spans;
or
event.richValue = event.richValue;
I end up with the correct content, but all of the line endings are missing. And this is code that I modified from the javascript reference documentation. The code is in the Custom Format Script for the field.
Can someone help me with an example of how to replace text (i.e replace '[NAME]' with 'John') in a richtext field and retain the line endings?
