nieuws: fix block replacement of variable contents
[minimedit.git] / edit / page.js
index 3071844a96e685c64d8ae6328e81af773e940bc2..ac2288a07fceb1ef132958ef22e44fad7f57f409 100644 (file)
@@ -162,7 +162,12 @@ if (pagebody) {
                editlink.onclick = undefined;
                pagebody.setAttribute('contenteditable', true);
                pagebody.querySelectorAll('[data-dyn]').forEach(function (el) {
-                       el.outerHTML = '[[' + el.getAttribute('data-dyn') + ']]';
+                       let blockname = el.getAttribute('data-dyn');
+                       if (!blockname) {
+                               el.remove();
+                               return;
+                       }
+                       el.outerHTML = '[[' + blockname + ']]';
                });
                CKEDITOR.inline(pagebody, { customConfig: '' });
                document.body.className = 'edit';