fix: set max textselection correctly, fix #2401
This commit is contained in:
@@ -19,8 +19,8 @@ export const setTextSelection: RawCommands['setTextSelection'] = position => ({
|
|||||||
const { from, to } = typeof position === 'number'
|
const { from, to } = typeof position === 'number'
|
||||||
? { from: position, to: position }
|
? { from: position, to: position }
|
||||||
: position
|
: position
|
||||||
const minPos = Selection.atStart(doc).from
|
const minPos = 0
|
||||||
const maxPos = Selection.atEnd(doc).to
|
const maxPos = tr.doc.content.size
|
||||||
const resolvedFrom = minMax(from, minPos, maxPos)
|
const resolvedFrom = minMax(from, minPos, maxPos)
|
||||||
const resolvedEnd = minMax(to, minPos, maxPos)
|
const resolvedEnd = minMax(to, minPos, maxPos)
|
||||||
const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd)
|
const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd)
|
||||||
|
|||||||
Reference in New Issue
Block a user