Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages: Extract the editor package #8081

Merged
merged 3 commits into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion core-blocks/test/full-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe( 'full post content fixture', () => {
unstable__bootstrapServerSideBlockDefinitions( require( './server-registered.json' ) );

// Load all hooks that modify blocks
require( 'editor/hooks' );
require( '../../packages/editor/src/hooks' );
registerCoreBlocks();
} );

Expand Down
4 changes: 2 additions & 2 deletions docs/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- [**core**: WordPress Core Data](../../docs/data/data-core.md)
- [**core/blocks**: Block Types Data](../../docs/data/data-core-blocks.md)
- [**core/editor**: The Editor's Data](../../docs/data/data-core-editor.md)
- [**core/edit-post**: The Editor's UI Data](../../docs/data/data-core-edit-post.md)
- [**core/editor**: The Editors Data](../../docs/data/data-core-editor.md)
- [**core/edit-post**: The Editors UI Data](../../docs/data/data-core-edit-post.md)
- [**core/nux**: The NUX (New User Experience) Data](../../docs/data/data-core-nux.md)
- [**core/viewport**: The Viewport Data](../../docs/data/data-core-viewport.md)
2 changes: 1 addition & 1 deletion docs/data/data-core-edit-post.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **core/edit-post**: The Editor's UI Data
# **core/edit-post**: The Editors UI Data

## Selectors

Expand Down
2 changes: 1 addition & 1 deletion docs/data/data-core-editor.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **core/editor**: The Editor's Data
# **core/editor**: The Editors Data

## Selectors

Expand Down
16 changes: 8 additions & 8 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/dom/README.md",
"parent": "packages"
},
{
"title": "@wordpress/editor",
"slug": "packages-editor",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/editor/README.md",
"parent": "packages"
},
{
"title": "@wordpress/element",
"slug": "packages-element",
Expand Down Expand Up @@ -449,12 +455,6 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/edit-post/README.md",
"parent": "packages"
},
{
"title": "@wordpress/editor",
"slug": "packages-editor",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/editor/README.md",
"parent": "packages"
},
{
"title": "Data Package Reference",
"slug": "data",
Expand All @@ -474,13 +474,13 @@
"parent": "data"
},
{
"title": "The Editor's Data",
"title": "The Editors Data",
"slug": "data-core-editor",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/data/data-core-editor.md",
"parent": "data"
},
{
"title": "The Editor's UI Data",
"title": "The Editors UI Data",
"slug": "data-core-edit-post",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/data/data-core-edit-post.md",
"parent": "data"
Expand Down
5 changes: 2 additions & 3 deletions docs/tool/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const npmReadyPackages = glob( 'packages/*/package.json' )
const gutenbergPackages = [
'core-blocks',
'edit-post',
'editor',
];

module.exports = {
Expand All @@ -33,8 +32,8 @@ module.exports = {
},
'core/editor': {
title: 'The Editor’s Data',
selectors: [ path.resolve( root, 'editor/store/selectors.js' ) ],
actions: [ path.resolve( root, 'editor/store/actions.js' ) ],
selectors: [ path.resolve( root, 'packages/editor/src/store/selectors.js' ) ],
actions: [ path.resolve( root, 'packages/editor/src/store/actions.js' ) ],
},
'core/edit-post': {
title: 'The Editor’s UI Data',
Expand Down
31 changes: 24 additions & 7 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,27 @@ function gutenberg_register_scripts_and_styles() {
// WordPress packages.
wp_register_script( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array() );

wp_register_script(
'wp-url',
gutenberg_url( 'build/url/index.js' ),
array(),
filemtime( gutenberg_dir_path() . 'build/url/index.js' ),
true
);
wp_register_script(
'wp-autop',
gutenberg_url( 'build/autop/index.js' ),
array(),
filemtime( gutenberg_dir_path() . 'build/autop/index.js' ),
true
);
wp_register_script(
'wp-wordcount',
gutenberg_url( 'build/wordcount/index.js' ),
array(),
filemtime( gutenberg_dir_path() . 'build/wordcount/index.js' ),
true
);
wp_register_script(
'wp-dom-ready',
gutenberg_url( 'build/dom-ready/index.js' ),
Expand Down Expand Up @@ -439,10 +453,6 @@ function gutenberg_register_scripts_and_styles() {
'wp-editor',
gutenberg_url( 'build/editor/index.js' ),
array(
'editor',
'jquery',
'lodash',
'postbox',
'wp-a11y',
'wp-api-fetch',
'wp-blob',
Expand All @@ -454,16 +464,21 @@ function gutenberg_register_scripts_and_styles() {
'wp-date',
'wp-deprecated',
'wp-dom',
'wp-element',
'wp-hooks',
'wp-html-entities',
'wp-i18n',
'wp-is-shallow-equal',
'wp-keycodes',
'wp-element',
'wp-plugins',
'wp-nux',
'wp-url',
'wp-viewport',
'wp-wordcount',
'lodash',
'wp-tinymce',
'tinymce-latest-lists',
'tinymce-latest-paste',
'tinymce-latest-table',
'wp-nux',
),
filemtime( gutenberg_dir_path() . 'build/editor/index.js' )
);
Expand All @@ -474,9 +489,11 @@ function gutenberg_register_scripts_and_styles() {
array(
'jquery',
'lodash',
'postbox',
'media-models',
'media-views',
'wp-a11y',
'wp-api',
'wp-api-fetch',
'wp-components',
'wp-compose',
Expand Down
50 changes: 45 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@wordpress/deprecated": "file:packages/deprecated",
"@wordpress/dom": "file:packages/dom",
"@wordpress/dom-ready": "file:packages/dom-ready",
"@wordpress/editor": "file:packages/editor",
"@wordpress/element": "file:packages/element",
"@wordpress/hooks": "file:packages/hooks",
"@wordpress/html-entities": "file:packages/html-entities",
Expand All @@ -42,9 +43,6 @@
"@wordpress/viewport": "file:packages/viewport",
"@wordpress/wordcount": "file:packages/wordcount",
"classnames": "2.2.5",
"dom-react": "2.2.1",
"dom-scroll-into-view": "1.2.1",
"element-closest": "2.0.2",
"equivalent-key-map": "0.2.1",
"eslint-plugin-wordpress": "git://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.git#1774343f6226052a46b081e01db3fca8793cc9f1",
"jquery": "3.3.1",
Expand All @@ -56,16 +54,10 @@
"querystringify": "1.0.0",
"re-resizable": "4.4.8",
"react": "16.4.1",
"react-autosize-textarea": "3.0.2",
"react-dom": "16.4.1",
"redux": "3.7.2",
"redux-multi": "0.1.12",
"redux-optimist": "1.0.0",
"refx": "3.0.0",
"rememo": "3.0.0",
"tinycolor2": "1.4.1",
"tinymce": "4.7.2",
"uuid": "3.1.0"
"rememo": "3.0.0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.52",
Expand Down Expand Up @@ -119,6 +111,7 @@
"sprintf-js": "1.1.1",
"style-loader": "0.20.3",
"symlink-or-copy": "1.2.0",
"uuid": "3.1.0",
"webpack": "4.8.3",
"webpack-cli": "2.1.3",
"webpack-livereload-plugin": "2.1.1",
Expand Down
1 change: 0 additions & 1 deletion packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@wordpress/i18n": "file:../i18n",
"@wordpress/is-shallow-equal": "file:../is-shallow-equal",
"@wordpress/shortcode": "file:../shortcode",
"dom-react": "^2.2.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When checking listed deps I discovered it is no longer used in blocks 🤷‍♂️

"element-closest": "^2.0.2",
"hpq": "^1.2.0",
"lodash": "^4.17.10",
Expand Down
3 changes: 1 addition & 2 deletions packages/dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"dependencies": {
"@babel/runtime": "^7.0.0-beta.52",
"element-closest": "^2.0.2",
"lodash": "^4.17.10",
"tinymce": "^4.7.2"
"lodash": "^4.17.10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, to see tinymce isn't required by dom anymore.

},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions packages/editor/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
5 changes: 2 additions & 3 deletions editor/README.md → packages/editor/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Editor: an overview
===================
# Editor

The logic flow concerning the editor includes: inferring a block representation of the post content (parsing); describing the state of a post (representation); rendering of the post to the DOM (rendering); attaching controls to manipulate the content a.k.a blocks (UI).

Expand Down Expand Up @@ -122,4 +121,4 @@ Example:
window.wp.editor,
window.wp.element
);
```
```
71 changes: 71 additions & 0 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "@wordpress/editor",
"version": "1.0.0-alpha.1",
"description": "Building blocks for WordPress editors.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"editor"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/editor/README.md",
"repository": {
"type": "git",
"url": "https://github.com/WordPress/gutenberg.git"
},
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"dependencies": {
"@babel/runtime": "^7.0.0-beta.52",
"@wordpress/a11y": "file:../a11y",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/blob": "file:../blob",
"@wordpress/blocks": "file:../blocks",
"@wordpress/components": "file:../components",
"@wordpress/compose": "file:../compose",
"@wordpress/core-data": "file:../core-data",
"@wordpress/data": "file:../data",
"@wordpress/date": "file:../date",
"@wordpress/deprecated": "file:../deprecated",
"@wordpress/dom": "file:../dom",
"@wordpress/element": "file:../element",
"@wordpress/hooks": "file:../hooks",
"@wordpress/html-entities": "file:../html-entities",
"@wordpress/i18n": "file:../i18n",
"@wordpress/is-shallow-equal": "file:../is-shallow-equal",
"@wordpress/keycodes": "file:../keycodes",
"@wordpress/nux": "file:../nux",
"@wordpress/url": "file:../url",
"@wordpress/viewport": "file:../viewport",
"@wordpress/wordcount": "file:../wordcount",
"classnames": "^2.2.5",
"dom-react": "^2.2.1",
"dom-scroll-into-view": "^1.2.1",
"element-closest": "^2.0.2",
"lodash": "^4.17.10",
"memize": "^1.0.5",
"querystring": "^0.2.0",
"querystringify": "^1.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use multiple querystring libraries, we should settle on one. I'm leaving this for a later PR though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And Gutenberg itself also requires http-build-query to build PHP-compatible query strings (because PHP has to be special), which adds to the query string fun :)

"react-autosize-textarea": "^3.0.2",
"redux-multi": "^0.1.12",
"redux-optimist": "^1.0.0",
"refx": "^3.0.0",
"rememo": "^3.0.0",
"tinycolor2": "^1.4.1",
"tinymce": "^4.7.2",
"uuid": "^3.1.0"
},
"devDependencies": {
"deep-freeze": "^0.0.1",
"enzyme": "^3.3.0",
"react-dom": "^16.4.1",
"react-test-renderer": "^16.4.1"
},
"publishConfig": {
"access": "public"
}
}
File renamed without changes.
Loading