| | @@ -5,21 +5,20 @@ |
| 5 | 5 | const _me = F.user.name; |
| 6 | 6 | /* State for paste and drag/drop */ |
| 7 | 7 | const BlobXferState = { |
| 8 | 8 | dropZone: document.querySelector('#chat-drop-zone'), |
| 9 | 9 | dropDetails: document.querySelector('#chat-drop-details'), |
| 10 | | - imgTag: document.querySelector('#chat-drop-details img'), |
| 11 | 10 | blob: undefined |
| 12 | 11 | }; |
| 13 | 12 | /** Updates the paste/drop zone with details of the pasted/dropped |
| 14 | 13 | data. */ |
| 15 | 14 | const updateDropZoneContent = function(blob){ |
| 16 | 15 | const bx = BlobXferState, dd = bx.dropDetails; |
| 17 | 16 | bx.blob = blob; |
| 18 | 17 | D.clearElement(dd); |
| 19 | 18 | if(!blob) return; |
| 20 | | - D.append(dd, D.br(), "Name: ", blob.name, |
| 19 | + D.append(dd, "Name: ", blob.name, |
| 21 | 20 | D.br(), "Size: ",blob.size); |
| 22 | 21 | if(blob.type && blob.type.startsWith("image/")){ |
| 23 | 22 | const img = D.img(); |
| 24 | 23 | D.append(dd, D.br(), img); |
| 25 | 24 | const reader = new FileReader(); |
| | @@ -105,10 +104,22 @@ |
| 105 | 104 | updateDropZoneContent(items[0].getAsFile()); |
| 106 | 105 | }else if('string'===item.kind){ |
| 107 | 106 | item.getAsString((v)=>form.msg.value = v); |
| 108 | 107 | } |
| 109 | 108 | }; |
| 109 | + if(true){/* Add help button for drag/drop/paste zone */ |
| 110 | + const help = D.div(); |
| 111 | + BlobXferState.dropDetails.parentNode.insertBefore( |
| 112 | + help,BlobXferState.dropDetails |
| 113 | + ); |
| 114 | + F.helpButtonlets.create( |
| 115 | + help, |
| 116 | + "Drag/drop a file into this spot, or paste an image "+ |
| 117 | + "from the clipboard if supported by your environment." |
| 118 | + ); |
| 119 | + } |
| 120 | + |
| 110 | 121 | /* Injects element e as a new row in the chat, at the top of the list */ |
| 111 | 122 | const injectMessage = function f(e){ |
| 112 | 123 | if(!f.injectPoint){ |
| 113 | 124 | f.injectPoint = document.querySelector('#message-inject-point'); |
| 114 | 125 | } |
| 115 | 126 | |