Lift all nodes including siblings

When calling the lift command the selected nodes are moved up to the parent above, but any other sibling nodes remain where they are. Is it possible to move all nodes within the current parent up when calling lift, regardless of which are selected?

I’ve tried a couple of things like calling lift multiple times and expanding the selection before lifting, but I cant seem figure it out.


The lift command acts on the selection but most of the work is done using the lift method and liftTarget. So you could make your own command and act on whatever range you want.

Thanks so much for pointing me in the right direction, I’ve actually managed to put something together that works! This is what I have:

export function liftAll(state, dispatch) {
    let { $from, $to } = state.selection;
    let range = $from.blockRange($to)
    let target = liftTarget(range)
    let inner = target + 1
    let from = $from.start(inner), to = $to.end(inner)
    let fullRange = TextSelection.create(state.doc, from, to).ranges[0]
    fullRange.depth = inner;
    if (dispatch) dispatch(, target).scrollIntoView())
    return true

I’m finding the target depth, going one level down to fetch the start and end positions, then creating a new range from those to parse to lift. It works, but it can probably be improved?