-
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
slate-html-serializer is not supported anymore? #3899
Comments
That's not a bug, Slate core concepts were improved and lots of things changed, including removal of some plugins. Changes can be see here: |
Is there any replacement for the obsolete slate-html-serializer? |
@takahser you could do a reactdom renderToStaticMarkup |
The |
What's the recommended method to converting HTML to slate js format? |
as @jordie23 asked, What's the recommended method to converting HTML to slate js format? |
I made a big mistake selecting this mess of library XD, super bag documentation, they change thinks and dont inform clients, they change something a crash a lot of piece in other parts, is a complete mess. They make people lose their time. XD |
@PinoFlores you can use ReactDOMServer.renderToStaticMarkup |
That converts a react tree to html. We want to convert a string of HTML to an object tree for slatejs. |
oh, sorry. The old package has still has valid code that you can start an implementation of. |
I know documentation is quite huge and most don't read it but rich text editor is a complex beast and you probably should read most of it before doing anything. There's so much useful information and can decrease the frustration on your editor development journey! I speak from experience: it's not a fun ride without kind of knowing all the moving parts.
const html = '...'
const document = new DOMParser().parseFromString(html, 'text/html')
// deserialize function example can be found on docs linked above
deserialize(document.body); |
@gitcatrat You're absolutely right, thank you also for taking the time to write your comments. Now, I'm not a slatejs developer. I'm the author of a slate integration package with a React CMS, and for us SlateJS with its intended goal of being a "library to write an editor" is perfect. Minimal design and can be shaped in any form we like. There is a problem with comments such as "they change things and don't inform clients" and such. What I can say, though, is that there's plenty of documentation, code examples and more to get somebody knowledgeable up to speed pretty fast. It's not easy task, but it's also not impossible. |
Any other alternatives? I'm having trouble with |
Nobody seems to answer the question, how to change the array state of type Descendant[], into html? It seems what they recommend is to traverse each node and render accordingly but we already did that in renderElement, so there must be some workaround to get that data? |
Great question @amanzrx4. As someone hoping to upgrade to Slate 0.50 and above, I'd really like to know the answer to this myself. |
Working on this in https://github.com/thompsonsj/slate-serializers as I'd like that too. If you are still looking to do this, it would be interesting if you could test it out and provide any feedback! |
This library is fantastic! Great work @thompsonsj 👍 |
Do you want to request a feature or report a bug?
Bug
What's the current behavior?
After updating package version slate-html-serializer throwing error
Uncaught TypeError: slate.Node.createProperties is not a function at new Html (slate-html-serializer.js:209)
Looks like Node inside the new Slate don't have this method and cant be used
I created sandbox: https://jsfiddle.net/xkb69mqe/2/
Slate: 0.59.0
slate-html-serializer: 0.8.13
Browser: Chrome
OS: MacOS
What's the expected behavior?
slate-html-serializer should work instead of breaks with error
The text was updated successfully, but these errors were encountered: