-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[PE-155] chore: floating toolbar for pages #6482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request introduces a new Changes
Sequence DiagramsequenceDiagram
participant Editor as CollaborativeDocumentEditor
participant Renderer as PageRenderer
participant Menu as EditorBubbleMenu
Editor->>Renderer: Pass bubbleMenuEnabled prop
alt bubbleMenuEnabled is true
Renderer->>Menu: Render EditorBubbleMenu
else bubbleMenuEnabled is false
Renderer-->>Menu: Skip rendering
end
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
web/core/hooks/use-page-filters.ts (1)
93-104: Fix JSDoc description for handleStickyToolbar.The JSDoc comment incorrectly states it updates
full_widthvalue instead ofsticky_toolbar.- * @description action to update full_width value + * @description action to update sticky_toolbar valuepackages/editor/src/core/components/editors/document/collaborative-editor.tsx (1)
79-83: Consider maintaining consistent prop ordering.For better readability and maintainability, consider grouping related props together. The
bubbleMenuEnabledprop could be grouped with other display-related props likedisplayConfig.<PageRenderer aiHandler={aiHandler} - bubbleMenuEnabled={bubbleMenuEnabled} - displayConfig={displayConfig} + displayConfig={displayConfig} + bubbleMenuEnabled={bubbleMenuEnabled} editor={editor} editorContainerClassName={editorContainerClassNames}packages/editor/src/core/components/editors/document/page-renderer.tsx (1)
144-150: Consider optimizing the menu wrapper structure.The additional
divwrapper around BlockMenu and AIFeaturesMenu might be unnecessary. Consider simplifying the structure:{editor.isEditable && ( <> {bubbleMenuEnabled && <EditorBubbleMenu editor={editor} />} - <div> <BlockMenu editor={editor} /> <AIFeaturesMenu menu={aiHandler?.menu} /> - </div> </> )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
packages/editor/src/core/components/editors/document/collaborative-editor.tsx(2 hunks)packages/editor/src/core/components/editors/document/page-renderer.tsx(3 hunks)packages/editor/src/core/components/editors/document/read-only-editor.tsx(1 hunks)packages/editor/src/core/types/editor.ts(1 hunks)web/core/components/pages/dropdowns/actions.tsx(1 hunks)web/core/components/pages/editor/header/options-dropdown.tsx(4 hunks)web/core/components/pages/editor/header/root.tsx(2 hunks)web/core/hooks/use-page-filters.ts(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (8)
web/core/hooks/use-page-filters.ts (1)
32-38: LGTM! Well-implemented memoization.The memoization is correctly implemented with proper dependency tracking and fallback handling.
web/core/components/pages/editor/header/root.tsx (1)
51-53: LGTM! Robust conditional rendering.The PageToolbar rendering logic includes all necessary checks in the correct order, ensuring a stable and predictable behavior.
packages/editor/src/core/components/editors/document/read-only-editor.tsx (1)
72-72: LGTM! Appropriate bubble menu handling for read-only mode.Correctly disables the bubble menu in read-only context, maintaining consistent behavior.
web/core/components/pages/editor/header/options-dropdown.tsx (3)
52-62: LGTM! Well-structured menu option implementation.The sticky toolbar menu option follows the established pattern and properly integrates with the ToggleSwitch component.
116-116: LGTM! Logical placement in options order.The sticky-toolbar option is appropriately placed alongside other view-related options.
35-35: Verify the implementation of usePageFilters hook.The hook returns new properties for sticky toolbar management. Let's verify their implementation.
✅ Verification successful
Sticky toolbar functionality is properly implemented in usePageFilters hook
The hook correctly implements sticky toolbar state management with proper memoization and localStorage persistence.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for the usePageFilters hook implementation ast-grep --pattern 'export const usePageFilters = () => { $$$ return { $$$ isStickyToolbarEnabled, handleStickyToolbar, $$$ } }'Length of output: 6296
packages/editor/src/core/types/editor.ts (1)
142-143: LGTM! Good type safety improvements.The changes improve type safety by:
- Making
editableexplicit- Adding
bubbleMenuEnabledas an optional property for backward compatibilityweb/core/components/pages/dropdowns/actions.tsx (1)
39-39: LGTM! Non-breaking type extension.The addition of "sticky-toolbar" to TPageActions is properly implemented as a non-breaking change.
|
|
||
| type IPageRenderer = { | ||
| aiHandler?: TAIHandler; | ||
| bubbleMenuEnabled: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making bubbleMenuEnabled optional.
Making bubbleMenuEnabled a required property could break existing implementations. Consider making it optional with a default value to ensure backward compatibility.
- bubbleMenuEnabled: boolean;
+ bubbleMenuEnabled?: boolean;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| bubbleMenuEnabled: boolean; | |
| bubbleMenuEnabled?: boolean; |
Description
This PR includes-
Sticky toolbaroption for Pages.Type of Change
Screenshots and Media (if applicable)
Screen.Recording.2025-01-28.at.13.53.07.mov
Summary by CodeRabbit
Release Notes
New Features
Improvements
Changes