/** Call a function after focusing a field and then restore the previous focus afterwards if necessary */ declare function withFocus(field: HTMLElement, callback: () => T): T; /** Inserts `text` at the cursor’s position, replacing any selection, with **undo** support and by firing the `input` event. */ export declare function insertTextIntoField(field: HTMLElement, text: string): void; /** Replaces the entire content, equivalent to `field.value = text` but with **undo** support and by firing the `input` event. */ export declare function setFieldText(field: HTMLElement, text: string): void; /** Get the selected text in a field or an empty string if nothing is selected. */ export declare function getFieldSelection(field: HTMLElement): string; /** Adds the `wrappingText` before and after field’s selection (or cursor). If `endWrappingText` is provided, it will be used instead of `wrappingText` at on the right. */ export declare function wrapFieldSelection(field: HTMLElement, wrap: string, wrapEnd?: string): void; type ReplacerCallback = (substring: string, ...arguments_: any[]) => string; /** Finds and replaces strings and regex in the field’s value, like `field.value = field.value.replace()` but better */ export declare function replaceFieldText(field: HTMLInputElement | HTMLTextAreaElement, searchValue: string | RegExp, replacer: string | ReplacerCallback, cursor?: 'select' | 'after-replacement'): void; /** @deprecated Import `insertTextIntoField` instead */ export declare const insert: typeof insertTextIntoField; /** @deprecated Import `setFieldText` instead */ export declare const set: typeof setFieldText; /** @deprecated Import `replaceFieldText` instead */ export declare const replace: typeof replaceFieldText; /** @deprecated Import `wrapFieldSelection` instead */ export declare const wrapSelection: typeof wrapFieldSelection; /** @deprecated Import `getFieldSelection` instead */ export declare const getSelection: typeof getFieldSelection; declare const textFieldEdit: { readonly insert: typeof insertTextIntoField; readonly set: typeof setFieldText; readonly replace: typeof replaceFieldText; readonly wrapSelection: typeof wrapFieldSelection; readonly getSelection: typeof getFieldSelection; }; export default textFieldEdit; export { withFocus as _TEST_ONLY_withFocus };