convert-rich-text
Advanced tools
Comparing version 4.0.1 to 5.0.0
@@ -1,6 +0,25 @@ | ||
var convert = require('./lib/convert'); | ||
var toHtml = require('./lib/export/to_html'); | ||
var toInlineHtml = require('./lib/export/to_inline_html'); | ||
var toInternalHtml = require('./lib/export/to_internal_html'); | ||
var toPublicHtml = require('./lib/export/to_public_html'); | ||
var toPlaintext = require('./lib/export/to_plaintext'); | ||
module.exports = function(delta, formats, options) { | ||
options.document = document; | ||
return convert(delta, formats, options); | ||
module.exports = { | ||
toHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: document }); | ||
return toHtml(delta, formats, options); | ||
}, | ||
toInlineHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: document }); | ||
return toInlineHtml(delta, formats, options); | ||
}, | ||
toInternalHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: document }); | ||
return toInternalHtml(delta, formats, options); | ||
}, | ||
toPublicHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: document }); | ||
return toPublicHtml(delta, formats, options); | ||
}, | ||
toPlaintext: toPlaintext | ||
}; |
28
index.js
var JSDOM = require('jsdom').JSDOM; | ||
var convert = require('./lib/convert'); | ||
var toHtml = require('./lib/export/to_html'); | ||
var toInlineHtml = require('./lib/export/to_inline_html'); | ||
var toInternalHtml = require('./lib/export/to_internal_html'); | ||
var toPublicHtml = require('./lib/export/to_public_html'); | ||
var toPlaintext = require('./lib/export/to_plaintext'); | ||
module.exports = function(delta, formats, options) { | ||
options.document = new JSDOM().window.document; | ||
return convert(delta, formats, options); | ||
module.exports = { | ||
toHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: new JSDOM().window.document }); | ||
return toHtml(delta, formats, options); | ||
}, | ||
toInlineHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: new JSDOM().window.document }); | ||
return toInlineHtml(delta, formats, options); | ||
}, | ||
toInternalHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: new JSDOM().window.document }); | ||
return toInternalHtml(delta, formats, options); | ||
}, | ||
toPublicHtml: function(delta, formats, options) { | ||
options = Object.assign({}, options, { document: new JSDOM().window.document }); | ||
return toPublicHtml(delta, formats, options); | ||
}, | ||
toPlaintext: toPlaintext | ||
}; | ||
{ | ||
"name": "convert-rich-text", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "Convert an insert-only rich-text delta into HTML", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
"lint": "jshint --verbose .", | ||
"test": "npm run lint && NODE_ENV=test karma start && NODE_ENV=test mocha test/server/server.js -R spec" | ||
"test": "npm run lint && NODE_ENV=test karma start && NODE_ENV=test mocha test/server/*.js -R spec" | ||
}, | ||
@@ -12,0 +12,0 @@ "repository": { |
@@ -49,3 +49,3 @@ exports.formats = { | ||
delta: { ops: [ | ||
{insert: 'Hello world\n'} | ||
{ insert: 'Hello world\n' } | ||
]}, | ||
@@ -58,5 +58,5 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'Hello, '}, | ||
{insert: 'World!', attributes: {bold: true}}, | ||
{insert: '\n'} | ||
{ insert: 'Hello, ' }, | ||
{ insert: 'World!', attributes: { bold: true } }, | ||
{ insert: '\n' } | ||
]}, | ||
@@ -69,9 +69,9 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'Hello, World!\nThis is a second line.', attributes: {bold: true}}, | ||
{insert: '\n', attributes: {firstheader: true}}, | ||
{insert: 'This is a demo of convert-rich-text '}, | ||
{insert: {image: 'http://i.imgur.com/2ockv.gif'}}, | ||
{insert: ' '}, | ||
{insert: 'Google', attributes: {link: 'https://www.google.com'}}, | ||
{insert: '\n'} | ||
{ insert: 'Hello, World!\nThis is a second line.', attributes: { bold: true } }, | ||
{ insert: '\n', attributes: { firstheader: true } }, | ||
{ insert: 'This is a demo of convert-rich-text ' }, | ||
{ insert: { image: 'http://i.imgur.com/2ockv.gif' } }, | ||
{ insert: ' ' }, | ||
{ insert: 'Google', attributes: { link: 'https://www.google.com' } }, | ||
{ insert: '\n' } | ||
]}, | ||
@@ -88,4 +88,4 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'Hello world', attributes: { color: 'red', user: 1234 }}, | ||
{insert: '\n'} | ||
{ insert: 'Hello world', attributes: { color: 'red', user: 1234 } }, | ||
{ insert: '\n' } | ||
]}, | ||
@@ -100,4 +100,4 @@ expected: { | ||
delta: { ops: [ | ||
{insert: 'hello world', attributes: { className: 'greeting' }}, | ||
{insert: '\n'} | ||
{ insert: 'hello world', attributes: { className: 'greeting' } }, | ||
{ insert: '\n' } | ||
]}, | ||
@@ -110,10 +110,10 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'Consecutive list elements'}, | ||
{insert: '\n', attributes: {list: true}}, | ||
{insert: 'Should create a parent tag'}, | ||
{insert: '\n', attributes: {list: true}}, | ||
{insert: 'Consecutive bullet elements'}, | ||
{insert: '\n', attributes: {bullet: true}}, | ||
{insert: 'Should create a parent tag'}, | ||
{insert: '\n', attributes: {bullet: true}} | ||
{ insert: 'Consecutive list elements' }, | ||
{ insert: '\n', attributes: { list: true } }, | ||
{ insert: 'Should create a parent tag' }, | ||
{ insert: '\n', attributes: { list: true } }, | ||
{ insert: 'Consecutive bullet elements' }, | ||
{ insert: '\n', attributes: { bullet: true } }, | ||
{ insert: 'Should create a parent tag' }, | ||
{ insert: '\n', attributes: { bullet: true } } | ||
]}, | ||
@@ -129,6 +129,6 @@ expected: | ||
delta: { ops: [ | ||
{attributes:{bold:true},insert:'hello'}, | ||
{insert:' '}, | ||
{attributes:{link:'http://vox.com'},insert:'world'}, | ||
{insert:' this works...?\n'} | ||
{ attributes: { bold: true }, insert:'hello' }, | ||
{ insert: ' ' }, | ||
{ attributes: { link: 'http://vox.com' }, insert:'world' }, | ||
{ insert:' this works...?\n' } | ||
]}, | ||
@@ -141,6 +141,6 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'Some text '}, | ||
{insert: 'a link', attributes: {link: 'http://vox.com'}}, | ||
{insert: ' more text'}, | ||
{insert: '\n', attributes: {list: true}} | ||
{ insert: 'Some text ' }, | ||
{ insert: 'a link', attributes: { link: 'http://vox.com' } }, | ||
{ insert: ' more text' }, | ||
{ insert: '\n', attributes: { list: true } } | ||
]}, | ||
@@ -153,4 +153,4 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'hello world', attributes: { parent: 'article' } }, | ||
{insert: '\n', attributes: { firstheader: true } } | ||
{ insert: 'hello world', attributes: { parent: 'article' } }, | ||
{ insert: '\n', attributes: { firstheader: true } } | ||
]}, | ||
@@ -163,6 +163,6 @@ expected: | ||
delta: { ops: [ | ||
{insert: 'Hello World!', attributes: {reverse: true}}, | ||
{insert: '\n'}, | ||
{insert: 'Foo Bar Baz', attributes: {bold: true, repeat: 3}}, | ||
{insert: '\n', attributes: { data: {foo: 'bar'}}} | ||
{ insert: 'Hello World!', attributes: { reverse: true } }, | ||
{ insert: '\n' }, | ||
{ insert: 'Foo Bar Baz', attributes: { bold: true, repeat: 3 } }, | ||
{ insert: '\n', attributes: { data: { foo: 'bar' } } } | ||
]}, | ||
@@ -175,3 +175,3 @@ expected: | ||
desc: 'Change default blockTag', | ||
delta: { ops: [{insert: 'Hello world'}]}, | ||
delta: { ops: [{ insert: 'Hello world' }]}, | ||
opts: { blockTag: 'P' }, | ||
@@ -182,5 +182,5 @@ expected: '<p>Hello world</p>' | ||
desc: 'Line formats with no contents', | ||
delta: { ops: [{insert: '\n', attributes: {firstheader: true} }] }, | ||
delta: { ops: [{ insert: '\n', attributes: { firstheader: true } }] }, | ||
expected: '<h1></h1>' | ||
} | ||
]; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
205944
68
1921
4
2