forked from cory/tildefriends
Fix wiki doc confusingly and incorrectly being pre-selected.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4606 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
8bdc27bf5c
commit
021f3ad5bc
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "📝",
|
"emoji": "📝",
|
||||||
"previous": "&OpEjJ6ZLsIabI1SOzLymRGKlwy2Q6YUI+I3JW5cR7nA=.sha256"
|
"previous": "&IJPpdyG/+rYiBwT0loE38hisCHZ2T/i7lpA3a2+wBgA=.sha256"
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import {LitElement, html} from './lit-all.min.js';
|
import {LitElement, html, keyed} from './lit-all.min.js';
|
||||||
import * as tfrpc from '/static/tfrpc.js';
|
import * as tfrpc from '/static/tfrpc.js';
|
||||||
|
|
||||||
class TfCollectionsAppElement extends LitElement {
|
class TfCollectionsAppElement extends LitElement {
|
||||||
@ -50,7 +50,6 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async read_wiki_docs() {
|
async read_wiki_docs() {
|
||||||
console.log('read_wiki_docs', this.wiki?.id);
|
|
||||||
if (!this.wiki?.id) {
|
if (!this.wiki?.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,11 +90,9 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
|
|
||||||
update_wiki_doc() {
|
update_wiki_doc() {
|
||||||
let want_wiki_doc = this.hash_wiki_doc();
|
let want_wiki_doc = this.hash_wiki_doc();
|
||||||
console.log('looking for', want_wiki_doc);
|
|
||||||
for (let wiki_doc of Object.values(this.wiki_docs ?? {})) {
|
for (let wiki_doc of Object.values(this.wiki_docs ?? {})) {
|
||||||
if (wiki_doc.name === want_wiki_doc) {
|
if (wiki_doc.name === want_wiki_doc) {
|
||||||
this.wiki_doc = wiki_doc;
|
this.wiki_doc = wiki_doc;
|
||||||
console.log('setting', wiki_doc.name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,6 +116,7 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
async on_wiki_changed(event) {
|
async on_wiki_changed(event) {
|
||||||
this.wiki = event.detail.value;
|
this.wiki = event.detail.value;
|
||||||
this.wiki_doc = undefined;
|
this.wiki_doc = undefined;
|
||||||
|
this.wiki_docs = undefined;
|
||||||
this.update_hash();
|
this.update_hash();
|
||||||
this.read_wiki_docs();
|
this.read_wiki_docs();
|
||||||
}
|
}
|
||||||
@ -157,10 +155,10 @@ class TfCollectionsAppElement extends LitElement {
|
|||||||
.collection=${this.wikis}
|
.collection=${this.wikis}
|
||||||
selected_id=${this.wiki?.id}
|
selected_id=${this.wiki?.id}
|
||||||
@change=${this.on_wiki_changed}></tf-collection>
|
@change=${this.on_wiki_changed}></tf-collection>
|
||||||
<tf-collection
|
${keyed(this.wiki_doc?.id, html`<tf-collection
|
||||||
.collection=${this.wiki_docs}
|
.collection=${this.wiki_docs}
|
||||||
selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''}
|
selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''}
|
||||||
@change=${this.on_wiki_doc_changed}></tf-collection>
|
@change=${this.on_wiki_doc_changed}></tf-collection>`)}
|
||||||
</div>
|
</div>
|
||||||
${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
|
||||||
|
Loading…
Reference in New Issue
Block a user