From 17653d5b7ab2c7276c97b0953648fcb885383711 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 1 Jan 2020 08:53:32 +0100 Subject: [PATCH] nieuws: fix block replacement of variable contents Restored as empty [[]] placeholders since previous commit. --- edit/page.js | 7 ++++++- nieuws/index.php | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/edit/page.js b/edit/page.js index 3071844..ac2288a 100644 --- a/edit/page.js +++ b/edit/page.js @@ -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'; diff --git a/nieuws/index.php b/nieuws/index.php index f74c632..ff433d5 100644 --- a/nieuws/index.php +++ b/nieuws/index.php @@ -15,6 +15,9 @@ if ($page and !is_numeric($page)) { if ($Article->dateparts) { $Place[1] = ' '.$Article->date.''; } + else { + $Place[1] = ''; + } print preg_replace('{(?<=

)(.*?)(?=

)}', ($edit ?: '\1').' [[1]]', $Article->raw); if ($User->admin("edit $Page$Args")) { $taglist = []; -- 2.30.0