render reflects new Leaf

This commit is contained in:
Bel LaPointe
2022-02-17 10:56:21 -07:00
parent 3addc717a3
commit ced507ca68
10 changed files with 65 additions and 35 deletions

View File

@@ -76,6 +76,9 @@
.tb_fullscreen {
height: 100%;
}
.button, button, input[type="button"] {
height: auto;
}
</style>
<script>
function http(method, remote, callback, body, headers) {
@@ -175,7 +178,7 @@
parentNameSafeId = id.slice(0, id.lastIndexOf("/")).replace(/\//g, "-")
const name=`filetree-leaf-${nameSafeId}`
const parentname=`filetree-leaf-${parentNameSafeId}`
const title=id ? branch.Leaf.Title : "ROOT"
const title=id ? branch.Leaf.Meta.Title : "ROOT"
const isLiveParent = 'id00\/id11'.slice(0, id.length) == id
const isLive = 'id00\/id11' == id
return `
@@ -190,7 +193,7 @@
var html = []
var out = ``
for(var i in branches) {
html.push([branches[i].Leaf.Title, `<details open>` + branchHTML(i, branches[i]) + `</details>`])
html.push([branches[i].Leaf.Meta.Title, `<details open>` + branchHTML(i, branches[i]) + `</details>`])
}
html.sort()
for(var i in html)
@@ -203,7 +206,7 @@
n += 1
return n > 0
}
drawTree(JSON.parse("{\n\t\t\t\"Leaf\": {\"Title\": \"\"},\n\t\t\t\"Branches\": {\n\t\t\t\t\"id00\": {\n\t\t\t\t\t\"Leaf\": {\"Title\": \"title id00\"},\n\t\t\t\t\t\"Branches\": {\n\t\t\t\t\t\t\"id10\": {\"Leaf\":{\"Title\":\"title id10\"},\"Branches\":{\n\t\t\t\t\t\t\t\"id20\": {\"Leaf\":{\"Title\":\"title id20\"},\"Branches\":{}}\n\t\t\t\t\t\t}},\n\t\t\t\t\t\t\"id11\": {\"Leaf\":{\"Title\":\"title id11\"},\"Branches\":{}}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"id01\": {\"Leaf\":{\"Title\":\"title id01\"},\"Branches\":{}},\n\t\t\t\t\"id02\": {\"Leaf\":{\"Title\":\"title id02\"},\"Branches\":{}},\n\t\t\t\t\"id03\": {\"Leaf\":{\"Title\":\"title id03\"},\"Branches\":{}},\n\t\t\t\t\"id04\": {\"Leaf\":{\"Title\":\"title id04\"},\"Branches\":{}},\n\t\t\t\t\"id04\": {\"Leaf\":{\"Title\":\"title id04\"},\"Branches\":{}},\n\t\t\t\t\"id05\": {\"Leaf\":{\"Title\":\"title id05\"},\"Branches\":{}},\n\t\t\t\t\"id06\": {\"Leaf\":{\"Title\":\"title id06\"},\"Branches\":{}},\n\t\t\t\t\"id07\": {\"Leaf\":{\"Title\":\"title id07 but it's really really really long\"},\"Branches\":{}}\n\t\t\t}\n\t\t}"))
drawTree(JSON.parse("{\n\t\t\t\"Leaf\": {\"Meta\":{\"Title\": \"\"}},\n\t\t\t\"Branches\": {\n\t\t\t\t\"id00\": {\n\t\t\t\t\t\"Leaf\": {\"Meta\":{\"Title\": \"title id00\"}},\n\t\t\t\t\t\"Branches\": {\n\t\t\t\t\t\t\"id10\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id10\"}},\"Branches\":{\n\t\t\t\t\t\t\t\"id20\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id20\"}},\"Branches\":{}}\n\t\t\t\t\t\t}},\n\t\t\t\t\t\t\"id11\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id11\"}},\"Branches\":{}}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"id01\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id01\"}},\"Branches\":{}},\n\t\t\t\t\"id02\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id02\"}},\"Branches\":{}},\n\t\t\t\t\"id03\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id03\"}},\"Branches\":{}},\n\t\t\t\t\"id04\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id04\"}},\"Branches\":{}},\n\t\t\t\t\"id04\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id04\"}},\"Branches\":{}},\n\t\t\t\t\"id05\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id05\"}},\"Branches\":{}},\n\t\t\t\t\"id06\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id06\"}},\"Branches\":{}},\n\t\t\t\t\"id07\": {\"Leaf\":{\"Meta\":{\"Title\":\"title id07 but it's really really really long\"}},\"Branches\":{}}\n\t\t\t}\n\t\t}"))
</script>
<div class="thic_flex lr_fullscreen" style="margin-left: 1em; width: 5px;">
@@ -261,11 +264,11 @@
alert(`failed to push file ${id}: ${status}: ${body}`)
throw `failed to push file ${id}: ${status}: ${body}`
}
document.getElementById("saveFeedback").innerHTML = "success!"
document.getElementById("saveFeedback").style.display = "block"
if (saveFeedbackInterval) {
clearTimeout(saveFeedbackInterval)
}
saveFeedbackInterval = setTimeout(() => {document.getElementById("saveFeedback").innerHTML = ""}, 5000)
saveFeedbackInterval = setTimeout(() => {document.getElementById("saveFeedback").style.display = "none"}, 2500)
}, body, headers)
}
function deleteFile() {
@@ -305,7 +308,10 @@
<div id="easyMDEwrap" class="monospace">
<textarea id="my-text-area"></textarea>
</div>
<div id="saveFeedback" style="min-height: 1.2em; text-align: right;">
<div style="min-height: 2em;"></div>
<div id="saveFeedback" class="button success" style="text-align: right; cursor: auto; display: none;">
Saved!
</div>
</div>
</article>
</div>
@@ -319,7 +325,7 @@
element: document.getElementById('my-text-area'),
forceSync: true,
indentWithTabs: false,
initialValue: "loading...",
initialValue: "# hello\n\n## world\n\n| this | is | my | table |\n| ---- | ---| ---| ----- |\n| hey |\n| ya | hey | ya |\n\n* and\n\t* a bulleted\n\t\t* list\n\n\u003e but here is a quote\n\n```go\n\/\/ and some go code\nfunc main() {\n\tlog.Println(\u0022hi\u0022)\n}\n```\n\nand\n\nnow\n\nthe\n\nnewlines\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t",
showIcons: ["code", "table"],
spellChecker: false,
sideBySideFullscreen: false,
@@ -339,7 +345,6 @@
},
status: ["lines", "words", "cursor"],
})
easyMDE.value("# hello\n\n## world\n\n| this | is | my | table |\n| ---- | ---| ---| ----- |\n| hey |\n| ya | hey | ya |\n\n* and\n\t* a bulleted\n\t\t* list\n\n\u003e but here is a quote\n\n```go\n// and some go code\nfunc main() {\n\tlog.Println(\"hi\")\n}\n```\n\nand\n\nnow\n\nthe\n\nnewlines\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t")
</script>
</div>