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() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.composerInputEl = document.querySelector(".chat-composer__input");
|
|
||||||
this.composerInputEl?.addEventListener("paste", this._pasteEventListener);
|
this.composerInputEl?.addEventListener("paste", this._pasteEventListener);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
<div class="chat-composer__input-container">
|
<div class="chat-composer__input-container">
|
||||||
<DTextarea
|
<DTextarea
|
||||||
|
id={{this.composerId}}
|
||||||
value={{readonly this.currentMessage.message}}
|
value={{readonly this.currentMessage.message}}
|
||||||
type="text"
|
type="text"
|
||||||
class="chat-composer__input"
|
class="chat-composer__input"
|
||||||
|
@ -86,6 +87,7 @@
|
||||||
@onUploadChanged={{this.onUploadChanged}}
|
@onUploadChanged={{this.onUploadChanged}}
|
||||||
@existingUploads={{this.currentMessage.uploads}}
|
@existingUploads={{this.currentMessage.uploads}}
|
||||||
@uploadDropZone={{@uploadDropZone}}
|
@uploadDropZone={{@uploadDropZone}}
|
||||||
|
@composerInputEl={{this.textareaInteractor.textarea}}
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ export default class ChatComposerChannel extends ChatComposer {
|
||||||
|
|
||||||
context = "channel";
|
context = "channel";
|
||||||
|
|
||||||
|
composerId = "channel-composer";
|
||||||
|
|
||||||
@action
|
@action
|
||||||
sendMessage(raw) {
|
sendMessage(raw) {
|
||||||
const message = ChatMessage.createDraftMessage(this.args.channel, {
|
const message = ChatMessage.createDraftMessage(this.args.channel, {
|
||||||
|
|
|
@ -11,6 +11,8 @@ export default class ChatComposerThread extends ChatComposer {
|
||||||
|
|
||||||
context = "thread";
|
context = "thread";
|
||||||
|
|
||||||
|
composerId = "thread-composer";
|
||||||
|
|
||||||
@action
|
@action
|
||||||
sendMessage(raw) {
|
sendMessage(raw) {
|
||||||
const message = ChatMessage.createDraftMessage(this.args.channel, {
|
const message = ChatMessage.createDraftMessage(this.args.channel, {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class TextareaInteractor extends EmberObject.extend(
|
||||||
this._textarea = textarea;
|
this._textarea = textarea;
|
||||||
this.element = this._textarea;
|
this.element = this._textarea;
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
this.composerFocusSelector = ".chat-composer__input";
|
this.composerFocusSelector = `#${textarea.id}`;
|
||||||
|
|
||||||
this.init(); // mixin init wouldn't be called otherwise
|
this.init(); // mixin init wouldn't be called otherwise
|
||||||
this.composerEventPrefix = null; // we don't need app events
|
this.composerEventPrefix = null; // we don't need app events
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-composer {
|
.chat-composer__wrapper {
|
||||||
padding-bottom: 28px;
|
padding-bottom: 28px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue