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

Add a URL field for File blocks #10521

Closed
shaunandrews opened this issue Oct 11, 2018 · 12 comments
Closed

Add a URL field for File blocks #10521

shaunandrews opened this issue Oct 11, 2018 · 12 comments
Labels
[Block] File Affects the File Block [Feature] Blocks Overall functionality of blocks [Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.

Comments

@shaunandrews
Copy link
Contributor

The Audio and Video blocks allow using a URL for the media. However, the File and Image blocks don't. I'm not sure why its like this, but I feel like the URL option should be available to all of these blocks.

Here's a comparison of the four blocks:
image

@Soean Soean added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks labels Oct 11, 2018
@didipaterno
Copy link

I agree with this. I had a difficult time adding photos with URL, so I reverted back to the classic editor

@Soean Soean added the Needs Decision Needs a decision to be actionable or relevant label Oct 12, 2018
@mtias
Copy link
Member

mtias commented Oct 23, 2018

Image has this already (in 4.1).

@sarahmonster
Copy link
Member

💯

See also: #8409!

@designsimply
Copy link
Member

I noticed the file block uses the download attribute for <a> links and that the download attribute only works for same-origin URLs. Noting this because if a URL were to be added as an option for a file block it may need to behave differently for HTML5 and become just a link without the explicit download option for that case. (You may already know this! Apologies if it's obvious or repetitive. 🙂)

@talldan
Copy link
Contributor

talldan commented Dec 14, 2018

Adding the ability to insert from URL to the file block would create quite a lot of overlap between it and the button block.

Not necessarily a bad thing, but was wondering what use cases could be achieved with a url in the file block compared to a url in the button block?

@gziolo
Copy link
Member

gziolo commented May 23, 2019

@draganescu, aren't you working on some media blocks unification? Is it part of the scope of your work?

@talldan
Copy link
Contributor

talldan commented May 24, 2019

#15515 should close this.

@talldan talldan assigned talldan and draganescu and unassigned talldan May 24, 2019
@gziolo gziolo added [Feature] Media Anything that impacts the experience of managing media and removed Needs Decision Needs a decision to be actionable or relevant labels May 24, 2019
@draganescu draganescu removed their assignment Nov 11, 2019
@Soean Soean added the [Block] File Affects the File Block label Jan 13, 2020
@druxstr
Copy link

druxstr commented May 14, 2020

#15515 evolved to #19174, which was merged to 7.3 without adding a URL field for File blocks

@talldan a use case could be :

I want to add a file for my visitors to download, but the file is on another website

The File block is relevant, as the intended action is file related. The File block displays the file name and a "Download" button : this is more helpful than a Button block.

Other use case :

I want to add 2 files for my visitors to download. The 1st file is stored in my media library : I can use the File block. The 2d file is on another website : I can't use the File block.

Here the user is doing the same action, but the File block limitations are getting in the way.

@talldan
Copy link
Contributor

talldan commented May 15, 2020

A restriction would be that the 'Download' button wouldn't be possible for cross origin resources (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a):

download only works for same-origin URLs, or the blob: and data: schemes.

The way this would work is that the browser would still offer to download files that it can't handle, but for other files (like images, videos) that the browser can display, the file block would just act like a link.

The file block could still show the link and the Copy URL button in this case. I wonder whether also displaying some indication that the link is from another resource would be a good idea.

@draganescu draganescu self-assigned this May 15, 2020
@druxstr
Copy link

druxstr commented Oct 3, 2020

Any update on this?

@shaunandrews
Copy link
Contributor Author

Using the URL field could lead to a scenario where the "download" button doesn't actually download anything due to the same-origin requirements discussed above.

I think we could incorporate the URL field for the File block, but it would require adding the linked resource to the site's Media Library — and I see that as an entirely different issue to work out.

With that in mind, I'm going to close this issue. If you disagree, by all means comment or reopen for discussion.

@JosVelasco
Copy link

Using the URL field could lead to a scenario where the "download" button doesn't actually download anything due to the same-origin requirements discussed above.

I think we could incorporate the URL field for the File block, but it would require adding the linked resource to the site's Media Library — and I see that as an entirely different issue to work out.

With that in mind, I'm going to close this issue. If you disagree, by all means comment or reopen for discussion.

I want to add a PDF file for a magazine. This PDF is not hosted on the same server, but in a CDN.
Perhaps checking for the URL extension would make sure the link actually downloads something.

@draganescu draganescu removed their assignment Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] File Affects the File Block [Feature] Blocks Overall functionality of blocks [Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.