var pagebody;
+function editorcontents() {
+ return document.getElementsByClassName('static')[0];
+}
+
function editorsetup() {
CKEDITOR.disableAutoInline = true;
editlink.style.fontWeight = 'bold';
editlink.href = '';
editlink.onclick = undefined;
- var dynpage = document.getElementsByClassName('static')[0];
- document.body.replaceChild(pagebody, dynpage);
+ document.body.replaceChild(pagebody, editorcontents());
pagebody.setAttribute('contenteditable', true);
pagebody.querySelectorAll('[data-dyn]').forEach(function (el) {
let blockname = el.getAttribute('data-dyn');
}
document.addEventListener('DOMContentLoaded', function (e) {
- pagebody = document.getElementsByClassName('static')[0].cloneNode(true);
+ pagebody = editorcontents().cloneNode(true);
var editorinc = document.createElement('script');
editorinc.addEventListener('load', editorsetup);
editorinc.src = ckesrc;