fix: set max textselection correctly, fix #2401

This commit is contained in:
Philipp Kühn
2022-01-27 09:44:53 +01:00
parent ed56337470
commit 4be16fcd2e

View File

@@ -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)