Skip to content
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

Feat: Add clipboard paste functionality for screenshots #12181

Merged
merged 8 commits into from
Aug 7, 2024

Conversation

meel-hd
Copy link
Collaborator

@meel-hd meel-hd commented Aug 2, 2024

Proposed changes

Added: Paste screenshot from clipboard.

The user clicks paste. Then the clipboard is read if the permesion is given and the context is secure (as required by the clipboard API). Then the image is pasted into the select file input. Otherwise if no image is available we only inform the user about that.

Closes: #6710

Checklist

  • Lint and unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added documentation to describe my feature.
  • I have squashed my commits into logic units.
  • I have described the changes in the commit messages.

Other information

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.15%. Comparing base (6aee586) to head (4fde151).
Report is 5796 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12181      +/-   ##
==========================================
+ Coverage   90.82%   91.15%   +0.33%     
==========================================
  Files         554      584      +30     
  Lines       57306    59631    +2325     
  Branches     9122     9457     +335     
==========================================
+ Hits        52046    54358    +2312     
- Misses       3640     3653      +13     
  Partials     1620     1620              
Files with missing lines Coverage Δ
weblate/screenshots/forms.py 100.00% <100.00%> (ø)

... and 403 files with indirect coverage changes

@nijel nijel linked an issue Aug 5, 2024 that may be closed by this pull request
Copy link
Member

@nijel nijel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some changes to this:

  • d944d52 removes extra html after changes in the PR
  • 4d95777 customizes input widget instead of adding a dummy one
  • 9d74d1b adds pasting to the screenshot editing
  • c7013bb adds changelog entry

weblate/screenshots/forms.py Outdated Show resolved Hide resolved
@nijel nijel added this to the 5.7 milestone Aug 7, 2024
@nijel nijel requested a review from orangesunny as a code owner August 7, 2024 12:59
meel-hd and others added 8 commits August 7, 2024 14:59
The user clicks paste. Then the clipboard is read if the permesion is given and the context is secure (as required by the clipboard API). Then the image is pasted into the select file input. Otherwise if no image is available we only inform the  user about that.

NOTE: Implemented only in the add screenshot form in /screenshots page and not in the modal.

Related: WeblateOrg#6710
The previous commit added pase screenshot in screenshot/ pages. This adds it in the modal box that opens when Add Screenshot button clicked while checking individual strings.

Related: WeblateOrg#6710
The paste button now is rendered  by django screenshot form isntead of being in the template.
@nijel nijel enabled auto-merge (squash) August 7, 2024 13:00
@nijel nijel self-assigned this Aug 7, 2024
@nijel nijel merged commit e31e0ff into WeblateOrg:main Aug 7, 2024
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upload screenshot from clipboard
2 participants