jasonlamkk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-10 08:03 UTC
patch to [FireFox Bug?!] : convertHTMLLineBreaks in scriptaculous.js->control.js
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---