How to use the slate-hotkeys.isExtendForward function in slate-hotkeys

To help you get started, we’ve selected a few slate-hotkeys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ianstormtaylor / slate / packages / slate-react / src / plugins / dom / after.js View on Github external
})

      let isPrevInVoid = false

      if (prevEntry) {
        const [, prevPath] = prevEntry
        isPrevInVoid = document.hasVoidParent(prevPath, editor)
      }

      if (hasVoidParent || isPrevInVoid || startText.text === '') {
        event.preventDefault()
        return editor.moveFocusBackward()
      }
    }

    if (Hotkeys.isExtendForward(event)) {
      const startText = document.getNode(start.path)
      const [nextEntry] = document.texts({ path: start.path })
      let isNextInVoid = false

      if (nextEntry) {
        const [, nextPath] = nextEntry
        isNextInVoid = document.hasVoidParent(nextPath, editor)
      }

      if (hasVoidParent || isNextInVoid || startText.text === '') {
        event.preventDefault()
        return editor.moveFocusForward()
      }
    }

    next()