]> git.mdlowis.com Git - proto/journal.git/commitdiff
updated editor to preserve titles on saved pages
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 1 Dec 2017 13:31:42 +0000 (08:31 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 1 Dec 2017 13:31:42 +0000 (08:31 -0500)
editor.js
index.html

index b1c890b6fd9afa2f75d8fee8be837ca5ec2aae91..1697355925b799b5a634fae6845e2428384aa5bf 100644 (file)
--- a/editor.js
+++ b/editor.js
@@ -61,7 +61,9 @@
 
     header.onkeyup = (ev) => (doc.title = header.innerText);
     content.onkeydown = (ev) => (keys[ev.key] ? (keys[ev.key])(ev) : true);
-    header.innerHTML = '<h1 align="center" contenteditable="true">' + ymd_string() + '</h1><hr/>';
-    doc.title = header.innerText;
     content.focus();
+    if (doc.title != "") {
+        header.innerHTML = '<h1 align="center" contenteditable="true">' + ymd_string() + '</h1><hr/>';
+        doc.title = header.innerText;
+    }
 })();
index 76db35cdb3e1a65e82fd164f2e251f80f1c33c87..a718752a451e5fa7bf07034fb2465378200ba343 100644 (file)
@@ -142,9 +142,11 @@ th:first-child, td:first-child {
 
     header.onkeyup = (ev) => (doc.title = header.innerText);
     content.onkeydown = (ev) => (keys[ev.key] ? (keys[ev.key])(ev) : true);
-    header.innerHTML = '<h1 align="center" contenteditable="true">' + ymd_string() + '</h1><hr/>';
-    doc.title = header.innerText;
     content.focus();
+    if (doc.title != "") {
+        header.innerHTML = '<h1 align="center" contenteditable="true">' + ymd_string() + '</h1><hr/>';
+        doc.title = header.innerText;
+    }
 })();
     </script>
 </body>