I’m trying to understand this line of code:
if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) return false
Here’s what the reference says about $cursor
:
Returns a resolved position if this is a cursor selection (an empty text selection), and null otherwise.
So, if a selection is empty, doesn’t it always have a $cursor
? Why test for this? I’m guessing this is for cases of non-text or non-inline nodes. But wouldn’t that be covered in that markApplies()
call that follows?