From e78d2af1b995cbd79e2d22f61eccbf47586782be Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Sun, 22 Aug 2021 12:13:35 +0200 Subject: [PATCH] initial preparation to not just edit but also add new pages via local editor.. --- assets/js/sandpoints.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/js/sandpoints.js b/assets/js/sandpoints.js index c283f5f..4d46e25 100644 --- a/assets/js/sandpoints.js +++ b/assets/js/sandpoints.js @@ -63,12 +63,20 @@ function editPage(repoJsId) { } el.src = `${relPath}js/repo/${repoJsId}.js` document.body.appendChild(el) - document.location.href = `${relPath}edit/index.html#${repoJsId}` + document.location.href = `${relPath}edit/index.html?edit=${repoJsId}` ev} window.addEventListener("keyup", (e)=> { if (e.key == "e" && location.protocol == "file:") { editPage(sandpointsPageId) + } else if (e.key == "E" && location.protocol == "file:") { + let preview = document.querySelector("#preview"); + if (preview.style.display == "flex") { + preview.style.display = "none"; + } else { + preview.style.display = "flex"; + } + console.log("preview: ", preview); } }) @@ -80,7 +88,6 @@ window.addEventListener("DOMContentLoaded", (e) => { } document.querySelectorAll('.triadlink').forEach((i) => { - console.log(i) i.addEventListener("click", (ev) => { if (ev.ctrlKey) { ev.preventDefault()