forked from cory/tildefriends
Fix up links to other wiki-doc pages, and reduce the following depth to improve load times.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4631 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
305f5232e7
commit
a0043ec49f
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "📝",
|
"emoji": "📝",
|
||||||
"previous": "&HpEPHrCdoej769DCZmJYH0ma9OfzdhPKMTEmvcNz8Wg=.sha256"
|
"previous": "&FINPRELEEbBO4wVoRYZyd5/VIMERFMyk4NjC8wxjelE=.sha256"
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
this.owner_ids = await tfrpc.rpc.getOwnerIdentities();
|
this.owner_ids = await tfrpc.rpc.getOwnerIdentities();
|
||||||
this.whoami = await tfrpc.rpc.localStorageGet('collections_whoami');
|
this.whoami = await tfrpc.rpc.localStorageGet('collections_whoami');
|
||||||
let ids = [...new Set([...this.owner_ids, this.whoami])].sort();
|
let ids = [...new Set([...this.owner_ids, this.whoami])].sort();
|
||||||
this.following = Object.keys(await tfrpc.rpc.following(ids, 2)).sort();
|
this.following = Object.keys(await tfrpc.rpc.following(ids, 1)).sort();
|
||||||
|
|
||||||
await this.read_wikis();
|
await this.read_wikis();
|
||||||
await this.read_Wiki_docs();
|
await this.read_Wiki_docs();
|
||||||
@ -281,6 +281,7 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html`
|
${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html`
|
||||||
<tf-wiki-doc
|
<tf-wiki-doc
|
||||||
whoami=${this.whoami}
|
whoami=${this.whoami}
|
||||||
|
.wiki=${this.wiki}
|
||||||
.value=${this.wiki_doc}></tf-wiki-doc>
|
.value=${this.wiki_doc}></tf-wiki-doc>
|
||||||
` : undefined}
|
` : undefined}
|
||||||
`;
|
`;
|
||||||
|
@ -5,6 +5,7 @@ class TfWikiDocElement extends LitElement {
|
|||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
whoami: {type: String},
|
whoami: {type: String},
|
||||||
|
wiki: {type: String},
|
||||||
value: {type: Object},
|
value: {type: Object},
|
||||||
blob: {type: String},
|
blob: {type: String},
|
||||||
blob_original: {type: String},
|
blob_original: {type: String},
|
||||||
@ -21,6 +22,19 @@ class TfWikiDocElement extends LitElement {
|
|||||||
var reader = new commonmark.Parser({safe: true});
|
var reader = new commonmark.Parser({safe: true});
|
||||||
var writer = new commonmark.HtmlRenderer();
|
var writer = new commonmark.HtmlRenderer();
|
||||||
var parsed = reader.parse(md || '');
|
var parsed = reader.parse(md || '');
|
||||||
|
let walker = parsed.walker();
|
||||||
|
let event;
|
||||||
|
while ((event = walker.next())) {
|
||||||
|
let node = event.node;
|
||||||
|
if (event.entering) {
|
||||||
|
if (node.type === 'link') {
|
||||||
|
if (node.destination.indexOf(':') == -1 &&
|
||||||
|
node.destination.indexOf('/') == -1) {
|
||||||
|
node.destination = `#${this.wiki?.name}/${node.destination}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return writer.render(parsed);
|
return writer.render(parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user