MCPcopy Create free account
hub / github.com/dailydotdev/apps / focusInput

Function focusInput

packages/shared/src/lib/textarea.ts:35–43  ·  view source on GitHub ↗
(
  textarea: HTMLTextAreaElement,
  [start, end]: number[],
)

Source from the content-addressed store, hash-verified

33
34/* eslint-disable no-param-reassign */
35export const focusInput = async (
36 textarea: HTMLTextAreaElement,
37 [start, end]: number[],
38): Promise<void> => {
39 textarea.focus();
40 await nextTick(); // for the selection to work, we need to wait for the input to get updated
41 textarea.selectionStart = start;
42 textarea.selectionEnd = end;
43};
44
45export const getCloseWord = (
46 textarea: HTMLTextAreaElement,

Callers 2

MarkdownInputFunction · 0.90
replaceWordMethod · 0.70

Calls 1

nextTickFunction · 0.90

Tested by

no test coverage detected