From: Mail M. <squ...@cn...> - 2005-08-25 21:31:41
|
Paul Lesneiwski wrote: >Paul Lesneiwski wrote: > > >>Matthew Snyder wrote: >> >> >> >>>Mail Manager <squirrelmail <at> cnz.com> writes: >>> >>> >>> >>> >>>>We have found a problem using HTML Mail. If the compose window is >>>>refreshed for any reason (adding an attachment, pressing Send with no To >>>>address, etc.), then all the blank lines are doubled. Do it again, and >>>>they are doubled again. >>>> >>>> >>>Same problem here. We can prevent this behavior by commenting out lines 306-308 >>>in $SM_PATH/plugins/html_mail/functions.php >>> >>>The downside to this "fix" is that loading the compose window by replying or >>>forwarding a message (i.e., in such a way that the textarea has pre-populated >>>content) causes any existing newlines to be removed, so that the quoted text is >>>run together as one long line. The same problem happens if a signature is >>>defined and loaded automatically when composing. >>> >>>My guess is that what is happening is that each time the compose window is >>>reloaded (due to adding/removing an attachment, requesting a signature, etc), >>>the newlines in the message text are interpreted as and replaced by <br /> tags, >>>and appended to the end of the lines, which already have (invisible) <br /> >>>tags. Using FCKeditor's "source" feature to view the tags seems to confirm this >>>behavior. >>> >>> >>Your guess is accurate. People, please try replacing line 307 of >>functions.php with this: >> >> . 'document.compose.body.value = >>document.compose.body.value.replace(/[^<][^b][^r][^ ][^\/][^>]\n/g, "<br >>/>");' >> >>It's a somewhat ugly hack due to JavaScript's lack of support for >>lookbehinds, but it just might work. >> >> > >Oh, no no no. That's not zero-width so it will eat the last 6 chars >from every line. Bad idea. If anyone knows of a good javascript >lookbehind replacement that is not convoluted and browser-dependent, >feel free to send it along. > >-paul > > > How about this? echo '<script language="javascript" type="text/javascript">' . "\n<!--\n" . 'document.compose.body.value = document.compose.body.value.replace(/<br *\/>\n/g, "\n");' . "\n" . 'document.compose.body.value = document.compose.body.value.replace(/\n/g, "<br />");' . "\n// -->\n</script>"; It seems to fix the problem in Firefox, but not IE. I read that html_mail handles newlines differently in IE. Is there someplace else the same kind of thing could be done for IE? -- Jack |