Is there a recommended way to get a node-view into it’s selected state (i.e. have .selectNode called) when it is inside a TextSelection?
I think it should be pretty easy to handle with a plugin, but I was expecting that to be the default behaviour, so I’m wondering if there’s some complication I’ve not thought of.
I’d think this was done via dispatching a transaction (setSelection with NodeSelection.at) with the start position of the node view.
Something easier than that?
I wasn’t very clear - what I meant was, when a text selection is created by dragging, if that selections spans a node view, it seems like
selectNode is not called on the nodeview. It only seems to get called when the node is selected directly (i.e. a NodeSelection), such as when a nodeview without
contentDOM is clicked on.
selectNode is used when that exact node is selected with a node selection. To do what you’re looking to do, you could set up a plugin that adds a decoration to nodes of the appropriate type when they are covered by a selection, and have your node view’s
update method look for such decorations.