Skip to content

Commit

Permalink
3.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbengtsson committed Oct 15, 2024
1 parent 70b66de commit 4a69e34
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 6 additions & 2 deletions dist/jspdf.plugin.autotable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
*
* jsPDF AutoTable plugin v3.8.3
* jsPDF AutoTable plugin v3.8.4
*
* Copyright (c) 2024 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
* Licensed under the MIT License.
Expand Down Expand Up @@ -2197,7 +2197,11 @@ function calculate(doc, table) {
table.callCellHooks(doc, hooks, cell, row, column, null);
var padding = cell.padding('horizontal');
cell.contentWidth = (0, common_1.getStringWidth)(cell.text, cell.styles, doc) + padding;
var longestWordWidth = (0, common_1.getStringWidth)(cell.text.join(' ').split(/\s+/), cell.styles, doc);
// Using [^\S\u00A0] instead of \s ensures that we split the text on all
// whitespace except non-breaking spaces (\u00A0). We need to preserve
// them in the split process to ensure correct word separation and width
// calculation.
var longestWordWidth = (0, common_1.getStringWidth)(cell.text.join(' ').split(/[^\S\u00A0]+/), cell.styles, doc);
cell.minReadableWidth = longestWordWidth + cell.padding('horizontal');
if (typeof cell.styles.cellWidth === 'number') {
cell.minWidth = cell.styles.cellWidth;
Expand Down
4 changes: 2 additions & 2 deletions dist/jspdf.plugin.autotable.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/jspdf.plugin.autotable.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,11 @@ function calculate(doc, table) {
table.callCellHooks(doc, hooks, cell, row, column, null);
var padding = cell.padding('horizontal');
cell.contentWidth = getStringWidth(cell.text, cell.styles, doc) + padding;
var longestWordWidth = getStringWidth(cell.text.join(' ').split(/\s+/), cell.styles, doc);
// Using [^\S\u00A0] instead of \s ensures that we split the text on all
// whitespace except non-breaking spaces (\u00A0). We need to preserve
// them in the split process to ensure correct word separation and width
// calculation.
var longestWordWidth = getStringWidth(cell.text.join(' ').split(/[^\S\u00A0]+/), cell.styles, doc);
cell.minReadableWidth = longestWordWidth + cell.padding('horizontal');
if (typeof cell.styles.cellWidth === 'number') {
cell.minWidth = cell.styles.cellWidth;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspdf-autotable",
"version": "3.8.3",
"version": "3.8.4",
"description": "Generate pdf tables with javascript (jsPDF plugin)",
"main": "dist/jspdf.plugin.autotable.js",
"exports": {
Expand Down

0 comments on commit 4a69e34

Please sign in to comment.