Quote:
<Element name="blockquote">
<OneOrMore>
<Element name="p">
<Text as="value" />
</Element>
</OneOrMore>
<Optional>
// JavaScript | |
if (Object.keys == null) { | |
Object.keys = function(obj) { | |
var keys = []; | |
for (var key in obj) { | |
if (obj.hasOwnProperty(key)) { | |
keys.push(key); | |
} | |
} | |
return keys; |
# Before | |
get: (fileName, complete) -> | |
throw new Error("File name `#{fileName}` has not been added yet") unless fileName of @ipsums | |
if @cached[fileName].length | |
# Pull from cache if available | |
complete null, @cached[fileName].shift() | |
else | |
# Else, generate fresh | |
complete null, @getFresh(fileName) |
var transitionDurationToMilliseconds = function(duration) { | |
var pieces = duration.match(/^([\d\.]+)(\w+)$/), | |
time, unit, multiplier; | |
if (pieces.length <= 1) { | |
return duration; | |
} | |
time = pieces[1]; | |
unit = pieces[2]; |
function enable_gforms_placeholders($content, $field, $value, $lead_id, $form_id) { | |
if (strpos($field['cssClass'], 'gforms-placeholder') !== false) { | |
switch ($field['type']) { | |
case 'text': | |
case 'phone': | |
case 'website': | |
case 'number': | |
case 'name': | |
case 'address': | |
case 'email': |
/* eslint-disable no-console */ | |
/** | |
* External dependencies | |
*/ | |
const execSync = require( 'child_process' ).execSync; | |
const reduce = require( 'lodash/reduce' ); | |
/** | |
* Internal dependencies |
// state/effects.js | |
/** | |
* Internal dependencies | |
*/ | |
import post from './post/effects'; | |
export default [ | |
post | |
]; |
const parse, { query, text, attr } = wp.blocks.parse; | |
const quote = parse( '<blockquote><p>...</p><p>...</p><cite>Andrew</cite></blockquote>', { | |
text: query( 'p', text() ), | |
cite: text( 'cite' ) | |
} ); | |
// { text: [ "...", "..." ], cite: "Andrew" } | |
const image = parse( '<figure><img src="img.png" alt="Image"><figcaption>An Image</figcaption></figure>', { |
const { parse, registerBlock } = wp.blocks; | |
const { attr, html } = parse; | |
registerBlock( 'wp/image', { | |
schema: { | |
src: attr( 'img', 'src' ), | |
alt: attr( 'img', 'alt' ), | |
caption: html( 'figcaption' ) | |
}, |
Quote:
<Element name="blockquote">
<OneOrMore>
<Element name="p">
<Text as="value" />
</Element>
</OneOrMore>
<Optional>
// Action creators | |
function savePost( post ) { | |
return { | |
type: 'SAVE_POST', | |
post | |
}; | |
} | |
function receivePost( post ) { |