Re-hook up all the wiki-related modification events.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4614 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-11-06 00:59:30 +00:00
parent b83704a218
commit 889773c38d
2 changed files with 62 additions and 1 deletions

View File

@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "📝",
"previous": "&263ro6L8r7tRcrC7LjvY59gC72DlEM/nehd6s7S08sQ=.sha256"
"previous": "&0dFKAKThgExsyMQN99dOX7HP4UBhYYnuhYTILTCO5FI=.sha256"
}

View File

@ -128,6 +128,61 @@ class TfCollectionsAppElement extends LitElement {
this.read_wiki_docs();
}
async on_wiki_create(event) {
await tfrpc.rpc.appendMessage(this.whoami, {
type: 'wiki',
name: event.detail.name,
});
}
async on_wiki_rename(event) {
await tfrpc.rpc.appendMessage(this.whoami, {
type: 'wiki',
key: event.detail.id,
name: event.detail.name,
});
}
async on_wiki_tombstone(event) {
await tfrpc.rpc.appendMessage(this.whoami, {
type: 'wiki',
key: event.detail.id,
tombstone: {
date: new Date().valueOf(),
reason: 'tombstoned by user',
},
});
}
async on_wiki_doc_create(event) {
await tfrpc.rpc.appendMessage(this.whoami, {
type: 'wiki-doc',
parent: this.wiki.id,
name: event.detail.name,
});
}
async on_wiki_doc_rename(event) {
await tfrpc.rpc.appendMessage(this.whoami, {
type: 'wiki-doc',
parent: this.wiki.id,
key: event.detail.id,
name: event.detail.name,
});
}
async on_wiki_doc_tombstone(event) {
await tfrpc.rpc.appendMessage(this.whoami, {
type: 'wiki-doc',
parent: this.wiki.id,
key: event.detail.id,
tombstone: {
date: new Date().valueOf(),
reason: 'tombstoned by user',
},
});
}
async on_wiki_doc_changed(event) {
this.wiki_doc = event.detail.value;
this.update_hash();
@ -143,10 +198,16 @@ class TfCollectionsAppElement extends LitElement {
<tf-collection
.collection=${this.wikis}
selected_id=${this.wiki?.id}
@create=${this.on_wiki_create}
@rename=${this.on_wiki_rename}
@tombstone=${this.on_wiki_tombstone}
@change=${this.on_wiki_changed}></tf-collection>
${keyed(this.wiki_doc?.id, html`<tf-collection
.collection=${this.wiki_docs}
selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''}
@create=${this.on_wiki_doc_create}
@rename=${this.on_wiki_doc_rename}
@tombstone=${this.on_wiki_doc_tombstone}
@change=${this.on_wiki_doc_changed}></tf-collection>`)}
</div>
${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html`