File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050 :maxlength =" 64_000 "
5151 :multiline =" isMobile "
5252 dir="auto"
53+ @paste =" onPaste "
5354 @update :model-value =" $emit (' update:chatContent' , $event )"
5455 @submit =" onSubmitText " />
5556 <div class =" input-area__button-box" >
@@ -198,6 +199,13 @@ export default {
198199 },
199200
200201 methods: {
202+ onPaste (e ) {
203+ if (! this .multimodalChatAvailable || e .clipboardData .files .length === 0 ) {
204+ return
205+ }
206+ e .preventDefault ()
207+ this .uploadFiles (e .clipboardData .files )
208+ },
201209 focus () {
202210 this .$nextTick (() => {
203211 this .$refs .richContenteditable .focus ()
@@ -228,12 +236,17 @@ export default {
228236 this .$refs .fileInput .click ()
229237 },
230238 onUploadFileSelected () {
231- const files = this .$refs .fileInput .files
239+ this .uploadFiles (this .$refs .fileInput .files )
240+ .finally (() => {
241+ this .$refs .fileInput .value = ' '
242+ })
243+ },
244+ uploadFiles (files ) {
232245 if (! files || files .length === 0 ) {
233- return
246+ return Promise . resolve ()
234247 }
235248 this .isUploading = true
236- Promise .all (Array .from (files).map (f => uploadInputFile (f)))
249+ return Promise .all (Array .from (files).map (f => uploadInputFile (f)))
237250 .then ((responses ) => {
238251 const fileIds = responses .map (response => response .data .ocs .data .fileId )
239252 this .attachedFileIds = [... this .attachedFileIds , ... fileIds]
@@ -244,7 +257,6 @@ export default {
244257 })
245258 .finally (() => {
246259 this .isUploading = false
247- this .$refs .fileInput .value = ' '
248260 })
249261 },
250262 async onChooseFromNextcloud () {
You can’t perform that action at this time.
0 commit comments