Skip to content

Updating Document UI - #152

Merged
Deodat-Lawson merged 3 commits into
stablefrom
main
Jan 31, 2026
Merged

Deodat-Lawson merged 3 commits into
stablefrom
main

Conversation

@Deodat-Lawson

Copy link
Copy Markdown
Owner

No description provided.

@vercel

vercel Bot commented Jan 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pdr-ai-v2 Ready Ready Preview, Comment Jan 31, 2026 10:30am

@Deodat-Lawson
Deodat-Lawson merged commit 345ce30 into stable Jan 31, 2026
4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +142 to +146
const handleTextSelection = () => {
const selection = window.getSelection();
if (selection && selection.toString().length > 0) {
setSelectedText(selection.toString());
// Note: Getting accurate positions in contentEditable is complex

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

This branch was successfully deployed

1 active deployment
Preview — 3511788c Deployed Jan 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant