remirror/remirror

View on GitHub
packages/remirror__react-core/src/hooks/use-current-selection.ts

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
import { Selection } from '@remirror/core';

import { useRemirrorContext } from './use-remirror-context';

/**
 * A core hook which returns the current selection.
 */
export function useCurrentSelection(): Selection {
  return useRemirrorContext({ autoUpdate: true }).getState().selection;
}