open-agreements
Version:
Open-source legal template filling CLI and library
39 lines • 2.05 kB
TypeScript
/**
* In-Place AST Modifier
*
* Modifies the revised document's AST in-place to add track changes markup.
* This replaces the reconstruction-based approach with direct tree manipulation.
*/
import type { ComparisonUnitAtom } from '../../core-types.js';
export declare function atomContentVisibleLength(el: Element): number;
/**
* Pre-split revised-tree runs that contain atoms with mixed correlation statuses.
*
* Without this, `handleInserted` wraps the entire run with `<w:ins>`, destroying
* Equal content in the same run. After splitting, each fragment is a separate
* `<w:r>` and existing per-status handlers work without modification.
*
* Safety: wrapped in try/catch per run group. If any DOM operation fails, the
* run is skipped and the existing fallback-to-rebuild architecture handles it.
*/
export declare function preSplitMixedStatusRuns(mergedAtoms: ComparisonUnitAtom[]): void;
/**
* Pre-split revised-tree runs where word-split Equal atoms from the same run
* are interleaved with Deleted/MovedSource atoms in the merged atom list.
*
* `preSplitMixedStatusRuns` handles the case where a single run contains atoms
* with DIFFERENT statuses (e.g., some Equal and some Inserted). But it cannot
* handle the case where ALL atoms from a run are Equal yet Deleted atoms (from
* the original tree) are interspersed between them in the merged list.
*
* Without this split, `handleEqual` sees all Equal atoms pointing to the same
* run and skips position advancement (the `lastRevisedRunAnchor` optimization).
* Subsequent `handleDeleted` calls then insert deleted content at the wrong
* position because the cursor never advanced past the shared run.
*
* This function detects interleaved sequences and splits the DOM run so each
* contiguous group of Equal atoms gets its own run fragment. The handlers then
* advance the cursor correctly across fragments.
*/
export declare function preSplitInterleavedWordRuns(mergedAtoms: ComparisonUnitAtom[]): void;
//# sourceMappingURL=inPlaceModifier-presplit.d.ts.map