UX: Allow pasting lat / lng in a single operation - #3568
Conversation
This speeds up the workflow when pasting location found in external mapping application
| * and lng fields | ||
| */ | ||
| let paste = (event.clipboardData || window.clipboardData).getData("text"); | ||
| let s = paste.split(/[ ,]+/); |
There was a problem hiding this comment.
Looks like it might throw an exception if paste isn't a string for some reason?
There was a problem hiding this comment.
The specification of this seems to indicate that you will always get an empty string result even if the data type does not support strings (https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/getData#return_value).
I tested this by pasting some non-text data (eg image data), and the code just ends up with s.length == 0, and thus ignoring it.
|
Thank you very much! I didn't know a |
|
As I'm not sure how much time I have for this next week, I'll move ahead to merge your PR and add checks in case the browser clipboard cannot be accessed for some reason. Thank you for your contribution! ❤️ |
Signed-off-by: Michael Mayer <michael@photoprism.app>
It seems you can capture any DOM event in Vue. This should work with basically any browser. They all support the paste event (https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event#browser_compatibility) |
Signed-off-by: Michael Mayer <michael@photoprism.app>
This speeds up the workflow when pasting location found in external mapping application
Acceptance Criteria: