From dcdc846acf22e43d056dddf477204de0353957c2 Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Fri, 24 Aug 2018 17:17:44 +0100 Subject: [PATCH 01/10] Try to implement Heading Toolbar --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index cb7c4132fdcfbd..379d16fdc7aedd 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit cb7c4132fdcfbd3aef64ce898748b6a5f2a6a192 +Subproject commit 379d16fdc7aedd6b8f3577f0305301a164b5bced From 8be481582912da08bcd96521728c230388046717 Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 11:43:56 +0100 Subject: [PATCH 02/10] Make redux is updated before data source is changed. --- src/block-management/block-manager.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/block-management/block-manager.js b/src/block-management/block-manager.js index 954683d24e364d..4fb6246a8b1473 100644 --- a/src/block-management/block-manager.js +++ b/src/block-management/block-manager.js @@ -164,14 +164,15 @@ export default class BlockManager extends React.Component } onChange( clientId: string, attributes: mixed ) { - // Update datasource UI + // Update Redux store + this.props.onChange( clientId, attributes ); + + // Change the data source const index = this.getDataSourceIndexFromClientId( clientId ); const dataSource = this.state.dataSource; - const block = dataSource.get( index ); + const block = { ...( dataSource.get( index ) ) }; block.attributes = attributes; dataSource.set( index, block ); - // Update Redux store - this.props.onChange( clientId, attributes ); } renderList() { From 8f5086cf82a9f093446da75d625cfe3e397f86e8 Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 12:17:52 +0100 Subject: [PATCH 03/10] Remove no longer need comment. --- src/block-management/block-holder.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index 0d1b24a8e2186c..ec45733bd77f41 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -61,8 +61,7 @@ export default class BlockHolder extends React.Component { } else if ( blockType.name === 'core/paragraph' ) { style = styles.blockText; } - - // TODO: setAttributes needs to change the state/attributes + return ( Date: Mon, 3 Sep 2018 12:18:51 +0100 Subject: [PATCH 04/10] Update gutenberg version. --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 379d16fdc7aedd..225307aad89edb 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 379d16fdc7aedd6b8f3577f0305301a164b5bced +Subproject commit 225307aad89edb72096669595f49ca4989e49542 From 6a86f64672d8dde74bbab668b257128000727288 Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 12:55:48 +0100 Subject: [PATCH 05/10] Remove shallow copy of object. --- src/block-management/block-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/block-management/block-manager.js b/src/block-management/block-manager.js index 4fb6246a8b1473..6818945ebf0586 100644 --- a/src/block-management/block-manager.js +++ b/src/block-management/block-manager.js @@ -170,7 +170,7 @@ export default class BlockManager extends React.Component // Change the data source const index = this.getDataSourceIndexFromClientId( clientId ); const dataSource = this.state.dataSource; - const block = { ...( dataSource.get( index ) ) }; + const block = dataSource.get( index ); block.attributes = attributes; dataSource.set( index, block ); } From 0daf377caba7954da093f3f1fc8d86a187771295 Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 13:35:35 +0100 Subject: [PATCH 06/10] Remove white spaces. --- src/block-management/block-holder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index ec45733bd77f41..b5ba888cd38b47 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -61,7 +61,7 @@ export default class BlockHolder extends React.Component { } else if ( blockType.name === 'core/paragraph' ) { style = styles.blockText; } - + return ( Date: Mon, 3 Sep 2018 13:44:41 +0100 Subject: [PATCH 07/10] Fixed test/jest tests run/config. --- gutenberg | 2 +- jest.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gutenberg b/gutenberg index 225307aad89edb..22085346e55e22 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 225307aad89edb72096669595f49ca4989e49542 +Subproject commit 22085346e55e22b511c7be1db9ea43f285a1c500 diff --git a/jest.config.js b/jest.config.js index f5183cee2652d8..5b9618ecc4fc14 100644 --- a/jest.config.js +++ b/jest.config.js @@ -32,7 +32,7 @@ module.exports = { 'node', ], moduleNameMapper: { - '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y)$': '/gutenberg/packages/$1/src/index', + '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport)$': '/gutenberg/packages/$1/src/index', // Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets '\\.(scss)$': '/__mocks__/styleMock.js', From 5ad183b83292b01844b9c90343aa8fe0316406ee Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 13:54:33 +0100 Subject: [PATCH 08/10] Add core-data to jest config. --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index 5b9618ecc4fc14..ae00aaba067f28 100644 --- a/jest.config.js +++ b/jest.config.js @@ -32,7 +32,7 @@ module.exports = { 'node', ], moduleNameMapper: { - '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport)$': '/gutenberg/packages/$1/src/index', + '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport|core-data)$': '/gutenberg/packages/$1/src/index', // Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets '\\.(scss)$': '/__mocks__/styleMock.js', From 8d1d2cc58258760b5e42413ea28740b1bce28711 Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 14:09:25 +0100 Subject: [PATCH 09/10] Add api-fetch to jest.config. --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index ae00aaba067f28..493c6e744c443d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -32,7 +32,7 @@ module.exports = { 'node', ], moduleNameMapper: { - '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport|core-data)$': '/gutenberg/packages/$1/src/index', + '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport|core-data|api-fetch)$': '/gutenberg/packages/$1/src/index', // Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets '\\.(scss)$': '/__mocks__/styleMock.js', From ec457af9efddfde3425e8cb3ca3106a82d2c5c7a Mon Sep 17 00:00:00 2001 From: SergioEstevao Date: Mon, 3 Sep 2018 14:34:56 +0100 Subject: [PATCH 10/10] Add nux to jest config. --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index 493c6e744c443d..fd4c9e60b78cb8 100644 --- a/jest.config.js +++ b/jest.config.js @@ -32,7 +32,7 @@ module.exports = { 'node', ], moduleNameMapper: { - '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport|core-data|api-fetch)$': '/gutenberg/packages/$1/src/index', + '@wordpress\\/(blocks|data|element|deprecated|editor|redux-routine|block-library|components|keycodes|url|a11y|viewport|core-data|api-fetch|nux)$': '/gutenberg/packages/$1/src/index', // Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets '\\.(scss)$': '/__mocks__/styleMock.js',