X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/be188ffac98a3d824a1e143e1a5766801130c876..d092b634576730fc2ead1dc4c88711da09415f75:/edit.js diff --git a/edit.js b/edit.js index 94e84cc..6f9211e 100644 --- a/edit.js +++ b/edit.js @@ -2,17 +2,18 @@ CKEDITOR.plugins.add('inlinesave', { init: function(editor) { editor.addCommand( 'inlinesave', { exec: function (editor) { - var pagename = window.location.pathname.replace(/^\//, '') || 'index'; - var data = 'page='+encodeURIComponent(pagename)+'&body='+encodeURIComponent(editor.getData()); + var pagename = window.location.pathname.replace(/\/$/, '/index'); + var data = 'body='+encodeURIComponent(editor.getData()); ajaxpost = new XMLHttpRequest(); - ajaxpost.open('POST', 'edit.php', true); + ajaxpost.open('POST', '/edit'+pagename, true); ajaxpost.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ajaxpost.onreadystatechange = function () { if (ajaxpost.readyState != 4) return; // not done yet if (ajaxpost.status != 200) alert('Foutcode '+ajaxpost.status+' bij opslaan: '+ajaxpost.responseText); - //else alert('ok: '+ajaxpost.responseText); + else + alert('Pagina is goed opgeslagen'); }; ajaxpost.send(data); }, @@ -20,7 +21,7 @@ CKEDITOR.plugins.add('inlinesave', { editor.ui.addButton( 'Inlinesave', { command: 'inlinesave', label: editor.lang.save.toolbar, - icon: this.path + '../save/icons/save.png', + icon: 'save', }); } }); @@ -45,13 +46,19 @@ CKEDITOR.on('instanceCreated', function (event) { config.format_tags = 'h2;h3;h4;p'; config.allowedContent = true; config.entities = false; // keep unicode + config.filebrowserImageUploadUrl = '/edit?type=img'; + config.forcePasteAsPlainText = true; + config.contentsCss = '/excelsior.css'; config.toolbar = [ ['Inlinesave', '-', 'ShowBlocks', 'Sourcedialog', '-', 'Undo', 'Redo'], ['Format'], ['BulletedList', 'NumberedList', '-', 'Blockquote'], - ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Link'], + ['Bold', 'Italic', 'Underline', 'Strike', 'RemoveFormat', '-', 'Anchor', 'Link'], ['HorizontalRule', 'Table', 'Image'], ]; + + config.disableObjectResizing = true; + document.execCommand('enableObjectResizing', false, false); // workaround in inline mode; ff bug? }); }); @@ -68,3 +75,5 @@ CKEDITOR.on('instanceCreated', function (event) { var pagebody = document.getElementsByClassName('article')[0]; pagebody.setAttribute('contenteditable', 'true'); +document.body.className = 'edit'; +