Low Level Example and Thorough Introduction to ProseMirror


First, I would like to thanks @marijn for building this wonderful library. This topic is not a request for help topic, but more of a discussion on how to approach lower level development with ProseMirror.

I’ve spent the last week reading through the introduction and browsing through the references. From there, I tried to build a very simple editor by just using the core module. I want to know the bits and pieces so I have a total grasp of the knowledge. I also tried looking at some of the additional modules to see how things are implemented.

For now, my goals are to learn:

  1. How to insert a node as a next/prev siblings
  2. How to insert a node as the parent siblings
  3. How to delete/unwrap the node and merge the text only with the previous node
  4. How to prevent selection of a certain node (e.g, title and body both can be selected on its own, but body and title can’t be simultaneously selected)
  5. How to implement a custom drag and drop handle

I have read through the documentation of lift, join, insert, etc. But I am not sure the best practice to do it. One thing that I still find hard to understand is how node, position, index, all be used to achieve a certain objective. For example, I have a selection on a node, there’s no direct way to access the parent, and we can use resolve, but after resolving the parent, how to resolve the parent’s parent or the parent’s siblings? I understand the basic concept and terminology but still don’t understand how to navigate/manipulate the documents properly. I also don’t understand why a method accepts a certain parameter (e.g lift target, I don’t understand what is a lift target, and what happens when a certain parameter is left as default; e.g depth, pos).

I would try to keep learning and post my discoveries here, I would gladly welcome other to share their experiences and help each other along the way. For now, I am reading through the code directly to see how an API is being used. It’s a long way to go, but I hope to keep learning.