-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
7878 directly pasting images into edit box and broader drag and drop areas #7883
Conversation
@Fensterbank mind having a quick look at this PR if you have some minutes? :) |
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.
Thank you for your pull request. Seems to be a useful change.
I did not yet test the functionality in browsers, I just took a look over the code and found some small syntax and logic things I would like to have improved.
66384b0
to
918c45b
Compare
@Fensterbank I've addressed and pushed the requested changes |
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.
I tested this PR on my local dev environment and it worked fine. If nobody has additional remarks I think we can merge that.
Finally people can drop images anywhere without having to hit the camera icon and are able to paste images directly from the clipboard. Thanks @HankG, that's a great improvement. 🍪
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.
Drag and drop works well, but pasting doesn't work as expected:
- The filename is still pasted, I think that shouldn't happen, can you remove that behavior?
- I had one image, which only worked in chromium, in firefox I got
TypeError: blob is null; can't access its "type" property
, I don't know if that's a problem with the image or with fineuploader, so I don't know if that's something we can fix, but I still wanted to mention it. The same image works well with drag-and-drop, and other images work also well in firefox with pasting.
If it doesn't contain anything private, can you please provide this image so I can try to reproduce? |
@SuperTux88 You are correct that the filename should no longer be pasted in. Instead it should be pasting in the image for a supported image format or one that it can convert into that format. For example if I had vector art from LibreOffice Draw in the clipboard it would convert it to a PNG and paste that in my testing. All of my Desktop mode testing was in FireFox. All of my Mobile testing was in Chrome. All of that testing was done on Linux Mint MATE. You are having the problem in Firefox? Which OS? |
I just created an empty new image in gimp, saved it, and it is broken: here But it looks like it only happens with big images, 4000x3000 is broken, 3000x2000 works (I didn't do much more testing with different resolutions). It's broken for both: firefox stable and firefox nightly here. But it works in chromium. Also, while commenting here, I noticed that it's probably nothing we can fix, because I also couldn't copy-paste the broken image here (drag-and-drop worked, but drag-and-drop also works with this PR in diaspora with the broken image). And I also just tested it in rocketchat (the only other thing that came to my mind where I ever used copy-paste images), and it's broken there too. So it looks like it's something broken with the browser? I usually only use copy-paste from firefox-screenshots, which are usually much smaller, because I only screenshot parts of a page, so I never noticed that before.
I also just noticed that this happens here on GitHub too, so it's probably also something we can't fix? I usually only use copy paste directly from firefox-screenshots, where the image doesn't have a filename/path yet, so there is nothing to paste, so I never noticed that. When opening a file, copy the content, it has a path which then is pasted together with the image. So I think everything is fine, and I just tested stuff I usually don't do and didn't know the problems/behavior exist everywhere else 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.
So only a little thing :) otherwise I think we can merge this, because as said in the comment above, I think the other stuff is nothing we can fix.
@@ -53,6 +54,10 @@ Diaspora.PostPhotoUploader = class { | |||
/* eslint-enable camelcase */ | |||
} | |||
}, | |||
paste: { | |||
targetElement: document.getElementById("status_message_text"), | |||
promptForName: true |
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.
Just a little thing: I looked what this option does, and it should open a prompt for asking for a filename. It neither opens a prompt nor do I think we need a prompt. The filename doesn't matter, so I suggest to remove this option.
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.
IIRC with that field set to false the request didn't percolate up correctly to initiate our handlers it just pasted into the text field like before. I can double check that that was the case. If it is there is nothing I can do about it even though it is confusing.
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.
I confirmed what I stated above.
Oh, and I just tested that image on another computer and there it works, even with firefox, but here I can download it and I can't upload it to diaspora. The only difference is that one computer has i3wm and the other has awesomewm. I have no idea how this image-copy-paste magic works and what needs to work together for it to work ;) But I think we can ignore that problem for this PR, because it's obviously a problem on my side ;) |
I think I may feel better if it's tested on a Windows and a Mac under Chrome, Firefox, and Safari if we are having some differences between window managers. I won't be able to do that until early next week though since I'm on travel right now. If someone else knocks that out before then that's fine too of course :) |
I have access to any browser / os configuration thanks to browserstack. I'll test this PR. |
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.
I'm so sorry I took me that long to test the different browsers versions on that code. I forgot I had to do that. Fortunately as this is targeted for next major release this oversight didn't have any consequences but still sorry about it.
The good news is, it works very well! I tested copy paste and drag and drop on Windows 10 with Edge 18, Chrome 74 and Firefox 66 and on Mac OS with Safari 12, Firefox 66 and Chrome 74. The only thing I noticed is that drag and drop wasn't working between two browser tabs in Chrome and Firefox on both Windows and Mac. It displayed the message "No file to upload" but it worked from the windows explorer so I guess we're good.
Two last minor things, in the console, each time I drop a file, I have the "Grabbed 1 dropped files." message displayed, can this be removed? Also, when dropping an image to the reduced publisher, it doesn't expand. Can this be changed?
https://docs.fineuploader.com/quickstart/02-setting_options.html
|
Works for me (on a user perspective) well, too. I rebased to latest diaspora/develop and tried it out. There are still some points open for review - can someone clarify the need to fix this?
For the first point I found no direct way to get rid of the message. The hint 'debug:false' seems to have no effect Third: (automatic open of a publisher) is this really a blocker? |
@SuperTux88 Can you have a look here and possible approve this? For me there are no more tasks left. |
I still have the same issues as before:
But I don't know, maybe that's just a firefox/linux issue and I'm the only one having them? If it's working for everybody else I'm fine with it. Drag-and-drop works, and also pasting a screenshot that was directly copied and not stored to a file first (which is my most used workflow) both works as expected. And then there is still the issue with not opening the publisher when dragging a file into it when it's closed. The upload still works, but it stays closed, so you don't see that it worked, which is definitely bad UX. But since I think overall it's still an improvement to the old state, so I guess we can fix the publisher opening in a follow up PR? |
Thanks for watching again. With this amount of open and follow-up PRs I am beginning to loose the overview. So maybe this PR might be closed as all is shifted to #8237 ? |
Fixes #7878