Skip to content

Instantly share code, notes, and snippets.

View mtias's full-sized avatar

Matias Ventura mtias

View GitHub Profile
@mtias
mtias / block.js
Created June 23, 2017 18:11
Creating a Gutenberg block from the console.
var el = wp.element.createElement;
wp.blocks.registerBlockType( 'mytheme/block', {
title: 'Red Block',
icon: 'universal-access-alt',
category: 'layout',
edit: function() {
return el( 'div', { style: { backgroundColor: '#900', color: '#fff', padding: '20px' } }, 'I am a red block.' );
},
save: function() {
@mtias
mtias / gutenberg-internal.js
Created July 29, 2021 13:15
How Gutenberg works witihin.
{
"name": "core/paragraph",
"attributes": {
"className": "my-text",
"content": {
"formats": (23) [empty × 6, Array(1), Array(1), Array(1), Array(1), Array(1), Array(1), empty, Array(1), Array(1), Array(1), Array(1), Array(1), Array(1), Array(1), Array(1), Array(1), empty]
"replacements": (23) [empty × 23]
"text": "Hello World! Read more."
},
"dropCap": false