-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Simplify the inserter styles and scrollable #44088
Merged
Merged
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions
44
packages/block-editor/src/components/inserter/stories/fixtures.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,44 @@ | ||
export const patterns = [ | ||
{ | ||
categories: [ 'featured', 'text' ], | ||
content: | ||
'<!-- wp:heading {"align":"wide","style":{"typography":{"fontSize":"48px","lineHeight":"1.1"}}} -->\n<h2 class="alignwide" id="we-re-a-studio-in-berlin-with-an-international-practice-in-architecture-urban-planning-and-interior-design-we-believe-in-sharing-knowledge-and-promoting-dialogue-to-increase-the-creative-potential-of-collaboration" style="font-size:48px;line-height:1.1">We\'re a studio in Berlin with an international practice in architecture, urban planning and interior design. We believe in sharing knowledge and promoting dialogue to increase the creative potential of collaboration.</h2>\n<!-- /wp:heading -->', | ||
description: 'Heading text', | ||
keywords: [ 'large text', 'title' ], | ||
name: 'heading', | ||
title: 'Heading', | ||
}, | ||
]; | ||
|
||
export const patternCategories = [ | ||
{ | ||
name: 'featured', | ||
label: 'Featured', | ||
}, | ||
{ | ||
name: 'text', | ||
label: 'Text', | ||
}, | ||
]; | ||
|
||
export const reusableBlocks = [ | ||
{ | ||
content: { | ||
raw: '\x3C!-- wp:paragraph -->\n<p>This is reusable</p>\n\x3C!-- /wp:paragraph -->', | ||
protected: false, | ||
block_version: 1, | ||
}, | ||
date: '2022-09-12T13:28:06', | ||
date_gmt: '2022-09-12T13:28:06', | ||
id: 70, | ||
link: 'http://localhost:8888/?p=70', | ||
modified: '2022-09-12T13:28:06', | ||
modified_gmt: '2022-09-12T13:28:06', | ||
password: '', | ||
slug: 'simple-paragraph', | ||
status: 'publish', | ||
template: '', | ||
title: { raw: 'Simple paragraph' }, | ||
type: 'wp_block', | ||
}, | ||
]; |
90 changes: 90 additions & 0 deletions
90
packages/block-editor/src/components/inserter/stories/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,90 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockLibrary from '../library'; | ||
import BlockEditorProvider from '../../provider'; | ||
import { patternCategories, patterns, reusableBlocks } from './fixtures'; | ||
import Inserter from '../'; | ||
|
||
export default { title: 'BlockEditor/Inserter' }; | ||
|
||
export const libraryWithoutPatterns = () => { | ||
const wrapperStyle = { | ||
margin: '24px', | ||
height: 400, | ||
border: '1px solid #f3f3f3', | ||
display: 'inline-block', | ||
}; | ||
return ( | ||
<BlockEditorProvider> | ||
<div style={ wrapperStyle }> | ||
<BlockLibrary showInserterHelpPanel /> | ||
</div> | ||
</BlockEditorProvider> | ||
); | ||
}; | ||
|
||
export const libraryWithPatterns = () => { | ||
const wrapperStyle = { | ||
margin: '24px', | ||
height: 400, | ||
border: '1px solid #f3f3f3', | ||
display: 'inline-block', | ||
}; | ||
return ( | ||
<BlockEditorProvider | ||
settings={ { | ||
__experimentalBlockPatternCategories: patternCategories, | ||
__experimentalBlockPatterns: patterns, | ||
} } | ||
> | ||
<div style={ wrapperStyle }> | ||
<BlockLibrary showInserterHelpPanel /> | ||
</div> | ||
</BlockEditorProvider> | ||
); | ||
}; | ||
|
||
export const libraryWithPatternsAndReusableBlocks = () => { | ||
const wrapperStyle = { | ||
margin: '24px', | ||
height: 400, | ||
border: '1px solid #f3f3f3', | ||
display: 'inline-block', | ||
}; | ||
return ( | ||
<BlockEditorProvider | ||
settings={ { | ||
__experimentalBlockPatternCategories: patternCategories, | ||
__experimentalBlockPatterns: patterns, | ||
__experimentalReusableBlocks: reusableBlocks, | ||
} } | ||
> | ||
<div style={ wrapperStyle }> | ||
<BlockLibrary showInserterHelpPanel /> | ||
</div> | ||
</BlockEditorProvider> | ||
); | ||
}; | ||
|
||
export const quickInserter = () => { | ||
const wrapperStyle = { | ||
margin: '24px', | ||
height: 400, | ||
border: '1px solid #f3f3f3', | ||
display: 'inline-block', | ||
}; | ||
return ( | ||
<BlockEditorProvider | ||
settings={ { | ||
__experimentalBlockPatternCategories: patternCategories, | ||
__experimentalBlockPatterns: patterns, | ||
__experimentalReusableBlocks: reusableBlocks, | ||
} } | ||
> | ||
<div style={ wrapperStyle }> | ||
<Inserter __experimentalIsQuick /> | ||
</div> | ||
</BlockEditorProvider> | ||
); | ||
}; |
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
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.
Looks temporary? 🤔
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.
This is in the storybook story, it's not important, I just copied my own reusable blocks :P