-
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
Bootstrap the sections exploded view #40314
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4e28035
Bootstrap the sections exploded view
youknowriad 5d105d6
Add logic to disable exploded mode if there's only one root block
youknowriad 2b55c24
Extract exploded view component and add block selection
youknowriad c82fe8e
Add exploded view toolbar
youknowriad a600fd3
Add double click to exit exploded mode
youknowriad 2147e47
Add onFocus handler
youknowriad e0b38c3
Space things properly for locked items
youknowriad 905a705
Close the list view when opening the exploded view
youknowriad ed09924
ADd block lock toolbar
youknowriad 0d996d3
Add hover style
youknowriad 61d74b5
Aff focus on select
youknowriad 4e9395f
Toolbar styling
jameskoster d902a59
Make the inserter blue
youknowriad 030a5c6
Add inserter at the end
youknowriad 9dd0a55
Show patterns in all inserters
youknowriad e05433f
Clarify intent of event.detail using booleans
youknowriad 109b5fc
Fix the width of the exploded view
youknowriad 2a9f512
Better scaling
youknowriad 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 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 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 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 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
24 changes: 0 additions & 24 deletions
24
packages/block-editor/src/components/block-preview/live.js
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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
4 changes: 4 additions & 0 deletions
4
packages/edit-site/src/components/block-list-exploded/README.md
This file contains 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,4 @@ | ||
## BlockListExploded Component | ||
|
||
This is an experimental component being built to implement the exploded view in the site editor. | ||
The potential goal for this component is to be a component that can be used by any block editor, so it's important to keep its dependencies minimal. (block-editor dependencies). Eventually, it should be moved to the `@wordpress/block-editor` package. |
37 changes: 37 additions & 0 deletions
37
packages/edit-site/src/components/block-list-exploded/index.js
This file contains 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,37 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { store as blockEditorStore, Inserter } from '@wordpress/block-editor'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { pure } from '@wordpress/compose'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockListExplodedItem from './item'; | ||
|
||
const InserterBeforeBlock = pure( ( { clientId } ) => ( | ||
<div className="edit-site-block-list-exploded__inserter" key={ clientId }> | ||
<Inserter clientId={ clientId } __experimentalIsQuick isPrimary /> | ||
</div> | ||
) ); | ||
|
||
function BlockListExploded() { | ||
const blockOrder = useSelect( ( select ) => { | ||
return select( blockEditorStore ).getBlockOrder(); | ||
}, [] ); | ||
|
||
return ( | ||
<div className="edit-site-block-list-exploded"> | ||
{ blockOrder.map( ( clientId ) => ( | ||
<div key={ clientId }> | ||
<InserterBeforeBlock clientId={ clientId } /> | ||
<BlockListExplodedItem clientId={ clientId } /> | ||
</div> | ||
) ) } | ||
<InserterBeforeBlock /> | ||
</div> | ||
); | ||
} | ||
|
||
export default BlockListExploded; |
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.
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.
I didn't know we had this HoC. Should I prefer using this over
React.memo
?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.
To be honest at this point, I don't know. What's certain is that we need to make a decision :P. This HoC was here before React introduced React.memo and if I'm not wrong also works for Class component contrary to React.memo which I think is only suited for function components.
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.
Right, React.memo works only with functional components.
Got it. Use
React.memo
with function components usepure
with Class components 😄