Skip to content

Commit

Permalink
Query pagination: remove div (#28831)
Browse files Browse the repository at this point in the history
* Query pagination: remove div

* Remove formatting options
  • Loading branch information
ellatrix authored Feb 8, 2021
1 parent 2b55fce commit a340551
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 36 deletions.
29 changes: 11 additions & 18 deletions packages/block-library/src/query-pagination-next/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,22 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useBlockProps, RichText } from '@wordpress/block-editor';
import { useBlockProps, PlainText } from '@wordpress/block-editor';

export default function QueryPaginationNextEdit( {
attributes: { label },
setAttributes,
} ) {
const placeholder = __( 'Next Page' );
return (
<>
<div { ...useBlockProps() }>
{
<RichText
tagName="a"
aria-label={ __( 'Next page link' ) }
placeholder={ placeholder }
value={ label }
allowedFormats={ [ 'core/bold', 'core/italic' ] }
onChange={ ( newLabel ) =>
setAttributes( { label: newLabel } )
}
/>
}
</div>
</>
<PlainText
__experimentalVersion={ 2 }
tagName="a"
aria-label={ __( 'Next page link' ) }
placeholder={ __( 'Next Page' ) }
value={ label }
keepPlaceholderOnFocus
onChange={ ( newLabel ) => setAttributes( { label: newLabel } ) }
{ ...useBlockProps() }
/>
);
}
29 changes: 11 additions & 18 deletions packages/block-library/src/query-pagination-previous/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,22 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useBlockProps, RichText } from '@wordpress/block-editor';
import { useBlockProps, PlainText } from '@wordpress/block-editor';

export default function QueryPaginationPreviousEdit( {
attributes: { label },
setAttributes,
} ) {
const placeholder = __( 'Previous Page' );
return (
<>
<div { ...useBlockProps() }>
{
<RichText
tagName="a"
aria-label={ __( 'Previous page link' ) }
placeholder={ placeholder }
value={ label }
allowedFormats={ [ 'core/bold', 'core/italic' ] }
onChange={ ( newLabel ) =>
setAttributes( { label: newLabel } )
}
/>
}
</div>
</>
<PlainText
__experimentalVersion={ 2 }
tagName="a"
aria-label={ __( 'Previous page link' ) }
placeholder={ __( 'Previous Page' ) }
value={ label }
keepPlaceholderOnFocus
onChange={ ( newLabel ) => setAttributes( { label: newLabel } ) }
{ ...useBlockProps() }
/>
);
}

0 comments on commit a340551

Please sign in to comment.