Skip to content

Commit ca0bf6e

Browse files
committed
Merge branch 'develop' into master-1.11.0-to-develop
2 parents 908695f + 0e597a4 commit ca0bf6e

14 files changed

+234
-107
lines changed

RELEASE-NOTES.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.12.0
2+
------
3+
* Add rich text styling to video captions
4+
* Prevent keyboard dismissal when switching between caption and text block on Android
5+
* Blocks that would be replaced are now hidden when add block bottom sheet displays
6+
17
1.11.0
28
------
39
* Toolbar scroll position now resets when its content changes.

babel.config.js

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1+
/** @format */
2+
13
module.exports = function( api ) {
24
api.cache( true );
35
return {
4-
presets: [
5-
'module:metro-react-native-babel-preset',
6-
],
6+
presets: [ 'module:metro-react-native-babel-preset' ],
77
plugins: [
88
'@babel/plugin-proposal-async-generator-functions',
99
'@babel/plugin-transform-runtime',
1010
[
1111
'react-native-platform-specific-extensions',
1212
{
13-
extensions: [
14-
'css',
15-
'scss',
16-
'sass',
17-
],
13+
extensions: [ 'css', 'scss', 'sass' ],
1814
},
1915
],
2016
],
2117
overrides: [
22-
{ // Transforms JSX into JS function calls and use `createElement` instead of the default `React.createElement`
18+
{
19+
// Transforms JSX into JS function calls and use `createElement` instead of the default `React.createElement`
2320
plugins: [
2421
[
2522
'@babel/plugin-transform-react-jsx',
@@ -31,7 +28,8 @@ module.exports = function( api ) {
3128
],
3229
exclude: /node_modules\/react-native/,
3330
},
34-
{ // Auto-add `import { createElement } from '@wordpress/element';` when JSX is found
31+
{
32+
// Auto-add `import { createElement } from '@wordpress/element';` when JSX is found
3533
plugins: [
3634
[
3735
'./gutenberg/packages/babel-plugin-import-jsx-pragma',
@@ -48,9 +46,7 @@ module.exports = function( api ) {
4846
],
4947
env: {
5048
development: {
51-
plugins: [
52-
'@babel/transform-react-jsx-source',
53-
],
49+
plugins: [ '@babel/transform-react-jsx-source' ],
5450
},
5551
},
5652
};

bin/ci-checks-js.sh

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fi
1616
if [ "$CHECK_CORRECTNESS" = true ] ; then
1717
yarn flow || pFail
1818
yarn lint || pFail
19+
yarn prettier:check || pFail
1920
fi
2021

2122
if [ "$GUTENBERG_AS_PARENT" = true ] ; then

jest.config.js

+7-13
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,20 @@ module.exports = {
3333
'/__device-tests__/',
3434
],
3535
testURL: 'http://localhost/',
36-
modulePathIgnorePatterns: [ '<rootDir>/gutenberg/gutenberg-mobile', 'react-native-aztec-old-submodule' ],
36+
modulePathIgnorePatterns: [
37+
'<rootDir>/gutenberg/gutenberg-mobile',
38+
'react-native-aztec-old-submodule',
39+
],
3740
moduleDirectories: [ 'node_modules', 'symlinked-packages' ],
3841
moduleNameMapper: {
3942
// Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
4043
'\\.(scss)$': '<rootDir>/gutenberg/test/native/__mocks__/styleMock.js',
4144
},
4245
haste: {
4346
defaultPlatform: rnPlatform,
44-
platforms: [
45-
'android',
46-
'ios',
47-
'native',
48-
],
47+
platforms: [ 'android', 'ios', 'native' ],
4948
hasteImplModulePath: '<rootDir>/node_modules/react-native/jest/hasteImpl.js',
50-
providesModuleNodeModules: [
51-
'react-native',
52-
'react-native-svg',
53-
],
49+
providesModuleNodeModules: [ 'react-native', 'react-native-svg' ],
5450
},
5551
transformIgnorePatterns: [
5652
// This is required for now to have jest transform some of our modules
@@ -59,8 +55,6 @@ module.exports = {
5955
// https://github.com/facebook/react-native/blob/master/jest-preset.json#L20
6056
'node_modules/(?!(simple-html-tokenizer|(jest-)?react-native|react-clone-referenced-element))',
6157
],
62-
snapshotSerializers: [
63-
'enzyme-to-json/serializer',
64-
],
58+
snapshotSerializers: [ 'enzyme-to-json/serializer' ],
6559
reporters: [ 'default', 'jest-junit' ],
6660
};

libdefs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ declare module 'react-native' {
88
}
99

1010
declare module 'react-native/lib/TextInputState' {
11-
declare module.exports: any;
11+
declare module.exports: any;
1212
}

package.json

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"eslint-plugin-react-native": "^3.6.0",
3434
"eslint-plugin-wordpress": "git://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.git#552af1454d175e15f6d25aadc2ccde30a1922d4f",
3535
"flow-bin": "0.92.0",
36+
"husky": "^3.0.2",
3637
"identity-obj-proxy": "^3.0.0",
3738
"jest": "^24.1.0",
3839
"jest-junit": "^6.3.0",
@@ -50,6 +51,11 @@
5051
"sprintf-js": "^1.1.1",
5152
"wd": "^1.11.1"
5253
},
54+
"husky": {
55+
"hooks": {
56+
"pre-commit": "yarn prettier:check"
57+
}
58+
},
5359
"scripts": {
5460
"start": "react-native start",
5561
"start:inside-gb": "react-native start --config `pwd`/rn-cli-inside-gb.config.js",
@@ -101,6 +107,7 @@
101107
"test:e2e:install-app:ios": "yarn test:e2e:build-app:ios",
102108
"flow": "flow",
103109
"prettier": "prettier-eslint --write $npm_package_config_jsfiles $npm_package_config_scssfiles",
110+
"prettier:check": "prettier-eslint --list-different $npm_package_config_jsfiles $npm_package_config_scssfiles || { echo '\nERROR: `yarn prettier:check` found a formatting problem.\nNo files have been changed. Try running `yarn prettier` to fix any formatting issues.\n'; exit 1; }",
104111
"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;",
105112
"clean:runtime": "yarn clean:haste; yarn clean:react; yarn clean:metro; yarn clean:jest; yarn clean:watchman; yarn clean:babel-cache",
106113
"clean:aztec": "cd react-native-aztec && yarn clean && cd example && yarn clean",

rn-cli-inside-gb.config.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const path = require( 'path' );
33
const blacklist = require( 'metro-config/src/defaults/blacklist' );
44
// Blacklist the nested GB filetree so modules are not resolved in duplicates,
55
// both in the nested directory and the parent directory.
6-
const blacklistElements = blacklist( [ new RegExp( path.basename( __dirname ) + '/gutenberg/.*' ) ] );
6+
const blacklistElements = blacklist( [
7+
new RegExp( path.basename( __dirname ) + '/gutenberg/.*' ),
8+
] );
79

810
const enm = require( './extra-node-modules.config.js' );
911

@@ -19,7 +21,9 @@ const mapper = function( accu, v ) {
1921
};
2022

2123
const wppackages = wppackagenames.reduce( mapper, {} );
22-
const alternateRoots = [ path.resolve( __dirname, '../node_modules' ) ].concat( Object.values( wppackages ) );
24+
const alternateRoots = [ path.resolve( __dirname, '../node_modules' ) ].concat(
25+
Object.values( wppackages )
26+
);
2327

2428
module.exports = {
2529
extraNodeModules: Object.assign( enm, wppackages ),

sass-transformer-inside-gb.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ if ( reactNativeMinorVersion >= 56 ) {
6262
}
6363

6464
// TODO: need to find a way to pass the include paths and the default asset files via some config
65-
const autoImportIncludePaths = [
66-
path.join( path.dirname( __filename ), '../assets/stylesheets' ),
67-
];
65+
const autoImportIncludePaths = [ path.join( path.dirname( __filename ), '../assets/stylesheets' ) ];
6866
const autoImportAssets = [
6967
'_colors.scss',
7068
'_breakpoints.scss',

src/_colors.scss

+10-10
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,22 @@ $blue-500: #016087;
9494

9595
// Grays
9696
$gray: #87a6bc;
97-
$gray-light: lighten( $gray, 33% ); //#f3f6f8
98-
$gray-dark: darken( $gray, 38% ); //#2e4453
99-
$gray-900: #1A1A1A;
97+
$gray-light: lighten($gray, 33%); //#f3f6f8
98+
$gray-dark: darken($gray, 38%); //#2e4453
99+
$gray-900: #1a1a1a;
100100

101101
// $gray-text: ideal for standard, non placeholder text
102102
// $gray-text-min: minimum contrast needed for WCAG 2.0 AA on white background
103103
$gray-text: $gray-dark;
104-
$gray-text-min: darken( $gray, 18% ); //#537994
104+
$gray-text-min: darken($gray, 18%); //#537994
105105

106106
// Shades of gray
107-
$gray-lighten-10: lighten( $gray, 10% ); // #a8bece
108-
$gray-lighten-20: lighten( $gray, 20% ); // #c8d7e1
109-
$gray-lighten-30: lighten( $gray, 30% ); // #e9eff3
110-
$gray-darken-10: darken( $gray, 10% ); // #668eaa
111-
$gray-darken-20: darken( $gray, 20% ); // #4f748e
112-
$gray-darken-30: darken( $gray, 30% ); // #3d596d
107+
$gray-lighten-10: lighten($gray, 10%); // #a8bece
108+
$gray-lighten-20: lighten($gray, 20%); // #c8d7e1
109+
$gray-lighten-30: lighten($gray, 30%); // #e9eff3
110+
$gray-darken-10: darken($gray, 10%); // #668eaa
111+
$gray-darken-20: darken($gray, 20%); // #4f748e
112+
$gray-darken-30: darken($gray, 30%); // #3d596d
113113

114114
//
115115
// See wordpress.com/design-handbook/colors/ for more info.

src/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* External dependencies
3+
*
4+
* @format
5+
*/
6+
17
/**
28
* External dependencies
39
*/

src/index.test.js

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/** @format */
32

43
/**
@@ -45,32 +44,32 @@ describe( 'RootComponent', () => {
4544
it( 'Code block is a TextInput', () => {
4645
const app = renderer.create( <RootComponent /> );
4746

48-
app.root.findAllByType( BlockListBlock )
49-
.forEach( ( blockHolder ) => {
50-
if ( 'core/code' === blockHolder.props.name ) {
51-
// TODO: hardcoded indices are ugly and error prone. Can we do better here?
52-
const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
53-
const contentComponent = blockHolderContainer.children[ 0 ];
54-
const inputComponent =
55-
contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
56-
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
47+
app.root.findAllByType( BlockListBlock ).forEach( ( blockHolder ) => {
48+
if ( 'core/code' === blockHolder.props.name ) {
49+
// TODO: hardcoded indices are ugly and error prone. Can we do better here?
50+
const blockHolderContainer =
51+
blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
52+
const contentComponent = blockHolderContainer.children[ 0 ];
53+
const inputComponent =
54+
contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
55+
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
56+
.children[ 0 ];
5757

58-
expect( inputComponent.type ).toBe( 'TextInput' );
59-
}
60-
} );
58+
expect( inputComponent.type ).toBe( 'TextInput' );
59+
}
60+
} );
6161

6262
app.unmount();
6363
} );
6464

6565
it( 'Heading block test', () => {
6666
const app = renderer.create( <RootComponent /> );
67-
app.root.findAllByType( BlockListBlock )
68-
.forEach( ( blockHolder ) => {
69-
if ( 'core/heading' === blockHolder.props.name ) {
70-
const aztec = blockHolder.findByType( 'RCTAztecView' );
71-
expect( aztec.props.text.text ).toBe( '<h2>What is Gutenberg?</h2>' );
72-
}
73-
} );
67+
app.root.findAllByType( BlockListBlock ).forEach( ( blockHolder ) => {
68+
if ( 'core/heading' === blockHolder.props.name ) {
69+
const aztec = blockHolder.findByType( 'RCTAztecView' );
70+
expect( aztec.props.text.text ).toBe( '<h2>What is Gutenberg?</h2>' );
71+
}
72+
} );
7473
app.unmount();
7574
} );
7675
} );

0 commit comments

Comments
 (0)