Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…t-plugin into 2.0.0-alpha.1
  • Loading branch information
royboy789 committed Feb 15, 2019
2 parents 23d46c8 + 7e91114 commit c856737
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/js/block-save/block-save.js
Expand Up @@ -84,12 +84,12 @@ export class SaveBlock {
for ( let block of blocks ) {
let blockName = block.name.replace( '/', '-' );
newBlocks.push({
uid: block.uid,
uid: block.uid || block.clientId,
name: block.name,
data: wp.hooks.applyFilters( `clean_data_${blockName}`, block.attributes, block.name, block.innerBlocks )
})
}
return newBlocks;
}

}
}
29 changes: 29 additions & 0 deletions assets/js/save-filters/core-media-text.js
@@ -0,0 +1,29 @@
//core/media-text

import { CleanFilter } from './CleanFilter';

export class CoreMediaText extends CleanFilter {

constructor() {
super( 'core-media-text' );
}

hookCallback( attributes, name, innerBlocks ) {
console.log( attributes, innerBlocks );

attributes.content = [];

innerBlocks.map((block, key) => {
let blockName = block.name.replace( '/', '-' );
let blockData = block;
blockData.data = wp.hooks.applyFilters( `clean_data_${blockName}`, block.attributes, block.name, block.innerBlocks );
delete blockData.attributes;
attributes.content.push( blockData );
});

console.log( attributes );

return attributes;
}

}
2 changes: 2 additions & 0 deletions assets/js/save-filters/index.js
Expand Up @@ -14,6 +14,7 @@ import { CoreSubhead } from './core-subheading';
import { CoreTable } from './core-table';
import { CoreVerse } from './core-verse';
import { CoreVideo } from './core-video';
import { CoreMediaText } from './core-media-text';

// WDS Blocks
import { WDS_CallToAction_Block } from './wdsBlocks/call-to-action';
Expand All @@ -39,6 +40,7 @@ export class SaveFilters {
new CoreTable();
new CoreVerse();
new CoreVideo();
new CoreMediaText();

// WDS Blocks
new WDS_CallToAction_Block();
Expand Down

0 comments on commit c856737

Please sign in to comment.