Skip to content

Commit

Permalink
fix for native file
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jun 22, 2021
1 parent 50a5bef commit fd21312
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/block-library/src/buttons/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { name as buttonBlockName } from '../button/';
import styles from './editor.scss';

const ALLOWED_BLOCKS = [ buttonBlockName ];
const BUTTONS_TEMPLATE = [ [ 'core/button' ] ];

const layoutProp = { type: 'default', alignments: [] };

Expand Down Expand Up @@ -65,6 +64,14 @@ export default function ButtonsEdit( {
},
[ clientId ]
);

const preferredStyle = useSelect( ( select ) => {
const preferredStyleVariations = select(
blockEditorStore
).getSettings().__experimentalPreferredStyleVariations;
return preferredStyleVariations?.value?.[ 'core/button' ];
}, [] );

const { getBlockOrder } = useSelect( blockEditorStore );
const { insertBlock, removeBlock, selectBlock } = useDispatch(
blockEditorStore
Expand Down Expand Up @@ -133,7 +140,18 @@ export default function ButtonsEdit( {
{ resizeObserver }
<InnerBlocks
allowedBlocks={ ALLOWED_BLOCKS }
template={ BUTTONS_TEMPLATE }
template={
preferredStyle
? [
[
'core/button',
{
className: `is-style-${ preferredStyle }`,
},
],
]
: [ [ 'core/button' ] ]
}
renderFooterAppender={
shouldRenderFooterAppender && renderFooterAppender.current
}
Expand Down

0 comments on commit fd21312

Please sign in to comment.