Skip to content
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

Slot/Fill pattern with Toolbar #199 #11115

Merged
merged 27 commits into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ec171db
Added support for native toolbar component
marecar3 Oct 25, 2018
2b21b1a
Merge branch 'master' into feature/native-toolbar-component
marecar3 Oct 26, 2018
ecf5da5
Expose BlockEdit to native
marecar3 Oct 31, 2018
8b4d948
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Oct 31, 2018
8bf0d06
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 1, 2018
07646aa
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 1, 2018
1449764
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 1, 2018
237c9c7
Removed isSelected
marecar3 Nov 1, 2018
bf4fa94
Removed style from paragraph
marecar3 Nov 1, 2018
e52c994
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 1, 2018
7f49f78
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 1, 2018
5c26071
Fixed lint tests
marecar3 Nov 1, 2018
4f40a6d
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 1, 2018
0d3709b
Fixed lint
marecar3 Nov 1, 2018
90b13b7
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 5, 2018
cf5e3b4
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 6, 2018
211e3d2
Fix for iOS font crash
marecar3 Nov 6, 2018
ed31f31
Merge style with block code style
marecar3 Nov 6, 2018
4ab2b39
Merge branch 'master' into rnmobile/native-toolbar-component
marecar3 Nov 6, 2018
1a98cc8
Revert style
marecar3 Nov 6, 2018
5c9a7b5
Create edit.native.js file to bypass passing className from original one
marecar3 Nov 6, 2018
361166e
Fixed failing tests
marecar3 Nov 6, 2018
d9acc59
Disable styelint rule font-family-no-missing-generic-family-keyword f…
marecar3 Nov 6, 2018
2718990
Fixed tests
marecar3 Nov 6, 2018
5e9a9e5
Merge branch 'rnmobile/native-toolbar-component' of https://github.co…
marecar3 Nov 6, 2018
b8a9823
Merge
marecar3 Nov 7, 2018
4712418
Fix style little bit
marecar3 Nov 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/block-library/src/code/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ import { __ } from '@wordpress/i18n';
*/
import { PlainText } from '@wordpress/editor';

/**
* Block code style
*/
import styles from './theme.scss';

// Note: styling is applied directly to the (nested) PlainText component. Web-side components
// apply it to the container 'div' but we don't have a proper proposal for cascading styling yet.
export default function CodeEdit( { attributes, setAttributes, style } ) {
return (
<View>
<PlainText
value={ attributes.content }
style={ style }
style={ [ style, styles.blockCode ] }
multiline={ true }
underlineColorAndroid="transparent"
onChange={ ( content ) => setAttributes( { content } ) }
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/code/theme.android.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.blockCode {
font-family: monospace;
}

5 changes: 5 additions & 0 deletions packages/block-library/src/code/theme.ios.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* stylelint-disable font-family-no-missing-generic-family-keyword */
.blockCode {
font-family: courier;
}

6 changes: 4 additions & 2 deletions packages/block-library/src/heading/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { View } from 'react-native';
*/
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { RichText } from '@wordpress/editor';
import { RichText, BlockControls } from '@wordpress/editor';
import { parse, createBlock } from '@wordpress/blocks';

/**
Expand Down Expand Up @@ -42,7 +42,9 @@ class HeadingEdit extends Component {

return (
<View>
<HeadingToolbar minLevel={ 2 } maxLevel={ 5 } selectedLevel={ level } onChange={ ( newLevel ) => setAttributes( { level: newLevel } ) } />
<BlockControls>
<HeadingToolbar minLevel={ 2 } maxLevel={ 5 } selectedLevel={ level } onChange={ ( newLevel ) => setAttributes( { level: newLevel } ) } />
</BlockControls>
<RichText
tagName={ tagName }
value={ content }
Expand Down
9 changes: 7 additions & 2 deletions packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { Component } from '@wordpress/element';
import { parse, createBlock } from '@wordpress/blocks';
import { RichText } from '@wordpress/editor';

const minHeight = 50;
/**
* Import style
*/
import styles from './style.scss';

const name = 'core/paragraph';

Expand Down Expand Up @@ -68,15 +71,17 @@ class ParagraphEdit extends Component {
const {
attributes,
setAttributes,
style,
mergeBlocks,
style,
} = this.props;

const {
placeholder,
content,
} = attributes;

const minHeight = styles.blockText.minHeight;

return (
<View>
<RichText
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/paragraph/style.native.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.blockText {
min-height: 50;
}
4 changes: 2 additions & 2 deletions packages/components/src/button/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export default function Button( props ) {
onPress={ onClick }
style={ { borderColor: ariaPressed ? 'black' : 'white', borderWidth: 1, borderRadius: 2 } }
>
<View style={ { flex: 1, flexDirection: 'row' } }>
<View style={ { height: 44, width: 44, flexDirection: 'row', justifyContent: 'center', alignItems: 'center' } }>
{ children }
{ subscript && ( <Text style={ { fontVariant: [ 'small-caps' ], textAlignVertical: 'bottom' } }>{ subscript }</Text> ) }
{ subscript && ( <Text style={ { fontVariant: [ 'small-caps' ] } }>{ subscript }</Text> ) }
</View>
</TouchableOpacity>
);
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './primitives';
export { default as Dashicon } from './dashicon';
export { default as Toolbar } from './toolbar';
export { default as withSpokenMessages } from './higher-order/with-spoken-messages';
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider } from './slot-fill';

// Higher-Order Components
export { default as withFilters } from './higher-order/with-filters';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { View } from 'react-native';

export default ( props ) => (
<View style={ { flex: 1, flexDirection: 'row' } }>
<View style={ { flexDirection: 'row' } }>
{ props.children }
</View>
);
2 changes: 2 additions & 0 deletions packages/editor/src/components/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ export * from './font-sizes';
export { default as PlainText } from './plain-text';
export { default as RichText } from './rich-text';
export { default as MediaPlaceholder } from './media-placeholder';
export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockControls } from './block-controls';
export { default as BlockEdit } from './block-edit';
5 changes: 3 additions & 2 deletions packages/editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { Component, RawHTML } from '@wordpress/element';
import { withInstanceId, compose } from '@wordpress/compose';
import { Toolbar } from '@wordpress/components';
import { BlockFormatControls } from '@wordpress/editor';
import {
isEmpty,
create,
Expand Down Expand Up @@ -342,9 +343,9 @@ export class RichText extends Component {

return (
<View>
<View style={ { flex: 1 } }>
<BlockFormatControls>
<Toolbar controls={ toolbarControls } />
</View>
</BlockFormatControls>
<RCTAztecView
ref={ ( ref ) => {
this._editor = ref;
Expand Down