UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

25 lines 858 B
import * as React from 'react'; export const CharOverlay = ({ rectRef, ...rest }) => { const ref = React.useRef(null); // biome-ignore lint: lint/correctness/useExhaustiveDependencies React.useEffect(() => { rectRef.current = (rect) => { const span = ref.current; if (!span) return; const style = span.style; if (rect) { style.top = rect.y + 'px'; style.left = rect.x + 'px'; style.width = rect.width + 'px'; style.height = rect.height + 'px'; style.visibility = 'visible'; } else { style.visibility = 'hidden'; } }; }, []); return React.createElement("span", { ...rest, ref: ref }); }; //# sourceMappingURL=CharOverlay.js.map