-
-
Save pablocubico/b769700ebf5c0f101c5531b180abb53d to your computer and use it in GitHub Desktop.
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
Show hidden characters
// In case we find it's a Webpack/Babel config issue, | |
// it's possible to create a .babelrc file to override | |
// WP's Babel defaults, this is a sample file with no overrides, | |
// just the default config (i.e.: the same as without the file). | |
{ | |
"presets": [ "@wordpress/default" ] | |
} | |
// We are already overriding the default Webpack config for some configurations, | |
// check `webpack.config.js` in the Blocks Plugin root folder. | |
// Maybe we could try some Webpack debugging plugins as the Circular Dependency plugin: | |
// https://github.com/aackerman/circular-dependency-plugin |
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
/** | |
* We should be able to do something like this | |
* For the P4TableEdit component, but it doesn't work | |
* with our current setup: | |
*/ | |
import { createCustomColorsHOC } from '@wordpress/block-editor'; | |
// This requires installing the `block-library` module: | |
// `npm install --save @wordpress/block-library` | |
// It should be possible to import the component we actually need... | |
import { TableEdit } from '@wordpress/block-library/src/table/edit'; | |
// ...but this line will throw: | |
// Uncaught TypeError: Cannot read property 'TableEdit' of undefined | |
console.log(TableEdit); | |
const BACKGROUND_COLORS = [ | |
{ | |
color: '#f5f7f8', | |
name: 'Grey', | |
slug: 'grey' | |
}, | |
{ | |
color: '#eafee7', | |
name: 'Green', | |
slug: 'green' | |
}, | |
{ | |
color: '#e7f5fe', | |
name: 'Blue', | |
slug: 'blue' | |
} | |
]; | |
const withCustomBackgroundColors = createCustomColorsHOC( BACKGROUND_COLORS ); | |
export default withCustomBackgroundColors( 'backgroundColor' )( TableEdit ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment