-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Copy/Paste Option for adding Book Covers resolving #9993 #10101
base: master
Are you sure you want to change the base?
Copy/Paste Option for adding Book Covers resolving #9993 #10101
Conversation
for more information, see https://pre-commit.ci
@cdrini Are any changed required? Waiting for your review! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10101 +/- ##
==========================================
+ Coverage 17.12% 17.26% +0.13%
==========================================
Files 89 89
Lines 4752 4841 +89
Branches 831 853 +22
==========================================
+ Hits 814 836 +22
- Misses 3428 3480 +52
- Partials 510 525 +15 ☔ View full report in Codecov by Sentry. |
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.
Nice work @Spaarsh this looks like a great start! A few code fixes from a quick first pass.
Also for the UI: Place the image inside the "paste image" grey box ; just above the "Use this image" button. Like so:
We use this UI for one of the other grey boxes, so see if you can re-use the CSS there.
try { | ||
const clipboardItems = await navigator.clipboard.read(); | ||
for (const item of clipboardItems) { | ||
if (item.types.includes('image/png')) { |
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.
Ah there's a bug here; since there can be multiple items in the clipboardItems, you'll want to skip any non image types, not error. Eg
if (!item.types.includes('image/png')) {
continue;
}
And also check for jpg images as well, since those will work too!
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.
Yes done. Additionally, initially I had included only png support because clipboards store all copied image formats in .png irrespective of the initial image format. However after a little digging after your suggestion, I found out that in Windows, users can changes their settings to store images in the jpg format. I may have to dig deeper into this, but I do not see any harm in adding the support right now.
Co-authored-by: Drini Cami <[email protected]>
@cdrini any updates on this? |
Closes #9993
feature
Technical
Changes are limited to .html and .js files only. It is still a bit buggy on the front end side. A user may be shown 'No Image Selected' even if that is not the case. But the submission will be successfully done nonetheless.
Testing
Screenshot
Stakeholders
@RayBB @cdrini @mekarpeles @Freso