diff --git a/assets/js/save-filters/index.js b/assets/js/save-filters/index.js index 61c7a71..743ba54 100755 --- a/assets/js/save-filters/index.js +++ b/assets/js/save-filters/index.js @@ -15,6 +15,12 @@ import { CoreTable } from './core-table'; import { CoreVerse } from './core-verse'; import { CoreVideo } from './core-video'; +// WDS Blocks +import { WDS_CallToAction_Block } from './wdsBlocks/call-to-action'; +import { WDS_Hero_Block } from "./wdsBlocks/hero"; +import { WDS_TwoColumn_Block } from "./wdsBlocks/two-column"; +import { WDS_RecentPosts_Block } from "./wdsBlocks/recent-posts"; + export class SaveFilters { constructor() { new CoreParagraph(); @@ -33,5 +39,13 @@ export class SaveFilters { new CoreTable(); new CoreVerse(); new CoreVideo(); + + // WDS Blocks + new WDS_CallToAction_Block(); + new WDS_Hero_Block(); + new WDS_TwoColumn_Block(); + new WDS_RecentPosts_Block(); + + } } diff --git a/assets/js/save-filters/wdsBlocks/call-to-action.js b/assets/js/save-filters/wdsBlocks/call-to-action.js new file mode 100644 index 0000000..59684c9 --- /dev/null +++ b/assets/js/save-filters/wdsBlocks/call-to-action.js @@ -0,0 +1,14 @@ +import { CleanFilter } from './../CleanFilter'; + +export class WDS_CallToAction_Block extends CleanFilter { + + constructor() { + super( 'wds-call-to-action' ); + } + + hookCallback( attributes, name, innerBlocks ) { + attributes.message = wp.element.renderToString( attributes.message ); + return attributes; + } + +} \ No newline at end of file diff --git a/assets/js/save-filters/wdsBlocks/hero.js b/assets/js/save-filters/wdsBlocks/hero.js new file mode 100644 index 0000000..636e30c --- /dev/null +++ b/assets/js/save-filters/wdsBlocks/hero.js @@ -0,0 +1,14 @@ +import { CleanFilter } from './../CleanFilter'; + +export class WDS_Hero_Block extends CleanFilter { + + constructor() { + super( 'wds-hero' ); + } + + hookCallback( attributes, name, innerBlocks ) { + attributes.message = wp.element.renderToString( attributes.message ); + return attributes; + } + +} \ No newline at end of file diff --git a/assets/js/save-filters/wdsBlocks/recent-posts.js b/assets/js/save-filters/wdsBlocks/recent-posts.js new file mode 100644 index 0000000..6ca61ab --- /dev/null +++ b/assets/js/save-filters/wdsBlocks/recent-posts.js @@ -0,0 +1,14 @@ +import { CleanFilter } from './../CleanFilter'; + +export class WDS_RecentPosts_Block extends CleanFilter { + + constructor() { + super( 'wds-recent-posts' ); + } + + hookCallback( attributes, name, innerBlocks ) { + attributes.taxonomies = JSON.parse( attributes.taxonomies ); + return attributes; + } + +} \ No newline at end of file diff --git a/assets/js/save-filters/wdsBlocks/two-column.js b/assets/js/save-filters/wdsBlocks/two-column.js new file mode 100644 index 0000000..7641455 --- /dev/null +++ b/assets/js/save-filters/wdsBlocks/two-column.js @@ -0,0 +1,21 @@ +import { CleanFilter } from './../CleanFilter'; + +export class WDS_TwoColumn_Block extends CleanFilter { + + constructor() { + super( 'wds-two-column' ); + } + + hookCallback( attributes, name, innerBlocks ) { + if ( attributes.contentLeft ) { + attributes.contentLeft = wp.element.renderToString( attributes.contentLeft ); + } + + if ( attributes.contentRight ) { + attributes.contentRight = wp.element.renderToString( attributes.contentRight ); + } + + return attributes; + } + +} \ No newline at end of file