Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename blockSlug to blockType to match the rest of the project
  • Loading branch information
nylen committed Apr 18, 2017
commit f900617c8704da56d83d31fbf71c388a56bd5f9d
14 changes: 7 additions & 7 deletions blocks/api/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ export function getBlockAttributes( blockSettings, rawContent, attributes ) {
/**
* Creates a block with fallback to the unknown type handler.
*
* @param {?String} blockSlug Block slug
* @param {?String} blockType Block type slug
* @param {String} rawContent Raw block content
* @param {?Object} attributes Attributes obtained from block delimiters
* @return {?Object} An initialized block object (if possible)
*/
export function createBlockWithFallback( blockSlug, rawContent, attributes ) {
export function createBlockWithFallback( blockType, rawContent, attributes ) {
// Use type from block content, otherwise find unknown handler
blockSlug = blockSlug || getUnknownTypeHandler();
blockType = blockType || getUnknownTypeHandler();

// Try finding settings for known block type, else again fall back
let blockSettings = getBlockSettings( blockSlug );
let blockSettings = getBlockSettings( blockType );
if ( ! blockSettings ) {
blockSlug = getUnknownTypeHandler();
blockSettings = getBlockSettings( blockSlug );
blockType = getUnknownTypeHandler();
blockSettings = getBlockSettings( blockType );
}

// Include in set only if settings were determined
Expand All @@ -74,7 +74,7 @@ export function createBlockWithFallback( blockSlug, rawContent, attributes ) {
// Gradually convert all blocks to this new format, then remove the
// string serialization.
const block = createBlock(
blockSlug,
blockType,
getBlockAttributes( blockSettings, rawContent, attributes )
);
return block;
Expand Down