initial preparation to not just edit but also add new pages via local editor..

This commit is contained in:
Marcell Mars 2021-08-22 12:13:35 +02:00
parent b0ec5615b1
commit e78d2af1b9

View file

@ -63,12 +63,20 @@ function editPage(repoJsId) {
} }
el.src = `${relPath}js/repo/${repoJsId}.js` el.src = `${relPath}js/repo/${repoJsId}.js`
document.body.appendChild(el) document.body.appendChild(el)
document.location.href = `${relPath}edit/index.html#${repoJsId}` document.location.href = `${relPath}edit/index.html?edit=${repoJsId}`
ev} ev}
window.addEventListener("keyup", (e)=> { window.addEventListener("keyup", (e)=> {
if (e.key == "e" && location.protocol == "file:") { if (e.key == "e" && location.protocol == "file:") {
editPage(sandpointsPageId) 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) => { document.querySelectorAll('.triadlink').forEach((i) => {
console.log(i)
i.addEventListener("click", (ev) => { i.addEventListener("click", (ev) => {
if (ev.ctrlKey) { if (ev.ctrlKey) {
ev.preventDefault() ev.preventDefault()