Skip to content

Pt 3897 replace preview#2154

Open
katherinejensen00 wants to merge 16 commits intomainfrom
pt-3897-replace-preview
Open

Pt 3897 replace preview#2154
katherinejensen00 wants to merge 16 commits intomainfrom
pt-3897-replace-preview

Conversation

@katherinejensen00
Copy link
Copy Markdown
Contributor

@katherinejensen00 katherinejensen00 commented Mar 27, 2026

https://paratextstudio.atlassian.net/browse/PT-3897
image

  • Create a replace preview view options picker as per this V0: https://v0.app/chat/preview-options-picker-s08sC9IIAfJ
  • Fix history (I broke it when I implemented auto search)
  • Fix some styling that Sebastian pointed out
  • Improve keyboard navigation so the editor navigates to the reference without losing the cursor to the editor

Demo Video (had to zip it because it was just a little bit over the size limit for files):
replace-preview-options-picker.zip


This change is Reviewable


Open with Devin

@katherinejensen00 katherinejensen00 force-pushed the pt-3897-replace-preview branch 2 times, most recently from 435818b to b297cb5 Compare March 30, 2026 14:42
@katherinejensen00 katherinejensen00 marked this pull request as ready for review March 30, 2026 16:26
devin-ai-integration[bot]

This comment was marked as resolved.

@katherinejensen00 katherinejensen00 force-pushed the pt-3897-replace-preview branch from 60489f4 to b53bdfb Compare March 31, 2026 16:26
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 26 additional findings in Devin Review.

Open in Devin Review

Comment on lines +970 to +976
// Remove the find-result-highlight annotation when the editor changes or the find panel closes
useEffect(() => {
const currentController = editorWebViewController;
return () => {
currentController?.runAnnotationAction('find-current-result', 'removed').catch(() => {});
};
}, [editorWebViewController]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Stale find-result-highlight annotation persists in editor after clearing search

When the user clears the search (clicks the X button), handleStopSearch(true) clears results and sets focusedResultIndex to undefined, but the find-result-highlight annotation set in handleFocusedResultChange (find.web-view.tsx:991-996) is never removed from the editor. The cleanup effect at find.web-view.tsx:970-976 only triggers when editorWebViewController changes or the component unmounts — not when search results are cleared. This leaves a stale yellow highlight on the last-focused result in the editor until the Find panel is closed or the editor changes.

Prompt for agents
In extensions/src/platform-scripture/src/find.web-view.tsx, the annotation cleanup effect at lines 970-976 only fires when editorWebViewController changes or the component unmounts. Add an additional effect (or extend the existing handleStopSearch logic) that removes the find-current-result annotation when focusedResultIndex becomes undefined while results are empty (i.e. after clearing). For example, add:

useEffect(() => {
  if (focusedResultIndex === undefined && results.length === 0 && editorWebViewController) {
    editorWebViewController.runAnnotationAction('find-current-result', 'removed').catch(() => {});
  }
}, [focusedResultIndex, results.length, editorWebViewController]);

Alternatively, call the removal inside handleStopSearch by passing editorWebViewController into its dependency list, or trigger removal from the clear handler.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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