Add shared docs toolbar and read-only mode#84
Conversation
Shared docs were missing the formatting toolbar entirely. This adds the toolbar for editor-role users and implements read-only mode for viewer-role users: - Skip TextEditor creation in read-only mode (no cursor, no input) - Skip Ruler mouse handlers in read-only mode (no margin/indent drag) - Show formatting toolbar in shared docs for non-read-only users - Change canvas cursor from text to default in read-only mode Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request adds read-only mode support to the document editor. The Changes
Sequence DiagramsequenceDiagram
participant User
participant SharedDocsLayout
participant DocsView
participant Editor as Editor.initialize()
participant Ruler
User->>SharedDocsLayout: Render with share role
activate SharedDocsLayout
Note over SharedDocsLayout: Determine readOnly<br/>based on share role
SharedDocsLayout->>DocsView: Pass readOnly prop
activate DocsView
DocsView->>Editor: initialize(container, store, theme, readOnly)
activate Editor
alt readOnly = true
Editor->>Editor: Set cursor to 'default'<br/>Set textEditor = null<br/>Set focused = false
Editor->>Ruler: new Ruler(container, canvas, true)
activate Ruler
Note over Ruler: Skip mouse event<br/>handler registration
deactivate Ruler
Note over Editor: Skip TextEditor<br/>creation & wiring
else readOnly = false
Editor->>Editor: Set cursor to 'text'<br/>Create TextEditor
Editor->>Ruler: new Ruler(container, canvas, false)
activate Ruler
Note over Ruler: Register mouse<br/>event handlers
deactivate Ruler
Note over Editor: Wire focus/blur<br/>Start cursor blink
end
Editor-->>DocsView: Return EditorAPI
deactivate Editor
DocsView-->>SharedDocsLayout: Emit onEditorReady
deactivate DocsView
SharedDocsLayout->>SharedDocsLayout: Store editor instance
alt Share role ≠ viewer
SharedDocsLayout->>DocsFormattingToolbar: Render with editor
activate DocsFormattingToolbar
deactivate DocsFormattingToolbar
else Share role = viewer
Note over SharedDocsLayout: DocsFormattingToolbar<br/>not rendered
end
deactivate SharedDocsLayout
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Verification: verify:selfResult: ✅ PASS in 105.8s
Verification: verify:integrationResult: ✅ PASS |
Remove unused lineX parameter from renderListMarker, remove unused imports, and add missing textIndent/marginLeft fields to BlockStyle test fixtures. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace pattern-tiling with Google Sheets-style OLS (Ordinary Least Squares) regression for numeric cell autofill. When 2+ numeric cells exist along the fill axis, compute y = mx + b and extrapolate the trend. Mixed content (formulas, text, empty) falls back to existing tiling behavior. Use single-fraction computation with toPrecision(15) to minimize IEEE 754 floating-point drift, matching Excel/Google Sheets precision. Also fix docs package build and frontend test failures introduced by PR #83/#84: refactor TypeScript parameter properties and const enum unsupported by Node's --experimental-strip-types, remove unused parameters/imports, and add missing BlockStyle fields in test fixtures. Co-authored-by: Claude Opus 4.6 <[email protected]>
Summary
defaultinstead oftextTest plan
/d/:id) still works normally🤖 Generated with Claude Code
Summary by CodeRabbit