-
Notifications
You must be signed in to change notification settings - Fork 68
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
Produces a Slate error on image paste #37
Comments
I'm getting the same thing. |
@thedrew12 It turned out we need to define a schema for the editor to make this work. |
@scythargon Do you mind sharing the rest of your code? I took your schema and added it But now I can't copy and paste images or drag and drop, no errors but nothing happens. I'm just trying to get a running example of text and images. I'm using the
|
@thedrew12 What happens if you comment out the |
This is what I have right now:
Very similar to the example in the repo. There are some commmented out hacks. The onPaste doesn't really do anything, just a passthrough. |
Actually its kind of working, pasting and dragging and dropping. Something I've run into though if you paste an image at the very bottom of the editor there is no way to create a text block after the image, maybe its my schema. |
I was having the same issue, but it looked like it was happening as a result of I solved it by doing the following, rendering the children prop: <React.Fragment>
<img {...props.attributes} src={typeof src === File ? URL.createObjectURL(src) : src} />
{props.children}
</React.Fragment> The problem I'm getting now is that, when pasting an image link, |
I made a react / typescript repository if anyone's interested in seeing the full solution work. It's in working progress, so it might end up being much more than just an image paste example. |
Just wanted to add to @thedrew12's comment on being unable to create new text after an image was inserted, it drove me crazy but the solution was as simple as it gets:
was missing in my schema definition. You can find it here put into some more context. |
Hello, |
Do you want to request a feature or report a bug?
bug
What's the current behavior?
I clone this repo locally, install dependencies, run it and open the page in my Chrome browser, select "Drop/Paste images" tab, paste an image from clipboard, and see the error in the browser's console:
The worst thing comes that when in my project i use Nextjs with server-side rendering - this error crashes the page completely.
What's the expected behavior?
There is no error:)
The text was updated successfully, but these errors were encountered: