Skip to content

Commit

Permalink
addMulticursor: Do not set the cursor.
Browse files Browse the repository at this point in the history
This was causing the cursor to be set to null on mobile on Select All. I am not clear what the original intention was and it was not under test coverage.
  • Loading branch information
raineorshine committed Dec 29, 2024
1 parent 19f3efc commit 4ac46a3
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/actions/addMulticursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import Thunk from '../@types/Thunk'
import { isTouch } from '../browser'
import hashPath from '../util/hashPath'
import reducerFlow from '../util/reducerFlow'
import setCursor from './setCursor'

/** Adds a cursor to the multicursor set. */
const addMulticursor = (state: State, { path, ignoreCursor }: { path: Path; ignoreCursor?: boolean }): State => {
const isEmpty = !Object.keys(state.multicursors).length

return reducerFlow([
// for touch, unset the cursor before adding multicursor
isTouch && isEmpty ? setCursor({ path: null }) : null,
state => ({
...state,
multicursors: {
Expand All @@ -23,8 +20,6 @@ const addMulticursor = (state: State, { path, ignoreCursor }: { path: Path; igno
...(isEmpty && !ignoreCursor && state.cursor && !isTouch ? { [hashPath(state.cursor)]: state.cursor } : {}),
},
}),
// on desktop, set the cursor to the new multicursor if none exists
!state.cursor && !isTouch ? setCursor({ path, preserveMulticursor: true }) : null,
])(state)
}

Expand Down

0 comments on commit 4ac46a3

Please sign in to comment.