+ var body = editor.getData();
+ // empty line is equivalent to a paragraph break
+ body = body.replace(/<br \/>\s*<br \/>/g, '<p>');
+ // wrap long line after each sentence
+ body = body.replace(/^(\t*).{73,}/mg, function (line, indent) {
+ var dots = '(?:.{24,72}|.{73,}?)'; // chars before punctuation
+ var wrap = new RegExp('('+dots+'[.;:!?]) (?=[A-Z(<])', 'g'); // separate lines
+ return line.replace(wrap, '$1\n'+indent+'\t');
+ });
+ // treat standalone placeholders as block elements
+ body = body.replace(/<p>(\[\[.*\]\])<\/p>/g, '$1');
+
+ var data = 'body='+encodeURIComponent(body);