-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Global Styles: Add Style Book to Global Styles #45960
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a26d321
Add Style Book
noisysocks 4bb1790
Disable toolbar butons when Style Book is open
noisysocks 2db814c
Disable Style Book when in Code Editor mode
noisysocks 7b3e1c1
Make cursor a hand when hovering an example
noisysocks 071f55c
Remove top and bottom margin from block inside preview
noisysocks 7f22f7e
Add border beneath tab bar, make tab bar scroll on mobile
noisysocks b619e31
Improve performance
noisysocks e17b70b
Improve a11y
noisysocks 1c05a83
Add E2E tests
noisysocks 016e2d2
Make example titles uppercase
noisysocks 27d39b5
Hide toolbar when Style Book is open
noisysocks d389335
Make tabs always have white background
noisysocks a42064c
Update tests
noisysocks cf6d6f2
Add a little note of encouragement for future developers
noisysocks 3239fb0
Add border radius to Story Book
noisysocks c6d94f9
Fix vertical alignment of close button
noisysocks 18c601c
Reduce font size and increase font weight of example labels
noisysocks ae3f5af
Remove hover outline
noisysocks 47305ff
Use theme color for text instead of white or black
noisysocks b882088
Use math.div()
noisysocks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
packages/edit-site/src/components/block-editor/editor-canvas.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { | ||
| __experimentalUseResizeCanvas as useResizeCanvas, | ||
| __unstableEditorStyles as EditorStyles, | ||
| __unstableIframe as Iframe, | ||
| __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset, | ||
| store as blockEditorStore, | ||
| } from '@wordpress/block-editor'; | ||
| import { useSelect } from '@wordpress/data'; | ||
|
|
||
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import { store as editSiteStore } from '../../store'; | ||
|
|
||
| function EditorCanvas( { enableResizing, settings, children, ...props } ) { | ||
| const { deviceType, isZoomOutMode } = useSelect( | ||
| ( select ) => ( { | ||
| deviceType: | ||
| select( editSiteStore ).__experimentalGetPreviewDeviceType(), | ||
| isZoomOutMode: | ||
| select( blockEditorStore ).__unstableGetEditorMode() === | ||
| 'zoom-out', | ||
| } ), | ||
| [] | ||
| ); | ||
| const deviceStyles = useResizeCanvas( deviceType ); | ||
| const mouseMoveTypingRef = useMouseMoveTypingReset(); | ||
| return ( | ||
| <Iframe | ||
| scale={ ( isZoomOutMode && 0.45 ) || undefined } | ||
| frameSize={ isZoomOutMode ? 100 : undefined } | ||
| style={ enableResizing ? {} : deviceStyles } | ||
| head={ | ||
| <> | ||
| <EditorStyles styles={ settings.styles } /> | ||
| <style>{ | ||
| // Forming a "block formatting context" to prevent margin collapsing. | ||
| // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context | ||
| `.is-root-container { display: flow-root; } | ||
| body { position: relative; }` | ||
| }</style> | ||
| { enableResizing && ( | ||
| <style> | ||
| { | ||
| // Some themes will have `min-height: 100vh` for the root container, | ||
| // which isn't a requirement in auto resize mode. | ||
| `.is-root-container { min-height: 0 !important; }` | ||
| } | ||
| </style> | ||
| ) } | ||
| </> | ||
| } | ||
| assets={ settings.__unstableResolvedAssets } | ||
| ref={ mouseMoveTypingRef } | ||
| name="editor-canvas" | ||
| className="edit-site-visual-editor__editor-canvas" | ||
| { ...props } | ||
| > | ||
| { /* Filters need to be rendered before children to avoid Safari rendering issues. */ } | ||
| { settings.svgFilters } | ||
| { children } | ||
| </Iframe> | ||
| ); | ||
| } | ||
|
|
||
| export default EditorCanvas; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.