about summary refs log tree commit diff
path: root/src/view/com/composer/text-input/TextInput.web.tsx
diff options
context:
space:
mode:
authorHailey <153161762+haileyok@users.noreply.github.com>2024-01-02 12:16:28 -0800
committerGitHub <noreply@github.com>2024-01-02 12:16:28 -0800
commitc1dc0b7ee0f15134578d50a3d344ab4bdad1119f (patch)
treea8dd56018c9efe4c9a17e7bab4c6d0624b38fb41 /src/view/com/composer/text-input/TextInput.web.tsx
parente460b304fc2ce05be48567579647c969e46ed116 (diff)
downloadvoidsky-c1dc0b7ee0f15134578d50a3d344ab4bdad1119f.tar.zst
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
Diffstat (limited to 'src/view/com/composer/text-input/TextInput.web.tsx')
-rw-r--r--src/view/com/composer/text-input/TextInput.web.tsx5
1 files changed, 5 insertions, 0 deletions
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 (