MCPcopy Index your code
hub / github.com/editablejs/editable / SelectionComponent

Function SelectionComponent

packages/editor/src/components/selection.tsx:15–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13interface SelectionProps {}
14
15const SelectionComponent: React.FC<SelectionProps> = () => {
16 const selection = useSelectionDrawingSelection()
17 const rects = useSelectionDrawingRects()
18 const enabled = useSelectionDrawingEnabled()
19 const style = useSelectionDrawingStyle()
20 const [focused] = useFocused()
21 if (!enabled || !selection || Range.isCollapsed(selection)) return null
22
23 return (
24 <>
25 {rects.map((rect, index) => {
26 return (
27 <ShadowBlock
28 key={`sel-${index}`}
29 rect={Object.assign({}, rect.toJSON(), {
30 color: isTouchDevice || focused ? style.focusColor : style.blurColor,
31 })}
32 />
33 )
34 })}
35 </>
36 )
37}
38
39export { SelectionComponent }

Callers

nothing calls this directly

Calls 6

useSelectionDrawingRectsFunction · 0.90
useSelectionDrawingStyleFunction · 0.90
useFocusedFunction · 0.90
toJSONMethod · 0.80

Tested by

no test coverage detected