-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Paste-HTML example does not allow for pasting images #3812
Comments
What you are showing on the gif is pasting Relevant code: Lines 47 to 63 in 1cf63f0
|
Hi @mdmjg! I agree it's a little counter intuitive that paste html can't deal with image pasting, however it's mostly because (as @markogresak has pointed out) the paste html example does not support images. It is a bit awkward but I'm hesitant to add image support to the paste example because that example would get a bit unwieldy and duplicative with the image example. Interested in your thoughts on the duplication here. |
Pasting images, in some cases, may require a back-end component for complete functionality (i.e. certain web pages will not allow images to be sourced from domains other than the original host). Sounds like out of scope for HTML example but perhaps worth an note/explanation. |
@dmitrizzle not sure if it applies for the scope here. See the images example, it already supports it (see the code in my comment above). When copying the image, it's saved in the clipboard memory and you can read that via If I understand correctly, what you're describing applies only if you want to store the editor content, including the image. But that's application-specific logic and not a concern of Slate. So it does not make to include it in the example code. |
@markogresak I agree, all of this should be out of scope for the HTML example. However, the back-end component I mentioned isn't for storing. It's not really relevant to the point, but thought I'd explain anyways in case anyone is looking for answers here (feel free to remove): If you ctrl+c content off another website (i.e. you are trying to copy your own blog article and submit it onto another website that uses Slate as an editor), the content is likely not to have images as binary but URLs. What needs to happen from there on, is the image URLs from the clipboard to be either converted to a binary (which won't happen automatically) or have all those image URLs copied on the back-end to the new server and provided as a new URLs. Leaving it as-is may lead to broken images or unintended hosting of images on third-party websites. |
Taking a screenshot also returns the image as a URL rather than as file data. |
Similarly, if you copy some HTML that includes I haven't raised that as a separate issue because although it's different technically, it relates to the same use case, so the discussion here is relevant. |
Do you want to request a feature or report a bug?
bug
What's the current behavior?
When trying to paste an img into the paste-html example, nothing gets pasted.
OS: Mac Mojave
Browser: Chrome
Slate Version: 0.58.4
What's the expected behavior?
The expected behavior is that the editor should render the image that is being pasted.
The text was updated successfully, but these errors were encountered: