edit: disable image resizing (plus workaround)
[minimedit.git] / edit.js
diff --git a/edit.js b/edit.js
index fda6bf95741812e344958417f95e835c7dcb599b..88b03e3ac4d5b1792960fd7e5ba86554276f4611 100644 (file)
--- a/edit.js
+++ b/edit.js
@@ -25,6 +25,17 @@ CKEDITOR.plugins.add('inlinesave', {
        }
 });
 
+CKEDITOR.on('dialogDefinition', function (event) {
+       if (event.data.name === 'table') {
+               // override initial attribute values
+               var infoTab = event.data.definition.getContents('info');
+               infoTab.get('txtWidth').default = '';
+               infoTab.get('txtBorder').default = '0';
+               infoTab.get('txtCellSpace').default = '';
+               infoTab.get('txtCellPad').default = '';
+       }
+});
+
 CKEDITOR.on('instanceCreated', function (event) {
        var editor = event.editor;
        editor.on('configLoaded', function () {
@@ -41,10 +52,22 @@ CKEDITOR.on('instanceCreated', function (event) {
                        ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Link'],
                        ['HorizontalRule', 'Table', 'Image'],
                ];
-               config.enterMode = CKEDITOR.ENTER_BR; // results in <p>; ENTER_P does it twice
+
+               config.disableObjectResizing = true;
+               document.execCommand('enableObjectResizing', false, false); // workaround in inline mode; ff bug?
        });
 });
 
+       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');