UNPKG

@gechiui/block-editor

Version:
33 lines (31 loc) 737 B
/** * GeChiUI dependencies */ import { useEffect, useContext, useRef } from '@gechiui/element'; /** * Internal dependencies */ import { inputEventContext } from './'; export function __unstableRichTextInputEvent(_ref) { let { inputType, onInput } = _ref; const callbacks = useContext(inputEventContext); const onInputRef = useRef(); onInputRef.current = onInput; useEffect(() => { function callback(event) { if (event.inputType === inputType) { onInputRef.current(); event.preventDefault(); } } callbacks.current.add(callback); return () => { callbacks.current.delete(callback); }; }, [inputType]); return null; } //# sourceMappingURL=input-event.js.map