Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
docs: Update api comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SofiaSousa committed Nov 7, 2018
1 parent d1f0ace commit a617509
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ function parseDataAttributes (innerHTML, attributeSchema, value) {
return value;
}

/**
* Given an attribute key, an attribute's schema, a block's raw content and the
* commentAttributes returns the attribute value depending on its source
* definition of the given attribute key.
*
* @param {string} attributeKey Attribute key.
* @param {Object} attributeSchema Attribute's schema.
* @param {string} innerHTML Block's raw content.
* @param {Object} commentAttributes Block's comment attributes.
*
* @return {*} Attribute value.
*/
others.getBlockAttribute = (attributeKey, attributeSchema, innerHTML, commentAttributes) => {
const { type } = attributeSchema;
let value, data;
Expand All @@ -65,7 +77,7 @@ others.getBlockAttribute = (attributeKey, attributeSchema, innerHTML, commentAtt
case 'tag':
value = parseWithAttributeSchema(innerHTML, attributeSchema);

// checks 'data' property
// GUTENBERG-JS checks 'data' property
data = get(attributeSchema.query, [ 'data' ]);

if (data && data.type === 'object') {
Expand Down

0 comments on commit a617509

Please sign in to comment.