diff --git a/README.md b/README.md index ccf3a8a..b1d7454 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/formats/doc.js b/lib/formats/doc.js index b3f0dac..e615202 100644 --- a/lib/formats/doc.js +++ b/lib/formats/doc.js @@ -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'); \ No newline at end of file diff --git a/package.json b/package.json index 56d8d97..c001f36 100644 --- a/package.json +++ b/package.json @@ -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",