From 4be16fcd2e6c107e59679eebf1ea1d6112a88afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20K=C3=BChn?= Date: Thu, 27 Jan 2022 09:44:53 +0100 Subject: [PATCH] fix: set max textselection correctly, fix #2401 --- packages/core/src/commands/setTextSelection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/commands/setTextSelection.ts b/packages/core/src/commands/setTextSelection.ts index 2eceb494..6ce7e02d 100644 --- a/packages/core/src/commands/setTextSelection.ts +++ b/packages/core/src/commands/setTextSelection.ts @@ -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)