-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Inserting images by pasting URL directly into editor #8236
Comments
This sounds like a cool UX enhancement. There are some questions waiting to be answered, though:
|
I don't think we do this for the image inserted by URL input? (there's a validation issue to be resolved as well #7917 ).
I'd go with duplicating whatever is happening using the insert image UI. At least in the MVP.
That's tricky, but having some simple list of extensions would suite most of the cases and it shouldn't do more than that. This should handle valid URL resource: |
Oh, I've been thinking about inserting === uploading. That request appeared in the past and makes total sense as you shouldn't usually reference images from other websites. So, the upload via URL thing would be awesome, but AFAIR, there was a CSP problem. A backend solution would be a solution, though, but it makes this a bigger topic. As for simple inserting, it's much easier. I can imagine doing that by a file extension-driven heuristic. So, I agree with:
|
We already have adding images using URL implemented, so for most cases it could work the same. But right, when pasting to the editor there is a problem with recognizing if it is an image. We could first filter links using something like @jodator propose. Don't know how our engine works, but I suppose that when it will try to show the resource it will know if it is something it could render. Alternatively we could try to read some meta data from the resource. |
Yep, inserting is way easier and CSP is not a big deal here as Jodi pointed out:
The engine has very little to do with this, it does not actively recognize the content nor analyze it. The image URL discovery must be on the Image feature side and can be done in 3 ways:
This is the third way but we may hit CSP here. AFAIR (but I could be wrong) there's a difference in CSP when you do |
Privacy is one concern. We could make this opt-in and mention in the docs this concern. However, for starter, we could go with the regexp only and wait for the feedback. To be considered: There's already a logic inside media embed that enhances the link on paste. It's a bit more complex than it sounds because it first let the editor render that link so the user sees it and then replaces it with the media after a short timeout. Name? In the first stage, let's not add this to any build. |
In order to have this feature implement:
|
Feature (image): Inserting images by pasting URL to an image directly into the editor. Closes #8236. MINOR BREAKING CHANGE (image): The `insertImage()` Image's utility function parameters have changed. The removed `writer` instance is no longer needed. Additionaly, you can specify `insertPosition` as an optional parameter.
📝 Provide a description of the new feature
It could be usefull to have possibility to insert image just by pasting URL to the editor like it works in media-embed.
If you'd like to see this feature implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: