Hello, I’m exploring ProseMirror with a view to checking its suitability to serve as an outliner editor.
In this context, my document is essentially one huge nestable list type (for ex BulletList). If I understand the concept of having a BulletList and ListItem correctly, a BulletList is a collection (array) of one or more ListItems, while a ListItem can have either a paragraph or any other blocks (like a heading or a quote or even another BulletList).
In my scenario the simple approach would be restrict my version of ListItem to only allow paragraph or another BulletList as content. In such a scenario, the json representation of something like
This clearly also works, but it has one notable downside: your custom_list_item only ever semantically creates lists of a single item.
Now, it may be that the semantic markup of your lists don’t matter in your use case. If you never use ordered lists, it can be made invisible to end users.
Hmmm… I think calling it a CustomListItem was the wrong nomenclature… what it’s effectively describing is a standard tree structure created using something like pointers…
The ‘paragraph’ bit is the node’s data so to say, and then we have an optional array of other child nodes…
I had not actually thought about mapping each node to a <ul><li> type dom structure… I’m using tiptap to access prosemirror from within my vue app and my initial idea was that I’d like each node to render into a different template/component based on its custom attributes (one of which would a unique id). I’m not 100% sure if it’s possible or even necessary but that would break the semantics somewhat fiercely in any case…
Now that I’m thinking from that perspective… not supporting the standard <ul><li> format would mean that copy paste of data would require additional complexity… but using that instead of custom divs would be like trying to implement a treeview using <ul> and <li> elements alone
I think I need to read up more and test out more stuff… I definitely don’t know enough about prosemirror at this stage to even ask intelligent questions
Thanks a lot for your response! It’s helped me understand there’s more to think about than simple schema structure.