refactoring

This commit is contained in:
Philipp Kühn 2019-06-07 15:59:47 +02:00
parent 728ef2cef9
commit b8c2238a0a

View File

@ -346,16 +346,14 @@ export default class Editor extends Emitter {
if (position === 'start' || position === true) { if (position === 'start' || position === true) {
pos = 0 pos = 0
} else if (position === 'end') { } 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 selection = TextSelection.near(this.state.doc.resolve(pos))
const transaction = this.view.state.tr.setSelection(selection) const transaction = this.state.tr.setSelection(selection)
this.view.dispatch(transaction) this.view.dispatch(transaction)
setTimeout(() => { setTimeout(() => this.view.focus(), 10)
this.view.focus()
}, 10)
} }
blur() { blur() {