Skip to content

Commit

Permalink
fix: set max textselection correctly, fix #2401
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kühn authored and Philipp Kühn committed Jan 27, 2022
1 parent ed56337 commit 4be16fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/commands/setTextSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const setTextSelection: RawCommands['setTextSelection'] = position => ({
const { from, to } = typeof position === 'number'
? { from: position, to: position }
: position
const minPos = Selection.atStart(doc).from
const maxPos = Selection.atEnd(doc).to
const minPos = 0
const maxPos = tr.doc.content.size
const resolvedFrom = minMax(from, minPos, maxPos)
const resolvedEnd = minMax(to, minPos, maxPos)
const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd)
Expand Down

0 comments on commit 4be16fc

Please sign in to comment.