Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-to-pdfmake

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-to-pdfmake - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

example.js

@@ -112,2 +112,4 @@ var pdfMake = require("pdfmake/build/pdfmake");

</div>
<p style="text-align: center;"> <span style="font-size: 14px;"><em><strong>Bold italic centered text</strong></em></span> </p>
`, window);

@@ -114,0 +116,0 @@

@@ -94,3 +94,3 @@ // source: https://github.com/OpenSlides/OpenSlides/blob/f4f8b8422f9b3fbab58e35ac3f8f870d35813b7d/client/src/app/core/ui-services/html-to-pdf.service.ts

if (element.textContent) {
text = element.textContent.replace(/\n(\s+)?/g, "");
text = element.textContent.replace(/\n(\s+)?/g, "").trim();
if (text) {

@@ -216,2 +216,8 @@ ret = {'text': text};

ret=ret[0];
// check if we have a default css style to apply when a text is inside several <tag>
// e.g. <strong><em>text</em></strong>
if (ret.text) {
applyDefaultStyle(ret, nodeName);
setComputedStyle(ret, element.getAttribute("style"));
}
ret.style = (ret.style||[]).concat(['html-'+nodeName]);

@@ -218,0 +224,0 @@ // for TD and TH we want to include the style from TR

2

package.json
{
"name": "html-to-pdfmake",
"version": "1.0.5",
"version": "1.0.6",
"description": "Convert HTML code to PDFMake",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -340,1 +340,21 @@ var htmlToPdfMake = require('../index.js');

})
test("cascade_tags", function(t) {
var ret = htmlToPdfMake('<p style="text-align: center;"> <span style="font-size: 14px;"><em><strong>test</strong></em></span> </p>', window);
t.check(Array.isArray(ret) && ret.length===1, "return is OK");
ret = ret[0];
t.check(
ret.text === "test" &&
ret.bold &&
ret.italics &&
ret.fontSize === 14 &&
ret.alignment === 'center' &&
Array.isArray(ret.style) &&
ret.style.includes('html-strong') &&
ret.style.includes('html-em') &&
ret.style.includes('html-span') &&
ret.style.includes('html-p'),
"cascade_tags");
t.finish();
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc