mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 11:09:01 +08:00
improve focus handling again
This commit is contained in:
parent
d16a220255
commit
3e75703200
@ -344,14 +344,14 @@ export default class Editor extends Emitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
focus(position = 'start') {
|
focus(position = null) {
|
||||||
if (position === null || position === false) {
|
if ((this.view.focused && position === null) || position === false) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let pos = position
|
let pos = position
|
||||||
|
|
||||||
if (position === 'start' || position === true) {
|
if (position === 'start' || position === null) {
|
||||||
pos = 0
|
pos = 0
|
||||||
} else if (position === 'end') {
|
} else if (position === 'end') {
|
||||||
pos = this.state.doc.nodeSize - 2
|
pos = this.state.doc.nodeSize - 2
|
||||||
|
Loading…
Reference in New Issue
Block a user