init: function(editor) {
editor.addCommand( 'inlinesave', {
exec: function (editor) {
- var pagename = window.location.pathname.replace(/\/$/, '/index');
+ var pagename = window.location.pathname;
var body = editor.getData();
// empty line is equivalent to a paragraph break
body = body.replace(/<br \/>\s*<br \/>/g, '<p>');
ajaxpost.send(data);
},
});
+ editor.setKeystroke(CKEDITOR.CTRL + 83 /*S*/, 'inlinesave');
editor.ui.addButton( 'Inlinesave', {
command: 'inlinesave',
label: editor.lang.save.toolbar,
editlink.href = '';
editlink.onclick = undefined;
pagebody.setAttribute('contenteditable', true);
- pagebody.innerHTML = pagebody.innerHTML
- .replace(/<!--BLOCK:(.*?)-->[^]*?<!--\/-->/g, '$1');
+ pagebody.querySelectorAll('[data-dyn]').forEach(function (el) {
+ let blockname = el.getAttribute('data-dyn');
+ if (!blockname) {
+ el.remove();
+ return;
+ }
+ el.outerHTML = '[[' + blockname + ']]';
+ });
CKEDITOR.inline(pagebody, { customConfig: '' });
document.body.className = 'edit';
return false;