Repository navigation
Open
Description
Summary
Add a personal Editing / Viewing mode to the desktop pad. Viewing stops your own typing; the document, the chat and other people do not change. It is never the Editing lock and never access (CONTEXT.md §Document access, Viewing mode). It follows the Google Docs mode menu. There is no Suggesting mode. The two keys match Google Docs.
What the user sees
- Mode control. The first toolbar control reads "Editing ▾" (pencil icon) or "Viewing ▾" (book icon). Its menu has two
menuitemradiorows:- Editing — "Type and format. Everyone sees your changes."
- Viewing — "Typing is off for you. Others can still edit. Chat still works."
- A divider, a "Read full screen" row (Read full screen: large text, one section at a time, on the live document #614), and a help line: "⌥⇧⌘C switches to Viewing, ⌥⇧⌘Z back to Editing." On Windows and Linux it reads Ctrl+Alt+Shift+C / Z. The key text comes from
formatShortcut(Make every keyboard shortcut work on macOS and Windows, with correct hints #612).
- Viewing toolbar. Formatting hides. A quiet "Edit" button and Comment take its place, and the free space reads "Typing is off for you. Others can still edit." Discord and the right group stay. The mode control does not move.
- Shortcut. The Google Docs keys (maintainer ruling, 2026-10-25). ⌥⇧⌘C / Ctrl+Alt+Shift+C switches to Viewing. ⌥⇧⌘Z / Ctrl+Alt+Shift+Z switches to Editing.
- Typing hint. An edit key, paste or undo in Viewing shows one info toast: "Typing is off in Viewing mode. To type, select Edit or press ⌥⇧⌘Z." The key text comes from
formatShortcut. - Document menu row. "Viewing mode", a
menuitemcheckboxthat shows the shortcut. - Command jump row. "Switch to Viewing" or "Switch to Editing". The search words "view read reading typing off mode" also find it.
- Editing lock. A person under the Editing lock sees no mode control. The lock always wins.
- Still works. Chat, heading chat buttons, Comment on a selection, TOC navigation, Find, Filter, links and Copy.
- Hidden in Viewing. The first-visit line and the starter card (First-visit line and empty-document starter card #625).
- Announcements. One
role=statusregion outside.ProseMirrorsays "Viewing mode is on. Typing is off." or "Editing mode is on. You can type."
Maintainer rulings, 2026-10-25
- Everyone opens a document in Editing. Only a remembered personal choice opens it in Viewing. Visitors do not land in Viewing.
- Remember Viewing per document per device, keyed on
documentId, never the slug. - Collaborator cursors stay exactly as today in both modes.
- Desktop only. The phone keeps its own read mode (Edit / Done).
Build steps
- State. Add
padMode: 'editing' | 'viewing'toapps/webapp/src/stores/workspace.ts. Notsettings.editor.isEditable(workspace.ts:19,68), which means phone edit mode. Readdocsy:pad-mode:<documentId>on eachdocumentIdchange, desktop only. Use the try/catch shape ofreadPersistedTocWidth(apps/webapp/src/components/pages/document/hooks/useTocResize.tsx:91-108). Remove the key for Editing. If this is the first child of [Tracking] Document access, sharing and reading redesign #610 to merge, commit the four draftedCONTEXT.mdentries. - One editability rule.
apps/webapp/src/hooks/useEditorEditableState.ts:34-39setssetEditable(!locked). Make it!locked && padMode !== 'viewing', or a lock flip ends Viewing. A touch double tap (EditorContent.tsx:67) reachessetEditable(true)inapps/webapp/src/hooks/useCaretPosition.ts:120,127, gated only on the lock. Gate it on Viewing too, for desktop touch screens. - AppendHeadingButton.
apps/webapp/src/components/pages/document/components/AppendHeadingButton.tsx:78-79forces Editing on. Hide it in Viewing. - Toolbar. In
apps/webapp/src/components/TipTap/toolbar/desktop/EditorToolbar.tsx, add the mode control beforeStyleSelect(line 107). Use the houseDropdownMenuandToolbarButton. In Viewing, Edit, Comment and the line replace lines 107–285. Leave the right group (289–383) untouched. AddLuBookOpentoapps/webapp/src/components/icons/registry.ts; no book icon exists. - Skeleton. Add an Editing-shaped mode control bone to
apps/webapp/src/components/skeleton/ToolbarSkeleton.tsx. See the open decision below for a remembered Viewing pad. - Shortcut. The keys are ruled (2026-10-25): ⌥⇧⌘C / Ctrl+Alt+Shift+C for Viewing, ⌥⇧⌘Z / Ctrl+Alt+Shift+Z for Editing. Match them with
isModShortcutand itsaltoption from Make every keyboard shortcut work on macOS and Windows, with correct hints #612 (apps/webapp/src/utils/platform.ts:80-91). Itsevent.codefallback resolves Option-modified keys on a Mac. On Windows with Ctrl+Alt held, a typed character wins and the shortcut does not fire. That is the same rule as prosemirror-keymap. Do not guard ongetModifierState('AltGraph'): Firefox on Windows reports it for plain Ctrl+Alt (MDN). Ignore the key under the Editing lock. - Typing hint. A
keydownlistener on the pad wrapper (a non-editable view may not get keys). Edit keys: printable keys except Space, Enter, Backspace, Delete, and Mod+V, X, Z, Y. Block paste and drop too. Keys on links and buttons keep their meaning.Infofrom@components/toast, at most once per 3 s. Build the key text in the toast withformatShortcut. - Command jump. Add the row beside Find in
apps/webapp/src/components/commandJump/buildPlaceRows.ts, live pad only. Hide it on the phone and under the Editing lock;PlaceContexthas no lock flag yet, so pass one.PlaceRow(line 13) has no search words, andapps/webapp/src/components/commandJump/CommandJump.tsx:69matches labels only. This issue owns the new optionalkeywordsfield; Read full screen: large text, one section at a time, on the live document #614 and Title ▾ document menu with one action list for the menu and Command jump #621 reuse it. - Document menu row. The "Viewing mode" row lives in the action list of the Title ▾ document menu from Title ▾ document menu with one action list for the menu and Command jump #621. Whichever of this issue and Title ▾ document menu with one action list for the menu and Command jump #621 lands second adds it.
- Selection comment.
apps/webapp/src/components/TipTap/extensions/HeadingActions/plugins/selectionChatPlugin.ts:17needsview.hasFocus()andeditor.isEditable. First verify two things in a non-editable view. A mouse selection must updateeditor.state.selection, andview.hasFocus()must be able to be true. If both hold, relax the check to "not locked". If not, report back before Comment hides in Viewing. - TOC writes. TOC Delete section and drag still write when the editing lock is on #611 builds the TOC lock guard. Extend that guard to Viewing: hide TOC Delete section (
apps/webapp/src/components/toc/TocContextMenu.tsx:60-66) and the drag grip, and stop TOC drag (apps/webapp/src/components/toc/hooks/useTocDrag.ts:193). The other rows do not write. Share one guard with TOC Delete section and drag still write when the editing lock is on #611. - First-visit line and starter card. Hide both (First-visit line and empty-document starter card #625) in Viewing.
- Mermaid fold.
extensions/extension-mermaid/src/nodeView/fold.ts:83-84folds a diagram built non-editable. A remembered Viewing pad would fold every diagram. Passfold: { initial: 'open', remember: true }on desktop atapps/webapp/src/components/TipTap/TipTap.tsx:230. This also covers desktop readers under the Editing lock. Keep the default on the phone; the comment atTipTap.tsx:228-229says phone diagrams start folded on purpose. The extension stays unchanged. - Catalog.
.cursor/docs/design-system.md§EditorToolbar: add the mode control and Viewing rows. The skeleton rule says "the swap moves no pixel" (§State language, loading row), and the toolbar loading row (line 349) says "the swap moves no control". Record the outcome of the open decision below in the toolbar loading row. No new token.
Decisions (ruled 2026-10-25)
- Does
fold.initial: 'open'also cover desktop readers under the Editing lock? Yes. One desktop config has no timing risk. The phone keeps its folded start. - Does the shortcut show a toast under the Editing lock? No, ignore it. The design text "Read-only. Only the owner can edit." is wrong for a sync-error lock.
- Which keys switch the mode? The Google Docs keys: ⌥⇧⌘C / Ctrl+Alt+Shift+C for Viewing, ⌥⇧⌘Z / Ctrl+Alt+Shift+Z for Editing (Google Docs shortcuts). They replace the design's ⌥⌘E / Ctrl+Alt+E, which clashes on both platforms (Make every keyboard shortcut work on macOS and Windows, with correct hints #612). Every hint, menu row and Command jump row uses the new keys.
Decisions added by the review (ruled 2026-10-25)
- A remembered Viewing pad shifts the toolbar once at S1. Ruled: accept it as a recorded exception to "the swap moves no pixel". The S0 skeleton cannot read
localStorage, and no server-side read of a per-device choice exists.
Out of scope
- Read full screen (Read full screen: large text, one section at a time, on the live document #614).
- The phone read mode.
- TOC writes under the Editing lock (TOC Delete section and drag still write when the editing lock is on #611).
- Follow the presenter.
Checks
- Browser at 1280px or wider, light, dark and dark-HC: switch by control, menu, Command jump and shortcut.
- A reload and a renamed link keep Viewing.
- A lock flip under Viewing stays in Viewing.
- A Read-only non-owner sees no mode control.
- Typing, paste and Mod+Z in Viewing show the hint and change nothing.
- In Viewing, TOC Delete section and drag are gone, and the first-visit line and starter card hide.
- Mermaid opens unfolded in Viewing.
- Skeleton geometry at S0 and S1.
- Test: one Cypress E2E, "a lock flip must not end Viewing". Prove it by sabotage: remove the
padModeterm from step 2 and watch it fail.
Depends on
- Make every keyboard shortcut work on macOS and Windows, with correct hints #612 for the
altoption onisModShortcutand forformatShortcut. - Soft: TOC Delete section and drag still write when the editing lock is on #611 for the TOC lock guard that step 11 extends, and First-visit line and empty-document starter card #625 for the first-visit line and starter card that step 12 hides.
- Title ▾ document menu with one action list for the menu and Command jump #621 for the document menu row only.
Activity
HMarzban commentedon Oct 25, 2026
Maintainer ruling, 2026-10-25
The maintainer accepted every remaining recommended answer ("all picks").
fold.initial: 'open'also covers desktop readers under the Editing lock: yes. The phone keeps its folded start.HMarzban commentedon Oct 25, 2026
Maintainer ruling, 2026-10-25
Open decision 1: accept the one-time toolbar shift for a remembered Viewing pad, as a recorded exception to "the swap moves no pixel". The S0 skeleton cannot read
localStorage, and no server-side read of a per-device choice exists. A later change should not treat this shift as a skeleton regression.