UNPKG

@atlaskit/editor-plugin-media-insert

Version:

Media Insert plugin for @atlaskit/editor-core

14 lines (12 loc) 380 B
import { useCallback } from 'react'; // Usually either a DOM node or editorView export var useFocus = function useFocus(_ref) { var target = _ref.target; var focus = useCallback(function () { // Use setTimeout to run this async after any DOM updates in same callback setTimeout(function () { return target.focus(); }, 0); }, [target]); return focus; };