Focus while upload.
This commit is contained in:
		
							parent
							
								
									b0666a0090
								
							
						
					
					
						commit
						707788583a
					
				| @ -49,6 +49,8 @@ class UploadButtonElement extends HTMLElement { | |||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         request.send(formData); |         request.send(formData); | ||||||
|  |         const uploadEvent = new Event('upload',{}); | ||||||
|  |         this.dispatchEvent(uploadEvent); | ||||||
|     } |     } | ||||||
|     channelUid = null |     channelUid = null | ||||||
|     connectedCallback() { |     connectedCallback() { | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ | |||||||
|     function getInputField(){ |     function getInputField(){ | ||||||
|         return document.querySelector("textarea") |         return document.querySelector("textarea") | ||||||
|     } |     } | ||||||
| 
 |      | ||||||
|     function initInputField(textBox) { |     function initInputField(textBox) { | ||||||
|         textBox.addEventListener('keydown', (e) => { |         textBox.addEventListener('keydown', (e) => { | ||||||
|             if (e.key === 'Enter' && !e.shiftKey) { |             if (e.key === 'Enter' && !e.shiftKey) { | ||||||
| @ -42,7 +42,9 @@ | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 |         document.querySelector("upload-button").addEventListener("upload",function(e){ | ||||||
|  |             getInputField().focus(); | ||||||
|  |         }) | ||||||
|         textBox.addEventListener("paste", async (e) => { |         textBox.addEventListener("paste", async (e) => { | ||||||
|             try { |             try { | ||||||
|                 const clipboardItems = await navigator.clipboard.read(); |                 const clipboardItems = await navigator.clipboard.read(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user