forked from cory/tildefriends
Fix some ssb compose issues.
This commit is contained in:
parent
a9cb913a47
commit
c5ddf3ac99
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🐌",
|
"emoji": "🐌",
|
||||||
"previous": "&r2Xphgr4HGdG4WnqWngj8fcAs1xHfZ1a2DJgqr7hqZA=.sha256"
|
"previous": "&IknYNSKcVBOL5mY056kj4vUtd2IbW91LOl6KFwSqaWM=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {LitElement, html, unsafeHTML} from './lit-all.min.js';
|
import {LitElement, html, unsafeHTML, live} from './lit-all.min.js';
|
||||||
import * as tfutils from './tf-utils.js';
|
import * as tfutils from './tf-utils.js';
|
||||||
import * as tfrpc from '/static/tfrpc.js';
|
import * as tfrpc from '/static/tfrpc.js';
|
||||||
import {styles} from './tf-styles.js';
|
import {styles} from './tf-styles.js';
|
||||||
@ -66,7 +66,7 @@ class TfComposeElement extends LitElement {
|
|||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
if (updated) {
|
if (updated) {
|
||||||
this.requestUpdate();
|
setTimeout(() => this.notify(draft), 0);
|
||||||
}
|
}
|
||||||
return tfutils.markdown(text);
|
return tfutils.markdown(text);
|
||||||
}
|
}
|
||||||
@ -301,14 +301,14 @@ class TfComposeElement extends LitElement {
|
|||||||
{
|
{
|
||||||
values: values,
|
values: values,
|
||||||
selectTemplate: function (item) {
|
selectTemplate: function (item) {
|
||||||
return `[@${item.original.key}](${item.original.value})`;
|
return item ? `[@${item.original.key}](${item.original.value})` : undefined;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
trigger: '&',
|
trigger: '&',
|
||||||
values: this.autocomplete,
|
values: this.autocomplete,
|
||||||
selectTemplate: function (item) {
|
selectTemplate: function (item) {
|
||||||
return `![${item.original.key}](${item.original.value})`;
|
return item ? `![${item.original.key}](${item.original.value})` : undefined;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -342,8 +342,7 @@ class TfComposeElement extends LitElement {
|
|||||||
remove_mention(id) {
|
remove_mention(id) {
|
||||||
let draft = this.get_draft();
|
let draft = this.get_draft();
|
||||||
delete draft.mentions[id];
|
delete draft.mentions[id];
|
||||||
this.notify(draft);
|
setTimeout(() => this.requestUpdate(), 0);
|
||||||
this.requestUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render_mention(mention) {
|
render_mention(mention) {
|
||||||
@ -550,8 +549,8 @@ class TfComposeElement extends LitElement {
|
|||||||
@input=${this.input}
|
@input=${this.input}
|
||||||
@paste=${this.paste}
|
@paste=${this.paste}
|
||||||
contenteditable
|
contenteditable
|
||||||
>${draft.text}</span
|
innerText=${live(draft.text)}
|
||||||
>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-half w3-padding">
|
<div class="w3-half w3-padding">
|
||||||
${content_warning}
|
${content_warning}
|
||||||
|
@ -85,9 +85,7 @@ class TfTabNewsElement extends LitElement {
|
|||||||
delete this.drafts[id];
|
delete this.drafts[id];
|
||||||
}
|
}
|
||||||
/* Only trigger a re-render if we're creating a new draft or discarding an old one. */
|
/* Only trigger a re-render if we're creating a new draft or discarding an old one. */
|
||||||
if ((previous !== undefined) != (event.detail.draft !== undefined)) {
|
this.drafts = Object.assign({}, this.drafts);
|
||||||
this.drafts = Object.assign({}, this.drafts);
|
|
||||||
}
|
|
||||||
tfrpc.rpc.localStorageSet('drafts', JSON.stringify(this.drafts));
|
tfrpc.rpc.localStorageSet('drafts', JSON.stringify(this.drafts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user