-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Hide add note in distraction free mode #72835
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
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@dhruvang21 looks like a merge conflict, if you could take a look and resolve that would be lovely, thanks! |
2226aff to
dd0ee06
Compare
|
@jeffpaul Rebased |
t-hamano
left a 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.
Thanks for the PR!
In the Distraction Free mode, the NoteSidebar itself component doesn't need to render anything at all. Therefore, this should be handled in the parent NotesSidebarContainer component, like this:
export default function NotesSidebarContainer() {
const { postId, mode, editorMode, isDistractionFree } = useSelect(
( select ) => {
const { getCurrentPostId, getRenderingMode, getEditorMode } =
select( editorStore );
const { getSettings } = select( blockEditorStore );
return {
postId: getCurrentPostId(),
mode: getRenderingMode(),
editorMode: getEditorMode(),
isDistractionFree: getSettings().isDistractionFree,
};
},
[]
);
if ( ! postId || typeof postId !== 'number' || isDistractionFree ) {
return null;
}
// Hide Notes sidebar in Code Editor mode since block-level commenting.
if ( editorMode === 'text' ) {
return null;
}
return (
<PostTypeSupportCheck supportKeys="editor.notes">
<NotesSidebar postId={ postId } mode={ mode } />
</PostTypeSupportCheck>
);
}dd0ee06 to
44098cd
Compare
|
@t-hamano updated code as per your suggestion |
|
@dhruvang21 Can you remove the |
|
@t-hamano Done |
t-hamano
left a 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.
LGTM 👍
* Hide add note in distraction free mode * refactor: NotesSidebarContainer component code * refactor: remove condition from NotesSidebar component Co-authored-by: dhruvang21 <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: jeffpaul <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: adamsilverstein <[email protected]> Co-authored-by: karthick-murugan <[email protected]>
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: 41863b5 |
* Revert "Hide add note in distraction free mode (#72835)" This reverts commit a2f779c. * Notes: Disable "Add note" button in Distraction free mode Co-authored-by: t-hamano <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: jeffpaul <[email protected]>
* Revert "Hide add note in distraction free mode (#72835)" This reverts commit a2f779c. * Notes: Disable "Add note" button in Distraction free mode Co-authored-by: t-hamano <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: jeffpaul <[email protected]>
What?
Closes #72824
Why?
When working in Distraction-Free Mode, the Add Notes option in the Block Toolbar does not display the New Note form or trigger any visible action.
How?
Visually hide the Add note button
Testing Instructions
Screenshots or screencast
Pages.gutenberg.WordPress.mp4