Skip to content

Commit

Permalink
Adding WDS Blocks Support - #3
Browse files Browse the repository at this point in the history
  • Loading branch information
royboy789 committed Jul 13, 2018
1 parent ac466bc commit ab9936f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
14 changes: 14 additions & 0 deletions assets/js/save-filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();


}
}
14 changes: 14 additions & 0 deletions assets/js/save-filters/wdsBlocks/call-to-action.js
Original file line number Diff line number Diff line change
@@ -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;
}

}
14 changes: 14 additions & 0 deletions assets/js/save-filters/wdsBlocks/hero.js
Original file line number Diff line number Diff line change
@@ -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;
}

}
14 changes: 14 additions & 0 deletions assets/js/save-filters/wdsBlocks/recent-posts.js
Original file line number Diff line number Diff line change
@@ -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;
}

}
21 changes: 21 additions & 0 deletions assets/js/save-filters/wdsBlocks/two-column.js
Original file line number Diff line number Diff line change
@@ -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;
}

}

0 comments on commit ab9936f

Please sign in to comment.