Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 8 additions & 12 deletions core-blocks/block/edit-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ReusableBlockEditPanel extends Component {

this.titleField = createRef();
this.editButton = createRef();
this.editForm = createRef();
this.handleFormSubmit = this.handleFormSubmit.bind( this );
this.handleTitleChange = this.handleTitleChange.bind( this );
this.handleTitleKeyDown = this.handleTitleKeyDown.bind( this );
Expand All @@ -35,7 +36,7 @@ class ReusableBlockEditPanel extends Component {
if ( ! prevProps.isEditing && this.props.isEditing ) {
this.titleField.current.select();
}
// Move focus back to the Edit button after pressing the Escape key, Cancel, or Save.
// Move focus back to the Edit button after pressing the Escape key or after saving.
if ( ( prevProps.isEditing || prevProps.isSaving ) && ! this.props.isEditing && ! this.props.isSaving ) {
this.editButton.current.focus();
}
Expand All @@ -58,7 +59,7 @@ class ReusableBlockEditPanel extends Component {
}

render() {
const { isEditing, title, isSaving, onEdit, onCancel, instanceId } = this.props;
const { isEditing, title, isSaving, onEdit, instanceId } = this.props;

return (
<Fragment>
Expand All @@ -78,7 +79,11 @@ class ReusableBlockEditPanel extends Component {
</div>
) }
{ ( isEditing || isSaving ) && (
<form className="reusable-block-edit-panel" onSubmit={ this.handleFormSubmit }>
<form
className="reusable-block-edit-panel"
ref={ this.editForm }
onSubmit={ this.handleFormSubmit }
>
<label
htmlFor={ `reusable-block-edit-panel__title-${ instanceId }` }
className="reusable-block-edit-panel__label"
Expand All @@ -97,22 +102,13 @@ class ReusableBlockEditPanel extends Component {
/>
<Button
type="submit"
isPrimary
isLarge
isBusy={ isSaving }
disabled={ ! title || isSaving }
className="reusable-block-edit-panel__button"
>
{ __( 'Save' ) }
</Button>
<Button
isLarge
disabled={ isSaving }
className="reusable-block-edit-panel__button"
onClick={ onCancel }
>
{ __( 'Cancel' ) }
</Button>
</form>
) }
</Fragment>
Expand Down
4 changes: 0 additions & 4 deletions core-blocks/block/edit-panel/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
margin: #{ $item-spacing / 2 } 0 $item-spacing;
}

.components-button.reusable-block-edit-panel__button {
margin: 0 5px 0 0;
}

@include break-large() {
flex-wrap: nowrap;

Expand Down
3 changes: 1 addition & 2 deletions packages/editor/src/components/post-permalink/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PostPermalinkEditor extends Component {
isLarge
onClick={ this.onSavePermalink }
>
{ __( 'OK' ) }
{ __( 'Save' ) }
</Button>
</form>
);
Expand All @@ -91,4 +91,3 @@ export default compose( [
return { editPost };
} ),
] )( PostPermalinkEditor );

1 change: 1 addition & 0 deletions packages/editor/src/components/post-permalink/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

.editor-post-permalink__label {
margin: 0 10px 0 5px;
font-weight: 600;
}

.editor-post-permalink__link {
Expand Down