I am new to web锛孖 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?
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.
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.
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.
Thanks for all you suggest, I will try to learn one