Cursor movement on node with atom = true

I have an editor with a custom node type with this NodeSpec:

  • atom = true
  • selectable = true
  • isolating = true
  • defining = true

When I cursor into this node from the left edge (right arrow), all is ok, i.e. the cursor selects the entire node. the next cursor movement advances past the node to the right of the node.

When I cursor into the node from the right (left arrow), the cursor enters the text contents, and the text contents are editable.

from reference:

atom: ?⁠bool
Can be set to true to indicate that, though this isn’t a leaf node, it doesn’t have directly editable content and should be treated as a single unit in the view.

I thought that setting atom = true would prevent editing the contents.

  • If my understanding is correct, is this a known bug, and if so, is there a workaround or a planned fix?
  • If it’s not true, how do I achieve the effect of only selecting the entire node?


No, it doesn’t do that, it’s just a hint to the selection managing code that arrowing into the node should select it, rather than enter it. You can still click it or otherwise have your cursor end up inside of it. To make its content ineditable, create a node view (which doesn’t expose a contentDOM property).


Does this mean the atom node can have its text content and its nodeSize can greater than 2?

Yes, but in that case you’ll probably want to render it using a node view.

1 Like