Skip to content

Commit

Permalink
Merge pull request #26 from voxmedia/kv-product-card
Browse files Browse the repository at this point in the history
Add support for subdoc data params
  • Loading branch information
dalla777 authored Aug 28, 2020
2 parents 14b49c8 + eda50b9 commit 784dc81
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ convert(delta, formats, { blockTag: 'FIGURE', inlineTag: 'INS' });

## Changelog

- `5.5.0` Add support for data params in doc component
- `5.4.1` Update dev dependencies to address security vulnerabilities
- `5.4.0` Update jsdom and lodash dependencies
- `5.3.0` Add support for Pym.js component
Expand Down
8 changes: 7 additions & 1 deletion lib/formats/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ exports.public = {

var div = node.ownerDocument.createElement('div');
div.setAttribute('data-anthem-component', value.type + ':' + value.id);
// if doc has data params object
if (value[value.type]) {
// should be an object
var data = value[value.type];
div.setAttribute('data-anthem-component-data', JSON.stringify(data));
}
dom(node).replace(div);

return div;
}
};

exports.private = require('./object')('doc');
exports.private = require('./object')('doc');
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "convert-rich-text",
"version": "5.4.1",
"version": "5.5.0",
"description": "Convert an insert-only rich-text delta into HTML",
"main": "index.js",
"browser": "browser.js",
Expand Down

0 comments on commit 784dc81

Please sign in to comment.