X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/a09479494778e395ffe2dc75eb858ab3537ef14a..e533b4e9662636f565f6e487b0ab99e768858370:/edit/page.js diff --git a/edit/page.js b/edit/page.js index ac2288a..4e389db 100644 --- a/edit/page.js +++ b/edit/page.js @@ -4,6 +4,8 @@ CKEDITOR.plugins.add('inlinesave', { exec: function (editor) { var pagename = window.location.pathname; var body = editor.getData(); + // trim trailing whitespace in non-empty paragraphs + body = body.replace(/((?!

).{3})(?:\s|\u200B)+(?=<\/p>)/g, '$1'); // empty line is equivalent to a paragraph break body = body.replace(/
\s*
/g, '

'); // wrap long line after each sentence