UNPKG

@atlaskit/editor-plugin-media-insert

Version:

Media Insert plugin for @atlaskit/editor-core

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