Skip to content

Commit

Permalink
Merge branch 'master' into add-default-alt-values-to-images-in-editin…
Browse files Browse the repository at this point in the history
…g-context-WordPress#1520
  • Loading branch information
antpb committed Nov 12, 2018
2 parents d93e67e + c1ae13e commit b04f8d4
Show file tree
Hide file tree
Showing 402 changed files with 9,988 additions and 3,542 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Expand Up @@ -67,5 +67,9 @@ jobs:
- stage: test
env: WP_VERSION=latest
script:
- npm install || exit 1
- ./bin/run-e2e-tests.sh || exit 1

- stage: test
env: WP_VERSION=latest E2E_ROLE=author
script:
- ./bin/run-e2e-tests.sh || exit 1
5 changes: 4 additions & 1 deletion CONTRIBUTORS.md
Expand Up @@ -2,7 +2,7 @@

Gutenberg is built by many contributors and volunteers. Thanks to all of them for their work!

This list is manually curated to include valuable contributions by volunteers that do not include code, such as user testing, providing feedback, or mockups. Please edit this list to include new contributors as they come in. There is no particular order to this list. If you or someone else were omitted from this list, we assure you that was not intentional. Please let us know and we'll add you. For volunteers who contributed their translations, your names are listed on [WordPress Translate site here](https://translate.wordpress.org/projects/wp-plugins/gutenberg/contributors).
This list is manually curated to include valuable contributions by volunteers that do not include code, such as user testing, providing feedback, or mockups. Please edit this list to include new contributors as they come in. There is no particular order to this list. If you or someone else was omitted from this list, we assure you that was not intentional. Please let us know and we'll add you. For volunteers who contributed their translations, your names are listed on [WordPress Translate site here](https://translate.wordpress.org/projects/wp-plugins/gutenberg/contributors).

| GitHub Username | WordPress.org Username|
| --------------- | --------------------- |
Expand Down Expand Up @@ -114,3 +114,6 @@ This list is manually curated to include valuable contributions by volunteers th
| @tofumatt | @lonelyvegan |
| @LukePettway | @luke_pettway |
| @pratikthink | @pratikthink |
| @amdrew | @sumobi |
| @MaedahBatool | @MaedahBatool |
| @luehrsen | @luehrsen |
3 changes: 3 additions & 0 deletions assets/stylesheets/_z-index.scss
Expand Up @@ -37,6 +37,9 @@ $z-layers: (
// Active pill button
".components-button.is-button {:focus or .is-primary}": 1,

// Reusable blocks UI, needs to be above sibling inserter.
".editor-block-list__layout .reusable-block-edit-panel": 7,

// The draggable element should show up above the entire UI
".components-draggable__clone": 1000000000,

Expand Down
10 changes: 10 additions & 0 deletions bin/install-wordpress.sh
Expand Up @@ -54,6 +54,13 @@ echo -e $(status_message "Installing WordPress...")
# prevents permissions errors. See: https://github.com/WordPress/gutenberg/pull/8427#issuecomment-410232369
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI core install --title="$SITE_TITLE" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:$HOST_PORT >/dev/null

if [ "$E2E_ROLE" = "author" ]; then
# Create an additional author user for testsing.
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI user create author author@example.com --role=author --user_pass=authpass
# Assign the existing Hello World post to the author.
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI post update 1 --post_author=2
fi

if [ "$WP_VERSION" == "latest" ]; then
# Check for WordPress updates, to make sure we're running the very latest version.
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm -u 33 $CLI core update >/dev/null
Expand All @@ -69,3 +76,6 @@ fi
# Activate Gutenberg.
echo -e $(status_message "Activating Gutenberg...")
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm $CLI plugin activate gutenberg >/dev/null

# Install a dummy favicon to avoid 404 errors.
docker-compose $DOCKER_COMPOSE_FILE_OPTIONS run --rm $CONTAINER touch /var/www/html/favicon.ico
7 changes: 5 additions & 2 deletions bin/run-e2e-tests.sh
Expand Up @@ -7,5 +7,8 @@ cd "$(dirname "$0")/../"
# Setup local environement
( ./bin/setup-local-env.sh )

# Run the tests
npm run test-e2e
if [ "$E2E_ROLE" = "author" ]; then
WP_PASSWORD=authpass WP_USERNAME=author npm run test-e2e
else
npm run test-e2e
fi
7 changes: 7 additions & 0 deletions docs/block-api.md
Expand Up @@ -504,6 +504,13 @@ inserter: false,
multiple: false,
```

- `reusable` (default `true`): A block may want to disable the ability of being converted into a reusable block.
By default all blocks can be converted to a reusable block. If supports reusable is set to false, the option to convert the block into a reusable block will not appear.

```js
// Don't allow the block to be converted into a reusable block.
reusable: false,
```
## Edit and Save

The `edit` and `save` functions define the editor interface with which a user would interact, and the markup to be serialized back when a post is saved. They are the heart of how a block operates, so they are [covered separately](../docs/block-api/block-edit-save.md).
Expand Down
8 changes: 4 additions & 4 deletions docs/blocks/applying-styles-with-stylesheets.md
Expand Up @@ -21,8 +21,8 @@ registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-02', {
return el( 'p', { className: props.className }, 'Hello editor.' );
},

save: function( props ) {
return el( 'p', { className: props.className }, 'Hello saved content.' );
save: function() {
return el( 'p', {}, 'Hello saved content.' );
}
} );
```
Expand All @@ -41,8 +41,8 @@ registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-02', {
return <p className={ className }>Hello editor.</p>;
},

