Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): account for internal scroll in popover; warn on missing anchors

[._.]/ Adam Eivyd84835f16230
diff --git a/client/src/components/pipeline/manuscript/ManuscriptImpactPreview.jsx b/client/src/components/pipeline/manuscript/ManuscriptImpactPreview.jsx
index 45c621078b..3a45e126ee 100644
--- a/client/src/components/pipeline/manuscript/ManuscriptImpactPreview.jsx
+++ b/client/src/components/pipeline/manuscript/ManuscriptImpactPreview.jsx
@@ -45,9 +45,9 @@ export default function ManuscriptImpactPreview({ open, onClose, sections, comme
const sectionEdits = edits.get(key);
if (!sectionEdits?.length) return null;
const before = s.content || '';
- const { output: after, overlapping } = planManuscriptEdits(before, sectionEdits);
- if (after === before && !overlapping) return null;
- return { section: s, before, after, count: sectionEdits.length, overlapping };
+ const { output: after, overlapping, notFound } = planManuscriptEdits(before, sectionEdits);
+ if (after === before && !overlapping && !notFound) return null;
+ return { section: s, before, after, count: sectionEdits.length, overlapping, notFound };
})
.filter(Boolean);
}, [open, sections, comments, fixDrafts]);
@@ -77,13 +77,18 @@ export default function ManuscriptImpactPreview({ open, onClose, sections, comme
Nothing to preview. Generate fixes on the open editorial notes (and leave the edits you want checked); they'll show here as before/after diffs.
</p>
) : (
- changed.map(({ section, before, after, count, overlapping }) => (
+ changed.map(({ section, before, after, count, overlapping, notFound }) => (
<div key={`${section.issueId}:${section.stageId}`} className="border border-port-border rounded-lg overflow-hidden">
<div className="px-3 py-2 bg-port-bg/60 border-b border-port-border text-sm text-gray-200">
Issue {section.number}{section.title ? ` — ${section.title}` : ''}
<span className="ml-2 text-[10px] uppercase tracking-wider text-gray-500">{STAGE_LABEL[section.stageId] || section.stageId}</span>
<span className="ml-2 text-[10px] text-port-accent">{count} edit{count === 1 ? '' : 's'}</span>
</div>
+ {notFound ? (
+ <p className="px-3 py-1.5 text-[11px] text-port-warning border-b border-port-border bg-port-warning/10">
+ {notFound} edit{notFound === 1 ? '' : 's'} couldn’t be located in the current draft — accepting will be rejected; regenerate the fix. Preview below shows only the edits that matched.
+ </p>
+ ) : null}
{overlapping ? (
<p className="px-3 py-1.5 text-[11px] text-port-warning border-b border-port-border bg-port-warning/10">
{overlapping} of these edits overlap — accepting will be rejected; regenerate the fix. Preview below shows the non-overlapping subset.
diff --git a/client/src/components/pipeline/manuscript/ManuscriptLiveSection.jsx b/client/src/components/pipeline/manuscript/ManuscriptLiveSection.jsx
index 161edd679a..eaf8015ec4 100644
--- a/client/src/components/pipeline/manuscript/ManuscriptLiveSection.jsx
+++ b/client/src/components/pipeline/manuscript/ManuscriptLiveSection.jsx
@@ -55,12 +55,18 @@ export default function ManuscriptLiveSection({
};
// Position the popover just below the open comment's first underline mark.
- useLayoutEffect(() => {
- if (!openComment || !backdropRef.current) return;
- const marks = backdropRef.current.querySelectorAll('mark[data-cids]');
+ // `offsetTop` is a content coordinate, so subtract the textarea's scrollTop —
+ // otherwise a note opened after scrolling a long (>400-row) section lands far
+ // from the visible underline. Recomputed on scroll (see the textarea handler).
+ const positionPopover = () => {
+ const backdrop = backdropRef.current;
+ if (!openComment || !backdrop) return;
+ const marks = backdrop.querySelectorAll('mark[data-cids]');
const mark = [...marks].find((m) => (m.dataset.cids || '').split(',').includes(openComment.id));
- setPopTop(mark ? mark.offsetTop + mark.offsetHeight + 4 : 0);
- }, [openComment, content, segments]);
+ const scrollTop = taRef.current?.scrollTop || 0;
+ setPopTop(mark ? mark.offsetTop + mark.offsetHeight + 4 - scrollTop : 0);
+ };
+ useLayoutEffect(positionPopover, [openComment, content, segments]);
// Esc closes the popover.
useEscapeKey(openComment, onCloseComment);
@@ -128,12 +134,14 @@ export default function ManuscriptLiveSection({
// keyup re-open it because the caret still sits inside the span.
onKeyUp={(e) => { if (e.key !== 'Escape') handleCaret(); }}
// Keep the underline backdrop aligned when a section longer than the
- // row cap scrolls internally (the backdrop is overflow-hidden).
+ // row cap scrolls internally (the backdrop is overflow-hidden), and
+ // re-pin the open popover to its now-moved underline.
onScroll={(e) => {
if (backdropRef.current) {
backdropRef.current.scrollTop = e.target.scrollTop;
backdropRef.current.scrollLeft = e.target.scrollLeft;
}
+ positionPopover();
}}
rows={rowsFor(content)}
spellCheck