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

need suggest for making a rich text editor in seed #114

Closed
songmaotian opened this issue May 18, 2019 · 4 comments
Closed

need suggest for making a rich text editor in seed #114

songmaotian opened this issue May 18, 2019 · 4 comments
Labels
question Further information is requested

Comments

@songmaotian
Copy link

I am new to web,I read about some contenteditable, would it possible to define a tree-like document model, and receive the edit event to map to the model? I try inputEvent, but the changed content does't appear.

or it would be better to use another tech to make a rich text editor?

@David-OConnor
Copy link
Member

David-OConnor commented May 18, 2019

Can you post an example of the inputEvent that's not working as you expect?

This is something that can be made with any frontend framework, including this one. I imagine one approach is to store the tree however you like using Rust data structures (Nothing framework-specific), and provide views which parse your tree, creating html elements as appropriate. Eg div with contenteditable set to true, ps, spans etc which control formatting.

@MartinKavik
Copy link
Member

If tree-like structure is not required for everything, read Building a Text Editor for a Digital-First Newsroom - they are using flat structure for paragraphs and their editor is based on ProseMirror.

You can also look at Draft.js and Quill for inspiration.

If you are new to web, I suggest to use something proven and study its API before you decide to create a library. However, It will be nice to have a modular rich editor in Rust if you decide to go the hard way.
But It always depends on project - maybe contenteditable will be enough for your project.

@David-OConnor
Copy link
Member

David-OConnor commented May 18, 2019

Agree. I think the best approach is to find an existing one, attempt to port it to your framework of choice, then modify as desired. Unless this is purely a learning project. I don't think the most complicated parts will be specific to a framework.

@songmaotian
Copy link
Author

Thanks for all you suggest, I will try to learn one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants