forked from cory/tildefriends
ssb: Add a checkbox to reply in a new thread. #47 Also, it's crab time. I'm sorry it took me so long.
This commit is contained in:
@ -15,6 +15,7 @@ class TfComposeElement extends LitElement {
|
||||
drafts: {type: Object},
|
||||
author: {type: String},
|
||||
channel: {type: String},
|
||||
new_thread: {type: Boolean},
|
||||
};
|
||||
}
|
||||
|
||||
@ -28,6 +29,7 @@ class TfComposeElement extends LitElement {
|
||||
this.apps = undefined;
|
||||
this.drafts = {};
|
||||
this.author = undefined;
|
||||
this.new_thread = false;
|
||||
}
|
||||
|
||||
process_text(text) {
|
||||
@ -200,7 +202,7 @@ class TfComposeElement extends LitElement {
|
||||
channel: this.channel,
|
||||
};
|
||||
if (this.root || this.branch) {
|
||||
message.root = this.root;
|
||||
message.root = this.new_thread ? this.branch ?? this.root : this.root;
|
||||
message.branch = this.branch;
|
||||
}
|
||||
if (Object.values(draft.mentions || {}).length) {
|
||||
@ -469,6 +471,16 @@ class TfComposeElement extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
render_new_thread() {
|
||||
let self = this;
|
||||
if (this.root !== undefined && this.branch !== undefined && this.root != this.branch) {
|
||||
return html`
|
||||
<input type="checkbox" class="w3-check w3-theme-d1" id="new_thread" @change=${() => self.new_thread = !self.new_thread} ?checked=${self.new_thread}></input>
|
||||
<label for="new_thread">New Thread</label>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
get_draft() {
|
||||
return this.drafts[this.branch || ''] || {};
|
||||
}
|
||||
@ -562,7 +574,9 @@ class TfComposeElement extends LitElement {
|
||||
${Object.values(draft.mentions || {}).map((x) =>
|
||||
self.render_mention(x)
|
||||
)}
|
||||
${this.render_attach_app()} ${this.render_content_warning()}
|
||||
${this.render_attach_app()}
|
||||
${this.render_content_warning()}
|
||||
${this.render_new_thread()}
|
||||
<button class="w3-button w3-theme-d1" id="submit" @click=${this.submit}>
|
||||
Submit
|
||||
</button>
|
||||
|
Reference in New Issue
Block a user