From ddc29b7c0d1f50edcbb469d62000d747d8c5868d Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 29 Sep 2017 13:11:10 +0200 Subject: [PATCH] edit: replace double linebreaks by paragraphs Works within lists, so currently the only workaround in CKEditor to create multiple paragraphs for a list item. --- edit.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edit.js b/edit.js index 6dcb705..439fb97 100644 --- a/edit.js +++ b/edit.js @@ -3,7 +3,9 @@ CKEDITOR.plugins.add('inlinesave', { editor.addCommand( 'inlinesave', { exec: function (editor) { var pagename = window.location.pathname.replace(/\/$/, '/index'); - var body = editor.getData().replace(/^(\t*).{73,}/mg, function (line, indent) { + var body = editor.getData(); + body = body.replace(/
\s*
/g, '

'); + body = body.replace(/^(\t*).{73,}/mg, function (line, indent) { // wrap long line after each sentence var dots = '(?:.{24,72}|.{73,}?)'; // chars before punctuation var wrap = new RegExp('('+dots+'[.;:!?]) (?=[A-Z(<])', 'g'); // separate lines -- 2.30.0