From b8c2238a0a3c0c97421e32dd6e9ce33ce56d7083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 7 Jun 2019 15:59:47 +0200 Subject: [PATCH] refactoring --- packages/tiptap/src/Editor.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/tiptap/src/Editor.js b/packages/tiptap/src/Editor.js index 6a036db6..df647b9d 100644 --- a/packages/tiptap/src/Editor.js +++ b/packages/tiptap/src/Editor.js @@ -346,16 +346,14 @@ export default class Editor extends Emitter { if (position === 'start' || position === true) { pos = 0 } else if (position === 'end') { - pos = this.view.state.doc.nodeSize - 2 + pos = this.state.doc.nodeSize - 2 } - const selection = TextSelection.near(this.view.state.doc.resolve(pos)) - const transaction = this.view.state.tr.setSelection(selection) + const selection = TextSelection.near(this.state.doc.resolve(pos)) + const transaction = this.state.tr.setSelection(selection) this.view.dispatch(transaction) - setTimeout(() => { - this.view.focus() - }, 10) + setTimeout(() => this.view.focus(), 10) } blur() {