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)
}
});
+CKEDITOR.on('dialogDefinition', function (event) {
+ if (event.data.name === 'table') {
+ // override initial attribute values
+ var infoTab = event.data.definition.getContents('info');
+ infoTab.get('txtWidth').default = '';
+ infoTab.get('txtBorder').default = '0';
+ infoTab.get('txtCellSpace').default = '';
+ infoTab.get('txtCellPad').default = '';
+ }
+});
+
CKEDITOR.on('instanceCreated', function (event) {
var editor = event.editor;
editor.on('configLoaded', function () {
config.format_tags = 'h2;h3;h4;p';
config.allowedContent = true;
config.entities = false; // keep unicode
+ config.filebrowserImageUploadUrl = '/edit.php?type=img';
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'],
];
- config.enterMode = CKEDITOR.ENTER_BR; // results in <p>; ENTER_P does it twice
+
+ config.disableObjectResizing = true;
+ document.execCommand('enableObjectResizing', false, false); // workaround in inline mode; ff bug?
});
});
+ CKEDITOR.on('instanceReady', function (event) {
+ var editor = event.editor;
+ var writer = editor.dataProcessor.writer;
+ writer.selfClosingEnd = '>';
+ writer.setRules( 'p', {
+ breakAfterOpen: true,
+ breakBeforeClose: true,
+ });
+ });
+
var pagebody = document.getElementsByClassName('article')[0];
pagebody.setAttribute('contenteditable', 'true');