Skip to content

Commit 8642ea1

Browse files
committed
Merge branch 'master' into add/440-script-versioning-cachebust
2 parents a7a540c + 43f3efb commit 8642ea1

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

blocks/components/editable/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,8 @@ export default class Editable extends wp.element.Component {
153153
if ( this.props.onMerge && event.keyCode === KEYCODE_BACKSPACE && this.isStartOfEditor() ) {
154154
this.onChange();
155155
this.props.onMerge( this.editor.getContent() );
156-
157-
// If merge causes editor to be removed, stop other callbacks from
158-
// trying to handle the event
159-
if ( this.editor.removed ) {
160-
event.stopImmediatePropagation();
161-
}
156+
event.preventDefault();
157+
event.stopImmediatePropagation();
162158
}
163159
}
164160

@@ -266,8 +262,14 @@ export default class Editable extends wp.element.Component {
266262
}
267263

268264
focus() {
269-
if ( this.props.focus ) {
265+
const { focus } = this.props;
266+
if ( focus ) {
270267
this.editor.focus();
268+
// Offset = -1 means we should focus the end of the editable
269+
if ( focus.offset === -1 ) {
270+
this.editor.selection.select( this.editor.getBody(), true );
271+
this.editor.selection.collapse( false );
272+
}
271273
}
272274
}
273275

blocks/library/quote/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ registerBlock( 'core/quote', {
7474
);
7575
},
7676

77-
save( attributes ) {
77+
save( { attributes } ) {
7878
const { value, citation, style = 1 } = attributes;
7979

8080
return (
8181
<blockquote className={ `blocks-quote-style-${ style }` }>
82-
{ value && value.map( ( paragraph, i ) => (
82+
{ value && wp.element.Children.map( value, ( paragraph, i ) => (
8383
<p key={ i }>{ paragraph }</p>
8484
) ) }
8585
<footer>{ citation }</footer>

editor/components/toolbar/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
background-color: $white;
66
}
77

8-
.editor-toolbar__control {
8+
.editor-toolbar__control.editor-button {
99
display: inline-flex;
1010
margin: 3px;
1111
margin-left: 0;
@@ -24,7 +24,7 @@
2424
&.is-active,
2525
&:hover,
2626
&:not(:disabled):hover {
27-
border-color: $dark-gray-500;
27+
border: 1px solid $dark-gray-500;
2828
color: $dark-gray-500;
2929
}
3030

editor/modes/visual-editor/block.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { connect } from 'react-redux';
55
import classnames from 'classnames';
66
import { Slot } from 'react-slot-fill';
7+
import { partial } from 'lodash';
78

89
/**
910
* Internal dependencies
@@ -63,7 +64,7 @@ class VisualEditorBlock extends wp.element.Component {
6364
}
6465

6566
mergeWithPrevious() {
66-
const { block, previousBlock, onRemove, onChange } = this.props;
67+
const { block, previousBlock, onRemove, onChange, onFocus } = this.props;
6768

6869
// Do nothing when it's the first block
6970
if ( ! previousBlock ) {
@@ -90,6 +91,7 @@ class VisualEditorBlock extends wp.element.Component {
9091

9192
// Calling the merge to update the attributes and remove the block to be merged
9293
const updatedAttributes = previousBlockSettings.merge( previousBlock.attributes, blockWithTheSameType.attributes );
94+
onFocus( previousBlock.uid, { offset: -1 } );
9395
onChange( previousBlock.uid, {
9496
attributes: {
9597
...previousBlock.attributes,
@@ -174,7 +176,7 @@ class VisualEditorBlock extends wp.element.Component {
174176
attributes={ block.attributes }
175177
setAttributes={ this.setAttributes }
176178
insertBlockAfter={ onInsertAfter }
177-
setFocus={ onFocus }
179+
setFocus={ partial( onFocus, block.uid ) }
178180
mergeWithPrevious={ this.mergeWithPrevious }
179181
/>
180182
</div>
@@ -247,10 +249,10 @@ export default connect(
247249
} );
248250
},
249251

250-
onFocus( config ) {
252+
onFocus( uid, config ) {
251253
dispatch( {
252254
type: 'UPDATE_FOCUS',
253-
uid: ownProps.uid,
255+
uid,
254256
config
255257
} );
256258
},

0 commit comments

Comments
 (0)