forked from cory/tildefriends
Let the wiki app post blog messages.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4666 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
817838e522
commit
360d0bc110
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "📝",
|
"emoji": "📝",
|
||||||
"previous": "&S0BU5A5u3ltu0+QZn+wANrO/sx+nqi4vQLs2t5Rwm/I=.sha256"
|
"previous": "&4lapemQFDuH+5ZeI831O8Qk+nK+47xLdHvKU6x53j2A=.sha256"
|
||||||
}
|
}
|
@ -117,6 +117,22 @@ class TfWikiDocElement extends LitElement {
|
|||||||
return this.append_message(false);
|
return this.append_message(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async on_blog_publish() {
|
||||||
|
let blob = this.blob;
|
||||||
|
let id = await tfrpc.rpc.store_blob(blob);
|
||||||
|
let message = {
|
||||||
|
type: 'blog',
|
||||||
|
key: this.value.id,
|
||||||
|
parent: this.value.parent,
|
||||||
|
summary: this.summary(blob),
|
||||||
|
thumbnail: this.thumbnail(blob),
|
||||||
|
blog: id,
|
||||||
|
mentions: this.blob.match(/(&.{44}.sha256)/g)?.map(x => ({link: x})),
|
||||||
|
};
|
||||||
|
await tfrpc.rpc.appendMessage(this.whoami, message);
|
||||||
|
this.is_editing = false;
|
||||||
|
}
|
||||||
|
|
||||||
convert_to_format(buffer, type, mime_type) {
|
convert_to_format(buffer, type, mime_type) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let img = new Image();
|
let img = new Image();
|
||||||
@ -202,6 +218,7 @@ class TfWikiDocElement extends LitElement {
|
|||||||
<button ?disabled=${this.blob == this.blob_original && !this.value?.draft} @click=${this.on_publish}>Publish</button>
|
<button ?disabled=${this.blob == this.blob_original && !this.value?.draft} @click=${this.on_publish}>Publish</button>
|
||||||
<button ?disabled=${!this.is_editing} @click=${this.on_discard}>Discard</button>
|
<button ?disabled=${!this.is_editing} @click=${this.on_discard}>Discard</button>
|
||||||
<button ?disabled=${!this.is_editing} @click=${() => self.value = Object.assign({}, self.value, {private: !self.value.private})}>${this.value?.private ? 'Make Public' : 'Make Private'}</button>
|
<button ?disabled=${!this.is_editing} @click=${() => self.value = Object.assign({}, self.value, {private: !self.value.private})}>${this.value?.private ? 'Make Public' : 'Make Private'}</button>
|
||||||
|
<button ?disabled=${!this.is_editing} @click=${this.on_blog_publish}>Publish Blog</button>
|
||||||
</div>
|
</div>
|
||||||
<div ?hidden=${!this.value?.private} style="color: #800">🔒 document is private</div>
|
<div ?hidden=${!this.value?.private} style="color: #800">🔒 document is private</div>
|
||||||
<div style="display: flex; flex-direction: row; ${this.value?.private ? 'border-top: 4px solid #800' : ''}">
|
<div style="display: flex; flex-direction: row; ${this.value?.private ? 'border-top: 4px solid #800' : ''}">
|
||||||
|
Loading…
Reference in New Issue
Block a user