Skip to content

Commit

Permalink
auto spacer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gollenia committed Feb 2, 2024
1 parent 834bbc6 commit e3d9306
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 115 deletions.
2 changes: 1 addition & 1 deletion src/blocks/card/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}
}

&__content {
&-content {
padding: 15px;
position: relative;
flex: 1;
Expand Down
5 changes: 5 additions & 0 deletions src/common/styles/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@
.has-primary-background-color {
background-color: var(--primary) !important;
}

.ctx-auto-spacer {
flex: 1;
height: auto !important;
}
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import * as inlineSvg from './blocks/svg';
/**
* Core Block modification dependencies.
*/

import './mods/paragraphJustify';
import './mods/scrollAnimation';
import './mods/spacerAutoOption';
Expand Down
21 changes: 21 additions & 0 deletions src/mods/listClass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const { createHigherOrderComponent } = wp.compose;
const { InspectorControls, URLInput } = wp.blockEditor;
const { PanelBody, TextControl, RadioControl } = wp.components;
const { addFilter } = wp.hooks;
const { __ } = wp.i18n;

const addListClass = (props, name) => {
if (name !== 'core/post-title') {
return props;
}

const attributes = {
...props.attributes,
};

attributes.className = 'core-block';

return { ...props, attributes };
};

addFilter('blocks.registerBlockType', 'ctx-blocks/list', addListClass);
112 changes: 0 additions & 112 deletions src/mods/postTitleProps.js

This file was deleted.

5 changes: 3 additions & 2 deletions src/mods/spacerAutoOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const withAutoMarginControl = createHigherOrderComponent((BlockEdit) => {

const { attributes, setAttributes } = props;
const { autoMargin } = attributes;

console.log(attributes);
return (
<Fragment>
<BlockEdit {...props} />
Expand All @@ -49,12 +49,13 @@ const withAutoMarginControl = createHigherOrderComponent((BlockEdit) => {
>
<ToggleControl
label={__(
'Use as auto height control in a card',
'Use as auto height control in a flex container',
'ctx-blocks'
)}
checked={autoMargin}
onChange={(value) => {
setAttributes({ autoMargin: value });
setAttributes({ className: 'ctx-auto-spacer' });
}}
/>
</PanelBody>
Expand Down

0 comments on commit e3d9306

Please sign in to comment.