Skip to content

Commit 4a69e34

Browse files
3.8.4
1 parent 70b66de commit 4a69e34

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

dist/jspdf.plugin.autotable.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
*
3-
* jsPDF AutoTable plugin v3.8.3
3+
* jsPDF AutoTable plugin v3.8.4
44
*
55
* Copyright (c) 2024 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
66
* Licensed under the MIT License.
@@ -2197,7 +2197,11 @@ function calculate(doc, table) {
21972197
table.callCellHooks(doc, hooks, cell, row, column, null);
21982198
var padding = cell.padding('horizontal');
21992199
cell.contentWidth = (0, common_1.getStringWidth)(cell.text, cell.styles, doc) + padding;
2200-
var longestWordWidth = (0, common_1.getStringWidth)(cell.text.join(' ').split(/\s+/), cell.styles, doc);
2200+
// Using [^\S\u00A0] instead of \s ensures that we split the text on all
2201+
// whitespace except non-breaking spaces (\u00A0). We need to preserve
2202+
// them in the split process to ensure correct word separation and width
2203+
// calculation.
2204+
var longestWordWidth = (0, common_1.getStringWidth)(cell.text.join(' ').split(/[^\S\u00A0]+/), cell.styles, doc);
22012205
cell.minReadableWidth = longestWordWidth + cell.padding('horizontal');
22022206
if (typeof cell.styles.cellWidth === 'number') {
22032207
cell.minWidth = cell.styles.cellWidth;

dist/jspdf.plugin.autotable.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.plugin.autotable.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,11 @@ function calculate(doc, table) {
17561756
table.callCellHooks(doc, hooks, cell, row, column, null);
17571757
var padding = cell.padding('horizontal');
17581758
cell.contentWidth = getStringWidth(cell.text, cell.styles, doc) + padding;
1759-
var longestWordWidth = getStringWidth(cell.text.join(' ').split(/\s+/), cell.styles, doc);
1759+
// Using [^\S\u00A0] instead of \s ensures that we split the text on all
1760+
// whitespace except non-breaking spaces (\u00A0). We need to preserve
1761+
// them in the split process to ensure correct word separation and width
1762+
// calculation.
1763+
var longestWordWidth = getStringWidth(cell.text.join(' ').split(/[^\S\u00A0]+/), cell.styles, doc);
17601764
cell.minReadableWidth = longestWordWidth + cell.padding('horizontal');
17611765
if (typeof cell.styles.cellWidth === 'number') {
17621766
cell.minWidth = cell.styles.cellWidth;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspdf-autotable",
3-
"version": "3.8.3",
3+
"version": "3.8.4",
44
"description": "Generate pdf tables with javascript (jsPDF plugin)",
55
"main": "dist/jspdf.plugin.autotable.js",
66
"exports": {

0 commit comments

Comments
 (0)