How to use the slate-react.findRange function in slate-react

To help you get started, we’ve selected a few slate-react 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 YurkaninRyan / slate-sticky-inlines / lib / index.js View on Github external
function onSelect(event, change) {
    const selection = findRange(window.getSelection(), change.value);
    const selectionIsAtEndOfInline = change.value.focusInline &&
      selection.focusOffset === change.value.focusInline.text.length;

    if (
      change.value.isCollapsed &&
      selectionIsAtEndOfInline
    ) { return change; }

    return null;
  }