-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
UX: Allow pasting lat / lng in a single operation #3568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it might throw an exception if paste isn't a string for some reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: