Repository navigation
0.9.3: paste images, drop files - #37
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paste a copied image (web, desktop, Android). A screenshot or an image copied in another app goes into the message with Ctrl+V / ⌘V in the message box. The paste handler takes the clipboard's files when the paste has no text with it, because a range copied from a sheet also carries a picture of itself. A pasted image has no name of its own: browsers call it
image.png, and Android's are named after a number. So each one is namedimage-<local date and time>.png.On Android the WebView's text box offers no Paste when the clipboard holds only an image, and the page may not read the clipboard (
navigator.clipboard.read()is denied). A small plugin,ClipboardImagePlugin.java, does the reading:has()looks only at the clip's description, because reading the clip itself makes Android show its "pasted" notice.read()returns the image's type and bytes.Tapping 📎 with an image on the clipboard asks "You copied an image — Paste it / Choose a file". Without an image, 📎 opens the file picker as before. A keyboard's Ctrl+V works there too.
Drag and drop (web, desktop). Files dropped on a chat join the message, and a dashed "Drop to add to your message" shows while dragging. A file dropped anywhere else is ignored, so the browser or Electron doesn't open it in place of the app.
Tests
test/app.e2e.mjs files:test/android/paste.mjs, on an emulator. The app runs in a chat against the in-memory GitHub, with its requests caught through DevTools so none leave the machine. Chrome copies a real image from a page the test serves. Then:The usage guide (EN+TR) and the changelog (EN+TR) are updated.