-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Display the DocumentBar for Style Book and Style Revisions #62669
Changes from all commits
06e98fc
0a86365
7995a01
9098e74
737675c
b7f8c68
b7daae2
34f67d9
cc21af0
e4455b5
759d242
4000088
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor'; | |
*/ | ||
import { store as editSiteStore } from '../../store'; | ||
import { unlock } from '../../lock-unlock'; | ||
import { useHasEditorCanvasContainer } from '../../components/editor-canvas-container'; | ||
|
||
const { useCommandContext } = unlock( commandsPrivateApis ); | ||
|
||
|
@@ -25,6 +26,9 @@ export default function useSetCommandContext() { | |
hasBlockSelected: getBlockSelectionStart(), | ||
}; | ||
}, [] ); | ||
|
||
const hasEditorCanvasContainer = useHasEditorCanvasContainer(); | ||
|
||
// Sets the right context for the command palette | ||
let commandContext = 'site-editor'; | ||
if ( canvasMode === 'edit' ) { | ||
|
@@ -33,5 +37,13 @@ export default function useSetCommandContext() { | |
if ( hasBlockSelected ) { | ||
commandContext = 'block-selection-edit'; | ||
} | ||
if ( hasEditorCanvasContainer ) { | ||
/* | ||
* The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context | ||
* to remove the suggested commands that may not make sense with Style Book or Style Revisions open. | ||
* See https://github.com/WordPress/gutenberg/issues/62216. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, in the future we'd have something like Anyhoo, I'm going to try to shuffle some things around and start looking at that issue after 6.6. When the time comes, it'd be great to your feedback on the possible approaches 🙇🏻 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think a new command context would be needed. Presumably if opening Style Book was changing the currently edited entity to a For example, in the case of the suggested pattern commands I was manually checking before, the post type is no longer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, for sure! Putting together this PR was a great crash course on understanding the current relationship between the |
||
*/ | ||
commandContext = ''; | ||
} | ||
useCommandContext( commandContext ); | ||
} |
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.
Using the
! hasDefaultEditorCanvasView
check here causes theDocumentBar
title/icon to flash back and forth between the document and overlay titles when activating the Style Book in addition to Style Revisions and vice versa.Since the default title and icon are empty strings and the return value of
getEditorCanvasContainerTitleAndIcon
is directly tied the canvas container state, the check isn't really needed.