X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/0d35ad089db9ae6b1cd619be28ddda2b2314895b..d09e700618e8dd4e990870f5650c2fe42497ca62:/edit/page.js diff --git a/edit/page.js b/edit/page.js index c3ece3c..3101ea1 100644 --- a/edit/page.js +++ b/edit/page.js @@ -19,7 +19,7 @@ CKEDITOR.plugins.add('inlinesave', { // empty line is equivalent to a paragraph break body = body.replace(/
\s*
/g, '

'); // keep names and preceding abbreviations together - body = body.replace(/\b((?:dhr|mw|me?vr|mr?s?)\.)\s+(?=[A-Z])/ig, '$1 '); + body = body.replace(/\b((?:[Dd]hr|[Mm](?:w|e?vr|r|r?ss?)|[A-Z])\.)\s+(?=[A-Zdtv])/g, '$1 '); // wrap long line after each sentence body = body.replace(/^(\t*).{73,}/mg, function (line, indent) { var dots = '(?:.{24,72}|.{73,}?)'; // chars before punctuation @@ -57,7 +57,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 +217,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;