feat: success garbage cursor

This commit is contained in:
cudr
2019-10-12 12:19:06 +03:00
parent 4efc8db60e
commit ad2780b936
3 changed files with 34 additions and 9 deletions

View File

@@ -21,7 +21,9 @@ const setSelection = (doc, op, { id, selection, annotationType }) => {
if (focus) cursor.focus = focus
if (anchor) cursor.anchor = anchor
const cursorPath = (anchor && anchor.path) || (focus && focus.path)
const cursorPath = cursor.data.isBackward
? anchor && anchor.path
: focus && focus.path
if (cursorPath) cursor.data.cursorPath = toJS(cursorPath)