var pagename = window.location.pathname.replace(/\/$/, '/index');
var body = editor.getData().replace(/^(\t*).{73,}/mg, function (line, indent) {
// wrap long line after each sentence
- var dot = '(?:[^<]|<[^>]*>)'; // one character
- var dots = '(?:'+dot+'{24,72}|'+dot+'{73,}?)'; // chars before punctuation
- var wrap = new RegExp('('+dots+'[.;:!?]) (?=[A-Z])', 'g'); // separate lines
+ var dots = '(?:.{24,72}|.{73,}?)'; // chars before punctuation
+ var wrap = new RegExp('('+dots+'[.;:!?]) (?=[A-Z(<])', 'g'); // separate lines
return line.replace(wrap, '$1\n'+indent+'\t');
});
var data = 'body='+encodeURIComponent(body);
config.entities = false; // keep unicode
config.filebrowserImageUploadUrl = '/edit?type=img';
config.forcePasteAsPlainText = true;
- config.contentsCss = '/excelsior.css';
+ config.contentsCss = document.styleSheets[0].href;
config.toolbar = [
- ['Inlinesave', '-', 'ShowBlocks', 'Sourcedialog', '-', 'Undo', 'Redo'],
- ['Format'],
- ['BulletedList', 'NumberedList', '-', 'Blockquote'],
- ['Bold', 'Italic', 'Underline', 'Strike', 'RemoveFormat', '-', 'Anchor', 'Link'],
- ['HorizontalRule', 'Table', 'Image', 'CreatePlaceholder'],
+ ['Inlinesave', '-', 'Undo', 'Redo'],
+ ['Format', 'BulletedList', 'NumberedList', 'Blockquote'],
+ ['Bold', 'Italic', 'Link'],
+ ['HorizontalRule', 'Table', 'Image'],
+ ['CreatePlaceholder', 'Sourcedialog'],
];
config.toolbarCanCollapse = true;
config.floatSpacePreferRight = true;
// add edit link to menu
var pagebody = document.getElementsByClassName('static')[0];
if (pagebody) {
- var editlink = document.createElement('a');
- editlink.style.cursor = 'pointer';
- editlink.appendChild(document.createTextNode('Wijzig'));
- editlink.href = '#edit';
+ var editlink = document.querySelector('a[href="#edit"]');
editlink.onclick = function (e) {
editlink.style.fontWeight = 'bold';
editlink.href = '';
if (window.location.hash == '#edit') {
editlink.onclick();
}
- document.querySelector('header ul').appendChild(editlink);
}