| 1 |
import '../grid/awb-fallback'; |
| 2 |
|
| 3 |
import getIcon from '../../utils/get-icon'; |
| 4 |
import getBackgroundStyles from '../grid/get-background-styles'; |
| 5 |
import metadata from './block.json'; |
| 6 |
import edit from './edit'; |
| 7 |
import save from './save'; |
| 8 |
|
| 9 |
const { name } = metadata; |
| 10 |
|
| 11 |
export { metadata, name }; |
| 12 |
|
| 13 |
export const settings = { |
| 14 |
icon: getIcon('block-grid-column', true), |
| 15 |
ghostkit: { |
| 16 |
customStylesCallback(attributes) { |
| 17 |
const { stickyContent, stickyContentOffset } = attributes; |
| 18 |
|
| 19 |
const styles = { |
| 20 |
'--gkt-grid--column-sticky__offset': undefined, |
| 21 |
...getBackgroundStyles(attributes), |
| 22 |
}; |
| 23 |
|
| 24 |
// Sticky styles. |
| 25 |
if ( |
| 26 |
stickyContent && |
| 27 |
typeof stickyContentOffset !== 'undefined' && |
| 28 |
stickyContentOffset !== '' |
| 29 |
) { |
| 30 |
styles['--gkt-grid--column-sticky__offset'] = |
| 31 |
`${stickyContentOffset}px`; |
| 32 |
} |
| 33 |
|
| 34 |
return styles; |
| 35 |
}, |
| 36 |
customStylesFilter(styles, data, isEditor, attributes) { |
| 37 |
// change custom styles in Editor. |
| 38 |
if (isEditor && attributes?.ghostkit?.id) { |
| 39 |
// background. |
| 40 |
styles = styles.replace( |
| 41 |
new RegExp('> .nk-awb .jarallax-img', 'g'), |
| 42 |
'> .awb-gutenberg-preview-block .jarallax-img' |
| 43 |
); |
| 44 |
} |
| 45 |
return styles; |
| 46 |
}, |
| 47 |
}, |
| 48 |
edit, |
| 49 |
save, |
| 50 |
}; |
| 51 |
|