Skip to content

Commit

Permalink
allow subdoc to pass any data param object
Browse files Browse the repository at this point in the history
  • Loading branch information
dalla777 committed Aug 18, 2020
1 parent 795dcd3 commit 20d02f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/formats/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ exports.public = {

var div = node.ownerDocument.createElement('div');
div.setAttribute('data-anthem-component', value.type + ':' + value.id);
if (value.product && value.product.layout) {
var data = { layout: value.product.layout };
// if doc has data params object
if (value[value.type]) {
var data = value[value.type];
div.setAttribute('data-anthem-component-data', JSON.stringify(data));
}
dom(node).replace(div);
Expand All @@ -14,4 +15,5 @@ exports.public = {
}
};

exports.private = require('./object')('doc');
exports.private = require('./object')('doc')
;

0 comments on commit 20d02f2

Please sign in to comment.