Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Plugin: Backport bug fixes from Gutenberg 5.5.0 to wp/trunk (WordPress 5.2 RC) #14987

Merged
merged 22 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3d3abd6
Add new action REPLACE_INNER_BLOCKS for InnerBlocks replacement (#14291)
jorgefilipecosta Mar 18, 2019
8913322
Fix/post title borders in code editor (#14771)
kjellr Apr 3, 2019
e234570
Fix: Restrict block insert, move, and replace attending to allowedBlo…
jorgefilipecosta Apr 3, 2019
56bfeb7
Make image selected onFocus (#14813)
nosolosw Apr 4, 2019
cb39c74
Fix Blocker Picker autocompleter icon spacing (#14772)
getdave Apr 4, 2019
3e0f9e9
Avoid saving metaboxes before a preview (#14877)
talldan Apr 9, 2019
ca583e1
Add publish step to preview with custom fields test (#14894)
talldan Apr 10, 2019
0015eb1
Fix selecting separator block (#14854)
ashwin-pc Apr 10, 2019
8dd2043
Color palette hover tooltip fix. (#14693)
Apr 10, 2019
e2777f1
Refactor the Settings button CSS. (#14475)
afercia Apr 10, 2019
887d8a4
Input Interaction: take into account container padding (#14804)
ellatrix Apr 11, 2019
ad7095b
Fix regression with column block being selected. (#14876)
jasmussen Apr 11, 2019
949bef3
Block Editor: Consider received blocks state change as ignored (#14916)
aduth Apr 11, 2019
026734f
Block gallery: delete image with delete or backspace keys (#14822)
nosolosw Apr 12, 2019
9be8b69
Fix button isDefault isBusy hover (#14469)
sbardian Apr 12, 2019
bb5f4c7
Fix regression with color swatch focus style (#14944)
jasmussen Apr 12, 2019
83fc56f
Remove box shadow from the (#14936)
kjellr Apr 12, 2019
709d68c
Adjust clashing shortcuts used for character input (#14681)
ellatrix Apr 12, 2019
b8b3d2a
Button Block: fix space insertion (#14925)
ellatrix Apr 12, 2019
9a29787
Format Library: Assign Popover anchorRect to update selection positio…
aduth Apr 12, 2019
4c91030
Fix spacer NaN warning (#14785)
Jackie6 Apr 15, 2019
660fbaa
Block Editor: Assign Provider isSyncingOutcomingValue only when block…
aduth Apr 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,20 @@ via its `onChange` callback, in addition to `onInput`.

Whether the most recent block change was persistent.

### __unstableIsLastBlockChangeIgnored

Returns true if the most recent block change is be considered ignored, or
false otherwise. An ignored change is one not to be committed by
BlockEditorProvider, neither via `onChange` nor `onInput`.

*Parameters*

* state: Block editor state.

*Returns*

Whether the most recent block change was ignored.

## Actions

### resetBlocks
Expand Down Expand Up @@ -980,6 +994,17 @@ specified client ID is to be removed.
* selectPrevious: True if the previous block should be
selected when a block is removed.

### replaceInnerBlocks

Returns an action object used in signalling that the inner blocks with the
specified client ID should be replaced.

*Parameters*

* rootClientId: Client ID of the block whose InnerBlocks will re replaced.
* blocks: Block objects to insert as new InnerBlocks
* updateSelection: If true block selection will be updated. If false, block selection will not change. Defaults to true.

### toggleBlockMode

Returns an action object used to toggle the block editing mode between
Expand Down
8 changes: 4 additions & 4 deletions docs/designers-developers/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ This is the canonical list of keyboard shortcuts:
</tr>
<tr>
<td>Navigate to a the next part of the editor (alternative).</td>
<td><kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>N</kbd></td>
<td><kbd></kbd><kbd>⌥</kbd><kbd>N</kbd></td>
<td><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>N</kbd></td>
<td><kbd></kbd><kbd>⌥</kbd><kbd>N</kbd></td>
</tr>
<tr>
<td>Navigate to the previous part of the editor (alternative).</td>
<td><kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd></td>
<td><kbd></kbd><kbd>⌥</kbd><kbd>P</kbd></td>
<td><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd></td>
<td><kbd></kbd><kbd>⌥</kbd><kbd>P</kbd></td>
</tr>
<tr>
<td>Navigate to the nearest toolbar.</td>
Expand Down
9 changes: 9 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
## 2.0.0 (Unreleased)

### New Features

- The `URLPopover` component now passes through all unhandled props to the underlying Popover component.

### Breaking Changes

- `CopyHandler` will now only catch cut/copy events coming from its `props.children`, instead of from anywhere in the `document`.

### Internal

- Improved handling of blocks state references for unchanging states.
- Updated handling of blocks state to effectively ignored programmatically-received blocks data (e.g. reusable blocks received from editor).

## 1.0.0 (2019-03-06)

### New Features
Expand Down
3 changes: 2 additions & 1 deletion packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,11 @@
left: 0;
right: 0;
justify-content: center;
height: $block-padding + 8px;

// Show a clickable plus.
.block-editor-inserter__toggle {
margin-top: -4px;
margin-top: -8px;
border-radius: 50%;
color: $blue-medium-focus;
background: $white;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@

.block-editor-inserter__toggle {
margin-right: 0;

// Hide the box shadow that appears on hover.
// All the :not() rules are needed to override default iconButton styles.
&:not(:disabled):not([aria-disabled="true"]):not(.is-default):hover {
box-shadow: none;
}
}
}

Expand Down
12 changes: 3 additions & 9 deletions packages/block-editor/src/components/inner-blocks/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { pick, isEqual, map } from 'lodash';
import { pick, isEqual } from 'lodash';
import classnames from 'classnames';

/**
Expand Down Expand Up @@ -144,20 +144,14 @@ InnerBlocks = compose( [
} ),
withDispatch( ( dispatch, ownProps ) => {
const {
replaceBlocks,
insertBlocks,
replaceInnerBlocks,
updateBlockListSettings,
} = dispatch( 'core/block-editor' );
const { block, clientId, templateInsertUpdatesSelection = true } = ownProps;

return {
replaceInnerBlocks( blocks ) {
const clientIds = map( block.innerBlocks, 'clientId' );
if ( clientIds.length ) {
replaceBlocks( clientIds, blocks );
} else {
insertBlocks( blocks, undefined, clientId, templateInsertUpdatesSelection );
}
replaceInnerBlocks( clientId, blocks, block.innerBlocks.length === 0 && templateInsertUpdatesSelection );
},
updateNestedSettings( settings ) {
dispatch( updateBlockListSettings( clientId, settings ) );
Expand Down
15 changes: 13 additions & 2 deletions packages/block-editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class BlockEditorProvider extends Component {
const {
getBlocks,
isLastBlockChangePersistent,
__unstableIsLastBlockChangeIgnored,
} = registry.select( 'core/block-editor' );

let blocks = getBlocks();
Expand All @@ -76,7 +77,12 @@ class BlockEditorProvider extends Component {
} = this.props;
const newBlocks = getBlocks();
const newIsPersistent = isLastBlockChangePersistent();
if ( newBlocks !== blocks && this.isSyncingIncomingValue ) {
if (
newBlocks !== blocks && (
this.isSyncingIncomingValue ||
__unstableIsLastBlockChangeIgnored()
)
) {
this.isSyncingIncomingValue = false;
blocks = newBlocks;
isPersistent = newIsPersistent;
Expand All @@ -88,10 +94,15 @@ class BlockEditorProvider extends Component {
// This happens when a previous input is explicitely marked as persistent.
( newIsPersistent && ! isPersistent )
) {
// When knowing the blocks value is changing, assign instance
// value to skip reset in subsequent `componentDidUpdate`.
if ( newBlocks !== blocks ) {
this.isSyncingOutcomingValue = true;
}

blocks = newBlocks;
isPersistent = newIsPersistent;

this.isSyncingOutcomingValue = true;
if ( isPersistent ) {
onChange( blocks );
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// breaking spaces in between words. If also prevent Firefox from inserting
// a trailing `br` node to visualise any trailing space, causing the element
// to be saved.
white-space: pre-wrap;
white-space: pre-wrap !important;

> p:first-child {
margin-top: 0;
Expand Down
10 changes: 1 addition & 9 deletions packages/block-editor/src/components/url-popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MyURLPopover extends Component {

## Props

The component accepts the following props.
The component accepts the following props. Any other props are passed through to the underlying `Popover` component ([refer to props documentation](/packages/components/src/popover/README.md)).

### position

Expand All @@ -104,14 +104,6 @@ an element.
- Required: No
- Default: "firstElement"

### onClose

Callback that triggers when the user indicates the popover should close (e.g. they've used the escape key or clicked
outside of the popover.)

- Type: `Function`
- Required: No

### renderSettings

Callback used to return the React Elements that will be rendered inside the settings drawer. When this function
Expand Down
6 changes: 2 additions & 4 deletions packages/block-editor/src/components/url-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ class URLPopover extends Component {
const {
children,
renderSettings,
onClose,
onClickOutside,
position = 'bottom center',
focusOnMount = 'firstElement',
...popoverProps
} = this.props;

const {
Expand All @@ -46,8 +45,7 @@ class URLPopover extends Component {
className="editor-url-popover block-editor-url-popover"
focusOnMount={ focusOnMount }
position={ position }
onClose={ onClose }
onClickOutside={ onClickOutside }
{ ...popoverProps }
>
<div className="editor-url-popover__row block-editor-url-popover__row">
{ children }
Expand Down
Loading