TT-7149 each block is a paragraph - not each verse#234
TT-7149 each block is a paragraph - not each verse#234sarahentzel wants to merge 1 commit intodevelopfrom
Conversation
There was a problem hiding this comment.
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
postPasslogic 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
IntegrationPanelTextField customization to use MUIslotPropsfor 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.
| if (thisVerse) { | ||
| if (paraForThisVerse) thisVerse = moveToPara(doc, thisVerse); | ||
|
|
||
| if (thisVerse) | ||
| replaceText(doc, thisVerse, altRef + p.attributes.lastComment); |
There was a problem hiding this comment.
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.
| 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); | |
| } |
No description provided.