edit: page class to indicate edit mode
[minimedit.git] / edit.js
diff --git a/edit.js b/edit.js
index 784e370913d1a24d9547d08bb6d7bb0cec367dd5..2e44c28d3ac9c2f1a84359860d9306c6181a1c3b 100644 (file)
--- a/edit.js
+++ b/edit.js
@@ -2,7 +2,7 @@ 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);
@@ -72,3 +72,5 @@ CKEDITOR.on('instanceCreated', function (event) {
 var pagebody = document.getElementsByClassName('article')[0];
 pagebody.setAttribute('contenteditable', 'true');
 
+document.body.className = 'edit';
+