-
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
Support group block on mobile #17251
Merged
pinarol
merged 28 commits into
WordPress:rnmobile/master
from
callstack:rnmobile/add/group
Sep 3, 2019
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
c3fbe4c
First working version of the MediaText component for native mobile
Tug 2f26450
Fix adding a block to an innerblock list
Tug fe3cb13
Disable mediaText on production
Tug d4b30d8
MediaText native: improve editor visuals
Tug a390c7e
Move BlockToolbar from BlockList to Layout
Tug 2bc590b
Remove BlockEditorProvider from BlockList and add native version of E…
Tug 80e4e94
Update BlockMover for native to hide if locked or if it's the only block
Tug 2ef9cff
Make the vertical align button work, add more styling options for too…
Tug dff6ef7
Make sure registerCoreBlocks does not break in production
Tug c62606b
Copy docblock comment from the web version for registerCoreBlocks
Tug 201dd3e
Fix focusing on the media placeholder
Tug 7dc86a4
Only support adding image for now
Tug f6df91a
Update usage of MediaPlaceholder in MediaContainer
Tug f91fd8a
Enable autoScroll for just the out most block list
pinarol cba09ec
Merge branch 'rnmobile/master' into rnmobile/add/media-text
etoledom 4173518
Fix JS Unit tests
etoledom bb550ac
Roll back to IconButton refactor and fix tests
etoledom 7818564
Fix BlockVerticalAlignmentToolbar buttons style on mobile
etoledom dbe42d3
Fix thing for web and ensure ariaPressed is always passed down
gziolo f05d666
Use AriaPressed directly to style SVG on mobile
etoledom 7794404
Update snapshots
etoledom 021f528
Support group block on mobile
lukewalczak 443d401
Merge branch 'rnmobile/add/media-text' into rnmobile/add/group
lukewalczak 4e6e39e
Merge branch 'rnmobile/master' into rnmobile/add/group
lukewalczak d751e5c
Merge branch 'rnmobile/master' into rnmobile/add/group
lukewalczak d93f94a
Extend shouldShowInsertionPoint condition to be false when group is s…
lukewalczak 0ad701b
Code refactor
lukewalczak 470c254
Update package-lock
lukewalczak 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
48 changes: 48 additions & 0 deletions
48
packages/block-editor/src/components/button-block-appender/index.native.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,48 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { View } from 'react-native'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Button, Dashicon } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Inserter from '../inserter'; | ||
import styles from './styles.scss'; | ||
|
||
function ButtonBlockAppender( { rootClientId } ) { | ||
return ( | ||
<> | ||
<Inserter | ||
rootClientId={ rootClientId } | ||
renderToggle={ ( { onToggle, disabled, isOpen } ) => ( | ||
<Button | ||
onClick={ onToggle } | ||
aria-expanded={ isOpen } | ||
disabled={ disabled } | ||
fixedRatio={ false } | ||
> | ||
<View style={ [ styles.appender, { flex: 1 } ] }> | ||
<Dashicon | ||
icon="plus-alt" | ||
style={ styles.addBlockButton } | ||
color={ styles.addBlockButton.color } | ||
size={ styles.addBlockButton.size } | ||
/> | ||
</View> | ||
</Button> | ||
) } | ||
isAppender | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
/** | ||
* @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/button-block-appender/README.md | ||
*/ | ||
export default ButtonBlockAppender; |
17 changes: 17 additions & 0 deletions
17
packages/block-editor/src/components/button-block-appender/styles.native.scss
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,17 @@ | ||
.appender { | ||
align-items: center; | ||
justify-content: center; | ||
background-color: $gray-light; | ||
padding: 12px; | ||
background-color: $white; | ||
border: $border-width solid $light-gray-500; | ||
border-radius: 4px; | ||
} | ||
|
||
.addBlockButton { | ||
color: $white; | ||
background-color: $gray; | ||
border-radius: $icon-button-size-small / 2; | ||
overflow: hidden; | ||
size: $icon-button-size-small; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import { View } from 'react-native'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { withSelect } from '@wordpress/data'; | ||
import { compose } from '@wordpress/compose'; | ||
import { | ||
InnerBlocks, | ||
withColors, | ||
} from '@wordpress/block-editor'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './editor.scss'; | ||
|
||
function GroupEdit( { | ||
hasInnerBlocks, | ||
isSelected, | ||
} ) { | ||
if ( ! isSelected && ! hasInnerBlocks ) { | ||
return ( | ||
<View style={ styles.groupPlaceholder } /> | ||
); | ||
} | ||
|
||
return ( | ||
<InnerBlocks | ||
renderAppender={ isSelected && InnerBlocks.ButtonBlockAppender } | ||
/> | ||
); | ||
} | ||
|
||
export default compose( [ | ||
withColors( 'backgroundColor' ), | ||
withSelect( ( select, { clientId } ) => { | ||
const { | ||
getBlock, | ||
} = select( 'core/block-editor' ); | ||
|
||
const block = getBlock( clientId ); | ||
|
||
return { | ||
hasInnerBlocks: !! ( block && block.innerBlocks.length ), | ||
}; | ||
} ), | ||
] )( GroupEdit ); |
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,6 @@ | ||
.groupPlaceholder { | ||
padding: 12px; | ||
background-color: $white; | ||
border: $border-width dashed $light-gray-500; | ||
border-radius: 4px; | ||
} |
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
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.
@lukewalczak - I noticed that here
background-color
is defined two times.It's a small detail but it was giving a CI error on this PR: #17109
It's interesting that after re-running CI it now succeeded, but the issue is real. So it would be nice if we could fixe it.
I also wonder why it was catch once on another branch but it wasn't catch on this PR, and locally it also succeed 🤔
Would you mind taking a look? Thanks!
cc @pinarol
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.
Is there an option to remove redundant bg color
background-color: $gray-light;
within mentioned PR?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.
It is unclear when that PR will be merged, so it'd be better if we open a new PR to remove the redundant line. We can get the new one merged quickly.
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.
Ok, will create a PR for that.
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.
#17325