Hi @marijn. I am trying to implement indent/unindent too so I followed your advice. I added an indentation attribute to the node spec for paragraphs and it worked. When I hit Enter at the end of an indented paragraph though the new paragraph is not indented, that is it loses the attributes of the first paragraph. I fixed that by copying the splitBlock function and adding a few bits to it but overall it feels strange that the new paragraph does not keep the attributes of the one from which it was split.
If you split a paragraph in the middle, you’ll get a new paragraph with the same attributes. But when you press enter at the end splitBlock will create a fresh node (using the default content type at that position), so that when you press enter at the end of a heading or similar block, you get a plain paragraph.
I’m working on implementing indentation using an indentation attribute on the relevant blocks as suggested in this thread. To ensure that indentation is properly inherited, I’ve created a custom copy of the splitBlocks command with small modifications to that effect.
However, I’m beginning to worry about the number of similar commands I could end up with as I continue down this path for blocks beyond paragraph. I need all block content to be indentable – so headings, lists, etc. How will I ensure that, when I convert a series of indented paragraphs into a list, that the indentation is removed from the paragraphs and properly propagated to the list and list elements? Am I going to end up with custom copies of wrapIn and wrapInList as well? I can easily see this spiraling out of control to the point where the bug risks and maintenance burdens could threaten the feasibility of the feature.
Is the indentation attribute still the recommended approach for this functionality? Is anyone who has accomplished this willing to share their solution?