MCPcopy Create free account
hub / github.com/experdot/pointer / getSearchPrefillSelection

Function getSearchPrefillSelection

src/renderer/src/utils/searchSelection.ts:16–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14}
15
16export function getSearchPrefillSelection(): string | null {
17 if (isMonacoFocused()) {
18 return null
19 }
20
21 const activeElement = document.activeElement
22 const inputSelection = getSelectedTextFromInput(activeElement)
23 const rawSelection = inputSelection ?? window.getSelection()?.toString() ?? ''
24 const trimmedSelection = rawSelection.trim()
25
26 return trimmedSelection.length > 0 ? trimmedSelection : null
27}

Callers 2

useChatShortcutsFunction · 0.90

Calls 2

isMonacoFocusedFunction · 0.90
getSelectedTextFromInputFunction · 0.85

Tested by

no test coverage detected