867 milestone subdivisions squashed#915
Open
Luke-Bilhorn wants to merge 14 commits into
Open
Conversation
Introduces the core subdivision data model, shared TypeScript types (SubdivisionAnchor, MilestoneIndex, etc.), a provider-side subdivisionUtils module, and a subdivision-aware resolver in codexDocument that replaces the flat milestone splitter. Includes a full suite of unit tests covering resolver edge cases.
Adds message handlers in codexCellEditorMessagehandling.ts and wires them into the provider and codexDocument so that subdivision anchor mutations on the source side are persisted and mirrored to the paired target webview. Covers addAnchor, deleteAnchor, renameAnchor, and resetMilestone operations. Tests added for the write pipeline.
Extracts subdivision utility helpers into webviews/.../CodexCellEditor/utils/subdivisionUtils.ts, adds webview types (lib/types.ts), and wires the resolver's milestoneIndex data into CodexCellEditor.tsx so the accordion can consume it. Unit tests cover the webview-side subdivision helpers.
Wires up inline editing for subdivision labels (rename) and adds per-subsection delete and per-milestone reset affordances in MilestoneAccordion.tsx (source side only). All three operations dispatch messages to the provider. Tests cover rename, delete, and reset interactions.
Implements the addAnchor message handler and extracts a shared commit pipeline in codexCellEditorMessagehandling.ts so that all subdivision mutation operations (add, delete, rename, reset) go through one consistent save/notify path. Tests added for the add-anchor handler.
Adds an expandable form inside each milestone section (source side only) that lets translators insert a subdivision anchor at a specific cell. Dispatches addMilestoneSubdivisionAnchor to the provider. Tests cover the form's open/submit/cancel behavior.
Introduces the useSubdivisionNumberLabels configuration flag (package.json, interfaceSettings.ts, types, provider message handling) that forces numeric labels on subsection headings instead of named breaks. Also surfaces cellsPerPage in the Interface Settings panel. Wires both settings into ChapterNavigationHeader and MilestoneAccordion, with tests.
Ensures that when the source editor mutates subdivision anchors, the corresponding target webview receives an updated notebook state so both panels stay in sync without requiring a manual reload.
Adds a settings-mode toggle (gear icon) to the milestone accordion so that the rename, delete, reset, and add-break controls are hidden by default, keeping the read-only accordion view clean. Tests cover the toggle's show/hide behavior.
Introduces the maxSubdivisionLength configuration value (package.json, interfaceSettings.ts) that caps how many cells may appear in one subdivision section. The resolver now splits oversized sections automatically. Named-break labels are also persisted through adaptive splits. Surfaces the setting in the Interface Settings panel with polished copy. Full test coverage for adaptive chunking paths.
Consolidates several visual tweaks to MilestoneAccordion: - Red trash-can icons with a phantom spacer for vertical alignment - Non-deletable rows use a disabled icon button instead of a plain icon - Milestone row icon spacing adjusted for tighter layout - Fix rename handler to expand the correct milestone before entering edit mode, and move the rename affordance into the milestone row
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subdivisions in .codex and .source notebooks
Long chapters used to get sliced into rigid 50-cell pages. That's workable for fairly evenly-versed scripture imports, and episode length scripts, but pretty annoying for a 2000-cell .docx import or a feature film's worth of subtitles— translators end up navigating breaks that mean nothing to them. So we let them define their own breaks, and name them if they choose, right inside the milestone accordion. Nothing terribly novel, but for some users, it will be a quality of life boost.
Each milestone cell now stores an optional subdivisions array of {startCellId} placements anchored to stable cell IDs (not positional indexes, which could drift as cells are added/deleted). A separate subdivisionNames map stores localized labels per side. A central resolveSubdivisions helper turns those into render-ready chunks; if no placements exist it falls back to the old arithmetic 50-cell paging. (This is also an adjustable setting).
Source files own all of the placement edits; we mirror them into the paired target on every change and now also push a live refresh to the target webview. Names are independent so source and target can use their own translations, but target side uses source as default until another name is given. Editing UI is gated behind a new gear toggle to keep the read-only view uncluttered.