edit: compatibility html formatting v1.0
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 8 Jul 2014 22:12:26 +0000 (00:12 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 8 Jul 2014 22:53:23 +0000 (00:53 +0200)
Match format of existing documents.

edit.js

diff --git a/edit.js b/edit.js
index 385bba6753ec69bb743f4b7f3844619015e1ae9c..37e1444c6feee3050992b6880a76e204d6838777 100644 (file)
--- a/edit.js
+++ b/edit.js
@@ -44,6 +44,16 @@ CKEDITOR.on('instanceCreated', function (event) {
        });
 });
 
+       CKEDITOR.on('instanceReady', function (event) {
+               var editor = event.editor;
+               var writer = editor.dataProcessor.writer;
+               writer.selfClosingEnd = '>';
+               writer.setRules( 'p', {
+                       breakAfterOpen: true,
+                       breakBeforeClose: true,
+               });
+       });
+
 var pagebody = document.getElementsByClassName('article')[0];
 pagebody.setAttribute('contenteditable', 'true');