todo, scroll to cur pos

master
Bel LaPointe 2022-02-15 16:40:09 -07:00
parent f48d8dc533
commit 5fe85575dc
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,7 @@
todo: todo:
- highlight current page
- search page tree is empty
- hide checkbox for tree
- delete button does nothing - delete button does nothing
- do not rewrite .md title vs. link cause hrefs to ./gobs.md wont work - do not rewrite .md title vs. link cause hrefs to ./gobs.md wont work
- https://codepen.io/bisserof/pen/nrMveb - https://codepen.io/bisserof/pen/nrMveb

View File

@ -35,11 +35,17 @@
} }
function leafHTML(id, branch) { function leafHTML(id, branch) {
const href="/ui/files/" + (id ? id : "#") const href="/ui/files/" + (id ? id : "#")
const name=`filetree-leaf-${id}` var nameSafeId = id.replace(/\//g, "-")
var parentNameSafeId = nameSafeId
if (id.includes("/"))
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.Title : "ROOT"
return ` return `
<a style="flex-grow: 1;" href="${href}"><button style="width: 100%; text-align: left; outline: none;">${title}</button></a> <div style="margin: 0; padding: 0; height: 0; width: 0;" id="${name}"></div>
<a href="${href}/${crypto.randomUUID().split("-")[0]}"><button>+</button></a> <a style="flex-grow: 1;" href="${href}#${parentname}"><button style="width: 100%; text-align: left; outline: none;">${title}</button></a>
<a href="${href}/${crypto.randomUUID().split("-")[0]}#${parentname}"><button>+</button></a>
` `
} }
function branchesHTML(id, branches) { function branchesHTML(id, branches) {