mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
FIX: correctly differentiates channel/thread upload inputs (#21301)
Prior to this fix uploads event could end up in the wrong textarea. This will most importantly allow pasting an image in the thread composer. Also fixes a minor padding issue on thread when uploads are associated to it.
This commit is contained in:
parent
4a08c23965
commit
290bd975c5
@ -39,7 +39,7 @@ export default Component.extend(UppyUploadMixin, {
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
this.composerInputEl = document.querySelector(".chat-composer__input");
|
||||
|
||||
this.composerInputEl?.addEventListener("paste", this._pasteEventListener);
|
||||
},
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
<div class="chat-composer__input-container">
|
||||
<DTextarea
|
||||
id={{this.composerId}}
|
||||
value={{readonly this.currentMessage.message}}
|
||||
type="text"
|
||||
class="chat-composer__input"
|
||||
@ -86,6 +87,7 @@
|
||||
@onUploadChanged={{this.onUploadChanged}}
|
||||
@existingUploads={{this.currentMessage.uploads}}
|
||||
@uploadDropZone={{@uploadDropZone}}
|
||||
@composerInputEl={{this.textareaInteractor.textarea}}
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
|
@ -12,6 +12,8 @@ export default class ChatComposerChannel extends ChatComposer {
|
||||
|
||||
context = "channel";
|
||||
|
||||
composerId = "channel-composer";
|
||||
|
||||
@action
|
||||
sendMessage(raw) {
|
||||
const message = ChatMessage.createDraftMessage(this.args.channel, {
|
||||
|
@ -11,6 +11,8 @@ export default class ChatComposerThread extends ChatComposer {
|
||||
|
||||
context = "thread";
|
||||
|
||||
composerId = "thread-composer";
|
||||
|
||||
@action
|
||||
sendMessage(raw) {
|
||||
const message = ChatMessage.createDraftMessage(this.args.channel, {
|
||||
|
@ -22,7 +22,7 @@ export default class TextareaInteractor extends EmberObject.extend(
|
||||
this._textarea = textarea;
|
||||
this.element = this._textarea;
|
||||
this.ready = true;
|
||||
this.composerFocusSelector = ".chat-composer__input";
|
||||
this.composerFocusSelector = `#${textarea.id}`;
|
||||
|
||||
this.init(); // mixin init wouldn't be called otherwise
|
||||
this.composerEventPrefix = null; // we don't need app events
|
||||
|
@ -29,7 +29,7 @@
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.chat-composer {
|
||||
.chat-composer__wrapper {
|
||||
padding-bottom: 28px;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user