Thanks that is what I needed, though it put out \n\r were it should only
be \n  if you understand what I mean.  Easy enough to fix.  Here is what
my script looks like.


  var editor = document.getElementById('myEditor');

 var oldStr =
editor.getEditor(editor.contentWindow).outputToString("text/plain", 0);
   var findStr = '\n\r';
   var repStr = '';

   var srchNdx = 0;
   var newStr = '';
   while (oldStr.indexOf(findStr,srchNdx) != -1) {
       newStr  = oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
       newStr  = repStr;
       srchNdx = (oldStr.indexOf(findStr,srchNdx)   findStr.length   1);
   }
   newStr  = oldStr.substring(srchNdx,oldStr.length);

newStr being the text.

Neil wrote:
Michael Buckley wrote:

But my problem is getting the text out of the editor. doc.textContent returns all the text with out the line breaks. doc.innerHTML returns all the br tags and all the <> converted to &lt; &gt; and no line breaks. So how can this be done? Thunder Bird appears to be able to do this when a message is set a plain text so it must be possible.

TB probably uses its own serializer but I think you'll find that editor.outputToString can do what you want. The flags are defined on nsIDocumentEncoder on the trunk but it will work with earlier versions if you substitute the literal values.
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners


_________________________________________________________________
Research and compare new cars side by side at carpoint.com.au http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F833884&_t=54321&_r=hotmail_endtext&_m=EXT

_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to