Skip to content

Commit

Permalink
Merge branch 'develop' into issue/546-add-block-icon-color
Browse files Browse the repository at this point in the history
  • Loading branch information
etoledom committed Mar 27, 2019
2 parents fb24942 + bd1ebf5 commit 9ebdffc
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 99 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ buck-out/
!.vscode/extensions.json

*.pot
bin/wp-cli.phar
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 49 files
+4 −0 .eslintrc.js
+5 −1 assets/stylesheets/_mixins.scss
+16 −15 bin/install-wordpress.sh
+0 −3 bin/reset-e2e-tests.sh
+0 −14 bin/run-e2e-tests.sh
+1 −1 bin/update-readmes.js
+23 −8 docker-compose.yml
+60 −22 package-lock.json
+1 −1 package.json
+6 −2 packages/block-library/CHANGELOG.md
+2 −15 packages/block-library/src/archives/edit.js
+1 −7 packages/block-library/src/archives/index.js
+1 −0 packages/block-library/src/archives/index.php
+0 −8 packages/block-library/src/block/index.js
+0 −1 packages/block-library/src/block/index.php
+1 −0 packages/block-library/src/calendar/index.php
+0 −16 packages/block-library/src/categories/index.js
+21 −0 packages/block-library/src/categories/index.php
+56 −26 packages/block-library/src/heading/edit.native.js
+4 −0 packages/block-library/src/heading/style.native.scss
+3 −8 packages/block-library/src/image/edit.native.js
+2 −9 packages/block-library/src/latest-posts/edit.js
+1 −7 packages/block-library/src/latest-posts/index.js
+5 −4 packages/block-library/src/latest-posts/index.php
+3 −0 packages/block-library/src/legacy-widget/index.php
+1 −14 packages/block-library/src/paragraph/edit.native.js
+2 −1 packages/block-library/src/paragraph/style.native.scss
+3 −0 packages/block-library/src/rss/editor.scss
+1 −0 packages/block-library/src/rss/index.js
+25 −2 packages/block-library/src/rss/index.php
+1 −0 packages/block-library/src/rss/style.scss
+4 −0 packages/block-library/src/search/index.js
+11 −1 packages/block-library/src/search/index.php
+0 −7 packages/block-library/src/shortcode/index.js
+6 −0 packages/block-library/src/shortcode/index.php
+7 −6 packages/block-library/src/tag-cloud/index.php
+1 −1 packages/block-library/src/verse/index.js
+309 −144 packages/data/README.md
+54 −2 packages/data/src/components/with-dispatch/index.js
+26 −0 packages/data/src/components/with-select/index.js
+95 −0 packages/data/src/index.js
+4 −4 packages/e2e-tests/fixtures/blocks/core__rss.parsed.json
+1 −1 packages/e2e-tests/fixtures/blocks/core__rss.serialized.html
+2 −2 packages/e2e-tests/fixtures/blocks/core__search__custom-text.parsed.json
+1 −1 packages/e2e-tests/fixtures/blocks/core__search__custom-text.serialized.html
+2 −2 packages/e2e-tests/fixtures/blocks/core__tag-cloud__showTagCounts.parsed.json
+1 −1 packages/e2e-tests/fixtures/blocks/core__tag-cloud__showTagCounts.serialized.html
+2 −2 packages/e2e-tests/fixtures/blocks/core__video.json
+1 −1 test/integration/full-content/server-registered.json
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@
"bundle:ios": "mkdir -p bundle/ios && yarn react-native bundle --platform ios --dev false --entry-file index.js --assets-dest bundle/ios --bundle-output bundle/ios/App.js --sourcemap-output bundle/ios/App.js.map",
"i18n-cache": "node i18n-cache/index.js",
"postinstall": "yarn i18n-cache",
"makepot": "xgettext -f <( find . \\( -path './gutenberg/*/src/*.native.js' -or -path './src/*.js' \\) ! -path 'node_modules' -print ) --from-code=UTF-8 -k__ -k_n -k_x -k_nx -x ./gutenberg/languages/gutenberg.pot -o ./gutenberg-mobile.pot",
"install:wpcli": "(test -x bin/wp-cli.phar || curl -Ls https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o bin/wp-cli.phar && chmod +x bin/wp-cli.phar) && bin/wp-cli.phar --info",
"prewp": "yarn install:wpcli",
"wp": "php -d memory_limit=512M bin/wp-cli.phar",
"premakepot": "( command -v xgettext >/dev/null 2>&1 || { echo \"ERROR: xgettext is required to parse our Flow code.\" >&2; exit 1; } ) && yarn makepot:gutenberg",
"makepot": "bash -c \"xgettext -f <( find . -path './src/*.js' ! -path 'node_modules' -print ) --from-code=UTF-8 -k__ -k_n -k_x -k_nx -x ./gutenberg.pot -o ./gutenberg-mobile.pot\"",
"makepot:gutenberg": "yarn clean:gutenberg && yarn wp i18n make-pot ./gutenberg --ignore-domain gutenberg.pot",
"android": "react-native run-android",
"prewpandroid": "rm -Rf $TMPDIR/gbmobile-wpandroidfakernroot && mkdir $TMPDIR/gbmobile-wpandroidfakernroot && ln -s $(cd \"$(dirname \"../../../\")\"; pwd) $TMPDIR/gbmobile-wpandroidfakernroot/android",
"wpandroid": "yarn android --root $TMPDIR/gbmobile-wpandroidfakernroot --variant wasabiDebug --appIdSuffix beta --appFolder WordPress --main-activity=ui.WPLaunchActivity",
Expand All @@ -72,6 +77,7 @@
"clean": "yarn clean:aztec; yarn cache clean; yarn clean:haste; yarn clean:jest; yarn clean:metro; yarn clean:react; yarn clean:watchman; yarn clean:node;",
"clean:runtime": "yarn clean:haste; yarn clean:react; yarn clean:metro; yarn clean:jest; yarn clean:watchman; yarn clean:babel-cache",
"clean:aztec": "cd react-native-aztec && yarn clean && cd example && yarn clean",
"clean:gutenberg": "cd gutenberg && npm run clean:packages && rm -rf build",
"clean:haste": "rm -rf /tmp/haste-map-react-native-packager-*",
"clean:install": "yarn clean; yarn",
"clean:jest": "yarn jest --clearCache --config jest.config.js; rm -rf $TMPDIR/jest_*",
Expand Down
6 changes: 3 additions & 3 deletions src/block-management/inline-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ export default class InlineToolbar extends React.Component<PropsType> {
return (
<View style={ styles.toolbar }>
<ToolbarButton
label={ __( 'Move block up' ) }
label={ __( 'Move up' ) }
isDisabled={ ! this.props.canMoveUp }
onClick={ this.onUpPressed }
icon="arrow-up-alt"
/>

<ToolbarButton
label={ __( 'Move block down' ) }
label={ __( 'Move down' ) }
isDisabled={ ! this.props.canMoveDown }
onClick={ this.onDownPressed }
icon="arrow-down-alt"
Expand All @@ -73,7 +73,7 @@ export default class InlineToolbar extends React.Component<PropsType> {
<InspectorControls.Slot />

<ToolbarButton
label={ __( 'Remove content' ) }
label={ __( 'Remove' ) }
onClick={ this.onDeletePressed }
icon="trash"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ $padding: 8;
$backgroundColor: white;
$htmlFont: $default-monospace-font;

.container {
.keyboardAvoidingView {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
}

.container {
flex: 1;
}
59 changes: 13 additions & 46 deletions src/components/html-text-input-ui/html-text-input-ui.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/**
* External dependencies
*/
import React from 'react';
import { TextInput, ScrollView } from 'react-native';
import * as React from 'react';
import { ScrollView } from 'react-native';

/**
* Internal dependencies
Expand All @@ -16,60 +16,27 @@ import styles from './html-text-input-ui.scss';
import KeyboardAvoidingView from '../keyboard-avoiding-view';

type PropsType = {
setTitleAction: string => void,
value: string,
title: string,
parentHeight: number,
onChangeHTMLText: string => mixed,
onBlurHTMLText: () => mixed,
titlePlaceholder: string,
htmlPlaceholder: string,
parentHeight: number,
children: React.Node,
};

type StateType = {
contentHeight: number,
};

export default class HTMLInputViewUI extends React.Component<PropsType, StateType> {
constructor() {
super( ...arguments );

this.state = {
contentHeight: 0,
};
}
class HTMLInputContainer extends React.Component<PropsType, StateType> {
static scrollEnabled: boolean;

render() {
return (
<KeyboardAvoidingView style={ styles.container } parentHeight={ this.props.parentHeight }>
<ScrollView
style={ { flex: 1 } }
keyboardDismissMode="interactive" >
<TextInput
autoCorrect={ false }
textAlignVertical="center"
numberOfLines={ 1 }
style={ styles.htmlViewTitle }
value={ this.props.title }
placeholder={ this.props.titlePlaceholder }
onChangeText={ this.props.setTitleAction }
/>
<TextInput
autoCorrect={ false }
textAlignVertical="top"
multiline
style={ { ...styles.htmlView, height: this.state.contentHeight + 16 } }
value={ this.props.value }
onChangeText={ this.props.onChangeHTMLText }
onBlur={ this.props.onBlurHTMLText }
placeholder={ this.props.htmlPlaceholder }
scrollEnabled={ false }
onContentSizeChange={ ( event ) => {
this.setState( { contentHeight: event.nativeEvent.contentSize.height } );
} }
/>
<KeyboardAvoidingView style={ styles.keyboardAvoidingView } parentHeight={ this.props.parentHeight }>
<ScrollView style={ styles.scrollView } >
{ this.props.children }
</ScrollView>
</KeyboardAvoidingView>
);
}
}

HTMLInputContainer.scrollEnabled = false;

export default HTMLInputContainer;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
padding-left: $padding;
padding-right: $padding;
padding-top: $padding;
padding-bottom: $padding;
padding-bottom: $padding + 16;
}

.htmlViewTitle {
Expand All @@ -19,3 +19,7 @@
padding-top: $padding;
padding-bottom: $padding;
}

.scrollView {
flex: 1;
}
48 changes: 15 additions & 33 deletions src/components/html-text-input-ui/html-text-input-ui.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
/**
* External dependencies
*/
import React from 'react';
import { TextInput, UIManager, PanResponder } from 'react-native';
import * as React from 'react';
import { UIManager, PanResponder } from 'react-native';

/**
* Internal dependencies
Expand All @@ -16,20 +16,15 @@ import styles from './html-text-input-ui.scss';
import KeyboardAvoidingView from '../keyboard-avoiding-view';

type PropsType = {
setTitleAction: string => void,
value: string,
title: string,
parentHeight: number,
onChangeHTMLText: string => mixed,
onBlurHTMLText: () => mixed,
titlePlaceholder: string,
htmlPlaceholder: string,
parentHeight: number,
children: React.Node,
};

type StateType = {
};

export default class HTMLInputViewUI extends React.Component<PropsType, StateType> {
class HTMLInputContainer extends React.Component<PropsType, StateType> {
static scrollEnabled: boolean;
panResponder: PanResponder;

constructor() {
Expand All @@ -40,7 +35,7 @@ export default class HTMLInputViewUI extends React.Component<PropsType, StateTyp

onPanResponderMove: ( e, gestureState ) => {
if ( gestureState.dy > 100 && gestureState.dy < 110 ) {
//Keyboard.dismiss() and this.textInput.blur() is not working here
//Keyboard.dismiss() and this.textInput.blur() are not working here
//They require to know the currentlyFocusedID under the hood but
//during this gesture there's no currentlyFocusedID
UIManager.blur( e.target );
Expand All @@ -52,29 +47,16 @@ export default class HTMLInputViewUI extends React.Component<PropsType, StateTyp
render() {
return (
<KeyboardAvoidingView
style={ styles.container }
style={ styles.keyboardAvoidingView }
{ ...this.panResponder.panHandlers }
parentHeight={ this.props.parentHeight }>
<TextInput
autoCorrect={ false }
textAlignVertical="center"
numberOfLines={ 1 }
style={ styles.htmlViewTitle }
value={ this.props.title }
placeholder={ this.props.titlePlaceholder }
onChangeText={ this.props.setTitleAction }
/>
<TextInput
autoCorrect={ false }
textAlignVertical="top"
multiline
style={ { ...styles.htmlView } }
value={ this.props.value }
onChangeText={ this.props.onChangeHTMLText }
onBlur={ this.props.onBlurHTMLText }
placeholder={ this.props.htmlPlaceholder }
/>
parentHeight={ this.props.parentHeight }
>
{ this.props.children }
</KeyboardAvoidingView>
);
}
}

HTMLInputContainer.scrollEnabled = true;

export default HTMLInputContainer;
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ $title-height: 32;
padding-top: $padding;
padding-bottom: $padding;
height: $title-height;

}
}
36 changes: 25 additions & 11 deletions src/components/html-text-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import { withInstanceId, compose } from '@wordpress/compose';
* External dependencies
*/
import React from 'react';
import { TextInput } from 'react-native';

/**
* Internal dependencies
*/
import HTMLInputViewUI from './html-text-input-ui/html-text-input-ui';
import HTMLInputContainer from './html-text-input-ui/html-text-input-ui';
import styles from './html-text-input-ui/html-text-input-ui.scss';

type PropsType = {
onChange: string => mixed,
Expand Down Expand Up @@ -80,16 +82,28 @@ export class HTMLInputView extends React.Component<PropsType, StateType> {

render() {
return (
<HTMLInputViewUI
setTitleAction={ this.props.setTitleAction }
value={ this.state.value }
title={ this.props.title }
parentHeight={ this.props.parentHeight }
onChangeHTMLText={ this.edit }
onBlurHTMLText={ this.stopEditing }
titlePlaceholder={ __( 'Add title' ) }
htmlPlaceholder={ __( 'Start writing…' ) }
/>
<HTMLInputContainer parentHeight={ this.props.parentHeight }>
<TextInput
autoCorrect={ false }
textAlignVertical="center"
numberOfLines={ 1 }
style={ styles.htmlViewTitle }
value={ this.props.title }
placeholder={ __( 'Add title' ) }
onChangeText={ this.props.setTitleAction }
/>
<TextInput
autoCorrect={ false }
textAlignVertical="top"
multiline
style={ styles.htmlView }
value={ this.state.value }
onChangeText={ this.edit }
onBlur={ this.stopEditing }
placeholder={ __( 'Start writing…' ) }
scrollEnabled={ HTMLInputContainer.scrollEnabled }
/>
</HTMLInputContainer>
);
}
}
Expand Down

0 comments on commit 9ebdffc

Please sign in to comment.