Repository navigation
Preliminary attachments support - #4329
Conversation
|
This should answer #2751 Note: web/images/toolbarButton-viewAttachments.png is obviously not acceptable but I don't have the skills to make it better. Some help would be appreciated on this. |
|
I haven't really looked at the code, but the feature seems nice to have! |
There was a problem hiding this comment.
This will not work, since the pagemode parameter is called "bookmarks" in the spec, but it's called "outline" in PDF.js (don't ask me why). Change this line to `(params.pagemode === 'bookmarks' instead.
|
@dferer The best way to get a nice looking icon for this feature is to ask @shorlander, since he is the one who created the current UI and the icons. |
|
/botio-linux preview |
|
It was worth trying :) |
|
@Snuffleupagus thanks |
|
Here is a test file that contain attachments of different types: https://dl.dropboxusercontent.com/u/1910542/attachments.pdf It has links to a PDF attachment and back (which is not yet supported). |
There was a problem hiding this comment.
Based on the placement of this button, I think that the tabindex of this button should be 4. This unfortunately means that you have to change most of the other indexes, but that's unavoidable in this instance.
|
There is a small issue with the "Attachments" button not getting disabled properly in some circumstances. This can be tricky to reproduce on a fast connection, but the following steps should help:
I'm guessing that this might be caused by not waiting on all the necessary promises to be resolved. You might have to wait for |
|
@Snuffleupagus I can't see this issue on my local tests. Could you please call botio one more time to see if it is fixed? And by the way, thank you for testing my PR |
|
Thanks. It looks like it is fixed. Edit: unless the attachment view is selected before the end of the loading |
I can still reproduce it intermittently, so I wouldn't say so unfortunately. |
|
Third time lucky I guess, that seems to do it! |
|
It does look better indeed. I should have taken your advice the first time. |
|
This is looking good. I have two questions though:
|
Those are |
|
Attachments are now sorted alphabetically |
There was a problem hiding this comment.
Nit: space before and after operators, i.e. var i = 0;.
There was a problem hiding this comment.
Also, we usually cache the length in loops: for (var i = 0, ii = names.length; i < ii; i++) {.
|
@shorlander Thank you for the quick response on this! @dferer For your information, the second icon's filename should end with @2x because it's a Retina icon. See #4315 in case you hadn't seen that PR yet. |
|
@shorlander Thanks, it looks much better now! |
|
Added retina-specific CSS for the icon |
|
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 |
There was a problem hiding this comment.
Please don't remove brackets.
There was a problem hiding this comment.
We need to use isValidUrl(this._filename, true) here (from shared/utils.js)
There was a problem hiding this comment.
Should I, instead, not pass this value to the DownloadManager in viewer.js (which doesn't make sense anyway)?
There was a problem hiding this comment.
I'm trying to avoid for users of api to validate url against XSS. But yeah, we should do that at least before DownloadManager
There was a problem hiding this comment.
I added a downloadBlob method to DownloadManager to cover the case of URL-less BLOBs. It seems cleaner and prevents unnecessary errors in case of a fallback to the downloadUrl method.
If it's OK with you, your other comments are also addressed.
There was a problem hiding this comment.
How about PDFJS.createObjectURL https://github.com/mozilla/pdf.js/blob/master/src/shared/util.js#L1314 and use downloadUrl .
Otherwise we have to change https://github.com/mozilla/pdf.js/blob/master/web/firefoxcom.js#L75https://github.com/mozilla/pdf.js/blob/master/web/firefoxcom.js#L75 as well, and that's more testing for us.
There was a problem hiding this comment.
I had to give up using DownloadManager as downloadUrl adds an extension to the URL that Safari does not appreciate when handling blobs (and isValidUrl does not accept the blob: protocol).
Also, as we don't know the content type of the attachments, and because Safari does not implement the "download" attribute on anchor tags, it tries to display the file in the current page, which generates errors. Opening the attachment in "_blank" is the cleanest way I can find to deal with that. It works fine in Firefox and Chrome though.
What do you think?
|
Sounds good. Let me play with last solution a little |
|
/botio-windows preview |
From: Bot.io (Windows)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 |
There was a problem hiding this comment.
I completely agree with the name change of the variable, but I don't think that this line should be added!
By adding || attachmentsView.classList.contains('hidden'), won't wasAnotherViewVisible be true even when the thumbnailView is already visible?
There was a problem hiding this comment.
I cannot find an excuse for this one :/
Added a partial Filespec support Added getAttachments in API Added a new attachments view in UI (with a new icon by @shorlander)
|
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 |
|
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 0 |
From: Bot.io (Linux)ReceivedCommand cmd_test from @yurydelendik received. Current queue size: 1 |
|
/botio-windows preview |
From: Bot.io (Windows)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 1 |
From: Bot.io (Windows)SuccessTotal script time: 21.80 mins
|
From: Bot.io (Linux)SuccessTotal script time: 25.78 mins
|
Preliminary attachments support
|
Thank you for the patch |


Added a partial Filespec support
Added getAttachments in API
Added a new attachments view in UI
attachments.pdf