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

Insert from URL missing when adding an image #1536

Closed
karmatosed opened this issue Jun 28, 2017 · 15 comments · Fixed by #4155 or #9264
Closed

Insert from URL missing when adding an image #1536

karmatosed opened this issue Jun 28, 2017 · 15 comments · Fixed by #4155 or #9264
Assignees
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.

Comments

@karmatosed
Copy link
Member

This functionality is missing, whilst it may just not be implemented yet, it would be great to at least track that it doesn't get missed out.

@karmatosed karmatosed added [Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement. labels Jun 28, 2017
@karmatosed
Copy link
Member Author

A user also brought this up themselves testing:

"Is it not possible to get an image via an url? If so, I could not find a way to do it."

@westonruter
Copy link
Member

Yeah, there probably needs to be a URL input field that appears in the placeholder, so somewhat of a combination of the current Image placeholder and the Embed placeholder:

image

But, with that in place, should a user be able to say, replace an image inserted via URL to then be an image from the media library? And vice versa, should an image added from the media library be able to be replaced with an external image URL without having to replace the entire block? We can do this in the Image widget since the media modal has the two tabs for selecting from the media library and selecting via URL:

image

@mtias mtias added the [Feature] Media Anything that impacts the experience of managing media label Nov 20, 2017
@imath
Copy link
Contributor

imath commented Dec 29, 2017

Hi,

I've been thinking about this lately. And i'm wondering if creating a specific core/media-url would be a better idea for Gutenberg. Because some users might also need to add external urls for Video and Audio.

Into the classic editor, It's possible to paste an external url to an image of course, but it's also possible to paste an external url to a video or an audio file. Once pasted, the image tag, video tag or audio tag are output into this editor.

So here's what came to my mind about it:

  1. The new core/media-url could show an url input and output the image/video/audio tags according to the file extension on form submit.
  2. The "Transform into:" button of this new block could show the core/image if it's an external image, the core/audio if it's an external audio, etc..
  3. If "Transform into:" is clicked the external media could be media_handle_sideload()-ed and added to the WP Media Library.
  4. As the contributor role shouldn't be able to upload_files ("upload_files" capability and Image relative blocks #3672) this new block could be used instead of the blocks needing the upload_files capability.
  5. It would avoid editing the core/image, core/audio, core/video blocks to add a similar code to let them deal with external urls.

@karmatosed karmatosed added [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Apr 27, 2018
@mtias mtias added [Type] Enhancement A suggestion for improvement. and removed [Type] Bug An existing feature does not function as intended labels May 8, 2018
@jasmussen jasmussen mentioned this issue May 24, 2018
11 tasks
@mtias mtias added the Needs Design Needs design efforts. label Jul 16, 2018
@talldan
Copy link
Contributor

talldan commented Aug 13, 2018

My thoughts are that this should become part of the Image Block. I think that's where the user would naturally expect to find this.

The audio/video blocks already seems to have this, so it should be possible to make it consistent.

I think there are two main changes.

  1. Change the placeholder for the image block so that it's consistent with audio/video:
    screen shot 2018-08-13 at 5 56 19 pm

  2. Change what happens when the edit button is pressed on the toolbar (this could behave in exactly the same way as the audio and video blocks, display the placeholder again.)
    screen shot 2018-08-13 at 5 57 15 pm

I think the most difficult question is whether these changes carry over to the Gallery Block (and if so, how?). That should probably be a separate issue.

@karmatosed what are your thoughts?

@imath
Copy link
Contributor

imath commented Aug 13, 2018 via email

@talldan
Copy link
Contributor

talldan commented Aug 14, 2018

@imath Oh no, I'd just about finished working on a branch that also adds the change when I saw your comment!

When do you think you'll get a chance to address the feedback on your PR? I'm more than happy to help out if you need some assistance with it and don't have the time to look at it.

If its something you can't look at I can also work on separating out the URL input change into a separate PR.

A few options available, let me know what you think.

@imath
Copy link
Contributor

imath commented Aug 14, 2018 via email

@imath
Copy link
Contributor

imath commented Aug 14, 2018

@talldan If it can help, I just invited you on my fork so that you can have push access on it. The branch for #4155 is add/blocks-capability

@talldan
Copy link
Contributor

talldan commented Aug 14, 2018

@imath Thanks for that, I'm very happy to take a look at #4155 to see whether I can progress it. Will start on that tomorrow.

@talldan
Copy link
Contributor

talldan commented Aug 21, 2018

@imath - I've been working on it for a bit now, but I just can't forsee #4155 being merged. It's too difficult to review because of the way comments are hidden by github.

I propose splitting it up into the following separate PRs:

  1. Make it so that external URLs can be used on image blocks
  2. Roll out MediaUploadCheck, but perhaps make it inactive so the UI appears the same as it is now.

☝️ I think those changes should be not too difficult to get reviewed and merged. MediaUploadCheck touches quite a few places, so it'd be good to get it into the codebase.

  1. Redux handling of upload permissions and preloading of OPTIONS request. Make the MediaUploadCheck active.

☝️ This bit requires more critique during review and possibly exploration of alternative ways of tackling the problem. I'm not sure that will happen on the #4155 PR as the feedback just gets lost.

I'll make sure you're credited for all your hard work on all three parts. Let me know what you think.

@imath
Copy link
Contributor

imath commented Aug 21, 2018

@talldan the only downside of it is precisely the UI will keep on being buggy for the contributor role. I wonder if it doesn't impact the Super Admin role on multisite btw... #4155 is 8 months old and it's being punted to later at almost each realease.

New blocks were added like the inline image & the file one. IMHO, this doesn't seem to be the right priority to me. I would expect to first fix the capability issue, then add new media blocks...

That being said. I understand your point of view, and i'm fine with your plan. At least, the contributor role will be able to add an image once he got stuck by the buggy UI with the media library 😉

@imath
Copy link
Contributor

imath commented Aug 21, 2018

Oh I forgot the most important @talldan : thank you so much for the progresses you’ve made on #4155 💪👍

@talldan
Copy link
Contributor

talldan commented Aug 24, 2018

@imath - I've decided to combine 2 & 3 from my message. I just couldn't forsee them being merged separately. It would be too hard to validate that everything works correctly.

New PR is here - #9301. Lets hope we get some good traction on this now.

@imath
Copy link
Contributor

imath commented Aug 24, 2018

Awesome work @talldan thanks a lot 🤞

@karmatosed karmatosed removed the Needs Design Needs design efforts. label Aug 25, 2018
@karmatosed
Copy link
Member Author

Just removing design for now as we're iterating in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[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
6 participants