HtmlParserButton.js
1 year ago
HtmlParserFooter.js
1 year ago
HtmlParserModal.js
1 year ago
index.js
1 year ago
serialize.js
1 year ago
serialize.js
14 lines
| 1 | function convertToCommentBlock( { name, attributes } ) { |
| 2 | const blockAttrs = JSON.stringify( attributes ); |
| 3 | |
| 4 | return `<!-- wp:${ name } ${ blockAttrs } /-->`; |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * @param blocks {Object[]} |
| 9 | */ |
| 10 | function serialize( blocks ) { |
| 11 | return blocks.map( convertToCommentBlock ).join( '\n\n' ); |
| 12 | } |
| 13 | |
| 14 | export default serialize; |