From c1dc0b7ee0f15134578d50a3d344ab4bdad1119f Mon Sep 17 00:00:00 2001 From: Hailey <153161762+haileyok@users.noreply.github.com> Date: Tue, 2 Jan 2024 12:16:28 -0800 Subject: emoji picker improvements (#2392) * rework emoji picker * dynamic position * always prefer the left if it will fit * add accessibility label * Update EmojiPicker.web.tsx oops. remove accessibility from fake button --- src/view/com/composer/text-input/TextInput.web.tsx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/view/com/composer/text-input/TextInput.web.tsx') diff --git a/src/view/com/composer/text-input/TextInput.web.tsx b/src/view/com/composer/text-input/TextInput.web.tsx index 206a3205b..ec3a042a3 100644 --- a/src/view/com/composer/text-input/TextInput.web.tsx +++ b/src/view/com/composer/text-input/TextInput.web.tsx @@ -22,6 +22,7 @@ import {useActorAutocompleteFn} from '#/state/queries/actor-autocomplete' export interface TextInputRef { focus: () => void blur: () => void + getCursorPosition: () => DOMRect | undefined } interface TextInputProps { @@ -169,6 +170,10 @@ export const TextInput = React.forwardRef(function TextInputImpl( React.useImperativeHandle(ref, () => ({ focus: () => {}, // TODO blur: () => {}, // TODO + getCursorPosition: () => { + const pos = editor?.state.selection.$anchor.pos + return pos ? editor?.view.coordsAtPos(pos) : undefined + }, })) return ( -- cgit 1.4.1