diff --git a/.travis.yml b/.travis.yml
index 5dc3f1ee26230a..2dc47aa01d6422 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,3 @@
-sudo: required
-
dist: trusty
language: php
@@ -19,11 +17,6 @@ cache:
- $HOME/.npm
before_install:
- - |
- git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)' || {
- echo "Only docs were updated, stopping build process."
- exit
- }
- nvm install && nvm use
- npm install npm -g
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 37c7e602bb7085..4ccb59aa2df443 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -104,11 +104,11 @@ For example, `add/gallery-block` means you're working on adding a new gallery bl
You can pick among all the tickets , or some of the ones labelled Good First Issue .
-The workflow is documented in greater detail in the [repository management](./docs/reference/repository-management.md) document.
+The workflow is documented in greater detail in the [repository management](./docs/contributors/repository-management.md) document.
## Testing
-Gutenberg contains both PHP and JavaScript code, and encourages testing and code style linting for both. It also incorporates end-to-end testing using [Google Puppeteer](https://developers.google.com/web/tools/puppeteer/). You can find out more details in [Testing Overview document](./docs/reference/testing-overview.md).
+Gutenberg contains both PHP and JavaScript code, and encourages testing and code style linting for both. It also incorporates end-to-end testing using [Google Puppeteer](https://developers.google.com/web/tools/puppeteer/). You can find out more details in [Testing Overview document](./docs/contributors/testing-overview.md).
## Managing packages
@@ -238,7 +238,7 @@ Choose the correct version based on `CHANGELOG.md` files, confirm your choices a
## How Designers Can Contribute
-If you'd like to contribute to the design or front-end, feel free to contribute to tickets labelled Design . We could use your thoughtful replies, mockups, animatics, sketches, doodles. Proposed changes are best done as minimal and specific iterations on the work that precedes it so we can compare. If you use Sketch , you can grab the source file for the mockups (updated April 6th).
+If you'd like to contribute to the design or front-end, feel free to contribute to tickets labelled [Needs Design](https://github.com/WordPress/gutenberg/issues?q=is%3Aissue+is%3Aopen+label%3A%22Needs+Design%22) or [Needs Design Feedback](https://github.com/WordPress/gutenberg/issues?q=is%3Aissue+is%3Aopen+label%3A"Needs+Design+Feedback%22). We could use your thoughtful replies, mockups, animatics, sketches, doodles. Proposed changes are best done as minimal and specific iterations on the work that precedes it so we can compare. If you use Sketch , you can grab the source file for the mockups (updated April 6th).
## Contribute to the Documentation
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 3a130f10d4ddf2..498a8ea1c131c7 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -119,3 +119,5 @@ This list is manually curated to include valuable contributions by volunteers th
| @luehrsen | @luehrsen |
| @getsource | @mikeschroder |
| @greatislander | @greatislander |
+| @sharazghouri | @sharaz |
+| @jakeparis | @jakeparis |
diff --git a/docs/contributors/scripts.md b/docs/contributors/scripts.md
index 0bd0cf98927921..dd7e1d295d528c 100644
--- a/docs/contributors/scripts.md
+++ b/docs/contributors/scripts.md
@@ -50,13 +50,12 @@ The editor also uses some popular third-party packages and scripts. Plugin devel
| [React](https://reactjs.org) | react | React is a JavaScript library for building user interfaces |
| [React Dom](https://reactjs.org/docs/react-dom.html) | react-dom | Serves as the entry point to the DOM and server renderers for React, intended to be paired with React |
| [Moment](https://momentjs.com/) | moment| Parse, validate, manipulate, and display dates and times in JavaScript |
-| [TinyMCE Lists](https://www.tiny.cloud/docs/plugins/lists/) | tinymce-latest-lists| The `lists` plugin allows you to add numbered and bulleted lists to TinyMCE |
| [Lodash](https://lodash.com) | lodash| Lodash is a JavaScript library which provides utility functions for common programming tasks |
## Polyfill Scripts
The editor also provides polyfills for certain features that may not be available in all modern browsers.
-It is recommened to use the main `wp-polyfill` script handle which takes care of loading all the below mentioned polyfills.
+It is recommened to use the main `wp-polyfill` script handle which takes care of loading all the below mentioned polyfills.
| Script Name | Handle | Description |
|-------------|--------|-------------|
diff --git a/docs/designers-developers/developers/block-api/block-registration.md b/docs/designers-developers/developers/block-api/block-registration.md
index 9738ac482353b7..af8aaa36a75ed2 100644
--- a/docs/designers-developers/developers/block-api/block-registration.md
+++ b/docs/designers-developers/developers/block-api/block-registration.md
@@ -233,8 +233,8 @@ transforms: {
// An attribute can be source from the shortcode attributes
align: {
type: 'string',
- shortcode: function( named ) {
- var align = named.align ? named.align : 'alignnone';
+ shortcode: function( attributes ) {
+ var align = attributes.named.align ? attributes.named.align : 'alignnone';
return align.replace( 'align', '' );
},
},
diff --git a/docs/designers-developers/developers/data/data-core-editor.md b/docs/designers-developers/developers/data/data-core-editor.md
index 25ea6598990d83..f48dc8539dd2ef 100644
--- a/docs/designers-developers/developers/data/data-core-editor.md
+++ b/docs/designers-developers/developers/data/data-core-editor.md
@@ -1292,11 +1292,12 @@ Returns the permalink for the post.
*Returns*
-The permalink.
+The permalink, or null if the post is not viewable.
### getPermalinkParts
-Returns the permalink for a post, split into it's three parts: the prefix, the postName, and the suffix.
+Returns the permalink for a post, split into it's three parts: the prefix,
+the postName, and the suffix.
*Parameters*
@@ -1304,7 +1305,8 @@ Returns the permalink for a post, split into it's three parts: the prefix, the p
*Returns*
-The prefix, postName, and suffix for the permalink.
+An object containing the prefix, postName, and suffix for
+ the permalink, or null if the post is not viewable.
### inSomeHistory
diff --git a/docs/designers-developers/developers/themes/theme-support.md b/docs/designers-developers/developers/themes/theme-support.md
index 9c9a5cc63539c5..abc611dc5d000b 100644
--- a/docs/designers-developers/developers/themes/theme-support.md
+++ b/docs/designers-developers/developers/themes/theme-support.md
@@ -202,7 +202,9 @@ This flag will make sure users are only able to choose colors from the `editor-c
Gutenberg supports the theme's [editor styles](https://codex.wordpress.org/Editor_Style), however it works a little differently than in the classic editor.
-In the classic editor, the editor stylesheet is loaded directly into the iframe of the WYSIWYG editor, with no changes. Gutenberg, however, doesn't use iframes. To make sure your styles are applied only to the content of the editor, we automatically transform your editor styles by selectively rewriting or adjusting certain CSS selectors.
+In the classic editor, the editor stylesheet is loaded directly into the iframe of the WYSIWYG editor, with no changes. Gutenberg, however, doesn't use iframes. To make sure your styles are applied only to the content of the editor, we automatically transform your editor styles by selectively rewriting or adjusting certain CSS selectors. This also allows Gutenberg to leverage your editor style in block variation previews.
+
+For example, if you write `body { ... }` in your editor style, this is rewritten to `.editor-styles-wrapper { ... }`. This also means that you should _not_ target any of the editor class names directly.
Because it works a little differently, you need to opt-in to this by adding an extra snippet to your theme, in addition to the add_editor_style function:
@@ -212,6 +214,8 @@ add_theme_support('editor-styles');
You shouldn't need to change your editor styles too much; most themes can add the snippet above and get similar results in the classic editor and inside Gutenberg.
+### Dark backgrounds
+
If your editor style relies on a dark background, you can add the following to adjust the color of the UI to work on dark backgrounds:
```php
@@ -221,6 +225,16 @@ add_theme_support( 'dark-editor-style' );
Note you don't need to add `add_theme_support( 'editor-styles' );` twice, but that rule does need to be present for the `dark-editor-style` rule to work.
+### Enqueuing the editor style
+
+To make sure your editor style is loaded and parsed correctly, enqueue it using the following method:
+
+```php
+add_editor_style( 'style-editor.css' );
+```
+
+It is enough to paste that in your `functions.php` file, for the style to be loaded and parsed.
+
### Basic colors
You can style the editor like any other webpage. Here's how to change the background color and the font color to blue:
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbars-and-inspector.md b/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbars-and-inspector.md
index 236e9856197696..de6509e4c42b73 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbars-and-inspector.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbars-and-inspector.md
@@ -171,7 +171,7 @@ Note that `BlockControls` is only visible when the block is currently selected a
## Inspector
-
+
The inspector is used to display less-often-used settings or settings that require more screen space. The inspector should be used for **block-level settings only**.
diff --git a/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md b/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
index 91680bbf7d6556..e696b73e4e911d 100644
--- a/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
+++ b/docs/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type.md
@@ -30,6 +30,8 @@ Note the two script dependencies:
- __`wp-blocks`__ includes block type registration and related functions
- __`wp-element`__ includes the [WordPress Element abstraction](https://github.com/WordPress/gutenberg/tree/master/packages/element) for describing the structure of your blocks
+If you were to use a component from the `wp-editor` package, for example the RichText component, you would also need to add `wp-editor` to the dependency list.
+
## Registering the Block
With the script enqueued, let's look at the implementation of the block itself:
diff --git a/docs/manifest.json b/docs/manifest.json
index c461c5d3b9a361..a15c102355f36c 100644
--- a/docs/manifest.json
+++ b/docs/manifest.json
@@ -1,14 +1,14 @@
[
{
"title": "Gutenberg Handbook",
- "slug": "readme",
+ "slug": "handbook",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/readme.md",
"parent": null
},
{
"title": "Designer & Developer Handbook",
"slug": "designers-developers",
- "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/README.md",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/readme.md",
"parent": null
},
{
@@ -27,115 +27,115 @@
"title": "Block API Reference",
"slug": "block-api",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/README.md",
- "parent": "designers-developers/developers"
+ "parent": "developers"
},
{
"title": "Block Registration ",
"slug": "block-registration",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/block-registration.md",
- "parent": "designers-developers/developers/block-api"
+ "parent": "block-api"
},
{
"title": "Edit and Save",
"slug": "block-edit-save",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/block-edit-save.md",
- "parent": "designers-developers/developers/block-api"
+ "parent": "block-api"
},
{
"title": "Attributes",
"slug": "block-attributes",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/block-attributes.md",
- "parent": "designers-developers/developers/block-api"
+ "parent": "block-api"
},
{
"title": "Deprecated Blocks",
"slug": "block-deprecation",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/block-deprecation.md",
- "parent": "designers-developers/developers/block-api"
+ "parent": "block-api"
},
{
"title": "Templates",
"slug": "block-templates",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/block-templates.md",
- "parent": "designers-developers/developers/block-api"
+ "parent": "block-api"
},
{
"title": "Annotations",
"slug": "block-annotations",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/block-api/block-annotations.md",
- "parent": "designers-developers/developers/block-api"
+ "parent": "block-api"
},
{
"title": "Filter Reference",
"slug": "filters",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/filters/README.md",
- "parent": "designers-developers/developers"
+ "parent": "developers"
},
{
"title": "Block Filters",
"slug": "block-filters",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/filters/block-filters.md",
- "parent": "designers-developers/developers/filters"
+ "parent": "filters"
},
{
"title": "Editor Filters (Experimental)",
"slug": "editor-filters",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/filters/editor-filters.md",
- "parent": "designers-developers/developers/filters"
+ "parent": "filters"
},
{
"title": "Parser Filters",
"slug": "parser-filters",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/filters/parser-filters.md",
- "parent": "designers-developers/developers/filters"
+ "parent": "filters"
},
{
"title": "Autocomplete",
"slug": "autocomplete-filters",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/filters/autocomplete-filters.md",
- "parent": "designers-developers/developers/filters"
+ "parent": "filters"
},
{
"title": "Data Module Reference",
"slug": "data",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/data/README.md",
- "parent": "designers-developers/developers"
+ "parent": "developers"
},
{
"title": "Packages",
"slug": "packages",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/packages.md",
- "parent": "designers-developers/developers"
+ "parent": "developers"
},
{
"title": "Theming for Gutenberg",
"slug": "themes",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/themes/README.md",
- "parent": "designers-developers/developers"
+ "parent": "developers"
},
{
"title": "Theme Support",
"slug": "theme-support",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/themes/theme-support.md",
- "parent": "designers-developers/developers/themes"
+ "parent": "themes"
},
{
"title": "Backwards Compatibility",
"slug": "backwards-compatibility",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/backwards-compatibility/README.md",
- "parent": "designers-developers/developers"
+ "parent": "developers"
},
{
"title": "Deprecations",
"slug": "deprecations",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/backwards-compatibility/deprecations.md",
- "parent": "designers-developers/developers/backwards-compatibility"
+ "parent": "backwards-compatibility"
},
{
"title": "Meta Boxes",
"slug": "meta-box",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/backwards-compatibility/meta-box.md",
- "parent": "designers-developers/developers/backwards-compatibility"
+ "parent": "backwards-compatibility"
},
{
"title": "Designer Documentation",
@@ -147,19 +147,19 @@
"title": "Block Design",
"slug": "block-design",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/designers/block-design.md",
- "parent": "designers-developers/designers"
+ "parent": "designers"
},
{
"title": "Patterns",
"slug": "design-patterns",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/designers/design-patterns.md",
- "parent": "designers-developers/designers"
+ "parent": "designers"
},
{
"title": "Resources",
"slug": "design-resources",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/designers/design-resources.md",
- "parent": "designers-developers/designers"
+ "parent": "designers"
},
{
"title": "Glossary",
@@ -173,6 +173,114 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/faq.md",
"parent": "designers-developers"
},
+ {
+ "title": "Contributors",
+ "slug": "contributors",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/readme.md",
+ "parent": null
+ },
+ {
+ "title": "Coding Guidelines",
+ "slug": "coding-guidelines",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/coding-guidelines.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Gutencopy Guidelines",
+ "slug": "copy-guide",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/copy-guide.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Gutenberg Design Principles & Vision",
+ "slug": "design",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/design.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "The Gutenberg block grammar",
+ "slug": "grammar",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/grammar.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "History",
+ "slug": "history",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/history.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Outreach",
+ "slug": "outreach",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/outreach.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Articles",
+ "slug": "articles",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/outreach/articles.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Meetups",
+ "slug": "meetups",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/outreach/meetups.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Resources",
+ "slug": "resources",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/outreach/resources.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Talks",
+ "slug": "talks",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/outreach/talks.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Principles",
+ "slug": "principles",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/principles.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Blocks are the Interface",
+ "slug": "the-block",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/principles/the-block.md",
+ "parent": "principles"
+ },
+ {
+ "title": "Reference",
+ "slug": "reference",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/reference.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Gutenberg Release Process",
+ "slug": "release",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/release.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Repository Management",
+ "slug": "repository-management",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/repository-management.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Scripts",
+ "slug": "scripts",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/scripts.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Testing Overview",
+ "slug": "testing-overview",
+ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/contributors/testing-overview.md",
+ "parent": "contributors"
+ },
{
"title": "Packages",
"slug": "packages",
diff --git a/docs/root-manifest.json b/docs/root-manifest.json
index 784008dd17bb50..0d8c79653cf331 100644
--- a/docs/root-manifest.json
+++ b/docs/root-manifest.json
@@ -1,14 +1,14 @@
[
{
"title": "Gutenberg Handbook",
- "slug": "readme",
+ "slug": "handbook",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/readme.md",
"parent": null
},
{
"title": "Designer & Developer Handbook",
"slug": "designers-developers",
- "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/README.md",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/readme.md",
"parent": null
},
{
@@ -27,115 +27,115 @@
"title": "Block API Reference",
"slug": "block-api",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/README.md",
- "parent": "designers-developers\/developers"
+ "parent": "developers"
},
{
"title": "Block Registration ",
"slug": "block-registration",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/block-registration.md",
- "parent": "designers-developers\/developers\/block-api"
+ "parent": "block-api"
},
{
"title": "Edit and Save",
"slug": "block-edit-save",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/block-edit-save.md",
- "parent": "designers-developers\/developers\/block-api"
+ "parent": "block-api"
},
{
"title": "Attributes",
"slug": "block-attributes",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/block-attributes.md",
- "parent": "designers-developers\/developers\/block-api"
+ "parent": "block-api"
},
{
"title": "Deprecated Blocks",
"slug": "block-deprecation",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/block-deprecation.md",
- "parent": "designers-developers\/developers\/block-api"
+ "parent": "block-api"
},
{
"title": "Templates",
"slug": "block-templates",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/block-templates.md",
- "parent": "designers-developers\/developers\/block-api"
+ "parent": "block-api"
},
{
"title": "Annotations",
"slug": "block-annotations",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/block-api\/block-annotations.md",
- "parent": "designers-developers\/developers\/block-api"
+ "parent": "block-api"
},
{
"title": "Filter Reference",
"slug": "filters",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/filters\/README.md",
- "parent": "designers-developers\/developers"
+ "parent": "developers"
},
{
"title": "Block Filters",
"slug": "block-filters",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/filters\/block-filters.md",
- "parent": "designers-developers\/developers\/filters"
+ "parent": "filters"
},
{
"title": "Editor Filters (Experimental)",
"slug": "editor-filters",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/filters\/editor-filters.md",
- "parent": "designers-developers\/developers\/filters"
+ "parent": "filters"
},
{
"title": "Parser Filters",
"slug": "parser-filters",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/filters\/parser-filters.md",
- "parent": "designers-developers\/developers\/filters"
+ "parent": "filters"
},
{
"title": "Autocomplete",
"slug": "autocomplete-filters",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/filters\/autocomplete-filters.md",
- "parent": "designers-developers\/developers\/filters"
+ "parent": "filters"
},
{
"title": "Data Module Reference",
"slug": "data",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/data\/README.md",
- "parent": "designers-developers\/developers"
+ "parent": "developers"
},
{
"title": "Packages",
"slug": "packages",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/packages.md",
- "parent": "designers-developers\/developers"
+ "parent": "developers"
},
{
"title": "Theming for Gutenberg",
"slug": "themes",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/themes\/README.md",
- "parent": "designers-developers\/developers"
+ "parent": "developers"
},
{
"title": "Theme Support",
"slug": "theme-support",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/themes\/theme-support.md",
- "parent": "designers-developers\/developers\/themes"
+ "parent": "themes"
},
{
"title": "Backwards Compatibility",
"slug": "backwards-compatibility",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/backwards-compatibility\/README.md",
- "parent": "designers-developers\/developers"
+ "parent": "developers"
},
{
"title": "Deprecations",
"slug": "deprecations",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/backwards-compatibility\/deprecations.md",
- "parent": "designers-developers\/developers\/backwards-compatibility"
+ "parent": "backwards-compatibility"
},
{
"title": "Meta Boxes",
"slug": "meta-box",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/developers\/backwards-compatibility\/meta-box.md",
- "parent": "designers-developers\/developers\/backwards-compatibility"
+ "parent": "backwards-compatibility"
},
{
"title": "Designer Documentation",
@@ -147,19 +147,19 @@
"title": "Block Design",
"slug": "block-design",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/designers\/block-design.md",
- "parent": "designers-developers\/designers"
+ "parent": "designers"
},
{
"title": "Patterns",
"slug": "design-patterns",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/designers\/design-patterns.md",
- "parent": "designers-developers\/designers"
+ "parent": "designers"
},
{
"title": "Resources",
"slug": "design-resources",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/designers\/design-resources.md",
- "parent": "designers-developers\/designers"
+ "parent": "designers"
},
{
"title": "Glossary",
@@ -172,5 +172,113 @@
"slug": "faq",
"markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/designers-developers\/faq.md",
"parent": "designers-developers"
+ },
+ {
+ "title": "Contributors",
+ "slug": "contributors",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/readme.md",
+ "parent": null
+ },
+ {
+ "title": "Coding Guidelines",
+ "slug": "coding-guidelines",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/coding-guidelines.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Gutencopy Guidelines",
+ "slug": "copy-guide",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/copy-guide.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Gutenberg Design Principles & Vision",
+ "slug": "design",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/design.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "The Gutenberg block grammar",
+ "slug": "grammar",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/grammar.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "History",
+ "slug": "history",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/history.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Outreach",
+ "slug": "outreach",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/outreach.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Articles",
+ "slug": "articles",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/outreach\/articles.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Meetups",
+ "slug": "meetups",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/outreach\/meetups.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Resources",
+ "slug": "resources",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/outreach\/resources.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Talks",
+ "slug": "talks",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/outreach\/talks.md",
+ "parent": "outreach"
+ },
+ {
+ "title": "Principles",
+ "slug": "principles",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/principles.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Blocks are the Interface",
+ "slug": "the-block",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/principles\/the-block.md",
+ "parent": "principles"
+ },
+ {
+ "title": "Reference",
+ "slug": "reference",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/reference.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Gutenberg Release Process",
+ "slug": "release",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/release.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Repository Management",
+ "slug": "repository-management",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/repository-management.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Scripts",
+ "slug": "scripts",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/scripts.md",
+ "parent": "contributors"
+ },
+ {
+ "title": "Testing Overview",
+ "slug": "testing-overview",
+ "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/contributors\/testing-overview.md",
+ "parent": "contributors"
}
]
\ No newline at end of file
diff --git a/docs/toc.json b/docs/toc.json
index d519837b89a8a8..b9f723a91ab54d 100644
--- a/docs/toc.json
+++ b/docs/toc.json
@@ -1,6 +1,6 @@
[
{"docs/readme.md": []},
- {"docs/designers-developers/README.md": [
+ {"docs/designers-developers/readme.md": [
{"docs/designers-developers/key-concepts.md": []},
{"docs/designers-developers/developers/README.md": [
{"docs/designers-developers/developers/block-api/README.md": [
@@ -34,5 +34,26 @@
]},
{"docs/designers-developers/glossary.md": []},
{"docs/designers-developers/faq.md": []}
+ ]},
+ {"docs/contributors/readme.md": [
+ {"docs/contributors/coding-guidelines.md": []},
+ {"docs/contributors/copy-guide.md": []},
+ {"docs/contributors/design.md": []},
+ {"docs/contributors/grammar.md": []},
+ {"docs/contributors/history.md": []},
+ {"docs/contributors/outreach.md": [
+ {"docs/contributors/outreach/articles.md": []},
+ {"docs/contributors/outreach/meetups.md": []},
+ {"docs/contributors/outreach/resources.md": []},
+ {"docs/contributors/outreach/talks.md": []}
+ ]},
+ {"docs/contributors/principles.md": [
+ {"docs/contributors/principles/the-block.md": []}
+ ]},
+ {"docs/contributors/reference.md": []},
+ {"docs/contributors/release.md": []},
+ {"docs/contributors/repository-management.md": []},
+ {"docs/contributors/scripts.md": []},
+ {"docs/contributors/testing-overview.md": []}
]}
]
diff --git a/gutenberg.php b/gutenberg.php
index 4c99e466cc6b6a..327a6dba8e76fc 100644
--- a/gutenberg.php
+++ b/gutenberg.php
@@ -3,7 +3,7 @@
* Plugin Name: Gutenberg
* Plugin URI: https://github.com/WordPress/gutenberg
* Description: Printing since 1440. This is the development plugin for the new block editor in core.
- * Version: 4.4.0
+ * Version: 4.5.1
* Author: Gutenberg Team
*
* @package gutenberg
@@ -200,13 +200,6 @@ function gutenberg_pre_init() {
add_filter( 'replace_editor', 'gutenberg_init', 10, 2 );
}
-/**
- * Enable Gutenberg based on user_can_richedit setting.
- * Set gutenberg_can_edit_post based on user setting for disable visual editor.
- */
-add_filter( 'gutenberg_can_edit_post_type', 'user_can_richedit', 5 );
-add_filter( 'gutenberg_can_edit_post', 'user_can_richedit', 5 );
-
/**
* Initialize Gutenberg.
*
diff --git a/lib/blocks.php b/lib/blocks.php
index a8083466a04053..0b11041d0576de 100644
--- a/lib/blocks.php
+++ b/lib/blocks.php
@@ -174,6 +174,13 @@ function gutenberg_render_block( $block ) {
* @return string Updated post content.
*/
function do_blocks( $content ) {
+ // If there are blocks in this content, we shouldn't run wpautop() on it later.
+ $priority = has_filter( 'the_content', 'wpautop' );
+ if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
+ remove_filter( 'the_content', 'wpautop', $priority );
+ add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
+ }
+
$blocks = gutenberg_parse_blocks( $content );
$output = '';
@@ -187,6 +194,28 @@ function do_blocks( $content ) {
add_filter( 'the_content', 'do_blocks', 7 ); // BEFORE do_shortcode() and oembed.
}
+if ( ! function_exists( '_restore_wpautop_hook' ) ) {
+ /**
+ * If do_blocks() needs to remove wpautop() from the `the_content` filter,
+ * this re-adds it afterwards, for subsequent `the_content` usage.
+ *
+ * @access private
+ *
+ * @since 4.6.0
+ *
+ * @param string $content The post content running through this filter.
+ * @return string The unmodified content.
+ */
+ function _restore_wpautop_hook( $content ) {
+ $current_priority = has_filter( 'the_content', '_restore_wpautop_hook' );
+
+ add_filter( 'the_content', 'wpautop', $current_priority - 1 );
+ remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority );
+
+ return $content;
+ }
+}
+
if ( ! function_exists( 'strip_dynamic_blocks' ) ) {
/**
* Remove all dynamic blocks from the given content.
diff --git a/lib/client-assets.php b/lib/client-assets.php
index fd1553c3cfd87b..6fa221bf4c5d8c 100644
--- a/lib/client-assets.php
+++ b/lib/client-assets.php
@@ -87,6 +87,8 @@ function register_tinymce_scripts() {
gutenberg_override_script( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce{$mce_suffix}.js", array(), $tinymce_version );
gutenberg_override_script( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin{$suffix}.js", array( 'wp-tinymce-root' ), $tinymce_version );
}
+
+ gutenberg_override_script( 'wp-tinymce-lists', includes_url( 'js/tinymce/' ) . "plugins/lists/plugin{$suffix}.js", array( 'wp-tinymce' ), $tinymce_version );
}
}
@@ -620,12 +622,6 @@ function gutenberg_register_vendor_scripts() {
'https://unpkg.com/moment@2.22.1/' . $moment_script,
array()
);
- $tinymce_version = '4.7.11';
- gutenberg_register_vendor_script(
- 'tinymce-latest-lists',
- 'https://unpkg.com/tinymce@' . $tinymce_version . '/plugins/lists/plugin' . $suffix . '.js',
- array( 'wp-tinymce' )
- );
gutenberg_register_vendor_script(
'lodash',
'https://unpkg.com/lodash@4.17.5/lodash' . $suffix . '.js'
@@ -1055,6 +1051,13 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
'after'
);
+ // Ignore Classic Editor's `rich_editing` user option, aka "Disable visual
+ // editor". Forcing this to be true guarantees that TinyMCE and its plugins
+ // are available in Gutenberg. Fixes
+ // https://github.com/WordPress/gutenberg/issues/5667.
+ $user_can_richedit = user_can_richedit();
+ add_filter( 'user_can_richedit', '__return_true' );
+
wp_enqueue_script( 'wp-edit-post' );
wp_enqueue_script( 'wp-format-library' );
wp_enqueue_style( 'wp-format-library' );
@@ -1208,10 +1211,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
),
);
- /*
- * Set a locale specific default font.
- * Translators: Use this to specify the CSS font family for the default font
- */
+ /* Translators: Use this to specify the CSS font family for the default font */
$locale_font_family = esc_html_x( 'Noto Serif', 'CSS Font Family for Editor Font', 'gutenberg' );
$styles[] = array(
'css' => "body { font-family: '$locale_font_family' }",
@@ -1224,11 +1224,13 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
'css' => file_get_contents( $style ),
);
} else {
- $file = get_theme_file_path( $style );
- $styles[] = array(
- 'css' => file_get_contents( get_theme_file_path( $style ) ),
- 'baseURL' => get_theme_file_uri( $style ),
- );
+ $file = get_theme_file_path( $style );
+ if ( file_exists( $file ) ) {
+ $styles[] = array(
+ 'css' => file_get_contents( $file ),
+ 'baseURL' => get_theme_file_uri( $style ),
+ );
+ }
}
}
}
@@ -1294,6 +1296,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
'allowedMimeTypes' => get_allowed_mime_types(),
'styles' => $styles,
'imageSizes' => gutenberg_get_available_image_sizes(),
+ 'richEditingEnabled' => $user_can_richedit,
// Ideally, we'd remove this and rely on a REST API endpoint.
'postLock' => $lock_details,
diff --git a/lib/compat.php b/lib/compat.php
index 88b417491a89e9..03af8d9302af14 100644
--- a/lib/compat.php
+++ b/lib/compat.php
@@ -99,23 +99,6 @@ function gutenberg_add_rest_nonce_to_heartbeat_response_headers( $response ) {
}
add_filter( 'wp_refresh_nonces', 'gutenberg_add_rest_nonce_to_heartbeat_response_headers' );
-/**
- * As a substitute for the default content `wpautop` filter, applies autop
- * behavior only for posts where content does not contain blocks.
- *
- * @param string $content Post content.
- * @return string Paragraph-converted text if non-block content.
- */
-function gutenberg_wpautop( $content ) {
- if ( has_blocks( $content ) ) {
- return $content;
- }
-
- return wpautop( $content );
-}
-remove_filter( 'the_content', 'wpautop' );
-add_filter( 'the_content', 'gutenberg_wpautop', 6 );
-
/**
* Check if we need to load the block warning in the Classic Editor.
*
diff --git a/lib/packages-dependencies.php b/lib/packages-dependencies.php
index ee99db32c2005b..34c70851ff727c 100644
--- a/lib/packages-dependencies.php
+++ b/lib/packages-dependencies.php
@@ -25,7 +25,6 @@
'wp-block-library' => array(
'editor',
'lodash',
- 'moment',
'wp-api-fetch',
'wp-autop',
'wp-blob',
@@ -134,7 +133,7 @@
'wp-editor' => array(
'jquery',
'lodash',
- 'tinymce-latest-lists',
+ 'wp-tinymce-lists',
'wp-a11y',
'wp-api-fetch',
'wp-blob',
@@ -184,6 +183,7 @@
'wp-is-shallow-equal' => array(),
'wp-keycodes' => array(
'lodash',
+ 'wp-i18n',
),
'wp-list-reusable-blocks' => array(
'lodash',
diff --git a/lib/rest-api.php b/lib/rest-api.php
index 35f4af5c52e77e..2baec1befdd19d 100644
--- a/lib/rest-api.php
+++ b/lib/rest-api.php
@@ -206,6 +206,11 @@ function gutenberg_add_permalink_template_to_posts( $response, $post, $request )
return $response;
}
+ $post_type_obj = get_post_type_object( $post->post_type );
+ if ( ! is_post_type_viewable( $post_type_obj ) || ! $post_type_obj->public ) {
+ return $response;
+ }
+
if ( ! function_exists( 'get_sample_permalink' ) ) {
require_once ABSPATH . '/wp-admin/includes/post.php';
}
diff --git a/package-lock.json b/package-lock.json
index b98a21aac33c39..ab4562395d1a18 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "4.4.0",
+ "version": "4.5.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2283,6 +2283,7 @@
"@wordpress/i18n": "file:packages/i18n",
"@wordpress/rich-text": "file:packages/rich-text",
"lodash": "^4.17.10",
+ "memize": "^1.0.5",
"rememo": "^3.0.0",
"uuid": "^3.3.2"
}
@@ -2359,9 +2360,6 @@
"classnames": "^2.2.5",
"lodash": "^4.17.10",
"memize": "^1.0.5",
- "moment": "^2.22.1",
- "querystring": "^0.2.0",
- "querystringify": "^1.0.0",
"url": "^0.11.0"
}
},
@@ -2659,6 +2657,7 @@
"version": "file:packages/keycodes",
"requires": {
"@babel/runtime": "^7.0.0",
+ "@wordpress/i18n": "file:packages/i18n",
"lodash": "^4.17.10"
}
},
@@ -11402,7 +11401,7 @@
},
"yargs": {
"version": "11.1.0",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
+ "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
"integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==",
"dev": true,
"requires": {
@@ -12713,7 +12712,7 @@
},
"yargs": {
"version": "11.1.0",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
+ "resolved": "http://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz",
"integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==",
"dev": true,
"requires": {
@@ -17738,11 +17737,6 @@
"integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=",
"dev": true
},
- "querystringify": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-1.0.0.tgz",
- "integrity": "sha1-YoYkIRLFtxL6ZU5SZlK/ahP/Bcs="
- },
"quick-lru": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz",
diff --git a/package.json b/package.json
index 19548299b7e193..41b226272d1bad 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "4.4.0",
+ "version": "4.5.1",
"private": true,
"description": "A new WordPress editor experience",
"repository": "git+https://github.com/WordPress/gutenberg.git",
diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md
index f8bd3d08f2c7bc..edceba997fe675 100644
--- a/packages/annotations/CHANGELOG.md
+++ b/packages/annotations/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.3 (2018-11-21)
+
+## 1.0.2 (2018-11-20)
+
## 1.0.1 (2018-11-15)
## 1.0.0 (2018-11-12)
diff --git a/packages/annotations/package.json b/packages/annotations/package.json
index 89eb55c53d0a67..5a73fb5e31ae49 100644
--- a/packages/annotations/package.json
+++ b/packages/annotations/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/annotations",
- "version": "1.0.1",
+ "version": "1.0.3",
"description": "Annotate content in the Gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
@@ -26,6 +26,7 @@
"@wordpress/i18n": "file:../i18n",
"@wordpress/rich-text": "file:../rich-text",
"lodash": "^4.17.10",
+ "memize": "^1.0.5",
"rememo": "^3.0.0",
"uuid": "^3.3.2"
},
diff --git a/packages/annotations/src/format/annotation.js b/packages/annotations/src/format/annotation.js
index a2f6f2973c7268..e72786bad0e3bc 100644
--- a/packages/annotations/src/format/annotation.js
+++ b/packages/annotations/src/format/annotation.js
@@ -1,3 +1,8 @@
+/**
+ * External dependencies
+ */
+import memize from 'memize';
+
/**
* WordPress dependencies
*/
@@ -115,6 +120,40 @@ function updateAnnotationsWithPositions( annotations, positions, { removeAnnotat
} );
}
+/**
+ * Create prepareEditableTree memoized based on the annotation props.
+ *
+ * @param {Object} The props with annotations in them.
+ *
+ * @return {Function} The prepareEditableTree.
+ */
+const createPrepareEditableTree = memize( ( props ) => {
+ const { annotations } = props;
+
+ return ( formats, text ) => {
+ if ( annotations.length === 0 ) {
+ return formats;
+ }
+
+ let record = { formats, text };
+ record = applyAnnotations( record, annotations );
+ return record.formats;
+ };
+} );
+
+/**
+ * Returns the annotations as a props object. Memoized to prevent re-renders.
+ *
+ * @param {Array} The annotations to put in the object.
+ *
+ * @return {Object} The annotations props object.
+ */
+const getAnnotationObject = memize( ( annotations ) => {
+ return {
+ annotations,
+ };
+} );
+
export const annotation = {
name: FORMAT_NAME,
title: __( 'Annotation' ),
@@ -128,21 +167,9 @@ export const annotation = {
return null;
},
__experimentalGetPropsForEditableTreePreparation( select, { richTextIdentifier, blockClientId } ) {
- return {
- annotations: select( STORE_KEY ).__experimentalGetAnnotationsForRichText( blockClientId, richTextIdentifier ),
- };
- },
- __experimentalCreatePrepareEditableTree( { annotations } ) {
- return ( formats, text ) => {
- if ( annotations.length === 0 ) {
- return formats;
- }
-
- let record = { formats, text };
- record = applyAnnotations( record, annotations );
- return record.formats;
- };
+ return getAnnotationObject( select( STORE_KEY ).__experimentalGetAnnotationsForRichText( blockClientId, richTextIdentifier ) );
},
+ __experimentalCreatePrepareEditableTree: createPrepareEditableTree,
__experimentalGetPropsForEditableTreeChangeHandler( dispatch ) {
return {
removeAnnotation: dispatch( STORE_KEY ).__experimentalRemoveAnnotation,
diff --git a/packages/annotations/src/store/selectors.js b/packages/annotations/src/store/selectors.js
index ca6fcb64796d5f..a39a315c92f907 100644
--- a/packages/annotations/src/store/selectors.js
+++ b/packages/annotations/src/store/selectors.js
@@ -4,6 +4,17 @@
import createSelector from 'rememo';
import { get, flatMap } from 'lodash';
+/**
+ * Shared reference to an empty array for cases where it is important to avoid
+ * returning a new array reference on every invocation, as in a connected or
+ * other pure component which performs `shouldComponentUpdate` check on props.
+ * This should be used as a last resort, since the normalized data should be
+ * maintained by the reducer result in state.
+ *
+ * @type {Array}
+ */
+const EMPTY_ARRAY = [];
+
/**
* Returns the annotations for a specific client ID.
*
@@ -19,12 +30,12 @@ export const __experimentalGetAnnotationsForBlock = createSelector(
} );
},
( state, blockClientId ) => [
- get( state, blockClientId, [] ),
+ get( state, blockClientId, EMPTY_ARRAY ),
]
);
export const __experimentalGetAllAnnotationsForBlock = function( state, blockClientId ) {
- return get( state, blockClientId, [] );
+ return get( state, blockClientId, EMPTY_ARRAY );
};
/**
@@ -54,7 +65,7 @@ export const __experimentalGetAnnotationsForRichText = createSelector(
} );
},
( state, blockClientId ) => [
- get( state, blockClientId, [] ),
+ get( state, blockClientId, EMPTY_ARRAY ),
]
);
diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md
index 733d979bc8ce89..912d833f3b909e 100644
--- a/packages/api-fetch/CHANGELOG.md
+++ b/packages/api-fetch/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 2.2.5 (2018-11-20)
+
## 2.2.4 (2018-11-15)
## 2.2.3 (2018-11-12)
@@ -22,4 +24,4 @@
### Breaking Change
-- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
+- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json
index fc9d2ac3295902..3cb6fb3c22979d 100644
--- a/packages/api-fetch/package.json
+++ b/packages/api-fetch/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/api-fetch",
- "version": "2.2.4",
+ "version": "2.2.5",
"description": "Utility to make WordPress REST API requests.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md
index 9dc4bfe833a91b..8a54a337049ce4 100644
--- a/packages/block-library/CHANGELOG.md
+++ b/packages/block-library/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 2.2.7 (2018-11-22)
+
+## 2.2.6 (2018-11-21)
+
+## 2.2.5 (2018-11-20)
+
## 2.2.4 (2018-11-15)
## 2.2.3 (2018-11-12)
diff --git a/packages/block-library/package.json b/packages/block-library/package.json
index b2d15a2e64cef5..5f6dbcd09b9321 100644
--- a/packages/block-library/package.json
+++ b/packages/block-library/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-library",
- "version": "2.2.4",
+ "version": "2.2.7",
"description": "Block library for the WordPress editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
@@ -38,9 +38,6 @@
"classnames": "^2.2.5",
"lodash": "^4.17.10",
"memize": "^1.0.5",
- "moment": "^2.22.1",
- "querystring": "^0.2.0",
- "querystringify": "^1.0.0",
"url": "^0.11.0"
},
"devDependencies": {
diff --git a/packages/block-library/src/archives/index.php b/packages/block-library/src/archives/index.php
index 85186ce6123a3f..3d7b5b42f4ae43 100644
--- a/packages/block-library/src/archives/index.php
+++ b/packages/block-library/src/archives/index.php
@@ -2,7 +2,7 @@
/**
* Server-side rendering of the `core/archives` block.
*
- * @package gutenberg
+ * @package WordPress
*/
/**
@@ -32,7 +32,7 @@ function render_block_core_archives( $attributes ) {
$class .= ' wp-block-archives-dropdown';
$dropdown_id = esc_attr( uniqid( 'wp-block-archives-' ) );
- $title = __( 'Archives', 'default' );
+ $title = __( 'Archives' );
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
$dropdown_args = apply_filters(
@@ -50,19 +50,19 @@ function render_block_core_archives( $attributes ) {
switch ( $dropdown_args['type'] ) {
case 'yearly':
- $label = __( 'Select Year', 'default' );
+ $label = __( 'Select Year' );
break;
case 'monthly':
- $label = __( 'Select Month', 'default' );
+ $label = __( 'Select Month' );
break;
case 'daily':
- $label = __( 'Select Day', 'default' );
+ $label = __( 'Select Day' );
break;
case 'weekly':
- $label = __( 'Select Week', 'default' );
+ $label = __( 'Select Week' );
break;
default:
- $label = __( 'Select Post', 'default' );
+ $label = __( 'Select Post' );
break;
}
@@ -101,7 +101,7 @@ function render_block_core_archives( $attributes ) {
$block_content = sprintf(
'
%2$s
',
$classnames,
- __( 'No archives to show.', 'default' )
+ __( 'No archives to show.' )
);
} else {
diff --git a/packages/block-library/src/block/index.php b/packages/block-library/src/block/index.php
index bc33929ac517ab..aa235f170333ee 100644
--- a/packages/block-library/src/block/index.php
+++ b/packages/block-library/src/block/index.php
@@ -2,7 +2,7 @@
/**
* Server-side rendering of the `core/block` block.
*
- * @package gutenberg
+ * @package WordPress
*/
/**
@@ -22,6 +22,10 @@ function render_block_core_block( $attributes ) {
return '';
}
+ if ( 'publish' !== $reusable_block->post_status || ! empty( $reusable_block->post_password ) ) {
+ return '';
+ }
+
return do_blocks( $reusable_block->post_content );
}
diff --git a/packages/block-library/src/button/editor.scss b/packages/block-library/src/button/editor.scss
index f20d565964dbcd..1330ff2cdf96f9 100644
--- a/packages/block-library/src/button/editor.scss
+++ b/packages/block-library/src/button/editor.scss
@@ -1,5 +1,3 @@
-$blocks-button__line-height: $big-font-size + 6px;
-
.editor-block-list__block[data-type="core/button"] {
&[data-align="center"] {
text-align: center;
@@ -18,7 +16,6 @@ $blocks-button__line-height: $big-font-size + 6px;
.editor-rich-text__tinymce.mce-content-body {
cursor: text;
- line-height: $blocks-button__line-height;
}
// Make placeholder text white unless custom colors or outline versions are chosen.
@@ -31,15 +28,15 @@ $blocks-button__line-height: $big-font-size + 6px;
opacity: 0.8;
}
- // Polish the empty placeholder text for the button in variation previews.
- .editor-rich-text__tinymce[data-is-placeholder-visible="true"] {
- height: auto;
- }
-
// Don't let the placeholder text wrap in the variation preview.
.editor-block-preview__content & {
max-width: 100%;
+ // Polish the empty placeholder text for the button in variation previews.
+ .editor-rich-text__tinymce[data-is-placeholder-visible="true"] {
+ height: auto;
+ }
+
.wp-block-button__link {
max-width: 100%;
overflow: hidden;
@@ -58,7 +55,7 @@ $blocks-button__line-height: $big-font-size + 6px;
font-size: $default-font-size;
line-height: $default-line-height;
- // the width of input box plus padding plus two icon buttons.
+ // The width of input box plus padding plus two icon buttons.
$blocks-button__link-input-width: 300px + 2px + 2 * $icon-button-size;
width: $blocks-button__link-input-width;
diff --git a/packages/block-library/src/button/style.scss b/packages/block-library/src/button/style.scss
index fa72a8bc7835d5..2a45e2e574b38f 100644
--- a/packages/block-library/src/button/style.scss
+++ b/packages/block-library/src/button/style.scss
@@ -1,5 +1,4 @@
-$blocks-button__height: 46px;
-$blocks-button__line-height: $big-font-size + 6px;
+$blocks-button__height: 56px;
.wp-block-button {
color: $white;
@@ -24,13 +23,12 @@ $blocks-button__line-height: $big-font-size + 6px;
cursor: pointer;
display: inline-block;
font-size: $big-font-size;
- line-height: $blocks-button__line-height;
margin: 0;
- padding: ($blocks-button__height - $blocks-button__line-height) / 2 24px;
+ padding: 12px 24px;
text-align: center;
text-decoration: none;
white-space: normal;
- word-break: break-all;
+ overflow-wrap: break-word;
&:hover,
&:focus,
diff --git a/packages/block-library/src/categories/index.php b/packages/block-library/src/categories/index.php
index 478d4579207eac..f302d9ba745383 100644
--- a/packages/block-library/src/categories/index.php
+++ b/packages/block-library/src/categories/index.php
@@ -2,7 +2,7 @@
/**
* Server-side rendering of the `core/categories` block.
*
- * @package gutenberg
+ * @package WordPress
*/
/**
@@ -27,7 +27,7 @@ function render_block_core_categories( $attributes ) {
if ( ! empty( $attributes['displayAsDropdown'] ) ) {
$id = 'wp-block-categories-' . $block_id;
$args['id'] = $id;
- $args['show_option_none'] = __( 'Select Category', 'default' );
+ $args['show_option_none'] = __( 'Select Category' );
$wrapper_markup = '%2$s
';
$items_markup = wp_dropdown_categories( $args );
$type = 'dropdown';
diff --git a/packages/block-library/src/classic/editor.scss b/packages/block-library/src/classic/editor.scss
index 0720c22d4a2c3d..1cda8777992fa7 100644
--- a/packages/block-library/src/classic/editor.scss
+++ b/packages/block-library/src/classic/editor.scss
@@ -116,6 +116,65 @@
cursor: default;
border: 2px dashed rgb(186, 186, 186);
}
+
+ /**
+ * The following gallery styles were replicated
+ * from the styles applied in the tinymce skin,
+ * /wp-includes/js/tinymce/skins/wordpress/wp-content.css.
+ */
+ .wpview-type-gallery::after {
+ content: "";
+ display: table;
+ clear: both;
+ }
+
+ .gallery img[data-mce-selected]:focus {
+ outline: none;
+ }
+
+ .gallery a {
+ cursor: default;
+ }
+
+ .gallery {
+ margin: auto -6px;
+ padding: 6px 0;
+ line-height: 1;
+ overflow-x: hidden;
+ }
+
+ .gallery .gallery-item {
+ float: left;
+ margin: 0;
+ text-align: center;
+ padding: 6px;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+
+ .gallery .gallery-caption,
+ .gallery .gallery-icon {
+ margin: 0;
+ }
+
+ .gallery .gallery-caption {
+ font-size: 13px;
+ margin: 4px 0;
+ }
+
+ @for $i from 1 through 9 {
+ .gallery-columns-#{ $i } .gallery-item {
+ width: #{ (100 / $i) + "%" };
+ }
+ }
+
+ .gallery img {
+ max-width: 100%;
+ height: auto;
+ border: none;
+ padding: 0;
+ }
}
.editor-block-list__layout .editor-block-list__block[data-type="core/freeform"] {
diff --git a/packages/block-library/src/code/edit.native.js b/packages/block-library/src/code/edit.native.js
index 40f1225b2ae755..d4ee2c8071c691 100644
--- a/packages/block-library/src/code/edit.native.js
+++ b/packages/block-library/src/code/edit.native.js
@@ -21,7 +21,7 @@ import styles from './theme.scss';
// Note: styling is applied directly to the (nested) PlainText component. Web-side components
// apply it to the container 'div' but we don't have a proper proposal for cascading styling yet.
export default function CodeEdit( props ) {
- const { attributes, setAttributes, style } = props;
+ const { attributes, setAttributes, style, onFocus, onBlur } = props;
return (
@@ -34,6 +34,8 @@ export default function CodeEdit( props ) {
placeholder={ __( 'Write codeā¦' ) }
aria-label={ __( 'Code' ) }
isSelected={ props.isSelected }
+ onFocus={ onFocus }
+ onBlur={ onBlur }
/>
);
diff --git a/packages/block-library/src/columns/editor.scss b/packages/block-library/src/columns/editor.scss
index db8b558c4a85a7..50b21f23523313 100644
--- a/packages/block-library/src/columns/editor.scss
+++ b/packages/block-library/src/columns/editor.scss
@@ -138,6 +138,6 @@
}
// This selector re-enables clicking on any child of a column block.
-:not(.components-disabled) > .wp-block-columns > .editor-inner-blocks > .editor-block-list__layout > [data-type="core/column"] > .editor-block-list__block-edit .editor-block-list__layout > * {
+:not(.components-disabled) > .wp-block-columns > .editor-inner-blocks > .editor-block-list__layout > [data-type="core/column"] > .editor-block-list__block-edit > * {
pointer-events: all;
}
diff --git a/packages/block-library/src/cover/editor.scss b/packages/block-library/src/cover/editor.scss
index 35eb31ab78c40c..dffeeca07dc3cd 100644
--- a/packages/block-library/src/cover/editor.scss
+++ b/packages/block-library/src/cover/editor.scss
@@ -23,4 +23,21 @@
&.has-right-content .editor-rich-text__inline-toolbar {
justify-content: flex-end;
}
+
+ &.components-placeholder {
+ // use opacity to work in various editor styles
+ background: $dark-opacity-light-200;
+ min-height: 200px;
+
+ .is-dark-theme & {
+ background: $light-opacity-light-200;
+ }
+ }
+
+ // Apply max-width to floated items that have no intrinsic width
+ [data-align="left"] &,
+ [data-align="right"] & {
+ max-width: $content-width / 2;
+ width: 100%;
+ }
}
diff --git a/packages/block-library/src/cover/style.scss b/packages/block-library/src/cover/style.scss
index 806ed02fb2dc9b..5e35c6d8ff809d 100644
--- a/packages/block-library/src/cover/style.scss
+++ b/packages/block-library/src/cover/style.scss
@@ -83,19 +83,27 @@
}
}
- &.components-placeholder {
- height: inherit;
- }
-
// Apply max-width to floated items that have no intrinsic width
- [data-align="left"] &,
- [data-align="right"] &,
&.alignleft,
&.alignright {
max-width: $content-width / 2;
width: 100%;
}
+ // Using flexbox without an assigned height property breaks vertical center alignment in IE11.
+ // Appending an empty ::after element tricks IE11 into giving the cover image an implicit height, which sidesteps this issue.
+ &::after {
+ display: block;
+ content: "";
+ font-size: 0;
+ min-height: inherit;
+
+ // IE doesn't support flex so omit that.
+ @supports (position: sticky) {
+ content: none;
+ }
+ }
+
// Aligned cover blocks should not use our global alignment rules
&.aligncenter,
&.alignleft,
diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss
index 31c6eccaf829c1..eb2dea826189bd 100644
--- a/packages/block-library/src/editor.scss
+++ b/packages/block-library/src/editor.scss
@@ -18,6 +18,7 @@
@import "./list/editor.scss";
@import "./more/editor.scss";
@import "./nextpage/editor.scss";
+@import "./paragraph/editor.scss";
@import "./preformatted/editor.scss";
@import "./pullquote/editor.scss";
@import "./quote/editor.scss";
diff --git a/packages/block-library/src/embed/edit.js b/packages/block-library/src/embed/edit.js
index d5ef390bfa34b6..0e251a8f0aafd0 100644
--- a/packages/block-library/src/embed/edit.js
+++ b/packages/block-library/src/embed/edit.js
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
-import { isFromWordPress, createUpgradedEmbedBlock, getClassNames } from './util';
+import { isFromWordPress, createUpgradedEmbedBlock, getClassNames, fallback } from './util';
import EmbedControls from './embed-controls';
import EmbedLoading from './embed-loading';
import EmbedPlaceholder from './embed-placeholder';
@@ -55,10 +55,11 @@ export function getEmbedEditComponent( title, icon, responsive = true ) {
componentDidUpdate( prevProps ) {
const hasPreview = undefined !== this.props.preview;
const hadPreview = undefined !== prevProps.preview;
- const switchedPreview = this.props.preview && this.props.attributes.url !== prevProps.attributes.url;
+ const previewChanged = prevProps.preview && this.props.preview && this.props.preview.html !== prevProps.preview.html;
+ const switchedPreview = previewChanged || ( hasPreview && ! hadPreview );
const switchedURL = this.props.attributes.url !== prevProps.attributes.url;
- if ( ( hasPreview && ! hadPreview ) || switchedPreview || switchedURL ) {
+ if ( switchedPreview || switchedURL ) {
if ( this.props.cannotEmbed ) {
// Can't embed this URL, and we've just received or switched the preview.
return;
@@ -140,7 +141,7 @@ export function getEmbedEditComponent( title, icon, responsive = true ) {
render() {
const { url, editingURL } = this.state;
const { caption, type, allowResponsive } = this.props.attributes;
- const { fetching, setAttributes, isSelected, className, preview, cannotEmbed, themeSupportsResponsive } = this.props;
+ const { fetching, setAttributes, isSelected, className, preview, cannotEmbed, themeSupportsResponsive, tryAgain } = this.props;
if ( fetching ) {
return (
@@ -161,6 +162,8 @@ export function getEmbedEditComponent( title, icon, responsive = true ) {
value={ url }
cannotEmbed={ cannotEmbed }
onChange={ ( event ) => this.setState( { url: event.target.value } ) }
+ fallback={ () => fallback( url, this.props.onReplace ) }
+ tryAgain={ tryAgain }
/>
);
}
diff --git a/packages/block-library/src/embed/embed-placeholder.js b/packages/block-library/src/embed/embed-placeholder.js
index 1d54279c9027fa..5545c6a3ddd3c8 100644
--- a/packages/block-library/src/embed/embed-placeholder.js
+++ b/packages/block-library/src/embed/embed-placeholder.js
@@ -6,7 +6,7 @@ import { Button, Placeholder } from '@wordpress/components';
import { BlockIcon } from '@wordpress/editor';
const EmbedPlaceholder = ( props ) => {
- const { icon, label, value, onSubmit, onChange, cannotEmbed } = props;
+ const { icon, label, value, onSubmit, onChange, cannotEmbed, fallback, tryAgain } = props;
return (
} label={ label } className="wp-block-embed">
);
diff --git a/packages/block-library/src/embed/settings.js b/packages/block-library/src/embed/settings.js
index a6d68ae80c9b20..d42a406b608ac9 100644
--- a/packages/block-library/src/embed/settings.js
+++ b/packages/block-library/src/embed/settings.js
@@ -14,7 +14,7 @@ import classnames from 'classnames/dedupe';
import { __, sprintf } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { RichText } from '@wordpress/editor';
-import { withSelect } from '@wordpress/data';
+import { withSelect, withDispatch } from '@wordpress/data';
const embedAttributes = {
url: {
@@ -79,6 +79,16 @@ export function getEmbedBlockSettings( { title, description, icon, category = 'e
themeSupportsResponsive: themeSupports[ 'responsive-embeds' ],
cannotEmbed,
};
+ } ),
+ withDispatch( ( dispatch, ownProps ) => {
+ const { url } = ownProps.attributes;
+ const coreData = dispatch( 'core/data' );
+ const tryAgain = () => {
+ coreData.invalidateResolution( 'core', 'getEmbedPreview', [ url ] );
+ };
+ return {
+ tryAgain,
+ };
} )
)( edit ),
diff --git a/packages/block-library/src/embed/util.js b/packages/block-library/src/embed/util.js
index 58b07b0a627743..5352fce1fb58e6 100644
--- a/packages/block-library/src/embed/util.js
+++ b/packages/block-library/src/embed/util.js
@@ -163,3 +163,17 @@ export function getClassNames( html, existingClassNames = '', allowResponsive =
return existingClassNames;
}
+
+/**
+ * Fallback behaviour for unembeddable URLs.
+ * Creates a paragraph block containing a link to the URL, and calls `onReplace`.
+ *
+ * @param {string} url The URL that could not be embedded.
+ * @param {function} onReplace Function to call with the created fallback block.
+ */
+export function fallback( url, onReplace ) {
+ const link = { url } ;
+ onReplace(
+ createBlock( 'core/paragraph', { content: renderToString( link ) } )
+ );
+}
diff --git a/packages/block-library/src/heading/edit.native.js b/packages/block-library/src/heading/edit.native.js
index 6d2ed5bf27e7d2..e613b9156b824a 100644
--- a/packages/block-library/src/heading/edit.native.js
+++ b/packages/block-library/src/heading/edit.native.js
@@ -24,6 +24,14 @@ import './editor.scss';
const minHeight = 50;
class HeadingEdit extends Component {
+ constructor( props ) {
+ super( props );
+
+ this.state = {
+ aztecHeight: 0,
+ };
+ }
+
render() {
const {
attributes,
@@ -48,8 +56,10 @@ class HeadingEdit extends Component {
tagName={ tagName }
value={ content }
isSelected={ this.props.isSelected }
+ onFocus={ this.props.onFocus } // always assign onFocus as a props
+ onBlur={ this.props.onBlur } // always assign onBlur as a props
style={ {
- minHeight: Math.max( minHeight, typeof attributes.aztecHeight === 'undefined' ? 0 : attributes.aztecHeight ),
+ minHeight: Math.max( minHeight, this.state.aztecHeight ),
} }
onChange={ ( event ) => {
// Create a React Tree from the new HTML
@@ -72,7 +82,7 @@ class HeadingEdit extends Component {
undefined
}
onContentSizeChange={ ( event ) => {
- setAttributes( { aztecHeight: event.aztecHeight } );
+ this.setState( { aztecHeight: event.aztecHeight } );
} }
placeholder={ placeholder || __( 'Write headingā¦' ) }
/>
diff --git a/packages/block-library/src/image/edit.js b/packages/block-library/src/image/edit.js
index 7daffa06203b08..cb059b5bfcdc60 100644
--- a/packages/block-library/src/image/edit.js
+++ b/packages/block-library/src/image/edit.js
@@ -441,7 +441,7 @@ class ImageEdit extends Component {
} );
const isResizable = [ 'wide', 'full' ].indexOf( align ) === -1 && isLargeViewport;
- const isLinkURLInputDisabled = linkDestination !== LINK_DESTINATION_CUSTOM;
+ const isLinkURLInputReadOnly = linkDestination !== LINK_DESTINATION_CUSTOM;
const getInspectorControls = ( imageWidth, imageHeight ) => (
@@ -529,8 +529,8 @@ class ImageEdit extends Component {
label={ __( 'Link URL' ) }
value={ href || '' }
onChange={ this.onSetCustomHref }
- placeholder={ ! isLinkURLInputDisabled ? 'https://' : undefined }
- disabled={ isLinkURLInputDisabled }
+ placeholder={ ! isLinkURLInputReadOnly ? 'https://' : undefined }
+ readOnly={ isLinkURLInputReadOnly }
/>
- or tag, based on if they have a URL), 2: post title related to this comment */
- __( '%1$s on %2$s', 'default' ),
+ __( '%1$s on %2$s' ),
$author_markup,
$post_title
);
@@ -119,7 +119,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
}
$class = 'wp-block-latest-comments';
- if ( $attributes['align'] ) {
+ if ( isset( $attributes['align'] ) ) {
$class .= " align{$attributes['align']}";
}
if ( $attributes['displayAvatar'] ) {
@@ -143,7 +143,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
) : sprintf(
'%2$s
',
$classnames,
- __( 'No comments to show.', 'default' )
+ __( 'No comments to show.' )
);
return $block_content;
diff --git a/packages/block-library/src/latest-posts/index.php b/packages/block-library/src/latest-posts/index.php
index 850192a5492c3e..18a43e51828e56 100644
--- a/packages/block-library/src/latest-posts/index.php
+++ b/packages/block-library/src/latest-posts/index.php
@@ -2,7 +2,7 @@
/**
* Server-side rendering of the `core/latest-posts` block.
*
- * @package gutenberg
+ * @package WordPress
*/
/**
@@ -13,16 +13,19 @@
* @return string Returns the post content with latest posts added.
*/
function render_block_core_latest_posts( $attributes ) {
- $recent_posts = wp_get_recent_posts(
- array(
- 'numberposts' => $attributes['postsToShow'],
- 'post_status' => 'publish',
- 'order' => $attributes['order'],
- 'orderby' => $attributes['orderBy'],
- 'category' => $attributes['categories'],
- )
+ $args = array(
+ 'numberposts' => $attributes['postsToShow'],
+ 'post_status' => 'publish',
+ 'order' => $attributes['order'],
+ 'orderby' => $attributes['orderBy'],
);
+ if ( isset( $attributes['categories'] ) ) {
+ $args['category'] = $attributes['categories'];
+ }
+
+ $recent_posts = wp_get_recent_posts( $args );
+
$list_items_markup = '';
foreach ( $recent_posts as $post ) {
@@ -30,7 +33,7 @@ function render_block_core_latest_posts( $attributes ) {
$title = get_the_title( $post_id );
if ( ! $title ) {
- $title = __( '(Untitled)', 'default' );
+ $title = __( '(Untitled)' );
}
$list_items_markup .= sprintf(
'%2$s ',
diff --git a/packages/block-library/src/media-text/index.js b/packages/block-library/src/media-text/index.js
index 281db991ae268a..6cb54f5d3c8309 100644
--- a/packages/block-library/src/media-text/index.js
+++ b/packages/block-library/src/media-text/index.js
@@ -83,6 +83,7 @@ export const settings = {
supports: {
align: [ 'wide', 'full' ],
+ html: false,
},
transforms: {
diff --git a/packages/block-library/src/media-text/media-container.js b/packages/block-library/src/media-text/media-container.js
index fa611a8406b089..863179d748b902 100644
--- a/packages/block-library/src/media-text/media-container.js
+++ b/packages/block-library/src/media-text/media-container.js
@@ -28,7 +28,7 @@ class MediaContainer extends Component {
render={ ( { open } ) => (
diff --git a/packages/block-library/src/more/edit.native.js b/packages/block-library/src/more/edit.native.js
index 2c4d8bf89a693a..5b85da44359d50 100644
--- a/packages/block-library/src/more/edit.native.js
+++ b/packages/block-library/src/more/edit.native.js
@@ -15,7 +15,7 @@ import { PlainText } from '@wordpress/editor';
import styles from './editor.scss';
export default function MoreEdit( props ) {
- const { attributes, setAttributes } = props;
+ const { attributes, setAttributes, onFocus, onBlur } = props;
const { customText } = attributes;
const defaultText = __( 'Read more' );
const value = customText !== undefined ? customText : defaultText;
@@ -32,6 +32,8 @@ export default function MoreEdit( props ) {
onChange={ ( newValue ) => setAttributes( { customText: newValue } ) }
placeholder={ defaultText }
isSelected={ props.isSelected }
+ onFocus={ onFocus }
+ onBlur={ onBlur }
/>
-->
diff --git a/packages/block-library/src/paragraph/edit.native.js b/packages/block-library/src/paragraph/edit.native.js
index 91cc885170144d..ecb075bca8003e 100644
--- a/packages/block-library/src/paragraph/edit.native.js
+++ b/packages/block-library/src/paragraph/edit.native.js
@@ -19,9 +19,13 @@ import styles from './style.scss';
const name = 'core/paragraph';
class ParagraphEdit extends Component {
- constructor() {
- super( ...arguments );
+ constructor( props ) {
+ super( props );
this.splitBlock = this.splitBlock.bind( this );
+
+ this.state = {
+ aztecHeight: 0,
+ };
}
/**
@@ -42,6 +46,7 @@ class ParagraphEdit extends Component {
attributes,
insertBlocksAfter,
setAttributes,
+ onReplace,
} = this.props;
if ( after !== null ) {
@@ -57,8 +62,7 @@ class ParagraphEdit extends Component {
const { content } = attributes;
if ( before === null ) {
- // TODO : If before content is omitted, treat as intent to delete block.
- // onReplace( [] );
+ onReplace( [] );
} else if ( content !== before ) {
// Only update content if it has in-fact changed. In case that user
// has created a new paragraph at end of an existing one, the value
@@ -88,9 +92,11 @@ class ParagraphEdit extends Component {
tagName="p"
value={ content }
isSelected={ this.props.isSelected }
+ onFocus={ this.props.onFocus } // always assign onFocus as a props
+ onBlur={ this.props.onBlur } // always assign onBlur as a props
style={ {
...style,
- minHeight: Math.max( minHeight, typeof attributes.aztecHeight === 'undefined' ? 0 : attributes.aztecHeight ),
+ minHeight: Math.max( minHeight, this.state.aztecHeight ),
} }
onChange={ ( event ) => {
// Create a React Tree from the new HTML
@@ -99,17 +105,12 @@ class ParagraphEdit extends Component {
...this.props.attributes,
content: newParaBlock.attributes.content,
} );
- }
- }
+ } }
onSplit={ this.splitBlock }
onMerge={ mergeBlocks }
onContentSizeChange={ ( event ) => {
- setAttributes( {
- ...this.props.attributes,
- aztecHeight: event.aztecHeight,
- } );
- }
- }
+ this.setState( { aztecHeight: event.aztecHeight } );
+ } }
placeholder={ placeholder || __( 'Add text or type / to add content' ) }
/>
diff --git a/packages/block-library/src/paragraph/editor.scss b/packages/block-library/src/paragraph/editor.scss
new file mode 100644
index 00000000000000..98ea5e4e2b85a4
--- /dev/null
+++ b/packages/block-library/src/paragraph/editor.scss
@@ -0,0 +1,6 @@
+// Specific to the empty paragraph placeholder:
+// when shown on mobile and in nested contexts, the plus to add blocks shows up on the right.
+// This padding makes sure it doesn't overlap text.
+.editor-rich-text__tinymce[data-is-placeholder-visible="true"] + .editor-rich-text__tinymce.wp-block-paragraph {
+ padding-right: $icon-button-size;
+}
diff --git a/packages/block-library/src/shortcode/index.php b/packages/block-library/src/shortcode/index.php
index d18dd4f5828b55..1c0761250d2cfd 100644
--- a/packages/block-library/src/shortcode/index.php
+++ b/packages/block-library/src/shortcode/index.php
@@ -2,7 +2,7 @@
/**
* Server-side rendering of the `core/shortcode` block.
*
- * @package gutenberg
+ * @package WordPress
*/
/**
diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md
index 05a69fef416970..f343aa557aeaa3 100644
--- a/packages/blocks/CHANGELOG.md
+++ b/packages/blocks/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 6.0.2 (2018-11-21)
+
+## 6.0.1 (2018-11-20)
+
## 6.0.0 (2018-11-15)
### Breaking Changes
@@ -19,9 +23,9 @@
## 5.2.0 (2018-11-09)
-- Paste: Google Docs: fix nested formatting, sub, sup and del.
-- Expose @wordpress/editor to Gutenberg mobile.
-- Separate Paste Handler.
+- Paste: Google Docs: fix nested formatting, sub, sup and del.
+- Expose @wordpress/editor to Gutenberg mobile.
+- Separate Paste Handler.
## 5.1.2 (2018-11-03)
@@ -64,7 +68,7 @@
### Breaking Changes
- The `isSharedBlock` function is removed. Use `isReusableBlock` instead.
-- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
+- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
### Deprecations
diff --git a/packages/blocks/package.json b/packages/blocks/package.json
index 176def63903a7c..0235f2c45f3e78 100644
--- a/packages/blocks/package.json
+++ b/packages/blocks/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blocks",
- "version": "6.0.0",
+ "version": "6.0.2",
"description": "Block API for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/blocks/src/api/index.native.js b/packages/blocks/src/api/index.native.js
index aa1056f46631e5..1350df80ec2225 100644
--- a/packages/blocks/src/api/index.native.js
+++ b/packages/blocks/src/api/index.native.js
@@ -14,6 +14,7 @@ export {
} from './serializer';
export {
registerBlockType,
+ getFreeformContentHandlerName,
setUnregisteredTypeHandlerName,
getUnregisteredTypeHandlerName,
getBlockType,
@@ -23,5 +24,8 @@ export {
setDefaultBlockName,
getDefaultBlockName,
} from './registration';
+export {
+ isUnmodifiedDefaultBlock,
+} from './utils';
export { getPhrasingContentSchema } from './raw-handling';
export { default as children } from './children';
diff --git a/packages/blocks/src/api/raw-handling/list-reducer.js b/packages/blocks/src/api/raw-handling/list-reducer.js
index 0025cc6cb5cb60..a5f079dcb24880 100644
--- a/packages/blocks/src/api/raw-handling/list-reducer.js
+++ b/packages/blocks/src/api/raw-handling/list-reducer.js
@@ -29,7 +29,11 @@ export default function( node ) {
prevElement.nodeName === node.nodeName &&
list.children.length === 1
) {
- prevElement.appendChild( list.firstChild );
+ // Move all child nodes, including any text nodes, if any.
+ while ( list.firstChild ) {
+ prevElement.appendChild( list.firstChild );
+ }
+
list.parentNode.removeChild( list );
}
diff --git a/packages/blocks/src/api/raw-handling/test/list-reducer.js b/packages/blocks/src/api/raw-handling/test/list-reducer.js
index cb55a63181a385..9d1b053627295d 100644
--- a/packages/blocks/src/api/raw-handling/test/list-reducer.js
+++ b/packages/blocks/src/api/raw-handling/test/list-reducer.js
@@ -11,6 +11,12 @@ describe( 'listReducer', () => {
expect( deepFilterHTML( input, [ listReducer ] ) ).toEqual( output );
} );
+ it( 'should merge lists with whitespace', () => {
+ const input = '\n';
+ const output = '\n';
+ expect( deepFilterHTML( input, [ listReducer ] ) ).toEqual( output );
+ } );
+
it( 'should not merge lists if it has more than one item', () => {
const input = '';
expect( deepFilterHTML( input, [ listReducer ] ) ).toEqual( input );
diff --git a/packages/blocks/src/api/raw-handling/utils.js b/packages/blocks/src/api/raw-handling/utils.js
index 1494c9b3e11a49..1859da6493a58f 100644
--- a/packages/blocks/src/api/raw-handling/utils.js
+++ b/packages/blocks/src/api/raw-handling/utils.js
@@ -27,7 +27,7 @@ const { ELEMENT_NODE, TEXT_NODE } = window.Node;
* @return {Object} A complete block content schema.
*/
export function getBlockContentSchema( transforms ) {
- const schemas = transforms.map( ( { blockName, schema } ) => {
+ const schemas = transforms.map( ( { isMatch, blockName, schema } ) => {
// If the block supports the "anchor" functionality, it needs to keep its ID attribute.
if ( hasBlockSupport( blockName, 'anchor' ) ) {
for ( const tag in schema ) {
@@ -37,18 +37,41 @@ export function getBlockContentSchema( transforms ) {
schema[ tag ].attributes.push( 'id' );
}
}
+
+ // If an isMatch function exists add it to each schema tag that it applies to.
+ if ( isMatch ) {
+ for ( const tag in schema ) {
+ schema[ tag ].isMatch = isMatch;
+ }
+ }
return schema;
} );
return mergeWith( {}, ...schemas, ( objValue, srcValue, key ) => {
- if ( key === 'children' ) {
- if ( objValue === '*' || srcValue === '*' ) {
- return '*';
- }
+ switch ( key ) {
+ case 'children': {
+ if ( objValue === '*' || srcValue === '*' ) {
+ return '*';
+ }
- return { ...objValue, ...srcValue };
- } else if ( key === 'attributes' || key === 'require' ) {
- return [ ...( objValue || [] ), ...( srcValue || [] ) ];
+ return { ...objValue, ...srcValue };
+ }
+ case 'attributes':
+ case 'require': {
+ return [ ...( objValue || [] ), ...( srcValue || [] ) ];
+ }
+ case 'isMatch': {
+ // If one of the values being merge is undefined (matches everything),
+ // the result of the merge will be undefined.
+ if ( ! objValue || ! srcValue ) {
+ return undefined;
+ }
+ // When merging two isMatch functions, the result is a new function
+ // that returns if one of the source functions returns true.
+ return ( ...args ) => {
+ return objValue( ...args ) || srcValue( ...args );
+ };
+ }
}
} );
}
@@ -153,8 +176,12 @@ function cleanNodeList( nodeList, doc, schema, inline ) {
Array.from( nodeList ).forEach( ( node ) => {
const tag = node.nodeName.toLowerCase();
- // It's a valid child.
- if ( schema.hasOwnProperty( tag ) ) {
+ // It's a valid child, if the tag exists in the schema without an isMatch
+ // function, or with an isMatch function that matches the node.
+ if (
+ schema.hasOwnProperty( tag ) &&
+ ( ! schema[ tag ].isMatch || schema[ tag ].isMatch( node ) )
+ ) {
if ( node.nodeType === ELEMENT_NODE ) {
const { attributes = [], classes = [], children, require = [] } = schema[ tag ];
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 81726381c57f13..9e3643db94c675 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -1,4 +1,8 @@
-## 7.0.0 (Unreleased)
+## 7.0.2 (2018-11-22)
+
+## 7.0.1 (2018-11-21)
+
+## 7.0.0 (2018-11-20)
### Breaking Change
diff --git a/packages/components/package.json b/packages/components/package.json
index 24ad3e68fbd39d..8e470335fa50a6 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/components",
- "version": "6.0.2",
+ "version": "7.0.2",
"description": "UI components for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/components/src/button/index.native.js b/packages/components/src/button/index.native.js
index be7f7caf4369b9..cd38fecd9ed2c2 100644
--- a/packages/components/src/button/index.native.js
+++ b/packages/components/src/button/index.native.js
@@ -1,20 +1,86 @@
/**
* External dependencies
*/
-import { TouchableOpacity, Text, View } from 'react-native';
+import { StyleSheet, TouchableOpacity, Text, View, Platform } from 'react-native';
+
+const isAndroid = Platform.OS === 'android';
+const marginBottom = isAndroid ? -0.5 : 0;
+const marginLeft = -3;
+
+const styles = StyleSheet.create( {
+ container: {
+ flex: 1,
+ padding: 3,
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
+ buttonInactive: {
+ flex: 1,
+ flexDirection: 'row',
+ justifyContent: 'center',
+ alignItems: 'center',
+ aspectRatio: 1,
+ backgroundColor: 'white',
+ },
+ buttonActive: {
+ flex: 1,
+ flexDirection: 'row',
+ justifyContent: 'center',
+ alignItems: 'center',
+ borderRadius: 6,
+ borderColor: '#2e4453',
+ aspectRatio: 1,
+ backgroundColor: '#2e4453',
+ },
+ subscriptInactive: {
+ color: '#7b9ab1',
+ fontWeight: 'bold',
+ fontSize: 13,
+ alignSelf: 'flex-end',
+ marginLeft: marginLeft,
+ marginBottom: marginBottom,
+ },
+ subscriptActive: {
+ color: 'white',
+ fontWeight: 'bold',
+ fontSize: 13,
+ alignSelf: 'flex-end',
+ marginLeft: marginLeft,
+ marginBottom: marginBottom,
+ },
+} );
export default function Button( props ) {
- const { children, onClick, 'aria-label': ariaLabel, 'aria-pressed': ariaPressed, 'data-subscript': subscript } = props;
+ const {
+ children,
+ onClick,
+ disabled,
+ 'aria-disabled': ariaDisabled,
+ 'aria-label': ariaLabel,
+ 'aria-pressed': ariaPressed,
+ 'data-subscript': subscript,
+ } = props;
+
+ const isDisabled = ariaDisabled || disabled;
+ const buttonViewStyle = {
+ opacity: isDisabled ? 0.2 : 1,
+ ...( ariaPressed ? styles.buttonActive : styles.buttonInactive ),
+ };
+
return (
-
- { children }
- { subscript && ( { subscript } ) }
+
+
+ { children }
+ { subscript && ( { subscript } ) }
+
);
diff --git a/packages/components/src/dashicon/icon-class.js b/packages/components/src/dashicon/icon-class.js
new file mode 100644
index 00000000000000..f82b6453ef68e9
--- /dev/null
+++ b/packages/components/src/dashicon/icon-class.js
@@ -0,0 +1,4 @@
+export const IconClass = ( props ) => {
+ const { icon, className } = props;
+ return [ 'dashicon', 'dashicons-' + icon, className ].filter( Boolean ).join( ' ' );
+};
diff --git a/packages/components/src/dashicon/icon-class.native.js b/packages/components/src/dashicon/icon-class.native.js
new file mode 100644
index 00000000000000..09a798008ea1c0
--- /dev/null
+++ b/packages/components/src/dashicon/icon-class.native.js
@@ -0,0 +1,4 @@
+export const IconClass = ( props ) => {
+ const { icon, className, ariaPressed } = props;
+ return [ ariaPressed ? 'dashicon-active' : 'dashicon', 'dashicons-' + icon, className ].filter( Boolean ).join( ' ' );
+};
diff --git a/packages/components/src/dashicon/index.js b/packages/components/src/dashicon/index.js
index 8308c4a97384eb..b58f77bfe371a5 100644
--- a/packages/components/src/dashicon/index.js
+++ b/packages/components/src/dashicon/index.js
@@ -14,18 +14,20 @@ import { Component } from '@wordpress/element';
* Internal dependencies
*/
import { Path, SVG } from '../primitives';
+import { IconClass } from './icon-class';
export default class Dashicon extends Component {
shouldComponentUpdate( nextProps ) {
return (
this.props.icon !== nextProps.icon ||
this.props.size !== nextProps.size ||
- this.props.className !== nextProps.className
+ this.props.className !== nextProps.className ||
+ this.props.ariaPressed !== nextProps.ariaPressed
);
}
render() {
- const { icon, className, size = 20 } = this.props;
+ const { icon, size = 20 } = this.props;
let path;
switch ( icon ) {
@@ -896,7 +898,7 @@ export default class Dashicon extends Component {
return null;
}
- const iconClass = [ 'dashicon', 'dashicons-' + icon, className ].filter( Boolean ).join( ' ' );
+ const iconClass = IconClass( this.props );
return (
- { isString( icon ) ? : icon }
+ { isString( icon ) ? : icon }
{ children }
);
if ( showTooltip ) {
element = (
-
+
{ element }
);
diff --git a/packages/components/src/index.native.js b/packages/components/src/index.native.js
index 47799cd872668a..3e44bdec61e509 100644
--- a/packages/components/src/index.native.js
+++ b/packages/components/src/index.native.js
@@ -2,6 +2,7 @@
export * from './primitives';
export { default as Dashicon } from './dashicon';
export { default as Toolbar } from './toolbar';
+export { default as ToolbarButton } from './toolbar-button';
export { default as withSpokenMessages } from './higher-order/with-spoken-messages';
export { default as IconButton } from './icon-button';
export { createSlotFill, Slot, Fill, Provider as SlotFillProvider } from './slot-fill';
diff --git a/packages/components/src/modal/style.scss b/packages/components/src/modal/style.scss
index 16b5e165ad1d06..99a76a85598c7c 100644
--- a/packages/components/src/modal/style.scss
+++ b/packages/components/src/modal/style.scss
@@ -66,13 +66,20 @@
justify-content: space-between;
background: $white;
align-items: center;
- box-sizing: border-box;
height: $header-height;
position: sticky;
top: 0;
z-index: z-index(".components-modal__header");
margin: 0 -#{ $grid-size-large } $grid-size-large;
+ // Rules inside this query are only run by Microsoft Edge.
+ // Edge has bugs around position: sticky;, so it needs a separate top rule.
+ // See also https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17555420/.
+ @supports (-ms-ime-align:auto) {
+ position: fixed;
+ width: 100%;
+ }
+
.components-modal__header-heading {
font-size: 1em;
font-weight: 400;
@@ -107,4 +114,10 @@
box-sizing: border-box;
height: 100%;
padding: 0 $grid-size-large $grid-size-large;
+
+ // Rules inside this query are only run by Microsoft Edge.
+ // This is a companion top padding to the fixed rule in line 77.
+ @supports (-ms-ime-align:auto) {
+ padding-top: $header-height;
+ }
}
diff --git a/packages/components/src/primitives/svg/index.native.js b/packages/components/src/primitives/svg/index.native.js
index 9f6da4772c48ef..47c49b1bb61289 100644
--- a/packages/components/src/primitives/svg/index.native.js
+++ b/packages/components/src/primitives/svg/index.native.js
@@ -1,13 +1,12 @@
/**
* External dependencies
*/
-import { omit } from 'lodash';
import { Svg } from 'react-native-svg';
/**
* Internal dependencies
*/
-import styles from '../../dashicon/style.scss';
+import styles from './style.scss';
export {
Circle,
@@ -21,24 +20,23 @@ export const SVG = ( props ) => {
// We're using the react-native-classname-to-style plugin, so when a `className` prop is passed it gets converted to `style` here.
// Given it carries a string (as it was originally className) but an object is expected for `style`,
// we need to check whether `style` exists and is a string, and convert it to an object
- let styleKeys = new Array();
- const styleValues = new Array();
- if ( typeof props.style === 'string' || props.style instanceof String ) {
- styleKeys = props.style.split( ' ' );
- styleKeys.forEach( ( element ) => {
- const oneStyle = styles[ element ];
- if ( oneStyle !== undefined ) {
- styleValues.push( oneStyle );
- }
- } );
+
+ let styleValues = {};
+ if ( typeof props.style === 'string' ) {
+ const oneStyle = props.style.split( ' ' ).map( ( element ) => styles[ element ] ).filter( Boolean );
+ styleValues = Object.assign( styleValues, ...oneStyle );
}
- const safeProps = styleValues.length === 0 ? { ...omit( props, [ 'style' ] ) } : { ...props, style: styleValues };
+ const safeProps = { ...props, style: styleValues };
+
return (
);
};
+
diff --git a/packages/components/src/primitives/svg/style.native.scss b/packages/components/src/primitives/svg/style.native.scss
new file mode 100644
index 00000000000000..a6017e488b9228
--- /dev/null
+++ b/packages/components/src/primitives/svg/style.native.scss
@@ -0,0 +1,14 @@
+.dashicon {
+ color: #7b9ab1;
+ fill: currentColor;
+}
+
+.dashicon-active {
+ color: #fff;
+ fill: currentColor;
+}
+
+.dashicons-insert {
+ color: #87a6bc;
+ fill: currentColor;
+}
diff --git a/packages/components/src/toolbar/style.native.scss b/packages/components/src/toolbar/style.native.scss
new file mode 100644
index 00000000000000..aca87d859b8bb6
--- /dev/null
+++ b/packages/components/src/toolbar/style.native.scss
@@ -0,0 +1,7 @@
+.container {
+ flex-direction: row;
+ border-right-width: 1px;
+ border-right-color: #e9eff3;
+ padding-left: 5px;
+ padding-right: 5px;
+}
diff --git a/packages/components/src/toolbar/toolbar-container.native.js b/packages/components/src/toolbar/toolbar-container.native.js
index 08106a987f4089..dba6d5123c1ae7 100644
--- a/packages/components/src/toolbar/toolbar-container.native.js
+++ b/packages/components/src/toolbar/toolbar-container.native.js
@@ -3,8 +3,12 @@
*/
import { View } from 'react-native';
-export default ( props ) => (
-
+import styles from './style.scss';
+
+const ToolbarContainer = ( props ) => (
+
{ props.children }
);
+
+export default ToolbarContainer;
diff --git a/packages/core-data/CHANGELOG.md b/packages/core-data/CHANGELOG.md
index aebc238e5fe4aa..98ed42a5473f08 100644
--- a/packages/core-data/CHANGELOG.md
+++ b/packages/core-data/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 2.0.14 (2018-11-20)
+
## 2.0.13 (2018-11-15)
## 2.0.12 (2018-11-12)
@@ -26,4 +28,4 @@
- `select("core").getCategories` has been deprecated. Please use `select("core").getEntityRecords` instead.
- `wp.data.select("core").isRequestingCategories` has been deprecated. Please use `wp.data.select("core/data").isResolving` instead.
- `select("core").isRequestingTerms` has been deprecated. Please use `select("core").isResolving` instead.
-- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
+- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
diff --git a/packages/core-data/package.json b/packages/core-data/package.json
index 0ae20c85125e77..ad9917d785bad3 100644
--- a/packages/core-data/package.json
+++ b/packages/core-data/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/core-data",
- "version": "2.0.13",
+ "version": "2.0.14",
"description": "Access to and manipulation of core WordPress entities.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/data/CHANGELOG.md b/packages/data/CHANGELOG.md
index 24d44618c11ffd..18139501460cc3 100644
--- a/packages/data/CHANGELOG.md
+++ b/packages/data/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 4.0.1 (2018-11-20)
+
## 4.0.0 (2018-11-15)
### Breaking Changes
@@ -68,5 +70,5 @@
- The `withRehdyration` function is removed. Use the persistence plugin instead.
- The `loadAndPersist` function is removed. Use the persistence plugin instead.
-- `restrictPersistence`, `setPersistenceStorage` and `setupPersistence` functions have been removed. Please use the data persistence plugin instead.
-- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
+- `restrictPersistence`, `setPersistenceStorage` and `setupPersistence` functions have been removed. Please use the data persistence plugin instead.
+- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
diff --git a/packages/data/package.json b/packages/data/package.json
index c0bd206f435136..493c9af3bd7be5 100644
--- a/packages/data/package.json
+++ b/packages/data/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/data",
- "version": "4.0.0",
+ "version": "4.0.1",
"description": "Data module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/date/src/index.js b/packages/date/src/index.js
index 4bd87396a58aad..24eb69434fd2e8 100644
--- a/packages/date/src/index.js
+++ b/packages/date/src/index.js
@@ -2,9 +2,11 @@
* External dependencies
*/
import momentLib from 'moment';
-import 'moment-timezone';
+import 'moment-timezone/moment-timezone';
import 'moment-timezone/moment-timezone-utils';
+const WP_ZONE = 'WP';
+
// Changes made here will likely need to be made in `lib/client-assets.php` as
// well because it uses the `setSettings()` function to change these settings.
let settings = {
@@ -92,8 +94,8 @@ export function __experimentalGetSettings() {
function setupWPTimezone() {
// Create WP timezone based off dateSettings.
momentLib.tz.add( momentLib.tz.pack( {
- name: 'WP',
- abbrs: [ 'WP' ],
+ name: WP_ZONE,
+ abbrs: [ WP_ZONE ],
untils: [ null ],
offsets: [ -settings.timezone.offset * 60 || 0 ],
} ) );
@@ -371,8 +373,8 @@ export function dateI18n( dateFormat, dateValue = new Date(), gmt = false ) {
* @return {boolean} Is in the future.
*/
export function isInTheFuture( dateValue ) {
- const now = momentLib.tz( 'WP' );
- const momentObject = momentLib.tz( dateValue, 'WP' );
+ const now = momentLib.tz( WP_ZONE );
+ const momentObject = momentLib.tz( dateValue, WP_ZONE );
return momentObject.isAfter( now );
}
@@ -386,10 +388,10 @@ export function isInTheFuture( dateValue ) {
*/
export function getDate( dateString ) {
if ( ! dateString ) {
- return momentLib.tz( 'WP' ).toDate();
+ return momentLib.tz( WP_ZONE ).toDate();
}
- return momentLib.tz( dateString, 'WP' ).toDate();
+ return momentLib.tz( dateString, WP_ZONE ).toDate();
}
setupWPTimezone();
diff --git a/packages/dom/CHANGELOG.md b/packages/dom/CHANGELOG.md
index a14324346a986b..9e07c5fa5ef3ce 100644
--- a/packages/dom/CHANGELOG.md
+++ b/packages/dom/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 2.0.7 (2018-11-20)
+
## 2.0.6 (2018-11-09)
## 2.0.5 (2018-11-09)
@@ -10,4 +12,4 @@
### Breaking Change
-- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
+- Change how required built-ins are polyfilled with Babel 7 ([#9171](https://github.com/WordPress/gutenberg/pull/9171)). If you're using an environment that has limited or no support for ES2015+ such as lower versions of IE then using [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/en/next/babel-polyfill) will add support for these methods.
diff --git a/packages/dom/package.json b/packages/dom/package.json
index 896a7bbf21a3eb..4da707b746bfe7 100644
--- a/packages/dom/package.json
+++ b/packages/dom/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/dom",
- "version": "2.0.6",
+ "version": "2.0.7",
"description": "DOM utilities module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-post/CHANGELOG.md b/packages/edit-post/CHANGELOG.md
index 4eeda8d66d7502..055d3a6b47b011 100644
--- a/packages/edit-post/CHANGELOG.md
+++ b/packages/edit-post/CHANGELOG.md
@@ -1,4 +1,8 @@
-## 3.1.0 (Unreleased)
+## 3.1.2 (2018-11-22)
+
+## 3.1.1 (2018-11-21)
+
+## 3.1.0 (2018-11-20)
### New Feature
diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json
index 05132ff4e3974a..c871c899256c9e 100644
--- a/packages/edit-post/package.json
+++ b/packages/edit-post/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/edit-post",
- "version": "3.0.2",
+ "version": "3.1.2",
"description": "Edit Post module for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/edit-post/src/components/header/header-toolbar/index.js b/packages/edit-post/src/components/header/header-toolbar/index.js
index e5e92af1f2a645..ef56ca64b3ad77 100644
--- a/packages/edit-post/src/components/header/header-toolbar/index.js
+++ b/packages/edit-post/src/components/header/header-toolbar/index.js
@@ -21,7 +21,7 @@ import {
*/
import FullscreenModeClose from '../fullscreen-mode-close';
-function HeaderToolbar( { hasFixedToolbar, isLargeViewport, mode } ) {
+function HeaderToolbar( { hasFixedToolbar, isLargeViewport, showInserter } ) {
const toolbarAriaLabel = hasFixedToolbar ?
/* translators: accessibility text for the editor toolbar when Top Toolbar is on */
__( 'Document and block tools' ) :
@@ -35,7 +35,7 @@ function HeaderToolbar( { hasFixedToolbar, isLargeViewport, mode } ) {
>
-
+
{ __( 'Welcome to the wonderful world of blocks! Click the ā+ā (āAdd blockā) button to add a new block. There are blocks available for all kinds of content: you can insert text, headings, images, lists, and lots more!' ) }
@@ -56,7 +56,7 @@ function HeaderToolbar( { hasFixedToolbar, isLargeViewport, mode } ) {
export default compose( [
withSelect( ( select ) => ( {
hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' ),
- mode: select( 'core/edit-post' ).getEditorMode(),
+ showInserter: select( 'core/edit-post' ).getEditorMode() === 'visual' && select( 'core/editor' ).getEditorSettings().richEditingEnabled,
} ) ),
withViewportMatch( { isLargeViewport: 'medium' } ),
] )( HeaderToolbar );
diff --git a/packages/edit-post/src/components/header/mode-switcher/index.js b/packages/edit-post/src/components/header/mode-switcher/index.js
index 849284d8e73a75..52ca0b78cfc945 100644
--- a/packages/edit-post/src/components/header/mode-switcher/index.js
+++ b/packages/edit-post/src/components/header/mode-switcher/index.js
@@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { MenuItemsChoice, MenuGroup } from '@wordpress/components';
-import { compose } from '@wordpress/compose';
+import { compose, ifCondition } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
/**
@@ -49,8 +49,10 @@ function ModeSwitcher( { onSwitch, mode } ) {
export default compose( [
withSelect( ( select ) => ( {
+ isRichEditingEnabled: select( 'core/editor' ).getEditorSettings().richEditingEnabled,
mode: select( 'core/edit-post' ).getEditorMode(),
} ) ),
+ ifCondition( ( { isRichEditingEnabled } ) => isRichEditingEnabled ),
withDispatch( ( dispatch, ownProps ) => ( {
onSwitch( mode ) {
dispatch( 'core/edit-post' ).switchEditorMode( mode );
diff --git a/packages/edit-post/src/components/header/more-menu/index.js b/packages/edit-post/src/components/header/more-menu/index.js
index a65aa8c9b2fbc8..223c2c0f272612 100644
--- a/packages/edit-post/src/components/header/more-menu/index.js
+++ b/packages/edit-post/src/components/header/more-menu/index.js
@@ -26,6 +26,7 @@ const MoreMenu = () => (
diff --git a/packages/edit-post/src/components/header/more-menu/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/header/more-menu/test/__snapshots__/index.js.snap
index 244a185376638c..4049a747b3fe0a 100644
--- a/packages/edit-post/src/components/header/more-menu/test/__snapshots__/index.js.snap
+++ b/packages/edit-post/src/components/header/more-menu/test/__snapshots__/index.js.snap
@@ -16,9 +16,11 @@ exports[`MoreMenu should match snapshot 1`] = `
aria-expanded={false}
icon="ellipsis"
label="Show more tools & options"
+ labelPosition="bottom"
onClick={[Function]}
>
( {
+ isRichEditingEnabled: select( 'core/editor' ).getEditorSettings().richEditingEnabled,
mode: select( 'core/edit-post' ).getEditorMode(),
isEditorSidebarOpen: select( 'core/edit-post' ).isEditorSidebarOpened(),
hasBlockSelection: !! select( 'core/editor' ).getBlockSelectionStart(),
diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js
index ed5773e5182f5b..5a4018bc9dd1b6 100644
--- a/packages/edit-post/src/components/layout/index.js
+++ b/packages/edit-post/src/components/layout/index.js
@@ -50,6 +50,7 @@ function Layout( {
hasActiveMetaboxes,
isSaving,
isMobileViewport,
+ isRichEditingEnabled,
} ) {
const sidebarIsOpened = editorSidebarOpened || pluginSidebarOpened || publishSidebarOpened;
@@ -84,8 +85,8 @@ function Layout( {
- { mode === 'text' && }
- { mode === 'visual' && }
+ { ( mode === 'text' || ! isRichEditingEnabled ) && }
+ { isRichEditingEnabled && mode === 'visual' && }
@@ -137,6 +138,7 @@ export default compose(
hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' ),
hasActiveMetaboxes: select( 'core/edit-post' ).hasMetaBoxes(),
isSaving: select( 'core/edit-post' ).isSavingMetaBoxes(),
+ isRichEditingEnabled: select( 'core/editor' ).getEditorSettings().richEditingEnabled,
} ) ),
withDispatch( ( dispatch ) => {
const { closePublishSidebar, togglePublishSidebar } = dispatch( 'core/edit-post' );
diff --git a/packages/edit-post/src/components/sidebar/settings-header/index.js b/packages/edit-post/src/components/sidebar/settings-header/index.js
index 33a3bbc27e29ab..e2866c231a1c98 100644
--- a/packages/edit-post/src/components/sidebar/settings-header/index.js
+++ b/packages/edit-post/src/components/sidebar/settings-header/index.js
@@ -12,16 +12,16 @@ import SidebarHeader from '../sidebar-header';
const SettingsHeader = ( { openDocumentSettings, openBlockSettings, sidebarName } ) => {
const blockLabel = __( 'Block' );
const [ documentAriaLabel, documentActiveClass ] = sidebarName === 'edit-post/document' ?
- // translators: ARIA label for the Document Settings sidebar tab, selected.
- [ __( 'Document settings (selected)' ), 'is-active' ] :
- // translators: ARIA label for the Document Settings sidebar tab, not selected.
- [ __( 'Document settings' ), '' ];
+ // translators: ARIA label for the Document sidebar tab, selected.
+ [ __( 'Document (selected)' ), 'is-active' ] :
+ // translators: ARIA label for the Document sidebar tab, not selected.
+ [ __( 'Document' ), '' ];
const [ blockAriaLabel, blockActiveClass ] = sidebarName === 'edit-post/block' ?
- // translators: ARIA label for the Block Settings sidebar tab, selected.
- [ __( 'Block settings (selected)' ), 'is-active' ] :
- // translators: ARIA label for the Block Settings sidebar tab, not selected.
- [ __( 'Block settings' ), '' ];
+ // translators: ARIA label for the Block sidebar tab, selected.
+ [ __( 'Block (selected)' ), 'is-active' ] :
+ // translators: ARIA label for the Block sidebar tab, not selected.
+ [ __( 'Block' ), '' ];
return (
-
-
{ __( 'Editing Code' ) }
-
- { __( 'Exit Code Editor' ) }
-
-
+ { isRichEditingEnabled && (
+
+
{ __( 'Editing Code' ) }
+
+ { __( 'Exit Code Editor' ) }
+
+
+ ) }
@@ -28,10 +31,15 @@ function TextEditor( { onExit } ) {
);
}
-export default withDispatch( ( dispatch ) => {
- return {
- onExit() {
- dispatch( 'core/edit-post' ).switchEditorMode( 'visual' );
- },
- };
-} )( TextEditor );
+export default compose(
+ withSelect( ( select ) => ( {
+ isRichEditingEnabled: select( 'core/editor' ).getEditorSettings().richEditingEnabled,
+ } ) ),
+ withDispatch( ( dispatch ) => {
+ return {
+ onExit() {
+ dispatch( 'core/edit-post' ).switchEditorMode( 'visual' );
+ },
+ };
+ } )
+)( TextEditor );
diff --git a/packages/edit-post/src/components/visual-editor/style.scss b/packages/edit-post/src/components/visual-editor/style.scss
index 67128f843aca47..f796ed8e4c7594 100644
--- a/packages/edit-post/src/components/visual-editor/style.scss
+++ b/packages/edit-post/src/components/visual-editor/style.scss
@@ -35,9 +35,17 @@
height: 0; // This collapses the container to an invisible element without margin.
text-align: center;
+ // This float rule takes the toolbar out of the flow, without it having to be absolute positioned.
+ // This is necessary because otherwise the mere presence of the toolbar can push down content.
+ // Pairs with relative rule on line 49.
+ float: left;
+
.editor-block-toolbar {
max-width: $content-width;
width: 100%;
+
+ // Necessary for the toolbar to be centered.
+ // This unsets an absolute position that will otherwise left align the toolbar.
position: relative;
}
}
@@ -47,10 +55,6 @@
width: 100%;
margin-left: 0;
margin-right: 0;
-
- .editor-block-toolbar {
- max-width: $content-width - $border-width - $border-width;
- }
}
}
}
diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md
index 65eb76bccf8f7b..d5b4c4b4bae694 100644
--- a/packages/editor/CHANGELOG.md
+++ b/packages/editor/CHANGELOG.md
@@ -1,4 +1,14 @@
-## 9.0.0 (Unreleased)
+## 9.0.3 (Unreleased)
+
+### Bug Fixes
+
+- `getEditedPostAttribute` now correctly returns the merged result of edits as a partial change when given `'meta'` as the `attributeName`.
+
+## 9.0.2 (2018-11-22)
+
+## 9.0.1 (2018-11-21)
+
+## 9.0.0 (2018-11-20)
### Breaking Changes
diff --git a/packages/editor/package.json b/packages/editor/package.json
index 71b536aa1ba38b..45f6c934df1b1f 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/editor",
- "version": "8.0.0",
+ "version": "9.0.2",
"description": "Building blocks for WordPress editors.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/editor/src/components/block-list/style.scss b/packages/editor/src/components/block-list/style.scss
index e7e13f8a9e06aa..3ecb8dcc263b82 100644
--- a/packages/editor/src/components/block-list/style.scss
+++ b/packages/editor/src/components/block-list/style.scss
@@ -870,7 +870,7 @@
// Hide right border on desktop, where the .components-toolbar instead has a right border.
border-right: none;
- // This prevents floats from messing up the position.
+ // This prevents floats from messing up the position of the block toolbar on floats-adjacent blocks when selected.
position: absolute;
left: 0;
}
diff --git a/packages/editor/src/components/block-navigation/dropdown.js b/packages/editor/src/components/block-navigation/dropdown.js
index 20910e4eebb042..c6b8e976db5cc3 100644
--- a/packages/editor/src/components/block-navigation/dropdown.js
+++ b/packages/editor/src/components/block-navigation/dropdown.js
@@ -5,6 +5,7 @@ import { Fragment } from '@wordpress/element';
import { IconButton, Dropdown, SVG, Path, KeyboardShortcuts } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { rawShortcut, displayShortcut } from '@wordpress/keycodes';
+import { withSelect } from '@wordpress/data';
/**
* Internal dependencies
@@ -17,7 +18,7 @@ const MenuIcon = (
);
-function BlockNavigationDropdown() {
+function BlockNavigationDropdown( { hasBlocks } ) {
return (
(
@@ -31,10 +32,11 @@ function BlockNavigationDropdown() {
) }
@@ -45,4 +47,8 @@ function BlockNavigationDropdown() {
);
}
-export default BlockNavigationDropdown;
+export default withSelect( ( select ) => {
+ return {
+ hasBlocks: !! select( 'core/editor' ).getBlockCount(),
+ };
+} )( BlockNavigationDropdown );
diff --git a/packages/editor/src/components/block-navigation/index.js b/packages/editor/src/components/block-navigation/index.js
index 117640b5677fe2..98a55c38af7d7e 100644
--- a/packages/editor/src/components/block-navigation/index.js
+++ b/packages/editor/src/components/block-navigation/index.js
@@ -67,6 +67,10 @@ function BlockNavigationList( {
}
function BlockNavigation( { rootBlock, rootBlocks, selectedBlockClientId, selectBlock } ) {
+ if ( ! rootBlocks || rootBlocks.length === 0 ) {
+ return null;
+ }
+
const hasHierarchy = (
rootBlock && (
rootBlock.clientId !== selectedBlockClientId ||
@@ -95,13 +99,6 @@ function BlockNavigation( { rootBlock, rootBlocks, selectedBlockClientId, select
selectBlock={ selectBlock }
/>
) }
- { ( ! rootBlocks || rootBlocks.length === 0 ) && (
- // If there are no blocks in this document, don't render a list of blocks.
- // Instead: inform the user no blocks exist yet.
-
- { __( 'No blocks created yet.' ) }
-
- ) }
);
}
diff --git a/packages/editor/src/components/block-styles/style.scss b/packages/editor/src/components/block-styles/style.scss
index 53a609012f74e4..8816ea0b9c4f82 100644
--- a/packages/editor/src/components/block-styles/style.scss
+++ b/packages/editor/src/components/block-styles/style.scss
@@ -38,14 +38,17 @@
height: 60px;
background: $white;
- > * {
+ // Actual preview contents.
+ .editor-block-preview__content {
transform: scale(0.7);
transform-origin: center center;
- font-family: $editor-font;
- }
-
- .editor-block-preview__content {
width: 100%;
+
+ // Unset some of the styles that might be inherited from the editor style.
+ margin: 0;
+ padding: 0;
+ overflow: visible;
+ min-height: auto;
}
}
diff --git a/packages/editor/src/components/block-switcher/index.js b/packages/editor/src/components/block-switcher/index.js
index 390e6a7f321371..adc4bf4efc142e 100644
--- a/packages/editor/src/components/block-switcher/index.js
+++ b/packages/editor/src/components/block-switcher/index.js
@@ -47,7 +47,7 @@ export class BlockSwitcher extends Component {
const possibleBlockTransformations = orderBy(
filter(
getPossibleBlockTransformations( blocks ),
- ( block ) => !! itemsByName[ block.name ]
+ ( block ) => block && !! itemsByName[ block.name ]
),
( block ) => itemsByName[ block.name ].frecency,
'desc'
diff --git a/packages/editor/src/components/block-switcher/style.scss b/packages/editor/src/components/block-switcher/style.scss
index daebe5a47ea72f..a994ff75424044 100644
--- a/packages/editor/src/components/block-switcher/style.scss
+++ b/packages/editor/src/components/block-switcher/style.scss
@@ -74,7 +74,8 @@
}
.components-popover:not(.is-mobile).editor-block-switcher__popover .components-popover__content {
- min-width: 320px;
+ min-width: 300px;
+ max-width: 340px;
}
.editor-block-switcher__popover .components-popover__content {
diff --git a/packages/editor/src/components/document-outline/index.js b/packages/editor/src/components/document-outline/index.js
index ad2ca5c2b61816..258bb792e7e3fd 100644
--- a/packages/editor/src/components/document-outline/index.js
+++ b/packages/editor/src/components/document-outline/index.js
@@ -9,12 +9,15 @@ import { countBy, flatMap, get } from 'lodash';
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
+import {
+ create,
+ getTextContent,
+} from '@wordpress/rich-text';
/**
* Internal dependencies
*/
import DocumentOutlineItem from './item';
-import RichText from './../rich-text';
/**
* Module constants
@@ -120,10 +123,9 @@ export const DocumentOutline = ( { blocks = [], title, onSelect, isTitleSupporte
>
{ item.isEmpty ?
emptyHeadingContent :
-
+ getTextContent(
+ create( { html: item.attributes.content } )
+ )
}
{ isIncorrectLevel && incorrectLevelContent }
{ item.level === 1 && hasMultipleH1 && multipleH1Headings }
diff --git a/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap b/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap
index a038d12930951e..89d0ebb04d6582 100644
--- a/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap
+++ b/packages/editor/src/components/document-outline/test/__snapshots__/index.js.snap
@@ -12,11 +12,7 @@ exports[`DocumentOutline header blocks present should match snapshot 1`] = `
onClick={[Function]}
path={Array []}
>
-
+ Heading parent
-
+ Heading child
@@ -47,11 +39,7 @@ exports[`DocumentOutline header blocks present should render warnings for multip
onClick={[Function]}
path={Array []}
>
-
+ Heading 1
@@ -68,11 +56,7 @@ exports[`DocumentOutline header blocks present should render warnings for multip
onClick={[Function]}
path={Array []}
>
-
+ Heading 1
diff --git a/packages/editor/src/components/index.native.js b/packages/editor/src/components/index.native.js
index 17943dee6b3ae2..dc651f9e7e0a6b 100644
--- a/packages/editor/src/components/index.native.js
+++ b/packages/editor/src/components/index.native.js
@@ -6,3 +6,5 @@ export { default as MediaPlaceholder } from './media-placeholder';
export { default as BlockFormatControls } from './block-format-controls';
export { default as BlockControls } from './block-controls';
export { default as BlockEdit } from './block-edit';
+export { default as EditorHistoryRedo } from './editor-history/redo';
+export { default as EditorHistoryUndo } from './editor-history/undo';
diff --git a/packages/editor/src/components/inserter/index.js b/packages/editor/src/components/inserter/index.js
index 1133f6e827faed..0012fbc8ddb1d1 100644
--- a/packages/editor/src/components/inserter/index.js
+++ b/packages/editor/src/components/inserter/index.js
@@ -16,6 +16,7 @@ const defaultRenderToggle = ( { onToggle, disabled, isOpen } ) => (
this._input = x }
className={ [ styles[ 'editor-plain-text' ], this.props.className ] }
onChangeText={ ( text ) => this.props.onChange( text ) }
+ onFocus={ this.props.onFocus } // always assign onFocus as a props
+ onBlur={ this.props.onBlur } // always assign onBlur as a props
{ ...this.props }
/>
);
diff --git a/packages/editor/src/components/rich-text/README.md b/packages/editor/src/components/rich-text/README.md
index b5449fbe4ec9e0..19ddd35bd26664 100644
--- a/packages/editor/src/components/rich-text/README.md
+++ b/packages/editor/src/components/rich-text/README.md
@@ -25,10 +25,6 @@ Render a rich [`contenteditable` input](https://developer.mozilla.org/en-US/docs
*Optional.* By default, a line break will be inserted on Enter . If the editable field can contain multiple paragraphs, this property can be set to create new paragraphs on Enter .
-### `onSplit( before: Array|String, after: Array|String, ...blocks: Object ): Function`
-
-*Optional.* Called when the content can be split with `before` and `after`. There might be blocks present, which should be inserted in between.
-
### `onReplace( blocks: Array ): Function`
*Optional.* Called when the `RichText` instance is empty and it can be replaced with the given blocks.
diff --git a/packages/editor/src/components/rich-text/index.js b/packages/editor/src/components/rich-text/index.js
index 43df39403e3bbd..688a5287052b68 100644
--- a/packages/editor/src/components/rich-text/index.js
+++ b/packages/editor/src/components/rich-text/index.js
@@ -682,18 +682,6 @@ export class RichText extends Component {
this.savedContent = value;
}
- // If blocks are merged, but the content remains the same, e.g. merging
- // an empty paragraph into another, then also set the selection to the
- // end.
- if ( isSelected && ! prevProps.isSelected && ! this.isActive() ) {
- const record = this.formatToValue( value );
- const prevRecord = this.formatToValue( prevProps.value );
- const length = getTextContent( prevRecord ).length;
- record.start = length;
- record.end = length;
- this.applyRecord( record );
- }
-
// If any format props update, reapply value.
const shouldReapply = Object.keys( this.props ).some( ( name ) => {
if ( name.indexOf( 'format_' ) !== 0 ) {
@@ -861,6 +849,7 @@ export class RichText extends Component {
editor={ this.editor }
onTagNameChange={ onTagNameChange }
tagName={ Tagname }
+ onSyncDOM={ () => this.onChange( this.createRecord() ) }
/>
) }
{ isSelected && ! inlineToolbar && (
diff --git a/packages/editor/src/components/rich-text/index.native.js b/packages/editor/src/components/rich-text/index.native.js
index 5b378ccd447394..ba6a4673e101c2 100644
--- a/packages/editor/src/components/rich-text/index.native.js
+++ b/packages/editor/src/components/rich-text/index.native.js
@@ -356,6 +356,8 @@ export class RichText extends Component {
}
text={ { text: html, eventCount: this.lastEventCount } }
onChange={ this.onChange }
+ onFocus={ this.props.onFocus }
+ onBlur={ this.props.onBlur }
onEnter={ this.onEnter }
onBackspace={ this.onBackspace }
onContentSizeChange={ this.onContentSizeChange }
diff --git a/packages/editor/src/components/rich-text/list-edit.js b/packages/editor/src/components/rich-text/list-edit.js
index 9d7e40f4b414cd..1e92d3d792eb49 100644
--- a/packages/editor/src/components/rich-text/list-edit.js
+++ b/packages/editor/src/components/rich-text/list-edit.js
@@ -35,27 +35,39 @@ function isActiveListType( editor, tagName, rootTagName ) {
return list.nodeName.toLowerCase() === tagName;
}
-export const ListEdit = ( { editor, onTagNameChange, tagName } ) => (
+export const ListEdit = ( { editor, onTagNameChange, tagName, onSyncDOM } ) => (
editor.execCommand( 'Outdent' ) }
+ onUse={ () => {
+ editor.execCommand( 'Outdent' );
+ onSyncDOM();
+ } }
/>
editor.execCommand( 'Indent' ) }
+ onUse={ () => {
+ editor.execCommand( 'Indent' );
+ onSyncDOM();
+ } }
/>
editor.execCommand( 'Indent' ) }
+ onUse={ () => {
+ editor.execCommand( 'Indent' );
+ onSyncDOM();
+ } }
/>
editor.execCommand( 'Outdent' ) }
+ onUse={ () => {
+ editor.execCommand( 'Outdent' );
+ onSyncDOM();
+ } }
/>
(
onTagNameChange( 'ul' );
} else {
editor.execCommand( 'InsertUnorderedList' );
+ onSyncDOM();
}
},
},
@@ -81,18 +94,25 @@ export const ListEdit = ( { editor, onTagNameChange, tagName } ) => (
onTagNameChange( 'ol' );
} else {
editor.execCommand( 'InsertOrderedList' );
+ onSyncDOM();
}
},
},
{
icon: 'editor-outdent',
title: __( 'Outdent list item' ),
- onClick: () => editor.execCommand( 'Outdent' ),
+ onClick() {
+ editor.execCommand( 'Outdent' );
+ onSyncDOM();
+ },
},
{
icon: 'editor-indent',
title: __( 'Indent list item' ),
- onClick: () => editor.execCommand( 'Indent' ),
+ onClick() {
+ editor.execCommand( 'Indent' );
+ onSyncDOM();
+ },
},
] }
/>
diff --git a/packages/editor/src/components/rich-text/style.scss b/packages/editor/src/components/rich-text/style.scss
index b4ebf2b4b8c69f..731809331440cb 100644
--- a/packages/editor/src/components/rich-text/style.scss
+++ b/packages/editor/src/components/rich-text/style.scss
@@ -100,12 +100,6 @@
// Ensure that if placeholder wraps (mobile/nested contexts) the clickable area is full-height.
height: 100%;
-
- // On mobile and in nested contexts, the plus to add blocks shows up on the right.
- // This padding makes sure it doesn't overlap text.
- & + .editor-rich-text__tinymce {
- padding-right: $icon-button-size;
- }
}
// Placeholder text.
diff --git a/packages/editor/src/components/rich-text/tinymce.js b/packages/editor/src/components/rich-text/tinymce.js
index 0085343bdbd27f..833a740c690ece 100644
--- a/packages/editor/src/components/rich-text/tinymce.js
+++ b/packages/editor/src/components/rich-text/tinymce.js
@@ -23,6 +23,7 @@ import { diffAriaProps, pickAriaProps } from './aria';
const { getSelection } = window;
const { TEXT_NODE } = window.Node;
+const { userAgent } = window.navigator;
/**
* Zero-width space character used by TinyMCE as a caret landing point for
@@ -34,23 +35,6 @@ const { TEXT_NODE } = window.Node;
*/
export const TINYMCE_ZWSP = '\uFEFF';
-/**
- * Determines whether we need a fix to provide `input` events for contenteditable.
- *
- * @param {Element} editorNode The root editor node.
- *
- * @return {boolean} A boolean indicating whether the fix is needed.
- */
-function needsInternetExplorerInputFix( editorNode ) {
- return (
- // Rely on userAgent in the absence of a reasonable feature test for contenteditable `input` events.
- /Trident/.test( window.navigator.userAgent ) &&
- // IE11 dispatches input events for ` ` and `