-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/WordPress/gutenberg into …
…rnmobile/open-video-by-browser-for-android * 'master' of https://github.com/WordPress/gutenberg: (34 commits) [RNMobile] Native mobile release v1.7.0 (#16156) Scripts: Document and simplify changing file entry and output of build scripts (#15982) Block library: Refactor Heading block to use class names for text align (#16035) Make calendar block resilient against editor module not being present (#16161) Bump plugin version to 5.9.1 Editor: Fix the issue where statics for deprecated components were not hoisted (#16152) Build Tooling: Use "full" `npm install` for Build Artifacts Travis task (#16166) Scripts: Fix naming conventions for function containing CLI keyword (#16091) Add native support for Inserter (Ported from gutenberg-mobile) (#16114) docs(components/higher-order/with-spoken-messages): fix issue in example code (#16144) docs(components/with-focus-return): fix typo in README.md (#16143) docs(block-editor/components/inspector-controls): fix image path in README.md (#16145) Add mention of on Figma to CONTRIBUTING.md (#16140) Bring greater consistency to placeholder text for media blocks. (#16135) Add descriptive text and a link to embed documentation in embed blocks (#16101) Update toolbar-text.png (#16102) Updating changelogs for the Gutenberg 5.9 packages release chore(release): publish [RNMobile] Fix pasting text on Post Title (#16116) Bump plugin version to 5.9.0 ... # Conflicts: # packages/block-library/src/video/video-player.android.js
- Loading branch information
Showing
137 changed files
with
813 additions
and
263 deletions.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## Master | ||
## 2.2.0 (2019-06-12) | ||
|
||
### Internal | ||
|
||
|
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
96 changes: 96 additions & 0 deletions
96
packages/block-editor/src/components/inserter/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,96 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { FlatList, Text, TouchableHighlight, View } from 'react-native'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { BottomSheet, Icon } from '@wordpress/components'; | ||
import { Component } from '@wordpress/element'; | ||
import { withSelect } from '@wordpress/data'; | ||
import { compose } from '@wordpress/compose'; | ||
import { getUnregisteredTypeHandlerName } from '@wordpress/blocks'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './style.scss'; | ||
|
||
class Inserter extends Component { | ||
calculateNumberOfColumns() { | ||
const bottomSheetWidth = BottomSheet.getWidth(); | ||
const { paddingLeft: itemPaddingLeft, paddingRight: itemPaddingRight } = styles.modalItem; | ||
const { paddingLeft: containerPaddingLeft, paddingRight: containerPaddingRight } = styles.content; | ||
const { width: itemWidth } = styles.modalIconWrapper; | ||
const itemTotalWidth = itemWidth + itemPaddingLeft + itemPaddingRight; | ||
const containerTotalWidth = bottomSheetWidth - ( containerPaddingLeft + containerPaddingRight ); | ||
return Math.floor( containerTotalWidth / itemTotalWidth ); | ||
} | ||
|
||
render() { | ||
const numberOfColumns = this.calculateNumberOfColumns(); | ||
const bottomPadding = this.props.addExtraBottomPadding && styles.contentBottomPadding; | ||
|
||
return ( | ||
<BottomSheet | ||
isVisible={ true } | ||
onClose={ this.props.onDismiss } | ||
contentStyle={ [ styles.content, bottomPadding ] } | ||
hideHeader | ||
> | ||
<FlatList | ||
scrollEnabled={ false } | ||
key={ `InserterUI-${ numberOfColumns }` } //re-render when numberOfColumns changes | ||
keyboardShouldPersistTaps="always" | ||
numColumns={ numberOfColumns } | ||
data={ this.props.items } | ||
ItemSeparatorComponent={ () => | ||
<View style={ styles.rowSeparator } /> | ||
} | ||
keyExtractor={ ( item ) => item.name } | ||
renderItem={ ( { item } ) => | ||
<TouchableHighlight | ||
style={ styles.touchableArea } | ||
underlayColor="transparent" | ||
activeOpacity={ .5 } | ||
accessibilityLabel={ item.title } | ||
onPress={ () => this.props.onValueSelected( item.name ) }> | ||
<View style={ styles.modalItem }> | ||
<View style={ styles.modalIconWrapper }> | ||
<View style={ styles.modalIcon }> | ||
<Icon icon={ item.icon.src } fill={ styles.modalIcon.fill } size={ styles.modalIcon.width } /> | ||
</View> | ||
</View> | ||
<Text style={ styles.modalItemLabel }>{ item.title }</Text> | ||
</View> | ||
</TouchableHighlight> | ||
} | ||
/> | ||
</BottomSheet> | ||
); | ||
} | ||
} | ||
|
||
export default compose( [ | ||
withSelect( ( select, { clientId, isAppender, rootClientId } ) => { | ||
const { | ||
getInserterItems, | ||
getBlockRootClientId, | ||
getBlockSelectionEnd, | ||
} = select( 'core/block-editor' ); | ||
|
||
let destinationRootClientId = rootClientId; | ||
if ( ! destinationRootClientId && ! clientId && ! isAppender ) { | ||
const end = getBlockSelectionEnd(); | ||
if ( end ) { | ||
destinationRootClientId = getBlockRootClientId( end ) || undefined; | ||
} | ||
} | ||
const inserterItems = getInserterItems( destinationRootClientId ); | ||
|
||
return { | ||
items: inserterItems.filter( ( { name } ) => name !== getUnregisteredTypeHandlerName() ), | ||
}; | ||
} ), | ||
] )( Inserter ); |
57 changes: 57 additions & 0 deletions
57
packages/block-editor/src/components/inserter/style.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,57 @@ | ||
/** @format */ | ||
|
||
.touchableArea { | ||
border-radius: 8px 8px 8px 8px; | ||
} | ||
|
||
.content { | ||
padding: 0 0 0 0; | ||
align-items: center; | ||
justify-content: space-evenly; | ||
} | ||
|
||
.contentBottomPadding { | ||
padding-bottom: 20px; | ||
} | ||
|
||
.rowSeparator { | ||
height: 12px; | ||
} | ||
|
||
.modalItem { | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
padding-left: 8; | ||
padding-right: 8; | ||
padding-top: 0; | ||
padding-bottom: 0; | ||
} | ||
|
||
.modalIconWrapper { | ||
width: 104px; | ||
height: 64px; | ||
background-color: $gray-light; //#f3f6f8 | ||
border-radius: 8px 8px 8px 8px; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.modalIcon { | ||
width: 32px; | ||
height: 32px; | ||
justify-content: center; | ||
align-items: center; | ||
fill: $gray-dark; | ||
} | ||
|
||
.modalItemLabel { | ||
background-color: transparent; | ||
padding-left: 2; | ||
padding-right: 2; | ||
padding-top: 4; | ||
padding-bottom: 0; | ||
justify-content: center; | ||
font-size: 12; | ||
color: $gray-dark; | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/block-editor/src/components/inspector-controls/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
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
Oops, something went wrong.