Skip to content

TT-7149 each block is a paragraph - not each verse#234

Open
sarahentzel wants to merge 1 commit intodevelopfrom
TT-7149
Open

TT-7149 each block is a paragraph - not each verse#234
sarahentzel wants to merge 1 commit intodevelopfrom
TT-7149

Conversation

@sarahentzel
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts local Paratext USX syncing so that paragraph boundaries are driven by transcription “blocks” (newlines / explicit markers) rather than forcing each verse into its own paragraph, aligning exported USX structure with intended paragraphing.

Changes:

  • Updates USX DOM manipulation to support inserting inline verses within an existing paragraph and to split transcript newlines into continuation <para style="p"> blocks.
  • Updates postPass logic to decide when a verse should start a new paragraph based on transcription layout and to avoid over-deleting surrounding verses when re-syncing.
  • Modernizes IntegrationPanel TextField customization to use MUI slotProps for Select/Menu styling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/renderer/src/components/Integration.tsx Switches MUI TextField select/menu styling from SelectProps/InputProps to slotProps.
src/renderer/src/business/localParatext/usxNodeChange.ts Adds helpers for paragraph container detection + continuation paragraph insertion; updates verse insertion/replacement behavior.
src/renderer/src/business/localParatext/usxNodeChange.test.ts Updates expectations for findNodeAfterVerse and adds coverage for new insertion/continuation behaviors.
src/renderer/src/business/localParatext/postPass.ts Implements “paragraph per block” logic and safer cleanup/reinsert behavior for multi-verse transcriptions.
src/renderer/src/business/localParatext/postPass.test.ts Adds regression tests around re-syncing ranges and keeping multiple verses in a single paragraph.
src/renderer/src/business/localParatext/localSync.ts Preserves transcription newlines instead of flattening them, enabling paragraph-aware sync.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +114 to +118
if (thisVerse) {
if (paraForThisVerse) thisVerse = moveToPara(doc, thisVerse);

if (thisVerse)
replaceText(doc, thisVerse, altRef + p.attributes.lastComment);
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

When paraForThisVerse is false and removeOverlappingVerses returns an existing verse element, this path calls replaceText(doc, thisVerse, ...) with a <verse> node. replaceText expects a paragraph container and uses firstVerse(para), so passing a verse can result in firstVerse returning undefined and subsequent addAfter calls appending text directly under <usx> (incorrect DOM structure) or overwriting the wrong verse.

To support multiple verses per paragraph, this branch needs a replacement routine that targets the specific verse element (e.g., remove/replace text after that verse until the next verse/section) or alternatively remove the existing exact verse and re-insert it via addParatextVerse in inline mode instead of calling replaceText. Adding a regression test for updating an existing in-paragraph verse would help prevent this from recurring.

Suggested change
if (thisVerse) {
if (paraForThisVerse) thisVerse = moveToPara(doc, thisVerse);
if (thisVerse)
replaceText(doc, thisVerse, altRef + p.attributes.lastComment);
// If we found an existing verse but this verse should be inline (not start a new paragraph),
// remove it so we can reinsert it correctly in inline mode below.
if (thisVerse && !paraForThisVerse) {
removeVerse(doc, thisVerse);
thisVerse = undefined;
}
if (thisVerse) {
// For paragraph-start verses, move to the paragraph container before replacing text.
thisVerse = moveToPara(doc, thisVerse);
if (thisVerse) {
replaceText(doc, thisVerse, altRef + p.attributes.lastComment);
}

Copilot uses AI. Check for mistakes.
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.

2 participants