From 478237dc611aab08b2a5847ceb9f6202333f04da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 4 Jun 2021 00:05:24 +0200 Subject: [PATCH] refactoring --- docs/src/demos/Experiments/Figure/figure.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/src/demos/Experiments/Figure/figure.ts b/docs/src/demos/Experiments/Figure/figure.ts index 828a9f3c..f6f971db 100644 --- a/docs/src/demos/Experiments/Figure/figure.ts +++ b/docs/src/demos/Experiments/Figure/figure.ts @@ -105,7 +105,10 @@ export const Figure = Node.create({ }) // set cursor at end of caption field .command(({ tr, commands }) => { - return commands.setTextSelection(tr.doc.resolve(tr.selection.to - 2).end()) + const { doc, selection } = tr + const position = doc.resolve(selection.to - 2).end() + + return commands.setTextSelection(position) }) .run() },