-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Widget Visibility: add scaffolding for upcoming editor features. (#20910
) This does not much on its own, but is the first step to allow us to ship #20731.
- Loading branch information
Showing
8 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
projects/plugins/jetpack/changelog/add-scaffolding-widget-visibilty-block-editor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: other | ||
Comment: Widget Visibility: add scaffolding for upcoming block editor features. | ||
|
||
|
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
7 changes: 7 additions & 0 deletions
7
projects/plugins/jetpack/modules/widget-visibility/editor/.eslintrc.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
extends: [ | ||
'plugin:@wordpress/eslint-plugin/recommended-with-formatting', | ||
'plugin:@wordpress/eslint-plugin/i18n', | ||
'../../../.eslintrc.js', | ||
], | ||
}; |
10 changes: 10 additions & 0 deletions
10
projects/plugins/jetpack/modules/widget-visibility/editor/README.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Widget Visibility editor controls | ||
|
||
[Widget Visibility](http://jetpack.com/support/widget-visibility) was first built to interact with widgets, in a WordPress world where the block editor didn't exist. | ||
In WordPress 5.8, it became possible to [use a block-based editor to manage widgets on your WordPress site](https://wordpress.org/news/2021/08/widgets-in-wordpress-5-8-and-beyond/). | ||
|
||
This means that we can now develop a new interface to manage widget visibility settings from the block editor. This directory allows us to build that interface. | ||
|
||
## Build (& Watch) | ||
|
||
This feature will be built via `pnpm run build-widget-visibility`, which is invoked in `pnpm build`. |
9 changes: 9 additions & 0 deletions
9
projects/plugins/jetpack/modules/widget-visibility/editor/index.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable react/react-in-jsx-scope */ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Fragment } from '@wordpress/element'; | ||
|
||
export const WidgetVisibility = () => { | ||
return <Fragment>Widget Visibility</Fragment>; | ||
}; |
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
45 changes: 45 additions & 0 deletions
45
projects/plugins/jetpack/tools/webpack.config.widget-visibility.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const path = require( 'path' ); | ||
const getBaseWebpackConfig = require( '@automattic/calypso-build/webpack.config.js' ); | ||
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' ); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
const { definePaletteColorsAsStaticVariables } = require( './webpack.helpers' ); | ||
|
||
const isDevelopment = process.env.NODE_ENV !== 'production'; | ||
|
||
const baseWebpackConfig = getBaseWebpackConfig( | ||
{ WP: true }, | ||
{ | ||
entry: { | ||
main: path.join( __dirname, '../modules/widget-visibility/editor/index.jsx' ), | ||
}, | ||
'output-filename': 'index.min.js', | ||
'output-path': path.join( __dirname, '../_inc/build/widget-visibility/editor' ), | ||
} | ||
); | ||
|
||
module.exports = { | ||
...baseWebpackConfig, | ||
resolve: { | ||
...baseWebpackConfig.resolve, | ||
modules: [ | ||
path.resolve( __dirname, '../_inc/client' ), | ||
path.resolve( __dirname, '../node_modules' ), | ||
'node_modules', | ||
], | ||
fallback: { | ||
fs: false, | ||
}, | ||
}, | ||
devtool: isDevelopment ? 'source-map' : false, | ||
plugins: [ | ||
...baseWebpackConfig.plugins, | ||
new DependencyExtractionWebpackPlugin( { injectPolyfill: true } ), | ||
definePaletteColorsAsStaticVariables(), | ||
], | ||
}; |