X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/544de694190d0961127503e9e6a1e5a67eb742ae..3c72253adb03b625b8d3593be66e2e684a82bee9:/edit.js diff --git a/edit.js b/edit.js index 88b03e3..573f3cd 100644 --- a/edit.js +++ b/edit.js @@ -2,10 +2,10 @@ CKEDITOR.plugins.add('inlinesave', { init: function(editor) { editor.addCommand( 'inlinesave', { exec: function (editor) { - var pagename = window.location.pathname.replace(/^\//, '') || 'index'; + var pagename = window.location.pathname.replace(/^\/(?:\.html)?/, '') || 'index'; var data = 'page='+encodeURIComponent(pagename)+'&body='+encodeURIComponent(editor.getData()); ajaxpost = new XMLHttpRequest(); - ajaxpost.open('POST', 'edit.php', true); + ajaxpost.open('POST', '/edit.php', true); ajaxpost.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxpost.onreadystatechange = function () { if (ajaxpost.readyState != 4) @@ -45,11 +45,13 @@ CKEDITOR.on('instanceCreated', function (event) { config.format_tags = 'h2;h3;h4;p'; config.allowedContent = true; config.entities = false; // keep unicode + config.filebrowserImageUploadUrl = '/edit.php?type=img'; + config.forcePasteAsPlainText = true; config.toolbar = [ ['Inlinesave', '-', 'ShowBlocks', 'Sourcedialog', '-', 'Undo', 'Redo'], ['Format'], ['BulletedList', 'NumberedList', '-', 'Blockquote'], - ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Link'], + ['Bold', 'Italic', 'Underline', 'Strike', 'RemoveFormat', '-', 'Link'], ['HorizontalRule', 'Table', 'Image'], ]; @@ -71,3 +73,5 @@ CKEDITOR.on('instanceCreated', function (event) { var pagebody = document.getElementsByClassName('article')[0]; pagebody.setAttribute('contenteditable', 'true'); +document.body.className = 'edit'; +