While this is very functional, it adds a couple of unnecessary steps for the most common use case: “I want to read this now” - especially on mobile devices.
The need to download / save something is very much secondary. Required sometimes, but usually the user just wants to read it and then move on.
The Inline PDF Previews TC addresses this by serving an inline PDF on desktop - and does this with aplomb. However, it misses these common situations:
PDFs on mobile devices
Multiple PDFs (due to visual clutter)
Viewing PDFs in a full browser tab
Of note, there are other paths to downloading a PDF. They can be downloaded from a link directly (via right-click / context menu), or from within the browser-based PDF viewer that this TC serves.
Suggestion: open PDFs in browser by default
This little tweak solves both of these situations nicely, and simply key into the default behaviour for other links in Discourse. So with the proposed change:
PDF links in mobile typically open in the same browser window
enables single tap viewing
PDF links on desktop (i.e. above the inline PDF) open in a new tab
this allows one-click full tab viewing
When inline behaviour is deliberately suppressed (by adding a space in the link text)
Here in meta.discourse.org, my link above opens in the same tab as this page (just like you describe). This is unchanged in safe-mode.
However, on three of my recently updated sites (with the TC disabled) it attempts a download. This is also the case with safe-mode. I’m not sure why that is. I can’t see any site settings that govern this at all.
Whatever the reason, my fork fixes it for my sites nicely!
We do have a work-in-progress. Hopefully will be able to land it in the next couple of weeks. It’s a little tricky because there are lots of different situations to verify (local uploads, s3, s3-compatible, with cdn, without cdn, etc).
I just checked a PDF that I uploaded to a topic today on a recently updated site and clicking the pdf link opens the PDF url on the CDN in my browser, fwiw