Skip to content

Commit

Permalink
Bug fixes from 5.4 (#14796)
Browse files Browse the repository at this point in the history
* RichText: improve format boundary style (#14519)

* RichText: improve format boundary style

* rgb => rgba

* Paste: check plain text for gutenberg content (#14536)

* Make ClipboardButton inside a block work correctly in Safari (#7106)

* Make ClipboardButton inside a block work in Safari

* Update changelogs

* Block Editor: Update "Next" to "Unreleased" per guidelines

https://github.com/WordPress/gutenberg/blob/master/packages/README.md#maintaining-changelogs

* Input Interaction: always expand single line selection vertically (#14487)

* Input Interaction: always expand single line selection vertically

* Add e2e test

* Use MenuItem instead of IconButton (#14569)

* Remove id, infoid, label and aria-describedby from MenuItem (#14423)

* Preformatted: save line breaks as characters (#14653)

* Preformatted: save line breaks as characters

* Update e2e test

* Remove negative toolbar position rules from full-aligned blocks. (#14669)

* Fix issue with double scrollbar in Fullscreen Mode (#14677)

This PR fixes an issue where the sidebar would have two scrollbars when in fullscreen mode.

* Fix WordPress embed block resolution (#14658)

* Retry failing embeds with trailing slash (#14705)

* Fix embedding Twitter URLs with a trailing slash (Closes #12664)

* Fix race condition for WordPress URLs that end in slashes, add test

* API Fetch: Fix error on empty OPTIONS preload data (#14714)

* Input Interaction: better horizontal edge detection (#14462)

* Input Interaction: better horizontal edge detection

* Correct BR ranges

* Add e2e test

* Increase buffer for Firefox

* Clean up

* Merge isEdge logic

* Fix typo

* Address feedback

* Build docs

* Fix memize option key typo (#14750)

* RichText: unify active formats, 'selectedFormat' and 'placeholderFormat' (#14411)

* RichText: unify active formats, 'selectedFormat' and 'placeholderFormat'

* Add extra e2e test

* Only should boundary style when focused

* Update docs

* Try to trigger tests with Travis

* Restore Travis config
  • Loading branch information
ellatrix authored Apr 4, 2019
1 parent 1352010 commit 09ac4a5
Show file tree
Hide file tree
Showing 49 changed files with 572 additions and 355 deletions.
6 changes: 5 additions & 1 deletion packages/api-fetch/src/middlewares/preloading.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const createPreloadingMiddleware = ( preloadedData ) => ( options, next ) => {

if ( parse && 'GET' === method && preloadedData[ path ] ) {
return Promise.resolve( preloadedData[ path ].body );
} else if ( 'OPTIONS' === method && preloadedData[ method ][ path ] ) {
} else if (
'OPTIONS' === method &&
preloadedData[ method ] &&
preloadedData[ method ][ path ]
) {
return Promise.resolve( preloadedData[ method ][ path ] );
}
}
Expand Down
35 changes: 22 additions & 13 deletions packages/api-fetch/src/middlewares/test/preloading.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,29 @@ describe( 'Preloading Middleware', () => {
} );
} );

it( 'should move to the next middleware if no preloaded data', () => {
const preloadedData = {};
const prelooadingMiddleware = createPreloadingMiddleware( preloadedData );
const requestOptions = {
method: 'GET',
path: 'wp/v2/posts',
};
describe.each( [
[ 'GET' ],
[ 'OPTIONS' ],
] )( '%s', ( method ) => {
describe.each( [
[ 'all empty', {} ],
[ 'method empty', { [ method ]: {} } ],
] )( '%s', ( label, preloadedData ) => {
it( 'should move to the next middleware if no preloaded data', () => {
const prelooadingMiddleware = createPreloadingMiddleware( preloadedData );
const requestOptions = {
method,
path: 'wp/v2/posts',
};

const callback = ( options ) => {
expect( options ).toBe( requestOptions );
return true;
};
const callback = ( options ) => {
expect( options ).toBe( requestOptions );
return true;
};

const ret = prelooadingMiddleware( requestOptions, callback );
expect( ret ).toBe( true );
const ret = prelooadingMiddleware( requestOptions, callback );
expect( ret ).toBe( true );
} );
} );
} );
} );
6 changes: 6 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.0.0 (Unreleased)

### Breaking Changes

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

## 1.0.0 (2019-03-06)

### New Features
Expand Down
6 changes: 6 additions & 0 deletions packages/block-editor/src/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,12 @@
.block-editor-block-contextual-toolbar > * {
pointer-events: auto;
}

// Full-aligned blocks have negative margins on the parent of the toolbar, so additional position adjustment is not required.
&[data-align="full"] .block-editor-block-contextual-toolbar {
left: 0;
right: 0;
}
}

.block-editor-block-list__block.is-focus-mode:not(.is-multi-selected) > .block-editor-block-contextual-toolbar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function BlockConvertButton( { shouldRender, onClick, small } ) {
className="editor-block-settings-menu__control block-editor-block-settings-menu__control"
onClick={ onClick }
icon="screenoptions"
label={ small ? label : undefined }
>
{ ! small && label }
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function BlockModeToggle( { blockType, mode, onToggleMode, small = false
className="editor-block-settings-menu__control block-editor-block-settings-menu__control"
onClick={ onToggleMode }
icon="html"
label={ small ? label : undefined }
>
{ ! small && label }
</MenuItem>
Expand Down
28 changes: 6 additions & 22 deletions packages/block-editor/src/components/copy-handler/index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
/**
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { serialize } from '@wordpress/blocks';
import { documentHasSelection } from '@wordpress/dom';
import { withDispatch } from '@wordpress/data';
import { compose } from '@wordpress/compose';

class CopyHandler extends Component {
constructor() {
super( ...arguments );

this.onCopy = ( event ) => this.props.onCopy( event );
this.onCut = ( event ) => this.props.onCut( event );
}

componentDidMount() {
document.addEventListener( 'copy', this.onCopy );
document.addEventListener( 'cut', this.onCut );
}

componentWillUnmount() {
document.removeEventListener( 'copy', this.onCopy );
document.removeEventListener( 'cut', this.onCut );
}

render() {
return null;
}
function CopyHandler( { children, onCopy, onCut } ) {
return (
<div onCopy={ onCopy } onCut={ onCut }>
{ children }
</div>
);
}

export default compose( [
Expand Down
Loading

0 comments on commit 09ac4a5

Please sign in to comment.