edit/page: indicate edit replacements in data-dyn attributes
[minimedit.git] / edit / page.js
index 9997e293c7615a3af4c6b29945f56583503a49e5..3071844a96e685c64d8ae6328e81af773e940bc2 100644 (file)
@@ -161,8 +161,9 @@ if (pagebody) {
                editlink.href = '';
                editlink.onclick = undefined;
                pagebody.setAttribute('contenteditable', true);
-               pagebody.innerHTML = pagebody.innerHTML
-                       .replace(/<!--BLOCK:(.*?)-->[^]*?<!--\/-->/g, '$1');
+               pagebody.querySelectorAll('[data-dyn]').forEach(function (el) {
+                       el.outerHTML = '[[' + el.getAttribute('data-dyn') + ']]';
+               });
                CKEDITOR.inline(pagebody, { customConfig: '' });
                document.body.className = 'edit';
                return false;