Skip to content

Commit 3a61091

Browse files
committed
new build
1 parent 808a78c commit 3a61091

File tree

8 files changed

+105
-61
lines changed

8 files changed

+105
-61
lines changed

demos/browser/js/pptxgen.bundle.js

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

demos/browser/js/pptxgen.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pptxgen.bundle.js

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

dist/pptxgen.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pptxgen.cjs.js

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* PptxGenJS 4.0.0 @ 2025-05-04T15:19:14.632Z */
1+
/* PptxGenJS 4.0.1-beta.0 @ 2025-05-29T03:10:57.445Z */
22
'use strict';
33

44
var JSZip = require('jszip');
@@ -1317,7 +1317,7 @@ function getSlidesForTableRows(tableRows = [], tableProps = {}, presLayout, mast
13171317
emuTabCurrH += emuLineMaxH;
13181318
// 6: advance column/cell index (or circle back to first one to continue adding lines)
13191319
currCellIdx = currCellIdx < rowCellLines.length - 1 ? currCellIdx + 1 : 0;
1320-
// 7: done?
1320+
// 7: WIP: done?
13211321
const brent = rowCellLines.map(cell => cell._lines.length).reduce((prev, next) => prev + next);
13221322
if (brent === 0)
13231323
isDone = true;
@@ -2488,7 +2488,7 @@ function addTableDefinition(target, tableRows, options, slideLayout, presLayout,
24882488
// Create hyperlink rels (IMPORTANT: Wait until table has been shredded across Slides or all rels will end-up on Slide 1!)
24892489
createHyperlinkRels(newSlide, slide.rows);
24902490
// Add rows to new slide
2491-
newSlide.addTable(slide.rows, Object.assign({}, opt));
2491+
newSlide.addTable(slide.rows, JSON.parse(JSON.stringify(opt || {})));
24922492
// Add reference to the new slide so it can be returned, but don't add the first one because the user already has a reference to that one.
24932493
if (idx > 0)
24942494
newAutoPagedSlides.push(newSlide);
@@ -2684,7 +2684,7 @@ function addBackgroundDefinition(props, target) {
26842684
* @param {PresSlide} target - slide object that any hyperlinks will be be added to
26852685
* @param {number | string | TextProps | TextProps[] | ITableCell[][]} text - text to parse
26862686
*/
2687-
function createHyperlinkRels(target, text) {
2687+
function createHyperlinkRels(target, text, options) {
26882688
let textObjs = [];
26892689
// Only text objects can have hyperlinks, bail when text param is plain text
26902690
if (typeof text === 'string' || typeof text === 'number')
@@ -2694,20 +2694,30 @@ function createHyperlinkRels(target, text) {
26942694
textObjs = text;
26952695
else if (typeof text === 'object')
26962696
textObjs = [text];
2697-
textObjs.forEach((text) => {
2698-
// `text` can be an array of other `text` objects (table cell word-level formatting), continue parsing using recursion
2697+
textObjs.forEach((text, idx) => {
2698+
// IMPORTANT: `options` are lost due to recursion/copy!
2699+
if (options && options[idx])
2700+
text.options = options[idx];
2701+
// NOTE: `text` can be an array of other `text` objects (table cell word-level formatting), continue parsing using recursion
26992702
if (Array.isArray(text)) {
2700-
createHyperlinkRels(target, text);
2703+
const cellOpts = [];
2704+
text.forEach((tablecell) => {
2705+
if (tablecell.options && !tablecell.text.options) {
2706+
cellOpts.push(tablecell.options);
2707+
}
2708+
});
2709+
createHyperlinkRels(target, text, cellOpts);
27012710
}
27022711
else if (Array.isArray(text.text)) {
2703-
// this handles TableCells with hyperlinks
2704-
createHyperlinkRels(target, text.text);
2712+
createHyperlinkRels(target, text.text, options && options[idx] ? [options[idx]] : undefined);
27052713
}
27062714
else if (text && typeof text === 'object' && text.options && text.options.hyperlink && !text.options.hyperlink._rId) {
2707-
if (typeof text.options.hyperlink !== 'object')
2715+
if (typeof text.options.hyperlink !== 'object') {
27082716
console.log('ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:\'https://github.com\'}` ');
2709-
else if (!text.options.hyperlink.url && !text.options.hyperlink.slide)
2717+
}
2718+
else if (!text.options.hyperlink.url && !text.options.hyperlink.slide) {
27102719
console.log('ERROR: \'hyperlink requires either: `url` or `slide`\'');
2720+
}
27112721
else {
27122722
const relId = getNewRelId(target);
27132723
target._rels.push({
@@ -2719,6 +2729,17 @@ function createHyperlinkRels(target, text) {
27192729
text.options.hyperlink._rId = relId;
27202730
}
27212731
}
2732+
else if (text && typeof text === 'object' && text.options && text.options.hyperlink && text.options.hyperlink._rId) {
2733+
// NOTE: auto-paging will create new slides, but skip above as _rId exists, BUT this is a new slide, so add rels!
2734+
if (target._rels.filter(rel => rel.rId === text.options.hyperlink._rId).length === 0) {
2735+
target._rels.push({
2736+
type: SLIDE_OBJECT_TYPES.hyperlink,
2737+
data: text.options.hyperlink.slide ? 'slide' : 'dummy',
2738+
rId: text.options.hyperlink._rId,
2739+
Target: encodeXmlEntities(text.options.hyperlink.url) || text.options.hyperlink.slide.toString(),
2740+
});
2741+
}
2742+
}
27222743
});
27232744
}
27242745

@@ -6761,7 +6782,7 @@ function makeXmlViewProps() {
67616782
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67626783
* SOFTWARE.
67636784
*/
6764-
const VERSION = '4.0.0';
6785+
const VERSION = '4.0.1-beta.0';
67656786
class PptxGenJS {
67666787
set layout(value) {
67676788
const newLayout = this.LAYOUTS[value];
@@ -7176,7 +7197,8 @@ class PptxGenJS {
71767197
// STEP 4: Write the file out
71777198
if (isNode) {
71787199
// Dynamically import to avoid bundling fs in the browser build
7179-
const { writeFile } = yield import('node:fs/promises');
7200+
const { promises: fs } = yield import('node:fs');
7201+
const { writeFile } = fs;
71807202
yield writeFile(fileName, data);
71817203
return fileName;
71827204
}

dist/pptxgen.es.js

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* PptxGenJS 4.0.0 @ 2025-05-04T15:19:14.634Z */
1+
/* PptxGenJS 4.0.1-beta.0 @ 2025-05-29T03:10:57.448Z */
22
import JSZip from 'jszip';
33

44
/******************************************************************************
@@ -1315,7 +1315,7 @@ function getSlidesForTableRows(tableRows = [], tableProps = {}, presLayout, mast
13151315
emuTabCurrH += emuLineMaxH;
13161316
// 6: advance column/cell index (or circle back to first one to continue adding lines)
13171317
currCellIdx = currCellIdx < rowCellLines.length - 1 ? currCellIdx + 1 : 0;
1318-
// 7: done?
1318+
// 7: WIP: done?
13191319
const brent = rowCellLines.map(cell => cell._lines.length).reduce((prev, next) => prev + next);
13201320
if (brent === 0)
13211321
isDone = true;
@@ -2486,7 +2486,7 @@ function addTableDefinition(target, tableRows, options, slideLayout, presLayout,
24862486
// Create hyperlink rels (IMPORTANT: Wait until table has been shredded across Slides or all rels will end-up on Slide 1!)
24872487
createHyperlinkRels(newSlide, slide.rows);
24882488
// Add rows to new slide
2489-
newSlide.addTable(slide.rows, Object.assign({}, opt));
2489+
newSlide.addTable(slide.rows, JSON.parse(JSON.stringify(opt || {})));
24902490
// Add reference to the new slide so it can be returned, but don't add the first one because the user already has a reference to that one.
24912491
if (idx > 0)
24922492
newAutoPagedSlides.push(newSlide);
@@ -2682,7 +2682,7 @@ function addBackgroundDefinition(props, target) {
26822682
* @param {PresSlide} target - slide object that any hyperlinks will be be added to
26832683
* @param {number | string | TextProps | TextProps[] | ITableCell[][]} text - text to parse
26842684
*/
2685-
function createHyperlinkRels(target, text) {
2685+
function createHyperlinkRels(target, text, options) {
26862686
let textObjs = [];
26872687
// Only text objects can have hyperlinks, bail when text param is plain text
26882688
if (typeof text === 'string' || typeof text === 'number')
@@ -2692,20 +2692,30 @@ function createHyperlinkRels(target, text) {
26922692
textObjs = text;
26932693
else if (typeof text === 'object')
26942694
textObjs = [text];
2695-
textObjs.forEach((text) => {
2696-
// `text` can be an array of other `text` objects (table cell word-level formatting), continue parsing using recursion
2695+
textObjs.forEach((text, idx) => {
2696+
// IMPORTANT: `options` are lost due to recursion/copy!
2697+
if (options && options[idx])
2698+
text.options = options[idx];
2699+
// NOTE: `text` can be an array of other `text` objects (table cell word-level formatting), continue parsing using recursion
26972700
if (Array.isArray(text)) {
2698-
createHyperlinkRels(target, text);
2701+
const cellOpts = [];
2702+
text.forEach((tablecell) => {
2703+
if (tablecell.options && !tablecell.text.options) {
2704+
cellOpts.push(tablecell.options);
2705+
}
2706+
});
2707+
createHyperlinkRels(target, text, cellOpts);
26992708
}
27002709
else if (Array.isArray(text.text)) {
2701-
// this handles TableCells with hyperlinks
2702-
createHyperlinkRels(target, text.text);
2710+
createHyperlinkRels(target, text.text, options && options[idx] ? [options[idx]] : undefined);
27032711
}
27042712
else if (text && typeof text === 'object' && text.options && text.options.hyperlink && !text.options.hyperlink._rId) {
2705-
if (typeof text.options.hyperlink !== 'object')
2713+
if (typeof text.options.hyperlink !== 'object') {
27062714
console.log('ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:\'https://github.com\'}` ');
2707-
else if (!text.options.hyperlink.url && !text.options.hyperlink.slide)
2715+
}
2716+
else if (!text.options.hyperlink.url && !text.options.hyperlink.slide) {
27082717
console.log('ERROR: \'hyperlink requires either: `url` or `slide`\'');
2718+
}
27092719
else {
27102720
const relId = getNewRelId(target);
27112721
target._rels.push({
@@ -2717,6 +2727,17 @@ function createHyperlinkRels(target, text) {
27172727
text.options.hyperlink._rId = relId;
27182728
}
27192729
}
2730+
else if (text && typeof text === 'object' && text.options && text.options.hyperlink && text.options.hyperlink._rId) {
2731+
// NOTE: auto-paging will create new slides, but skip above as _rId exists, BUT this is a new slide, so add rels!
2732+
if (target._rels.filter(rel => rel.rId === text.options.hyperlink._rId).length === 0) {
2733+
target._rels.push({
2734+
type: SLIDE_OBJECT_TYPES.hyperlink,
2735+
data: text.options.hyperlink.slide ? 'slide' : 'dummy',
2736+
rId: text.options.hyperlink._rId,
2737+
Target: encodeXmlEntities(text.options.hyperlink.url) || text.options.hyperlink.slide.toString(),
2738+
});
2739+
}
2740+
}
27202741
});
27212742
}
27222743

@@ -6759,7 +6780,7 @@ function makeXmlViewProps() {
67596780
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67606781
* SOFTWARE.
67616782
*/
6762-
const VERSION = '4.0.0';
6783+
const VERSION = '4.0.1-beta.0';
67636784
class PptxGenJS {
67646785
set layout(value) {
67656786
const newLayout = this.LAYOUTS[value];
@@ -7174,7 +7195,8 @@ class PptxGenJS {
71747195
// STEP 4: Write the file out
71757196
if (isNode) {
71767197
// Dynamically import to avoid bundling fs in the browser build
7177-
const { writeFile } = yield import('node:fs/promises');
7198+
const { promises: fs } = yield import('node:fs');
7199+
const { writeFile } = fs;
71787200
yield writeFile(fileName, data);
71797201
return fileName;
71807202
}

dist/pptxgen.min.js

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

dist/pptxgen.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)