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

Pin the jumped-to editorial comment as a floating overlay in the Manuscript editor

[._.]/ Adam Eivy4ee1db9aae9c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 74d1a05a7e..f44b8f16ce 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -13,6 +13,7 @@
## Changed
+- **[manuscript-editorial-jump-pinned-overlay] Jumping to an editorial comment in the Manuscript editor now keeps that comment on screen.** Clicking "Jump" (or the issue link) on an editorial feedback item still scrolls the manuscript to its anchor, but the comment is now also pinned as a floating, dismissable overlay over the manuscript — so its note, suggestion, and Generate-fix/Accept/Dismiss actions travel with the scroll instead of being lost off-screen (previously the sidebar card stayed put on desktop and was pushed far below the fold on mobile's stacked layout). The overlay reuses the existing comment card, auto-closes when the comment is accepted or dismissed, and dismisses on Escape or its close button.
- **[rich-text-editor-for-prose-stage-replace-plain] The pipeline prose stage now edits in the same reading-comfortable editor as the Writers Room.** Drafting a prose stage uses a serif, roomy-line-spacing, spellchecked editor with a heading-hint placeholder instead of the old code-style monospace box — so prose reads like prose while you write it. The script-shaped stages (comic script, teleplay) keep their monospace editor.
- **[inline-confirm-row-primitive]** Consolidated the duplicated Brain delete-confirmation rows onto one shared component, so inline confirm prompts stay visually and behaviorally consistent (no user-facing change).
- **[inline-confirm-row-border-b-variant] Delete confirmations across Notes, the wiki browser, the daily log, and link buckets now share one consistent look.** The four full-width "are you sure?" bars moved onto the same shared confirm component as the rest of the app, so their buttons and text now match every other inline delete prompt.
diff --git a/client/src/pages/PipelineManuscriptEditor.jsx b/client/src/pages/PipelineManuscriptEditor.jsx
index f85da0ba0a..6e8de2eb3c 100644
--- a/client/src/pages/PipelineManuscriptEditor.jsx
+++ b/client/src/pages/PipelineManuscriptEditor.jsx
@@ -87,6 +87,10 @@ export default function PipelineManuscriptEditor() {
const [overrideModel, setOverrideModel] = useState('');
// Per-issue free-text save state: 'saving' | 'saved' | undefined.
const [saveState, setSaveState] = useState({});
+ // The comment last jumped to — pinned as a floating overlay so its editorial
+ // context (and its Generate/Accept/Dismiss actions) stay on screen after the
+ // manuscript scrolls away from the sidebar card. null = no overlay.
+ const [activeCommentId, setActiveCommentId] = useState(null);
// textarea elements keyed by issue number, for jump-to-anchor.
const sectionRefs = useRef(new Map());
// Last-saved content per `${issueId}:${stageId}`, so a blur with no change
@@ -241,12 +245,15 @@ export default function PipelineManuscriptEditor() {
// Jump to a comment's anchor: focus the issue's textarea, select the verbatim
// quote (native selection highlights it), and scroll it into view.
const jumpToComment = (comment) => {
+ // Pin the comment to the overlay first, so even an unanchored note keeps its
+ // context (and actions) visible while the user works in the manuscript.
+ setActiveCommentId(comment.id);
const ta = comment.issueNumber != null ? sectionRefs.current.get(comment.issueNumber) : null;
if (!ta) {
toast('This comment is not anchored to a specific issue');
return;
}
- ta.scrollIntoView({ behavior: 'smooth', block: 'start' });
+ ta.scrollIntoView?.({ behavior: 'smooth', block: 'start' });
const quote = comment.anchorQuote || '';
const idx = quote ? ta.value.indexOf(quote) : -1;
ta.focus();
@@ -282,6 +289,13 @@ export default function PipelineManuscriptEditor() {
dismissed: comments.filter((c) => c.status === 'dismissed'),
}), [comments]);
+ // Only pin still-open comments — accepting/dismissing flips the status, which
+ // resolves this to null and closes the overlay automatically (resolved
+ // comments are navigational only, with no actions to keep on screen).
+ const activeComment = activeCommentId
+ ? comments.find((c) => c.id === activeCommentId && c.status === 'open')
+ : null;
+
if (loading) return <div className="p-6 text-gray-500 text-sm">Loading manuscript…</div>;
return (
@@ -447,6 +461,58 @@ export default function PipelineManuscriptEditor() {
<ResolvedGroup label="Dismissed" icon={X} items={grouped.dismissed} onJump={jumpToComment} />
</aside>
</div>
+
+ {/* Pinned overlay: the just-jumped-to comment, kept on screen over the
+ manuscript so its context and actions travel with the scroll. */}
+ {activeComment ? (
+ <ActiveCommentOverlay
+ comment={activeComment}
+ seriesId={seriesId}
+ providerOverride={providerOverride}
+ modelOverride={modelOverride}
+ onJump={jumpToComment}
+ onCommentChange={updateCommentLocal}
+ onAccepted={applyAccepted}
+ onClose={() => setActiveCommentId(null)}
+ />
+ ) : null}
+ </div>
+ );
+}
+
+// Floating, dismissable restatement of the comment the user just jumped to.
+// Anchored over the manuscript pane (bottom-left) — away from the right sidebar
+// and below the section that scrolled to the top — so the user can read/edit
+// the manuscript and act on the comment without losing either. Reuses
+// CommentCard with a distinct idScope so its form ids don't collide with the
+// sidebar's copy of the same open comment.
+function ActiveCommentOverlay({ comment, onClose, ...cardProps }) {
+ // Esc closes the pinned card — matches the dismiss convention of the app's
+ // other non-modal floating panels. (No click-outside: the overlay is meant to
+ // stay open while the user clicks into the manuscript to edit.)
+ useEffect(() => {
+ const onKey = (e) => { if (e.key === 'Escape') onClose(); };
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, [onClose]);
+
+ return (
+ <div
+ role="dialog"
+ aria-label="Editorial comment"
+ className="fixed bottom-4 left-4 z-40 w-[min(440px,calc(100vw-2rem))] max-h-[70vh] overflow-y-auto rounded-lg border border-port-accent/40 bg-port-card shadow-2xl shadow-black/60"
+ >
+ <div className="sticky top-0 flex items-center justify-between gap-2 px-3 py-2 border-b border-port-border bg-port-bg/90 backdrop-blur">
+ <span className="text-[11px] uppercase tracking-wider text-gray-400 inline-flex items-center gap-1.5">
+ <CornerDownRight size={12} className="text-port-accent" /> Editorial comment
+ </span>
+ <button type="button" onClick={onClose} className="text-gray-500 hover:text-white" title="Close pinned comment">
+ <X size={14} />
+ </button>
+ </div>
+ <div className="p-2.5">
+ <CommentCard comment={comment} idScope={`overlay-${comment.id}`} {...cardProps} />
+ </div>
</div>
);
}
@@ -537,7 +603,10 @@ function Badge({ comment }) {
);
}
-function CommentCard({ comment, seriesId, providerOverride, modelOverride, onJump, onCommentChange, onAccepted }) {
+function CommentCard({ comment, seriesId, providerOverride, modelOverride, onJump, onCommentChange, onAccepted, idScope }) {
+ // Namespace form ids so the overlay's copy of an open comment doesn't collide
+ // with the sidebar's (duplicate ids break label/htmlFor association).
+ const scope = idScope || comment.id;
const hasFix = !!comment.fix;
const fixEdits = useMemo(() => {
if (Array.isArray(comment.fix?.edits) && comment.fix.edits.length) return comment.fix.edits;
@@ -657,9 +726,9 @@ function CommentCard({ comment, seriesId, providerOverride, modelOverride, onJum
</label>
{edit.note ? <p className="px-2 pt-1.5 text-[11px] text-gray-500">{edit.note}</p> : null}
<InlineDiff oldText={edit.find || ''} newText={draft} emptyLabel="No replacement changes." />
- <label htmlFor={`fix-replace-${comment.id}-${i}`} className="block px-2 pt-1.5 text-[10px] uppercase tracking-wider text-gray-500">Replacement (editable)</label>
+ <label htmlFor={`fix-replace-${scope}-${i}`} className="block px-2 pt-1.5 text-[10px] uppercase tracking-wider text-gray-500">Replacement (editable)</label>
<textarea
- id={`fix-replace-${comment.id}-${i}`}
+ id={`fix-replace-${scope}-${i}`}
value={draft}
onChange={(e) => setEditDrafts((prev) => ({ ...prev, [i]: e.target.value }))}
rows={Math.min(14, Math.max(3, draft.split('\n').length + 1))}
diff --git a/client/src/pages/PipelineManuscriptEditor.test.jsx b/client/src/pages/PipelineManuscriptEditor.test.jsx
index 5aa18415e0..b9a95ce037 100644
--- a/client/src/pages/PipelineManuscriptEditor.test.jsx
+++ b/client/src/pages/PipelineManuscriptEditor.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { render, screen, waitFor, fireEvent } from '@testing-library/react';
+import { render, screen, waitFor, fireEvent, within } from '@testing-library/react';
import { MemoryRouter, Routes, Route } from 'react-router-dom';
const api = vi.hoisted(() => ({
@@ -63,6 +63,62 @@ describe('PipelineManuscriptEditor', () => {
expect(screen.getByText(/1 open/)).toBeInTheDocument();
});
+ it('pins the clicked comment in a dismissable overlay so its context survives the jump', async () => {
+ renderEditor();
+ await screen.findByText('My Series');
+
+ // Initially only the sidebar card exists.
+ expect(screen.getByText('The ending is abrupt')).toBeInTheDocument();
+ expect(screen.queryByRole('dialog', { name: 'Editorial comment' })).not.toBeInTheDocument();
+
+ // Clicking Jump pins it as a floating overlay (problem text now appears twice).
+ fireEvent.click(screen.getByTitle('Jump to this spot in the manuscript'));
+ const overlay = await screen.findByRole('dialog', { name: 'Editorial comment' });
+ expect(overlay).toBeInTheDocument();
+ expect(screen.getAllByText('The ending is abrupt').length).toBe(2);
+
+ // Closing the overlay leaves the sidebar card intact.
+ fireEvent.click(screen.getByTitle('Close pinned comment'));
+ await waitFor(() => expect(screen.queryByRole('dialog', { name: 'Editorial comment' })).not.toBeInTheDocument());
+ expect(screen.getByText('The ending is abrupt')).toBeInTheDocument();
+ });
+
+ it('dismisses the pinned overlay on Escape', async () => {
+ renderEditor();
+ await screen.findByText('My Series');
+
+ fireEvent.click(screen.getByTitle('Jump to this spot in the manuscript'));
+ await screen.findByRole('dialog', { name: 'Editorial comment' });
+
+ fireEvent.keyDown(window, { key: 'Escape' });
+ await waitFor(() => expect(screen.queryByRole('dialog', { name: 'Editorial comment' })).not.toBeInTheDocument());
+ });
+
+ it('closes the pinned overlay automatically when its comment is accepted', async () => {
+ api.generatePipelineManuscriptFix.mockResolvedValue({
+ fix: { find: 'She left.', replace: 'She left, but paused.' },
+ comment: { ...comment, fix: { find: 'She left.', replace: 'She left, but paused.' } },
+ });
+ api.acceptPipelineManuscriptFix.mockResolvedValue({
+ comment: { ...comment, status: 'accepted', fix: { find: 'She left.', replace: 'She left, but paused.' } },
+ section: { issueId: 'iss-1', number: 1, title: 'One', stageId: 'prose', content: 'The hero walked in. She left, but paused.' },
+ });
+
+ renderEditor();
+ await screen.findByText('My Series');
+
+ fireEvent.click(screen.getByTitle('Jump to this spot in the manuscript'));
+ const overlay = await screen.findByRole('dialog', { name: 'Editorial comment' });
+
+ // Act on the comment from inside the overlay.
+ fireEvent.click(within(overlay).getByText('Generate fix'));
+ fireEvent.click(await within(overlay).findByText('Accept'));
+
+ // Accepting flips status → the overlay vanishes on its own.
+ await waitFor(() => expect(screen.queryByRole('dialog', { name: 'Editorial comment' })).not.toBeInTheDocument());
+ await waitFor(() => expect(screen.getByText(/0 open/)).toBeInTheDocument());
+ });
+
it('generates a fix, then accepts it — moving the comment to Accepted and updating the section', async () => {
api.generatePipelineManuscriptFix.mockResolvedValue({
fix: { find: 'She left.', replace: 'She left, but paused.' },