diff --git a/client/src/components/writers-room/WorkEditor.jsx b/client/src/components/writers-room/WorkEditor.jsx index 3dd6fec67e..cbbba907b5 100644 --- a/client/src/components/writers-room/WorkEditor.jsx +++ b/client/src/components/writers-room/WorkEditor.jsx @@ -103,7 +103,7 @@ function readSidebarTab() { return STORYBOARD_TAB_VALUES.includes(stored) ? stored : STORYBOARD_TAB.BOARDS; } -export default function WorkEditor({ work, onChange, onToggleExercise, exerciseOpen, onDirtyChange }) { +export default function WorkEditor({ work, onChange, onToggleExercise, exerciseOpen, onDirtyChange, headerCollapsed = false }) { const navigate = useNavigate(); const [body, setBody] = useState(work.activeDraftBody || ''); const [title, setTitle] = useState(work.title); @@ -734,31 +734,24 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseO const runObjects = useCallback(() => runAnalysis(ANALYSIS_KIND.OBJECTS), [runAnalysis]); return ( -
- {/* - Header — one wrapping row on desktop, two compact rows on phones (#3568). - Under `sm` the status select and view-mode toggle move to a full-width - sub-bar of their own (`order-last`) so the first row is just title, Save, - Snapshot and the Work menu; at `sm+` the sub-bar is `display: contents`, - generating no box, so its children are direct flex items of the header - row again. DOM order is therefore the desktop order — no `order` classes - on the controls themselves — which keeps desktop tab order matching what - is on screen. Every control stays visible at every width; nothing was - pushed into the overflow menu to buy the space. - */} +
+ {/* Keep the editor mounted when collapsing controls so unsaved prose, + selection and active view survive focused writing. */}
+ {headerCollapsed && {title}} setTitle(e.target.value)} onBlur={commitTitle} onKeyDown={(e) => { if (e.key === 'Enter') e.target.blur(); }} - className="bg-transparent text-base font-semibold text-white border-none focus:outline-none focus:bg-port-bg/50 px-1 rounded flex-1 min-w-[140px] sm:min-w-[180px] min-h-[44px] sm:min-h-0" + className="bg-transparent text-base font-semibold text-white border-none focus:outline-none focus:bg-port-bg/50 px-1 rounded flex-1 min-w-0 w-0 sm:w-auto sm:min-w-[180px] min-h-[44px] sm:min-h-0" aria-label="Work title" /> {/* Secondary controls. `w-full order-last` gives them their own compact row below the primary actions under `sm`; `sm:contents` dissolves the wrapper so they sit inline — in this DOM order — on desktop. */} -
+