Manually overriding default selection behaviour after transaction?


I have a “sub-menu” that allows users to increment numbered lists via a couple of buttons. The sub-menu should only display when the user has $cursor inside of the list. However, when I click the buttons, the cursor is forced to the end of the list (and since the buttons are decorations, that means I have to then check what the prior node is to display the decoration again). if i was only dealing with 1D lists, it wouldn’t be a problem. but any deeper and I hit the same problem; I’m dumped out of the inner-list(s) and the outer-list… Let me show you what I mean:


It doesn’t feel like a nice solution to have to read through the prior nodes and make them visible in relation to the cursor position, i’ve tried to set a NodeSelection at the end of the transaction chain (using setSelection) I even tried using TextSelection set to the first text within the list but the transaction still dumps me after the list whatever I do. Any ideas how I could force the transaction to jump back to the first <li> rather than the subsequent paragraph?


This sounds like you need a stopEvent method on your widgets


thanks for the swift reply.

hmmm, well, that method captures the button’s event, but whether I return true or false from the method itself it still pushes on to the paragraph below. I think I need some way of forcing the cursor to move to a specific location if that’s possible.

[EDIT] scratch that. Yes I take the event in stopEvent and preventDefault() and I’m in business! Thanks @marijn :slight_smile:

man, you are a clever stick! You’ve thought of everything haha!