login/pass: error messages below page title
[minimedit.git] / edit / page.js
index c3ece3c0fbf7ec81c54edb1a0994d4c63e0330a8..8aa2890b8d3c426c1155a0264ad7a04fb44e68b7 100644 (file)
@@ -19,9 +19,10 @@ CKEDITOR.plugins.add('inlinesave', {
                                // empty line is equivalent to a paragraph break
                                body = body.replace(/<br \/>\s*<br \/>/g, '<p>');
                                // keep names and preceding abbreviations together
-                               body = body.replace(/\b((?:dhr|mw|me?vr|mr?s?)\.)\s+(?=[A-Z])/ig, '$1&nbsp;');
+                               body = body.replace(/\b((?:[Dd]hr|[Mm](?:w|e?vr|r|r?ss?)|[A-Z])\.)\s+(?=[A-Zdtv])/g, '$1&nbsp;');
                                // wrap long line after each sentence
                                body = body.replace(/^(\t*).{73,}/mg, function (line, indent) {
+                                       if (/^<meta /.test(line)) return line; // ignore metadata headers
                                        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');
@@ -57,7 +58,7 @@ CKEDITOR.plugins.add('inlinesave', {
                                ajaxpost.send(data);
                        },
                });
-               editor.setKeystroke(CKEDITOR.CTRL + 83 /*S*/, 'inlinesave');
+               editor.setKeystroke(CKEDITOR.CTRL + 'S'.charCodeAt(0), 'inlinesave');
                editor.ui.addButton( 'Inlinesave', {
                        command: 'inlinesave',
                        label: editor.lang.save.toolbar,
@@ -217,7 +218,9 @@ if (pagebody) {
 
 var ckesrc = document.currentScript.getAttribute('data-ckesrc');
 document.addEventListener('DOMContentLoaded', function (e) {
-       pagebody = editorcontents().cloneNode(true);
+       pagebody = editorcontents();
+       if (!pagebody) return;
+       pagebody = pagebody.cloneNode(true);
        var editorinc = document.createElement('script');
        editorinc.addEventListener('load', editorsetup);
        editorinc.src = ckesrc;