-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Drag'N'Drop #9772
Drag'N'Drop #9772
Conversation
A quick drive-by comment, since I'm not an official reviewer. I don't understand why the proposed solution is so complicated, since for one it shouldn't be necessary to edit This is untested, but why can't the entirety of the patch be limited to only e.g. the code below, placed just after this line?
|
@Snuffleupagus I like your approach and I think is it a more viable option. I thought about the inline JavaScript Pattern that it might don't be acceptable, although it was the only solution I could think of at that time. In communication with a maintainer, I asked to use the open() function and he pointed me to app.js, also I mentioned that I have created a new js file and I didn't get a comment on that. Your solution and the thought process of yours are much more solid. Thank you for your feedback, I should try your solution and make a new PR! |
Well, the suggestion in #9772 (comment) does indirectly rely on Lines 1926 to 1953 in 2921cc0
Without having seen the actual solution that someone proposes, please keep in mind that it's not always easy (or meaningful) to try and comment on every little detail beforehand :-)
You should be able to just update the current one, by removing the existing commits (e.g. with |
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.
In general this looks good (and much simpler this way). To make the review process easy, we usually ask contributors to not introduce changes that are unrelated to the patch itself, such as whitespace changes. I have indicated here which ones can be reverted. The goal is to make the diff as small as possible so it's easier to understand and to review.
When you made these changes, you can squash all commits into one commit, which is better because it keeps the commit history clean. Here we have written how to do that easily: https://github.com/mozilla/pdf.js/wiki/Squashing-Commits
Thank you!
@@ -698,6 +698,7 @@ let PDFViewerApplication = { | |||
* @returns {Promise} - Returns the promise, which is resolved when document | |||
* is opened. | |||
*/ | |||
|
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.
Undo this change.
@@ -790,7 +791,7 @@ let PDFViewerApplication = { | |||
throw new Error(msg); | |||
}); | |||
}); | |||
}, | |||
}, // open closes |
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.
Undo this change.
@@ -60,10 +60,8 @@ | |||
<!--#endif--> | |||
|
|||
</head> | |||
|
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.
Undo this change.
<body tabindex="1" class="loadingInProgress"> | ||
<div id="outerContainer"> | ||
|
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.
Undo this change.
</div> | ||
<div class="buttonRow"> | ||
<button id="printCancel" class="overlayButton"><span data-l10n-id="print_progress_close">Cancel</span></button> | ||
<!--#if !(FIREFOX || MOZCENTRAL)--> |
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 don't think we need to change anything in this file, correct? The diff is hard to read, but by appending ?w=1
to the URL I can see that only some div
element moved. Why is that required?
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.
That's correct, this file shouldn't appear anywhere in the diff.
@@ -1641,6 +1642,23 @@ function webViewerInitialized() { | |||
fileInput: evt.target, | |||
}); | |||
}); |
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.
Nit: Let's add a new line here, to improve readability, since the code above has nothing to do with drag and drop.
Edit: Also please make sure that the commit message makes sense, since the current one doesn't really make sense for the final version of the patch.
First of all, both of you were a huge help and made this contribution seems really easy! So, as I was trying to make the changes you asked, I messed up something on Git. The -git status showed me this: Changes to be committed:
What should I do? To make the commit with the changes you asked for! Edit: I managed to work around it, I will squash my commits and push it. |
Really good. Don't worry too much about messing up with Git because there are always ways to restore your work. First of all, it's already pushed to GitHub, so if something breaks locally you can always fetch the code from GitHub again. On your local system you can use Commands like |
Guys you are really helpful and your guidance was essential. I think I have squashed the commits. (not sure though) Mention me for any other mistakes I have done, or any other changes I need to make! |
It looks like it did not complete successfully. You can tell by the fact that this pull request contains 12 commits instead of one (you can see this at the top of the page or on the commit overview page at https://github.com/mozilla/pdf.js/pull/9772/commits). I cloned your branch and tried it out to make sure that the following suggestions work:
This means that all commits will be squashed into the first one, so you'll end up with one commit.
Feel free to comment if something is unclear. |
Implement drag-and-drop support in the viewer for local files
Finally, I made it to 1 commit, I hope that I didn't mess anything up with the force push! Fellows, once more you are incredibly helpful and thank you a lot for this collaboration! I learned a lot of new things. |
It looks like there were still some problems during the rebase. It's indeed one commit, but there are some unrelated changes in it. Since the solution is good now and works properly, I merged the patch for you in the pull request above (you're still the author of the commit). I'm really happy that this functionality is in place now as it's really useful, so thank you for working on this! |
Drag'n'Drop functionality. Drag'n'Drop a PDF file in the pdf viewer to render it.
Fixes #9690.