@polotno/pdf-export 0.1.26 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/text.js +4 -0
  2. package/package.json +2 -1
package/lib/text.js CHANGED
@@ -27,6 +27,10 @@ function normalizeRichText(text) {
27
27
  normalized = normalized.replace(/\n{3,}/g, '\n\n');
28
28
  // Trim stray leading/trailing newlines introduced by paragraph conversion
29
29
  normalized = normalized.replace(/^\n+/, '').replace(/\n+$/, '');
30
+ // Decode common HTML non-breaking space entities into their unicode counterpart
31
+ normalized = normalized.replace(/&(nbsp|#160|#xA0);/gi, '\u00A0');
32
+ // Strip zero-width characters that can create missing-glyph boxes in PDF output
33
+ normalized = normalized.replace(/[\u200B\u200C\u200D\uFEFF\u2060]/g, '');
30
34
  return normalized;
31
35
  }
32
36
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polotno/pdf-export",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Convert Polotno JSON into vector PDF",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "scripts": {
15
15
  "build": "tsc",
16
+ "prepublishOnly": "npm run build",
16
17
  "test": "vitest",
17
18
  "test:update-snapshots": "vitest -u",
18
19
  "dev": "vite client",