(activeElement: Element | null)
| 1 | import { isMonacoFocused } from './shortcutGuards' |
| 2 | |
| 3 | function getSelectedTextFromInput(activeElement: Element | null): string | null { |
| 4 | if (activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement) { |
| 5 | const selectionStart = activeElement.selectionStart |
| 6 | const selectionEnd = activeElement.selectionEnd |
| 7 | |
| 8 | if (selectionStart !== null && selectionEnd !== null && selectionEnd > selectionStart) { |
| 9 | return activeElement.value.slice(selectionStart, selectionEnd) |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | return null |
| 14 | } |
| 15 | |
| 16 | export function getSearchPrefillSelection(): string | null { |
| 17 | if (isMonacoFocused()) { |
no outgoing calls
no test coverage detected