1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Wire Chat.js to Attachment/Upload.js

This commit is contained in:
Tim Düsterhus 2020-11-01 12:03:04 +01:00
parent baa654a37a
commit 9a870f3f94
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
2 changed files with 20 additions and 5 deletions

View File

@ -4,7 +4,7 @@
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2024-10-31
* Change Date: 2024-11-01
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
@ -178,8 +178,11 @@ define([ './Chat/console'
this.ui = this.bottle.container.Ui
this.ui.bootstrap()
this.bottle.container.UiInput.on('submit', this.onSubmit.bind(this))
this.bottle.container.UiInput.on('autocomplete', this.onAutocomplete.bind(this))
this.ui.input.on('submit', this.onSubmit.bind(this))
this.ui.input.on('autocomplete', this.onAutocomplete.bind(this))
this.ui.attachmentUpload.on('send', (event) => {
event.detail.promise = this.onSendAttachment(event)
})
await this.bottle.container.Room.join()
@ -330,6 +333,10 @@ define([ './Chat/console'
}
}
async onSendAttachment(event) {
return this.bottle.container.Messenger.pushAttachment(event.detail.attachmentId)
}
onAutocomplete(event) {
const input = event.target
const value = input.getText(true)

View File

@ -1,10 +1,10 @@
/*
* Copyright (c) 2010-2018 Tim Düsterhus.
* Copyright (c) 2010-2020 Tim Düsterhus.
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
* Change Date: 2024-10-20
* Change Date: 2024-11-01
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
@ -56,6 +56,14 @@ define([ './console'
return Ajax.api(this, payload)
}
async pushAttachment(attachmentId) {
const payload = { actionName: 'pushAttachment'
, parameters: { attachmentId }
}
return Ajax.api(this, payload)
}
_ajaxSetup() {
return { silent: true
, ignoreError: true