org:

convertHTMLLineBreaks: function(string) {
    return string.replace(/<br>/gi, "\n").replace(/<br\/>/gi,
"\n").replace(/<\/p>/gi, "\n").replace(/<p[\s]*>/gi, "");
  },
when using multiline in place editor with nl2br in PHP,

the number of '<br/>' tags doubles evertime it was updated

reason:
nl2br change "\r\n" => "<br/>\r\n" or "<br/>\n"

any way the following patch solve the problem by enhanced
regularexpression matching

convertHTMLLineBreaks: function(string) {
    return string.replace(/<br[\s]*>[\s\r\n]*/gi,
"\n").replace(/<br[\s]*\/>[\s\r\n]*/gi, "\n").replace(/<\/p[\s]*>/gi,
"\n").replace(/<p[\s]*>/gi, "");
  },


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to