save( { className } ) {
return <p className={ className }>Hello saved content.</p>;
save() {
return <p>Hello saved content.</p>;
}
} );
```
Expand Down
3 changes: 1 addition & 2 deletions docs/blocks/block-controls-toolbars-and-inspector.md
Expand Up @@ -152,12 +152,11 @@ registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-04', {
);
},

save( { attributes, className } ) {
save( { attributes } ) {
const { content, alignment } = attributes;

return (
<RichText.Content
className={ className }
style={ { textAlign: alignment } }
value={ content }
tagName="p"
Expand Down
3 changes: 1 addition & 2 deletions docs/blocks/introducing-attributes-and-editable-fields.md
Expand Up @@ -96,13 +96,12 @@ registerBlockType( 'gutenberg-boilerplate-esnext/hello-world-step-03', {
);
},

save( { attributes, className } ) {
save( { attributes } ) {
const { content } = attributes;

return (
<RichText.Content
tagName="p"
className={ className }
value={ content }
/>
);
Expand Down
1 change: 1 addition & 0 deletions docs/data/README.md
@@ -1,6 +1,7 @@
# Data Module Reference

- [**core**: WordPress Core Data](../../docs/data/data-core.md)
- [**core/annotations**: Annotations](../../docs/data/data-core-annotations.md)
- [**core/blocks**: Block Types Data](../../docs/data/data-core-blocks.md)
- [**core/editor**: The Editor’s Data](../../docs/data/data-core-editor.md)
- [**core/edit-post**: The Editor’s UI Data](../../docs/data/data-core-edit-post.md)
Expand Down
84 changes: 84 additions & 0 deletions docs/data/data-core-annotations.md
@@ -0,0 +1,84 @@
# **core/annotations**: Annotations

## Selectors

### __experimentalGetAnnotationsForBlock

Returns the annotations for a specific client ID.

*Parameters*

* state: Editor state.
* clientId: The ID of the block to get the annotations for.

### __experimentalGetAnnotationsForRichText

Returns the annotations that apply to the given RichText instance.

Both a blockClientId and a richTextIdentifier are required. This is because
a block might have multiple `RichText` components. This does mean that every
block needs to implement annotations itself.

*Parameters*

* state: Editor state.
* blockClientId: The client ID for the block.
* richTextIdentifier: Unique identifier that identifies the given RichText.

*Returns*

All the annotations relevant for the `RichText`.

### __experimentalGetAnnotations

Returns all annotations in the editor state.

*Parameters*

* state: Editor state.

*Returns*

All annotations currently applied.

## Actions

### __experimentalAddAnnotation

Adds an annotation to a block.

The `block` attribute refers to a block ID that needs to be annotated.
`isBlockAnnotation` controls whether or not the annotation is a block
annotation. The `source` is the source of the annotation, this will be used
to identity groups of annotations.

The `range` property is only relevant if the selector is 'range'.

*Parameters*

* annotation: The annotation to add.
* blockClientId: The blockClientId to add the annotation to.
* richTextIdentifier: Identifier for the RichText instance the annotation applies to.
* range: The range at which to apply this annotation.
* range.start: The offset where the annotation should start.
* range.end: The offset where the annotation should end.
* string: [selector="range"] The way to apply this annotation.
* string: [source="default"] The source that added the annotation.
* string: [id=uuid()] The ID the annotation should have.
Generates a UUID by default.

### __experimentalRemoveAnnotation

Removes an annotation with a specific ID.

*Parameters*

* annotationId: The annotation to remove.

### __experimentalRemoveAnnotationsBySource

Removes all annotations of a specific source.

*Parameters*

* source: The source to remove.
31 changes: 31 additions & 0 deletions docs/data/data-core-blocks.md
Expand Up @@ -23,6 +23,19 @@ Returns a block type by name.

Block Type.

### getBlockStyles

Returns block styles by block name.

*Parameters*

* state: Data state.
* name: Block type name.

*Returns*

Block Styles.

### getCategories

Returns all the available categories.
Expand Down Expand Up @@ -161,6 +174,24 @@ Returns an action object used to remove a registered block type.

* names: Block name.

### addBlockStyles

Returns an action object used in signalling that new block styles have been added.

*Parameters*

* blockName: Block name.
* styles: Block styles.

### removeBlockStyles

Returns an action object used in signalling that block styles have been removed.

*Parameters*

* blockName: Block name.
* styleNames: Block style names.

### setDefaultBlockName

Returns an action object used to set the default block name.
Expand Down
22 changes: 0 additions & 22 deletions docs/data/data-core-edit-post.md
Expand Up @@ -103,20 +103,6 @@ enabled by default.

Whether or not the panel is enabled.

### isEditorSidebarPanelOpened

Returns true if the given panel is enabled, or false otherwise. Panels are
enabled by default.

*Parameters*

* state: Global application state.
* panel: A string that identifies the panel.

*Returns*

Whether or not the panel is enabled.

### isEditorPanelOpened

Returns true if the given panel is open, or false otherwise. Panels are
Expand Down Expand Up @@ -311,14 +297,6 @@ Returns an action object used to enable or disable a panel in the editor.

Returns an action object used to open or close a panel in the editor.

*Parameters*

* panelName: A string that identifies the panel to open or close.

### toggleGeneralSidebarEditorPanel

Returns an action object used to open or close a panel in the editor.

*Parameters*

* panelName: A string that identifies the panel to open or close.
Expand Down
35 changes: 28 additions & 7 deletions docs/data/data-core-editor.md
Expand Up @@ -36,6 +36,18 @@ the post has been saved.

Whether the post is new.

### hasChangedContent

Returns true if content includes unsaved changes, or false otherwise.

*Parameters*

* state: Editor state.

*Returns*

Whether content includes unsaved changes.

### isEditedPostDirty

Returns true if there are unsaved values for the current edit session, or
Expand Down Expand Up @@ -885,15 +897,15 @@ True if multi-selecting, false if not.

### isSelectionEnabled

Whether is selection disable or not.
Selector that returns if multi-selection is enabled or not.

*Parameters*

* state: Global application state.

*Returns*

True if multi is disable, false if not.
True if it should be possible to multi-select blocks, false if multi-selection is disabled.

### getBlockMode

Expand Down Expand Up @@ -1391,6 +1403,7 @@ the specified post object and editor settings.
*Parameters*

* post: Post object.
* edits: Initial edited attributes object.

### resetPost

Expand Down Expand Up @@ -1427,7 +1440,6 @@ Returns an action object used to setup the editor state when first opening an ed

* post: Post object.
* blocks: Array of blocks.
* edits: Initial edited attributes object.

### resetBlocks

Expand Down Expand Up @@ -1532,8 +1544,8 @@ inserted, optionally at a specific index respective a root block list.

* block: Block object to insert.
* index: Index at which block should be inserted.
* rootClientId: Optional root client ID of block list on which
to insert.
* rootClientId: Optional root client ID of block list on which to insert.
* updateSelection: If true block selection will be updated. If false, block selection will not change. Defaults to true.

### insertBlocks

Expand All @@ -1544,8 +1556,8 @@ be inserted, optionally at a specific index respective a root block list.

* blocks: Block objects to insert.
* index: Index at which block should be inserted.
* rootClientId: Optional root client ID of block list on
which to insert.
* rootClientId: Optional root cliente ID of block list on which to insert.
* updateSelection: If true block selection will be updated. If false, block selection will not change. Defaults to true.

### showInsertionPoint

Expand Down Expand Up @@ -1574,6 +1586,15 @@ Returns an action object resetting the template validity.

Returns an action object synchronize the template with the list of blocks

### editPost

Returns an action object used in signalling that attributes of the post have
been edited.

*Parameters*

* edits: Post attributes to edit.

### savePost

Returns an action object to save the post.
Expand Down

0 comments on commit b04f8d4

Please sign in to comment.