Repository navigation
Updating Document UI - #152
Conversation
…sign-improvement Feature/doucment viewer design improvement
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3511788cee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const handleTextSelection = () => { | ||
| const selection = window.getSelection(); | ||
| if (selection && selection.toString().length > 0) { | ||
| setSelectedText(selection.toString()); | ||
| // Note: Getting accurate positions in contentEditable is complex |
There was a problem hiding this comment.
Capture textarea selection correctly for AI edits
The document editor uses a <Textarea> and later decides whether to edit the selected text (selectedText.length > 0) before applying replacements via selectionStart/selectionEnd. However, window.getSelection() does not return selections from a textarea, so selectedText stays empty and the range offsets are unrelated to the textarea content. In practice, selection-based AI edits never trigger and the assistant will always append content or use incorrect offsets. Use the textarea’s selectionStart/selectionEnd (from contentRef.current) to populate selectedText and offsets so the “edit selected text” path can work.
Useful? React with 👍 / 👎.
No description provided.