Skip to content

Commit

Permalink
Add custom class name for native
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 14, 2023
1 parent 52dd992 commit d1b74ab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
13 changes: 8 additions & 5 deletions packages/block-editor/src/hooks/custom-class-name.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ addFilter(
'core/custom-class-name/attribute',
addAttribute
);
addFilter(
'blocks.getSaveContent.extraProps',
'core/custom-class-name/save-props',
addSaveProps
);

export default {
addSaveProps,
attributeKeys: [ 'className' ],
hasSupport( name ) {
return hasBlockSupport( name, 'customClassName', true );
},
};
11 changes: 9 additions & 2 deletions packages/block-editor/src/hooks/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import './compat';
import align from './align';
import anchor from './anchor';
import './custom-class-name';
import customClassName from './custom-class-name';
import './generated-class-name';
import style from './style';
import color from './color';
Expand All @@ -18,7 +18,14 @@ import './layout';

createBlockEditFilter( [ align, anchor, style ] );
createBlockListBlockFilter( [ align, style, color, fontSize ] );
createBlockSaveFilter( [ align, anchor, color, style, fontSize ] );
createBlockSaveFilter( [
align,
anchor,
customClassName,
color,
style,
fontSize,
] );

export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
Expand Down

0 comments on commit d1b74ab

Please sign in to comment.