You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm dealing with HTML that is generated via an RTF -> HTML conversion. That conversion makes use of spans for formatting text runs from the RTF (which generates a lot of spans!).
The HTML down below represents the text "female presents to the ED with a Chief Complaint of Shoulder Pain".
When I select this text in the browser (Chrome), and do rangy.getSelection().text(), I end up with an extra space in the text where new spans start. So, I end up with two spaces between the words "female" and "presents" and two spaces between "Complaint of" and "Shoulder".
From some experimentation, I can use some regexes to get the HTML from the selection and remove all of the tags and whitespace between tags, and this gets me the correct text: rangy.getSelection().toHtml().replace(/>\s+</gm, "><").replace(/<[^>]*>/gm, "");
but I was wondering if there's something I'm missing here or if this is a known behavior of rangy?
<spanstyle="font-family:Arial; font-size:11pt; font-weight:normal; text-decoration:none" data-point-size="11">female</span><spanstyle="font-family:Arial; font-size:11pt; font-weight:normal; text-decoration:none" data-point-size="11"> presents to the ED with a Chief Complaint of </span><spanstyle="font-family:Arial; font-size:11pt; font-weight:normal; text-decoration:none" data-point-size="11">Shoulder Pain</span>
The text was updated successfully, but these errors were encountered:
I'm dealing with HTML that is generated via an RTF -> HTML conversion. That conversion makes use of spans for formatting text runs from the RTF (which generates a lot of spans!).
The HTML down below represents the text "female presents to the ED with a Chief Complaint of Shoulder Pain".
When I select this text in the browser (Chrome), and do rangy.getSelection().text(), I end up with an extra space in the text where new spans start. So, I end up with two spaces between the words "female" and "presents" and two spaces between "Complaint of" and "Shoulder".
From some experimentation, I can use some regexes to get the HTML from the selection and remove all of the tags and whitespace between tags, and this gets me the correct text:
rangy.getSelection().toHtml().replace(/>\s+</gm, "><").replace(/<[^>]*>/gm, "");
but I was wondering if there's something I'm missing here or if this is a known behavior of rangy?
The text was updated successfully, but these errors were encountered: