-
Notifications
You must be signed in to change notification settings - Fork 10
Refactor toolbar and sidebar logic for editor compatibility #6105
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
Removed hardcoded toolbar button positioning and related CSS for improved compatibility with both classic and site editors. Introduced a helper to open the block sidebar in either editor, updating inspector sidebar logic to use this abstraction.
WalkthroughThree files modified to address FSE toolbar and sidebar issues: toolbar styling simplified by removing absolute positioning adjustments, toolbar initialization cleaned up by removing site-editor-specific layout calculations, and inspector sidebar opening abstracted to handle environment-aware dispatch calls (FSE vs. Classic Editor). Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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 |
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: 0
🧹 Nitpick comments (1)
src/extensions/inspector/inspectorPath.js (1)
53-62: Consider adding error handling to the Promise chain.If
openBlockSidebar()or subsequent dispatches fail, the rejection is unhandled. A.catch()at the end would improve resilience:export const openSidebarAccordion = (tab, accordionName, targetSelector) => { openBlockSidebar() .then(() => dispatch('maxiBlocks').updateInspectorPath({ depth: 0, value: tab, }) ) - .then(() => openSidebar(accordionName, targetSelector)); + .then(() => openSidebar(accordionName, targetSelector)) + .catch(error => console.error('Failed to open sidebar accordion:', error)); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/editor/toolbar-buttons/editor.scss(1 hunks)src/editor/toolbar-buttons/index.js(0 hunks)src/extensions/inspector/inspectorPath.js(4 hunks)
💤 Files with no reviewable changes (1)
- src/editor/toolbar-buttons/index.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: e2e-js-playwright
- GitHub Check: e2e-js
- GitHub Check: unit-js
🔇 Additional comments (3)
src/editor/toolbar-buttons/editor.scss (1)
55-60: LGTM! Clean approach to handle toolbar expansion in both editors.The separate handling for FSE-specific selectors alongside the existing classic editor rule (line 33-35) provides proper coverage. The selectors align with WordPress's current FSE toolbar structure.
src/extensions/inspector/inspectorPath.js (2)
64-84: Changes look correct; same error handling consideration applies.The refactoring properly uses the new
openBlockSidebar()helper. The same.catch()pattern suggested above would benefit this function as well.
28-43: Well-structured environment abstraction with correctly implemented sidebar integration.The helper cleanly encapsulates editor-specific sidebar logic. WordPress's
core/edit-sitestore supports theopenGeneralSidebaraction, and both sidebar identifiers ('edit-site/block-inspector'and'edit-post/block') are actively used throughout the codebase. ThegetIsSiteEditor()function is properly imported from@extensions/fseand used consistently. The Promise-based return pattern is correct per WordPress dispatch conventions.
Removed hardcoded toolbar button positioning and related CSS for improved compatibility with both classic and site editors. Introduced a helper to open the block sidebar in either editor, updating inspector sidebar logic to use this abstraction.
fixes #6103
Summary by CodeRabbit
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.