Horizontal scroll on blockwrappers

Hi, i was wondering if there is some way of forcing a horizontal scroll within a block-wrapper scroll only the block-wrapper instead of all of the .cm-scroller? i have prepared this try to demonstrate, what do i want to achieve.

if you can see, the block-wrapper can be scrolled with the mouse, but when you try to scroll with the cursor, all the editor moves to put the cursor into view.

with the mouse

with the cursor

You might be able to do with with a custom scroll handler.

The problem is that when i try to get coordsAtpos the editor thows : scroll handler: Error: Reading the editor layout isn’t allowed during an update.

aditionaly, when i scroll the container, the cursor disapears try

The work around that I found is to request a redrawn of the selection ranges by

if (moved) requestAnimationFrame(() => {
      view.dispatch({
        selection: EditorSelection.create(view.state.selection.ranges)
      })
    })

And also the scroll handler only gives the head selection, even when multiple ranges are present, so you need to access them by view.state.selection.ranges, I think it should send all the ranges. ( “just my opinion” )