documents.js 1.33.2 → 1.33.4
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.
- package/dist/index.cjs +251 -22
- package/dist/index.js +251 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1304,9 +1304,26 @@ function appendBlock(body, block) {
|
|
|
1304
1304
|
const CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
1305
1305
|
const RELS_NS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
1306
1306
|
const PML_NS = "http://schemas.openxmlformats.org/presentationml/2006/main";
|
|
1307
|
+
const DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
1307
1308
|
const R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
1308
1309
|
const DEFAULT_SLIDE_WIDTH_EMU = "12192000";
|
|
1309
1310
|
const DEFAULT_SLIDE_HEIGHT_EMU = "6858000";
|
|
1311
|
+
const DEFAULT_NOTES_WIDTH_EMU = "6858000";
|
|
1312
|
+
const DEFAULT_NOTES_HEIGHT_EMU = "9144000";
|
|
1313
|
+
const SLIDE_MASTER_PART_PATH = "ppt/slideMasters/slideMaster1.xml";
|
|
1314
|
+
const SLIDE_LAYOUT_PART_PATH = "ppt/slideLayouts/slideLayout1.xml";
|
|
1315
|
+
const THEME_PART_PATH = "ppt/theme/theme1.xml";
|
|
1316
|
+
const PRESENTATION_PART_PATH$1 = "ppt/presentation.xml";
|
|
1317
|
+
const NOTES_MASTER_PART_PATH = "ppt/notesMasters/notesMaster1.xml";
|
|
1318
|
+
const SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
1319
|
+
const SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
1320
|
+
const THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
1321
|
+
const NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
1322
|
+
const SLIDE_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
|
1323
|
+
const SLIDE_LAYOUT_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
1324
|
+
const THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
1325
|
+
const NOTES_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
|
|
1326
|
+
const MIN_MASTER_OR_LAYOUT_ID = 2147483648;
|
|
1310
1327
|
function declaration() {
|
|
1311
1328
|
return {
|
|
1312
1329
|
type: "declaration",
|
|
@@ -1326,6 +1343,153 @@ function declaration() {
|
|
|
1326
1343
|
]
|
|
1327
1344
|
};
|
|
1328
1345
|
}
|
|
1346
|
+
function buildEmptyGroupSpTree() {
|
|
1347
|
+
return el("p:spTree", {}, [el("p:nvGrpSpPr", {}, [
|
|
1348
|
+
el("p:cNvPr", {
|
|
1349
|
+
id: "1",
|
|
1350
|
+
name: ""
|
|
1351
|
+
}),
|
|
1352
|
+
el("p:cNvGrpSpPr"),
|
|
1353
|
+
el("p:nvPr")
|
|
1354
|
+
]), el("p:grpSpPr")]);
|
|
1355
|
+
}
|
|
1356
|
+
function buildFormatScheme() {
|
|
1357
|
+
const solidPhClr = () => el("a:solidFill", {}, [el("a:schemeClr", { val: "phClr" })]);
|
|
1358
|
+
return el("a:fmtScheme", { name: "Office" }, [
|
|
1359
|
+
el("a:fillStyleLst", {}, [
|
|
1360
|
+
solidPhClr(),
|
|
1361
|
+
solidPhClr(),
|
|
1362
|
+
solidPhClr()
|
|
1363
|
+
]),
|
|
1364
|
+
el("a:lnStyleLst", {}, [
|
|
1365
|
+
el("a:ln", {}, [solidPhClr()]),
|
|
1366
|
+
el("a:ln", {}, [solidPhClr()]),
|
|
1367
|
+
el("a:ln", {}, [solidPhClr()])
|
|
1368
|
+
]),
|
|
1369
|
+
el("a:effectStyleLst", {}, [
|
|
1370
|
+
el("a:effectStyle", {}, [el("a:effectLst")]),
|
|
1371
|
+
el("a:effectStyle", {}, [el("a:effectLst")]),
|
|
1372
|
+
el("a:effectStyle", {}, [el("a:effectLst")])
|
|
1373
|
+
]),
|
|
1374
|
+
el("a:bgFillStyleLst", {}, [
|
|
1375
|
+
solidPhClr(),
|
|
1376
|
+
solidPhClr(),
|
|
1377
|
+
solidPhClr()
|
|
1378
|
+
])
|
|
1379
|
+
]);
|
|
1380
|
+
}
|
|
1381
|
+
function buildTheme() {
|
|
1382
|
+
const clrScheme = el("a:clrScheme", { name: "Office" }, [
|
|
1383
|
+
el("a:dk1", {}, [el("a:sysClr", {
|
|
1384
|
+
val: "windowText",
|
|
1385
|
+
lastClr: "000000"
|
|
1386
|
+
})]),
|
|
1387
|
+
el("a:lt1", {}, [el("a:sysClr", {
|
|
1388
|
+
val: "window",
|
|
1389
|
+
lastClr: "FFFFFF"
|
|
1390
|
+
})]),
|
|
1391
|
+
el("a:dk2", {}, [el("a:srgbClr", { val: "1F497D" })]),
|
|
1392
|
+
el("a:lt2", {}, [el("a:srgbClr", { val: "EEECE1" })]),
|
|
1393
|
+
el("a:accent1", {}, [el("a:srgbClr", { val: "4F81BD" })]),
|
|
1394
|
+
el("a:accent2", {}, [el("a:srgbClr", { val: "C0504D" })]),
|
|
1395
|
+
el("a:accent3", {}, [el("a:srgbClr", { val: "9BBB59" })]),
|
|
1396
|
+
el("a:accent4", {}, [el("a:srgbClr", { val: "8064A2" })]),
|
|
1397
|
+
el("a:accent5", {}, [el("a:srgbClr", { val: "4BACC6" })]),
|
|
1398
|
+
el("a:accent6", {}, [el("a:srgbClr", { val: "F79646" })]),
|
|
1399
|
+
el("a:hlink", {}, [el("a:srgbClr", { val: "0000FF" })]),
|
|
1400
|
+
el("a:folHlink", {}, [el("a:srgbClr", { val: "800080" })])
|
|
1401
|
+
]);
|
|
1402
|
+
const fontScheme = el("a:fontScheme", { name: "Office" }, [el("a:majorFont", {}, [
|
|
1403
|
+
el("a:latin", { typeface: "Calibri Light" }),
|
|
1404
|
+
el("a:ea", { typeface: "" }),
|
|
1405
|
+
el("a:cs", { typeface: "" })
|
|
1406
|
+
]), el("a:minorFont", {}, [
|
|
1407
|
+
el("a:latin", { typeface: "Calibri" }),
|
|
1408
|
+
el("a:ea", { typeface: "" }),
|
|
1409
|
+
el("a:cs", { typeface: "" })
|
|
1410
|
+
])]);
|
|
1411
|
+
return el("a:theme", {
|
|
1412
|
+
"xmlns:a": DML_NS,
|
|
1413
|
+
name: "Office Theme"
|
|
1414
|
+
}, [el("a:themeElements", {}, [
|
|
1415
|
+
clrScheme,
|
|
1416
|
+
fontScheme,
|
|
1417
|
+
buildFormatScheme()
|
|
1418
|
+
])]);
|
|
1419
|
+
}
|
|
1420
|
+
function buildIdentityColorMap() {
|
|
1421
|
+
return el("p:clrMap", {
|
|
1422
|
+
bg1: "lt1",
|
|
1423
|
+
tx1: "dk1",
|
|
1424
|
+
bg2: "lt2",
|
|
1425
|
+
tx2: "dk2",
|
|
1426
|
+
accent1: "accent1",
|
|
1427
|
+
accent2: "accent2",
|
|
1428
|
+
accent3: "accent3",
|
|
1429
|
+
accent4: "accent4",
|
|
1430
|
+
accent5: "accent5",
|
|
1431
|
+
accent6: "accent6",
|
|
1432
|
+
hlink: "hlink",
|
|
1433
|
+
folHlink: "folHlink"
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
function buildWhiteBackground() {
|
|
1437
|
+
return el("p:bg", {}, [el("p:bgPr", {}, [el("a:solidFill", {}, [el("a:srgbClr", { val: "FFFFFF" })]), el("a:effectLst")])]);
|
|
1438
|
+
}
|
|
1439
|
+
function buildSlideMaster(layoutRelationshipId) {
|
|
1440
|
+
return el("p:sldMaster", {
|
|
1441
|
+
"xmlns:p": PML_NS,
|
|
1442
|
+
"xmlns:a": DML_NS,
|
|
1443
|
+
"xmlns:r": R_NS
|
|
1444
|
+
}, [
|
|
1445
|
+
el("p:cSld", {}, [buildWhiteBackground(), buildEmptyGroupSpTree()]),
|
|
1446
|
+
buildIdentityColorMap(),
|
|
1447
|
+
el("p:sldLayoutIdLst", {}, [el("p:sldLayoutId", {
|
|
1448
|
+
id: String(MIN_MASTER_OR_LAYOUT_ID),
|
|
1449
|
+
"r:id": layoutRelationshipId
|
|
1450
|
+
})])
|
|
1451
|
+
]);
|
|
1452
|
+
}
|
|
1453
|
+
function buildSlideLayout() {
|
|
1454
|
+
return el("p:sldLayout", {
|
|
1455
|
+
"xmlns:p": PML_NS,
|
|
1456
|
+
"xmlns:a": DML_NS,
|
|
1457
|
+
"xmlns:r": R_NS,
|
|
1458
|
+
type: "blank",
|
|
1459
|
+
preserve: "1"
|
|
1460
|
+
}, [el("p:cSld", { name: "Blank" }, [buildEmptyGroupSpTree()]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1461
|
+
}
|
|
1462
|
+
function buildNotesMaster() {
|
|
1463
|
+
return el("p:notesMaster", {
|
|
1464
|
+
"xmlns:p": PML_NS,
|
|
1465
|
+
"xmlns:a": DML_NS
|
|
1466
|
+
}, [el("p:cSld", {}, [buildWhiteBackground(), buildEmptyGroupSpTree()]), buildIdentityColorMap()]);
|
|
1467
|
+
}
|
|
1468
|
+
function ensureNotesMaster(pkg) {
|
|
1469
|
+
if (pkg.parts[NOTES_MASTER_PART_PATH] !== void 0) return NOTES_MASTER_PART_PATH;
|
|
1470
|
+
const masterToThemeTarget = buildRelativeTarget(NOTES_MASTER_PART_PATH, THEME_PART_PATH);
|
|
1471
|
+
addRelationship(pkg, NOTES_MASTER_PART_PATH, {
|
|
1472
|
+
type: THEME_REL_TYPE,
|
|
1473
|
+
target: masterToThemeTarget
|
|
1474
|
+
});
|
|
1475
|
+
pkg.parts[NOTES_MASTER_PART_PATH] = {
|
|
1476
|
+
kind: "xml",
|
|
1477
|
+
nodes: [declaration(), buildNotesMaster()]
|
|
1478
|
+
};
|
|
1479
|
+
ensureContentTypeOverride(pkg, NOTES_MASTER_PART_PATH, NOTES_MASTER_CONTENT_TYPE);
|
|
1480
|
+
const presentationToNotesMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, NOTES_MASTER_PART_PATH);
|
|
1481
|
+
const relId = addRelationship(pkg, PRESENTATION_PART_PATH$1, {
|
|
1482
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1483
|
+
target: presentationToNotesMasterTarget
|
|
1484
|
+
});
|
|
1485
|
+
const presentationPart = pkg.parts[PRESENTATION_PART_PATH$1];
|
|
1486
|
+
const presentationElement = presentationPart?.kind === "xml" ? presentationPart.nodes.find((n) => n.type === "element") : void 0;
|
|
1487
|
+
if (presentationElement === void 0) throw new Error("ensureNotesMaster: package has no ppt/presentation.xml element");
|
|
1488
|
+
const sldMasterIdLstIndex = presentationElement.children.findIndex((c) => c.type === "element" && c.tag === "p:sldMasterIdLst");
|
|
1489
|
+
const notesMasterIdLst = el("p:notesMasterIdLst", {}, [el("p:notesMasterId", { "r:id": relId })]);
|
|
1490
|
+
presentationElement.children.splice(sldMasterIdLstIndex === -1 ? 0 : sldMasterIdLstIndex + 1, 0, notesMasterIdLst);
|
|
1491
|
+
return NOTES_MASTER_PART_PATH;
|
|
1492
|
+
}
|
|
1329
1493
|
function createEmptyPptxPackage() {
|
|
1330
1494
|
const contentTypes = el("Types", { xmlns: CONTENT_TYPES_NS }, [
|
|
1331
1495
|
el("Default", {
|
|
@@ -1337,24 +1501,16 @@ function createEmptyPptxPackage() {
|
|
|
1337
1501
|
ContentType: "application/xml"
|
|
1338
1502
|
}),
|
|
1339
1503
|
el("Override", {
|
|
1340
|
-
PartName:
|
|
1504
|
+
PartName: `/${PRESENTATION_PART_PATH$1}`,
|
|
1341
1505
|
ContentType: "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
|
|
1342
1506
|
})
|
|
1343
1507
|
]);
|
|
1344
1508
|
const rootRels = el("Relationships", { xmlns: RELS_NS }, [el("Relationship", {
|
|
1345
1509
|
Id: "rId1",
|
|
1346
1510
|
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
|
|
1347
|
-
Target:
|
|
1511
|
+
Target: PRESENTATION_PART_PATH$1
|
|
1348
1512
|
})]);
|
|
1349
|
-
const
|
|
1350
|
-
"xmlns:p": PML_NS,
|
|
1351
|
-
"xmlns:r": R_NS
|
|
1352
|
-
}, [el("p:sldIdLst"), el("p:sldSz", {
|
|
1353
|
-
cx: DEFAULT_SLIDE_WIDTH_EMU,
|
|
1354
|
-
cy: DEFAULT_SLIDE_HEIGHT_EMU
|
|
1355
|
-
})]);
|
|
1356
|
-
const presentationRels = el("Relationships", { xmlns: RELS_NS }, []);
|
|
1357
|
-
return { parts: {
|
|
1513
|
+
const pkg = { parts: {
|
|
1358
1514
|
"[Content_Types].xml": {
|
|
1359
1515
|
kind: "xml",
|
|
1360
1516
|
nodes: [declaration(), contentTypes]
|
|
@@ -1363,15 +1519,63 @@ function createEmptyPptxPackage() {
|
|
|
1363
1519
|
kind: "xml",
|
|
1364
1520
|
nodes: [declaration(), rootRels]
|
|
1365
1521
|
},
|
|
1366
|
-
|
|
1367
|
-
kind: "xml",
|
|
1368
|
-
nodes: [declaration(), presentation]
|
|
1369
|
-
},
|
|
1370
|
-
"ppt/_rels/presentation.xml.rels": {
|
|
1522
|
+
[PRESENTATION_PART_PATH$1]: {
|
|
1371
1523
|
kind: "xml",
|
|
1372
|
-
nodes: [declaration(),
|
|
1524
|
+
nodes: [declaration(), el("p:presentation", {
|
|
1525
|
+
"xmlns:p": PML_NS,
|
|
1526
|
+
"xmlns:r": R_NS
|
|
1527
|
+
})]
|
|
1373
1528
|
}
|
|
1374
1529
|
} };
|
|
1530
|
+
const layoutToMasterTarget = buildRelativeTarget(SLIDE_LAYOUT_PART_PATH, SLIDE_MASTER_PART_PATH);
|
|
1531
|
+
addRelationship(pkg, SLIDE_LAYOUT_PART_PATH, {
|
|
1532
|
+
type: SLIDE_MASTER_REL_TYPE,
|
|
1533
|
+
target: layoutToMasterTarget
|
|
1534
|
+
});
|
|
1535
|
+
pkg.parts[SLIDE_LAYOUT_PART_PATH] = {
|
|
1536
|
+
kind: "xml",
|
|
1537
|
+
nodes: [declaration(), buildSlideLayout()]
|
|
1538
|
+
};
|
|
1539
|
+
ensureContentTypeOverride(pkg, SLIDE_LAYOUT_PART_PATH, SLIDE_LAYOUT_CONTENT_TYPE);
|
|
1540
|
+
const masterToLayoutTarget = buildRelativeTarget(SLIDE_MASTER_PART_PATH, SLIDE_LAYOUT_PART_PATH);
|
|
1541
|
+
const masterToLayoutRelId = addRelationship(pkg, SLIDE_MASTER_PART_PATH, {
|
|
1542
|
+
type: SLIDE_LAYOUT_REL_TYPE,
|
|
1543
|
+
target: masterToLayoutTarget
|
|
1544
|
+
});
|
|
1545
|
+
const masterToThemeTarget = buildRelativeTarget(SLIDE_MASTER_PART_PATH, THEME_PART_PATH);
|
|
1546
|
+
addRelationship(pkg, SLIDE_MASTER_PART_PATH, {
|
|
1547
|
+
type: THEME_REL_TYPE,
|
|
1548
|
+
target: masterToThemeTarget
|
|
1549
|
+
});
|
|
1550
|
+
pkg.parts[SLIDE_MASTER_PART_PATH] = {
|
|
1551
|
+
kind: "xml",
|
|
1552
|
+
nodes: [declaration(), buildSlideMaster(masterToLayoutRelId)]
|
|
1553
|
+
};
|
|
1554
|
+
ensureContentTypeOverride(pkg, SLIDE_MASTER_PART_PATH, SLIDE_MASTER_CONTENT_TYPE);
|
|
1555
|
+
pkg.parts[THEME_PART_PATH] = {
|
|
1556
|
+
kind: "xml",
|
|
1557
|
+
nodes: [declaration(), buildTheme()]
|
|
1558
|
+
};
|
|
1559
|
+
ensureContentTypeOverride(pkg, THEME_PART_PATH, THEME_CONTENT_TYPE);
|
|
1560
|
+
const presentationToMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, SLIDE_MASTER_PART_PATH);
|
|
1561
|
+
const presentationToMasterRelId = addRelationship(pkg, PRESENTATION_PART_PATH$1, {
|
|
1562
|
+
type: SLIDE_MASTER_REL_TYPE,
|
|
1563
|
+
target: presentationToMasterTarget
|
|
1564
|
+
});
|
|
1565
|
+
const presentationPart = pkg.parts[PRESENTATION_PART_PATH$1];
|
|
1566
|
+
const presentationElement = presentationPart?.kind === "xml" ? presentationPart.nodes.find((n) => n.type === "element") : void 0;
|
|
1567
|
+
if (presentationElement === void 0) throw new Error("createEmptyPptxPackage: failed to build ppt/presentation.xml");
|
|
1568
|
+
presentationElement.children.push(el("p:sldMasterIdLst", {}, [el("p:sldMasterId", {
|
|
1569
|
+
id: String(MIN_MASTER_OR_LAYOUT_ID),
|
|
1570
|
+
"r:id": presentationToMasterRelId
|
|
1571
|
+
})]), el("p:sldIdLst"), el("p:sldSz", {
|
|
1572
|
+
cx: DEFAULT_SLIDE_WIDTH_EMU,
|
|
1573
|
+
cy: DEFAULT_SLIDE_HEIGHT_EMU
|
|
1574
|
+
}), el("p:notesSz", {
|
|
1575
|
+
cx: DEFAULT_NOTES_WIDTH_EMU,
|
|
1576
|
+
cy: DEFAULT_NOTES_HEIGHT_EMU
|
|
1577
|
+
}));
|
|
1578
|
+
return pkg;
|
|
1375
1579
|
}
|
|
1376
1580
|
//#endregion
|
|
1377
1581
|
//#region src/edit/pptx/shape.ts
|
|
@@ -1592,7 +1796,7 @@ function nextIdIn(root) {
|
|
|
1592
1796
|
const NOTES_SLIDE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
|
1593
1797
|
const NOTES_SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
|
1594
1798
|
function buildMinimalNotesSlide(text) {
|
|
1595
|
-
|
|
1799
|
+
const body = el("p:sp", {}, [
|
|
1596
1800
|
el("p:nvSpPr", {}, [
|
|
1597
1801
|
el("p:cNvPr", {
|
|
1598
1802
|
id: "2",
|
|
@@ -1604,13 +1808,25 @@ function buildMinimalNotesSlide(text) {
|
|
|
1604
1808
|
idx: "1"
|
|
1605
1809
|
})])
|
|
1606
1810
|
]),
|
|
1607
|
-
el("p:spPr"
|
|
1811
|
+
el("p:spPr", {}, [el("a:xfrm", {}, [el("a:off", {
|
|
1812
|
+
x: "685800",
|
|
1813
|
+
y: "4400550"
|
|
1814
|
+
}), el("a:ext", {
|
|
1815
|
+
cx: "5486400",
|
|
1816
|
+
cy: "4200525"
|
|
1817
|
+
})])]),
|
|
1608
1818
|
el("p:txBody", {}, [
|
|
1609
1819
|
el("a:bodyPr"),
|
|
1610
1820
|
el("a:lstStyle"),
|
|
1611
1821
|
el("a:p", {}, [el("a:r", {}, [el("a:t", {}, [txt(encodeXmlText(text))])])])
|
|
1612
1822
|
])
|
|
1613
|
-
])
|
|
1823
|
+
]);
|
|
1824
|
+
const spTree = buildEmptyGroupSpTree();
|
|
1825
|
+
spTree.children.push(body);
|
|
1826
|
+
return el("p:notes", {
|
|
1827
|
+
"xmlns:p": PML_NS,
|
|
1828
|
+
"xmlns:a": DML_NS
|
|
1829
|
+
}, [el("p:cSld", {}, [spTree]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1614
1830
|
}
|
|
1615
1831
|
var PptxSlide = class {
|
|
1616
1832
|
container;
|
|
@@ -1661,12 +1877,17 @@ var PptxSlide = class {
|
|
|
1661
1877
|
const existingRel = [...(0, ooxml_js.resolveRelationships)(pkg, slidePartPath).values()].find((r) => r.type === NOTES_SLIDE_RELATIONSHIP_TYPE);
|
|
1662
1878
|
let notesPartPath;
|
|
1663
1879
|
if (existingRel === void 0) {
|
|
1664
|
-
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) =>
|
|
1880
|
+
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p)).length + 1}.xml`;
|
|
1665
1881
|
ensureContentTypeOverride(pkg, notesPartPath, NOTES_SLIDE_CONTENT_TYPE);
|
|
1666
1882
|
addRelationship(pkg, slidePartPath, {
|
|
1667
1883
|
type: NOTES_SLIDE_RELATIONSHIP_TYPE,
|
|
1668
1884
|
target: buildRelativeTarget(slidePartPath, notesPartPath)
|
|
1669
1885
|
});
|
|
1886
|
+
const notesMasterPartPath = ensureNotesMaster(pkg);
|
|
1887
|
+
addRelationship(pkg, notesPartPath, {
|
|
1888
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1889
|
+
target: buildRelativeTarget(notesPartPath, notesMasterPartPath)
|
|
1890
|
+
});
|
|
1670
1891
|
} else notesPartPath = existingRel.target;
|
|
1671
1892
|
pkg.parts[notesPartPath] = {
|
|
1672
1893
|
kind: "xml",
|
|
@@ -1730,7 +1951,11 @@ function nextSlidePartIndex(pkg) {
|
|
|
1730
1951
|
return max + 1;
|
|
1731
1952
|
}
|
|
1732
1953
|
function buildEmptySlideRoot() {
|
|
1733
|
-
return el("p:sld", {
|
|
1954
|
+
return el("p:sld", {
|
|
1955
|
+
"xmlns:p": PML_NS,
|
|
1956
|
+
"xmlns:a": DML_NS,
|
|
1957
|
+
"xmlns:r": R_NS
|
|
1958
|
+
}, [el("p:cSld", {}, [buildEmptyGroupSpTree()])]);
|
|
1734
1959
|
}
|
|
1735
1960
|
var PptxEditor = class {
|
|
1736
1961
|
pkg;
|
|
@@ -1772,6 +1997,10 @@ var PptxEditor = class {
|
|
|
1772
1997
|
type: SLIDE_RELATIONSHIP_TYPE,
|
|
1773
1998
|
target: `slides/slide${partIndex}.xml`
|
|
1774
1999
|
});
|
|
2000
|
+
addRelationship(this.pkg, slidePartPath, {
|
|
2001
|
+
type: SLIDE_LAYOUT_REL_TYPE,
|
|
2002
|
+
target: buildRelativeTarget(slidePartPath, SLIDE_LAYOUT_PART_PATH)
|
|
2003
|
+
});
|
|
1775
2004
|
const slideId = nextSlideId(sldIdLst);
|
|
1776
2005
|
sldIdLst.children.push(el("p:sldId", {
|
|
1777
2006
|
id: String(slideId),
|
package/dist/index.js
CHANGED
|
@@ -1303,9 +1303,26 @@ function appendBlock(body, block) {
|
|
|
1303
1303
|
const CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
1304
1304
|
const RELS_NS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
1305
1305
|
const PML_NS = "http://schemas.openxmlformats.org/presentationml/2006/main";
|
|
1306
|
+
const DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
1306
1307
|
const R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
1307
1308
|
const DEFAULT_SLIDE_WIDTH_EMU = "12192000";
|
|
1308
1309
|
const DEFAULT_SLIDE_HEIGHT_EMU = "6858000";
|
|
1310
|
+
const DEFAULT_NOTES_WIDTH_EMU = "6858000";
|
|
1311
|
+
const DEFAULT_NOTES_HEIGHT_EMU = "9144000";
|
|
1312
|
+
const SLIDE_MASTER_PART_PATH = "ppt/slideMasters/slideMaster1.xml";
|
|
1313
|
+
const SLIDE_LAYOUT_PART_PATH = "ppt/slideLayouts/slideLayout1.xml";
|
|
1314
|
+
const THEME_PART_PATH = "ppt/theme/theme1.xml";
|
|
1315
|
+
const PRESENTATION_PART_PATH$1 = "ppt/presentation.xml";
|
|
1316
|
+
const NOTES_MASTER_PART_PATH = "ppt/notesMasters/notesMaster1.xml";
|
|
1317
|
+
const SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
1318
|
+
const SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
1319
|
+
const THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
1320
|
+
const NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
1321
|
+
const SLIDE_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
|
1322
|
+
const SLIDE_LAYOUT_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
1323
|
+
const THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
1324
|
+
const NOTES_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
|
|
1325
|
+
const MIN_MASTER_OR_LAYOUT_ID = 2147483648;
|
|
1309
1326
|
function declaration() {
|
|
1310
1327
|
return {
|
|
1311
1328
|
type: "declaration",
|
|
@@ -1325,6 +1342,153 @@ function declaration() {
|
|
|
1325
1342
|
]
|
|
1326
1343
|
};
|
|
1327
1344
|
}
|
|
1345
|
+
function buildEmptyGroupSpTree() {
|
|
1346
|
+
return el("p:spTree", {}, [el("p:nvGrpSpPr", {}, [
|
|
1347
|
+
el("p:cNvPr", {
|
|
1348
|
+
id: "1",
|
|
1349
|
+
name: ""
|
|
1350
|
+
}),
|
|
1351
|
+
el("p:cNvGrpSpPr"),
|
|
1352
|
+
el("p:nvPr")
|
|
1353
|
+
]), el("p:grpSpPr")]);
|
|
1354
|
+
}
|
|
1355
|
+
function buildFormatScheme() {
|
|
1356
|
+
const solidPhClr = () => el("a:solidFill", {}, [el("a:schemeClr", { val: "phClr" })]);
|
|
1357
|
+
return el("a:fmtScheme", { name: "Office" }, [
|
|
1358
|
+
el("a:fillStyleLst", {}, [
|
|
1359
|
+
solidPhClr(),
|
|
1360
|
+
solidPhClr(),
|
|
1361
|
+
solidPhClr()
|
|
1362
|
+
]),
|
|
1363
|
+
el("a:lnStyleLst", {}, [
|
|
1364
|
+
el("a:ln", {}, [solidPhClr()]),
|
|
1365
|
+
el("a:ln", {}, [solidPhClr()]),
|
|
1366
|
+
el("a:ln", {}, [solidPhClr()])
|
|
1367
|
+
]),
|
|
1368
|
+
el("a:effectStyleLst", {}, [
|
|
1369
|
+
el("a:effectStyle", {}, [el("a:effectLst")]),
|
|
1370
|
+
el("a:effectStyle", {}, [el("a:effectLst")]),
|
|
1371
|
+
el("a:effectStyle", {}, [el("a:effectLst")])
|
|
1372
|
+
]),
|
|
1373
|
+
el("a:bgFillStyleLst", {}, [
|
|
1374
|
+
solidPhClr(),
|
|
1375
|
+
solidPhClr(),
|
|
1376
|
+
solidPhClr()
|
|
1377
|
+
])
|
|
1378
|
+
]);
|
|
1379
|
+
}
|
|
1380
|
+
function buildTheme() {
|
|
1381
|
+
const clrScheme = el("a:clrScheme", { name: "Office" }, [
|
|
1382
|
+
el("a:dk1", {}, [el("a:sysClr", {
|
|
1383
|
+
val: "windowText",
|
|
1384
|
+
lastClr: "000000"
|
|
1385
|
+
})]),
|
|
1386
|
+
el("a:lt1", {}, [el("a:sysClr", {
|
|
1387
|
+
val: "window",
|
|
1388
|
+
lastClr: "FFFFFF"
|
|
1389
|
+
})]),
|
|
1390
|
+
el("a:dk2", {}, [el("a:srgbClr", { val: "1F497D" })]),
|
|
1391
|
+
el("a:lt2", {}, [el("a:srgbClr", { val: "EEECE1" })]),
|
|
1392
|
+
el("a:accent1", {}, [el("a:srgbClr", { val: "4F81BD" })]),
|
|
1393
|
+
el("a:accent2", {}, [el("a:srgbClr", { val: "C0504D" })]),
|
|
1394
|
+
el("a:accent3", {}, [el("a:srgbClr", { val: "9BBB59" })]),
|
|
1395
|
+
el("a:accent4", {}, [el("a:srgbClr", { val: "8064A2" })]),
|
|
1396
|
+
el("a:accent5", {}, [el("a:srgbClr", { val: "4BACC6" })]),
|
|
1397
|
+
el("a:accent6", {}, [el("a:srgbClr", { val: "F79646" })]),
|
|
1398
|
+
el("a:hlink", {}, [el("a:srgbClr", { val: "0000FF" })]),
|
|
1399
|
+
el("a:folHlink", {}, [el("a:srgbClr", { val: "800080" })])
|
|
1400
|
+
]);
|
|
1401
|
+
const fontScheme = el("a:fontScheme", { name: "Office" }, [el("a:majorFont", {}, [
|
|
1402
|
+
el("a:latin", { typeface: "Calibri Light" }),
|
|
1403
|
+
el("a:ea", { typeface: "" }),
|
|
1404
|
+
el("a:cs", { typeface: "" })
|
|
1405
|
+
]), el("a:minorFont", {}, [
|
|
1406
|
+
el("a:latin", { typeface: "Calibri" }),
|
|
1407
|
+
el("a:ea", { typeface: "" }),
|
|
1408
|
+
el("a:cs", { typeface: "" })
|
|
1409
|
+
])]);
|
|
1410
|
+
return el("a:theme", {
|
|
1411
|
+
"xmlns:a": DML_NS,
|
|
1412
|
+
name: "Office Theme"
|
|
1413
|
+
}, [el("a:themeElements", {}, [
|
|
1414
|
+
clrScheme,
|
|
1415
|
+
fontScheme,
|
|
1416
|
+
buildFormatScheme()
|
|
1417
|
+
])]);
|
|
1418
|
+
}
|
|
1419
|
+
function buildIdentityColorMap() {
|
|
1420
|
+
return el("p:clrMap", {
|
|
1421
|
+
bg1: "lt1",
|
|
1422
|
+
tx1: "dk1",
|
|
1423
|
+
bg2: "lt2",
|
|
1424
|
+
tx2: "dk2",
|
|
1425
|
+
accent1: "accent1",
|
|
1426
|
+
accent2: "accent2",
|
|
1427
|
+
accent3: "accent3",
|
|
1428
|
+
accent4: "accent4",
|
|
1429
|
+
accent5: "accent5",
|
|
1430
|
+
accent6: "accent6",
|
|
1431
|
+
hlink: "hlink",
|
|
1432
|
+
folHlink: "folHlink"
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
function buildWhiteBackground() {
|
|
1436
|
+
return el("p:bg", {}, [el("p:bgPr", {}, [el("a:solidFill", {}, [el("a:srgbClr", { val: "FFFFFF" })]), el("a:effectLst")])]);
|
|
1437
|
+
}
|
|
1438
|
+
function buildSlideMaster(layoutRelationshipId) {
|
|
1439
|
+
return el("p:sldMaster", {
|
|
1440
|
+
"xmlns:p": PML_NS,
|
|
1441
|
+
"xmlns:a": DML_NS,
|
|
1442
|
+
"xmlns:r": R_NS
|
|
1443
|
+
}, [
|
|
1444
|
+
el("p:cSld", {}, [buildWhiteBackground(), buildEmptyGroupSpTree()]),
|
|
1445
|
+
buildIdentityColorMap(),
|
|
1446
|
+
el("p:sldLayoutIdLst", {}, [el("p:sldLayoutId", {
|
|
1447
|
+
id: String(MIN_MASTER_OR_LAYOUT_ID),
|
|
1448
|
+
"r:id": layoutRelationshipId
|
|
1449
|
+
})])
|
|
1450
|
+
]);
|
|
1451
|
+
}
|
|
1452
|
+
function buildSlideLayout() {
|
|
1453
|
+
return el("p:sldLayout", {
|
|
1454
|
+
"xmlns:p": PML_NS,
|
|
1455
|
+
"xmlns:a": DML_NS,
|
|
1456
|
+
"xmlns:r": R_NS,
|
|
1457
|
+
type: "blank",
|
|
1458
|
+
preserve: "1"
|
|
1459
|
+
}, [el("p:cSld", { name: "Blank" }, [buildEmptyGroupSpTree()]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1460
|
+
}
|
|
1461
|
+
function buildNotesMaster() {
|
|
1462
|
+
return el("p:notesMaster", {
|
|
1463
|
+
"xmlns:p": PML_NS,
|
|
1464
|
+
"xmlns:a": DML_NS
|
|
1465
|
+
}, [el("p:cSld", {}, [buildWhiteBackground(), buildEmptyGroupSpTree()]), buildIdentityColorMap()]);
|
|
1466
|
+
}
|
|
1467
|
+
function ensureNotesMaster(pkg) {
|
|
1468
|
+
if (pkg.parts[NOTES_MASTER_PART_PATH] !== void 0) return NOTES_MASTER_PART_PATH;
|
|
1469
|
+
const masterToThemeTarget = buildRelativeTarget(NOTES_MASTER_PART_PATH, THEME_PART_PATH);
|
|
1470
|
+
addRelationship(pkg, NOTES_MASTER_PART_PATH, {
|
|
1471
|
+
type: THEME_REL_TYPE,
|
|
1472
|
+
target: masterToThemeTarget
|
|
1473
|
+
});
|
|
1474
|
+
pkg.parts[NOTES_MASTER_PART_PATH] = {
|
|
1475
|
+
kind: "xml",
|
|
1476
|
+
nodes: [declaration(), buildNotesMaster()]
|
|
1477
|
+
};
|
|
1478
|
+
ensureContentTypeOverride(pkg, NOTES_MASTER_PART_PATH, NOTES_MASTER_CONTENT_TYPE);
|
|
1479
|
+
const presentationToNotesMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, NOTES_MASTER_PART_PATH);
|
|
1480
|
+
const relId = addRelationship(pkg, PRESENTATION_PART_PATH$1, {
|
|
1481
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1482
|
+
target: presentationToNotesMasterTarget
|
|
1483
|
+
});
|
|
1484
|
+
const presentationPart = pkg.parts[PRESENTATION_PART_PATH$1];
|
|
1485
|
+
const presentationElement = presentationPart?.kind === "xml" ? presentationPart.nodes.find((n) => n.type === "element") : void 0;
|
|
1486
|
+
if (presentationElement === void 0) throw new Error("ensureNotesMaster: package has no ppt/presentation.xml element");
|
|
1487
|
+
const sldMasterIdLstIndex = presentationElement.children.findIndex((c) => c.type === "element" && c.tag === "p:sldMasterIdLst");
|
|
1488
|
+
const notesMasterIdLst = el("p:notesMasterIdLst", {}, [el("p:notesMasterId", { "r:id": relId })]);
|
|
1489
|
+
presentationElement.children.splice(sldMasterIdLstIndex === -1 ? 0 : sldMasterIdLstIndex + 1, 0, notesMasterIdLst);
|
|
1490
|
+
return NOTES_MASTER_PART_PATH;
|
|
1491
|
+
}
|
|
1328
1492
|
function createEmptyPptxPackage() {
|
|
1329
1493
|
const contentTypes = el("Types", { xmlns: CONTENT_TYPES_NS }, [
|
|
1330
1494
|
el("Default", {
|
|
@@ -1336,24 +1500,16 @@ function createEmptyPptxPackage() {
|
|
|
1336
1500
|
ContentType: "application/xml"
|
|
1337
1501
|
}),
|
|
1338
1502
|
el("Override", {
|
|
1339
|
-
PartName:
|
|
1503
|
+
PartName: `/${PRESENTATION_PART_PATH$1}`,
|
|
1340
1504
|
ContentType: "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
|
|
1341
1505
|
})
|
|
1342
1506
|
]);
|
|
1343
1507
|
const rootRels = el("Relationships", { xmlns: RELS_NS }, [el("Relationship", {
|
|
1344
1508
|
Id: "rId1",
|
|
1345
1509
|
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
|
|
1346
|
-
Target:
|
|
1510
|
+
Target: PRESENTATION_PART_PATH$1
|
|
1347
1511
|
})]);
|
|
1348
|
-
const
|
|
1349
|
-
"xmlns:p": PML_NS,
|
|
1350
|
-
"xmlns:r": R_NS
|
|
1351
|
-
}, [el("p:sldIdLst"), el("p:sldSz", {
|
|
1352
|
-
cx: DEFAULT_SLIDE_WIDTH_EMU,
|
|
1353
|
-
cy: DEFAULT_SLIDE_HEIGHT_EMU
|
|
1354
|
-
})]);
|
|
1355
|
-
const presentationRels = el("Relationships", { xmlns: RELS_NS }, []);
|
|
1356
|
-
return { parts: {
|
|
1512
|
+
const pkg = { parts: {
|
|
1357
1513
|
"[Content_Types].xml": {
|
|
1358
1514
|
kind: "xml",
|
|
1359
1515
|
nodes: [declaration(), contentTypes]
|
|
@@ -1362,15 +1518,63 @@ function createEmptyPptxPackage() {
|
|
|
1362
1518
|
kind: "xml",
|
|
1363
1519
|
nodes: [declaration(), rootRels]
|
|
1364
1520
|
},
|
|
1365
|
-
|
|
1366
|
-
kind: "xml",
|
|
1367
|
-
nodes: [declaration(), presentation]
|
|
1368
|
-
},
|
|
1369
|
-
"ppt/_rels/presentation.xml.rels": {
|
|
1521
|
+
[PRESENTATION_PART_PATH$1]: {
|
|
1370
1522
|
kind: "xml",
|
|
1371
|
-
nodes: [declaration(),
|
|
1523
|
+
nodes: [declaration(), el("p:presentation", {
|
|
1524
|
+
"xmlns:p": PML_NS,
|
|
1525
|
+
"xmlns:r": R_NS
|
|
1526
|
+
})]
|
|
1372
1527
|
}
|
|
1373
1528
|
} };
|
|
1529
|
+
const layoutToMasterTarget = buildRelativeTarget(SLIDE_LAYOUT_PART_PATH, SLIDE_MASTER_PART_PATH);
|
|
1530
|
+
addRelationship(pkg, SLIDE_LAYOUT_PART_PATH, {
|
|
1531
|
+
type: SLIDE_MASTER_REL_TYPE,
|
|
1532
|
+
target: layoutToMasterTarget
|
|
1533
|
+
});
|
|
1534
|
+
pkg.parts[SLIDE_LAYOUT_PART_PATH] = {
|
|
1535
|
+
kind: "xml",
|
|
1536
|
+
nodes: [declaration(), buildSlideLayout()]
|
|
1537
|
+
};
|
|
1538
|
+
ensureContentTypeOverride(pkg, SLIDE_LAYOUT_PART_PATH, SLIDE_LAYOUT_CONTENT_TYPE);
|
|
1539
|
+
const masterToLayoutTarget = buildRelativeTarget(SLIDE_MASTER_PART_PATH, SLIDE_LAYOUT_PART_PATH);
|
|
1540
|
+
const masterToLayoutRelId = addRelationship(pkg, SLIDE_MASTER_PART_PATH, {
|
|
1541
|
+
type: SLIDE_LAYOUT_REL_TYPE,
|
|
1542
|
+
target: masterToLayoutTarget
|
|
1543
|
+
});
|
|
1544
|
+
const masterToThemeTarget = buildRelativeTarget(SLIDE_MASTER_PART_PATH, THEME_PART_PATH);
|
|
1545
|
+
addRelationship(pkg, SLIDE_MASTER_PART_PATH, {
|
|
1546
|
+
type: THEME_REL_TYPE,
|
|
1547
|
+
target: masterToThemeTarget
|
|
1548
|
+
});
|
|
1549
|
+
pkg.parts[SLIDE_MASTER_PART_PATH] = {
|
|
1550
|
+
kind: "xml",
|
|
1551
|
+
nodes: [declaration(), buildSlideMaster(masterToLayoutRelId)]
|
|
1552
|
+
};
|
|
1553
|
+
ensureContentTypeOverride(pkg, SLIDE_MASTER_PART_PATH, SLIDE_MASTER_CONTENT_TYPE);
|
|
1554
|
+
pkg.parts[THEME_PART_PATH] = {
|
|
1555
|
+
kind: "xml",
|
|
1556
|
+
nodes: [declaration(), buildTheme()]
|
|
1557
|
+
};
|
|
1558
|
+
ensureContentTypeOverride(pkg, THEME_PART_PATH, THEME_CONTENT_TYPE);
|
|
1559
|
+
const presentationToMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, SLIDE_MASTER_PART_PATH);
|
|
1560
|
+
const presentationToMasterRelId = addRelationship(pkg, PRESENTATION_PART_PATH$1, {
|
|
1561
|
+
type: SLIDE_MASTER_REL_TYPE,
|
|
1562
|
+
target: presentationToMasterTarget
|
|
1563
|
+
});
|
|
1564
|
+
const presentationPart = pkg.parts[PRESENTATION_PART_PATH$1];
|
|
1565
|
+
const presentationElement = presentationPart?.kind === "xml" ? presentationPart.nodes.find((n) => n.type === "element") : void 0;
|
|
1566
|
+
if (presentationElement === void 0) throw new Error("createEmptyPptxPackage: failed to build ppt/presentation.xml");
|
|
1567
|
+
presentationElement.children.push(el("p:sldMasterIdLst", {}, [el("p:sldMasterId", {
|
|
1568
|
+
id: String(MIN_MASTER_OR_LAYOUT_ID),
|
|
1569
|
+
"r:id": presentationToMasterRelId
|
|
1570
|
+
})]), el("p:sldIdLst"), el("p:sldSz", {
|
|
1571
|
+
cx: DEFAULT_SLIDE_WIDTH_EMU,
|
|
1572
|
+
cy: DEFAULT_SLIDE_HEIGHT_EMU
|
|
1573
|
+
}), el("p:notesSz", {
|
|
1574
|
+
cx: DEFAULT_NOTES_WIDTH_EMU,
|
|
1575
|
+
cy: DEFAULT_NOTES_HEIGHT_EMU
|
|
1576
|
+
}));
|
|
1577
|
+
return pkg;
|
|
1374
1578
|
}
|
|
1375
1579
|
//#endregion
|
|
1376
1580
|
//#region src/edit/pptx/shape.ts
|
|
@@ -1591,7 +1795,7 @@ function nextIdIn(root) {
|
|
|
1591
1795
|
const NOTES_SLIDE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
|
1592
1796
|
const NOTES_SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
|
1593
1797
|
function buildMinimalNotesSlide(text) {
|
|
1594
|
-
|
|
1798
|
+
const body = el("p:sp", {}, [
|
|
1595
1799
|
el("p:nvSpPr", {}, [
|
|
1596
1800
|
el("p:cNvPr", {
|
|
1597
1801
|
id: "2",
|
|
@@ -1603,13 +1807,25 @@ function buildMinimalNotesSlide(text) {
|
|
|
1603
1807
|
idx: "1"
|
|
1604
1808
|
})])
|
|
1605
1809
|
]),
|
|
1606
|
-
el("p:spPr"
|
|
1810
|
+
el("p:spPr", {}, [el("a:xfrm", {}, [el("a:off", {
|
|
1811
|
+
x: "685800",
|
|
1812
|
+
y: "4400550"
|
|
1813
|
+
}), el("a:ext", {
|
|
1814
|
+
cx: "5486400",
|
|
1815
|
+
cy: "4200525"
|
|
1816
|
+
})])]),
|
|
1607
1817
|
el("p:txBody", {}, [
|
|
1608
1818
|
el("a:bodyPr"),
|
|
1609
1819
|
el("a:lstStyle"),
|
|
1610
1820
|
el("a:p", {}, [el("a:r", {}, [el("a:t", {}, [txt(encodeXmlText(text))])])])
|
|
1611
1821
|
])
|
|
1612
|
-
])
|
|
1822
|
+
]);
|
|
1823
|
+
const spTree = buildEmptyGroupSpTree();
|
|
1824
|
+
spTree.children.push(body);
|
|
1825
|
+
return el("p:notes", {
|
|
1826
|
+
"xmlns:p": PML_NS,
|
|
1827
|
+
"xmlns:a": DML_NS
|
|
1828
|
+
}, [el("p:cSld", {}, [spTree]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1613
1829
|
}
|
|
1614
1830
|
var PptxSlide = class {
|
|
1615
1831
|
container;
|
|
@@ -1660,12 +1876,17 @@ var PptxSlide = class {
|
|
|
1660
1876
|
const existingRel = [...resolveRelationships$1(pkg, slidePartPath).values()].find((r) => r.type === NOTES_SLIDE_RELATIONSHIP_TYPE);
|
|
1661
1877
|
let notesPartPath;
|
|
1662
1878
|
if (existingRel === void 0) {
|
|
1663
|
-
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) =>
|
|
1879
|
+
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p)).length + 1}.xml`;
|
|
1664
1880
|
ensureContentTypeOverride(pkg, notesPartPath, NOTES_SLIDE_CONTENT_TYPE);
|
|
1665
1881
|
addRelationship(pkg, slidePartPath, {
|
|
1666
1882
|
type: NOTES_SLIDE_RELATIONSHIP_TYPE,
|
|
1667
1883
|
target: buildRelativeTarget(slidePartPath, notesPartPath)
|
|
1668
1884
|
});
|
|
1885
|
+
const notesMasterPartPath = ensureNotesMaster(pkg);
|
|
1886
|
+
addRelationship(pkg, notesPartPath, {
|
|
1887
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1888
|
+
target: buildRelativeTarget(notesPartPath, notesMasterPartPath)
|
|
1889
|
+
});
|
|
1669
1890
|
} else notesPartPath = existingRel.target;
|
|
1670
1891
|
pkg.parts[notesPartPath] = {
|
|
1671
1892
|
kind: "xml",
|
|
@@ -1729,7 +1950,11 @@ function nextSlidePartIndex(pkg) {
|
|
|
1729
1950
|
return max + 1;
|
|
1730
1951
|
}
|
|
1731
1952
|
function buildEmptySlideRoot() {
|
|
1732
|
-
return el("p:sld", {
|
|
1953
|
+
return el("p:sld", {
|
|
1954
|
+
"xmlns:p": PML_NS,
|
|
1955
|
+
"xmlns:a": DML_NS,
|
|
1956
|
+
"xmlns:r": R_NS
|
|
1957
|
+
}, [el("p:cSld", {}, [buildEmptyGroupSpTree()])]);
|
|
1733
1958
|
}
|
|
1734
1959
|
var PptxEditor = class {
|
|
1735
1960
|
pkg;
|
|
@@ -1771,6 +1996,10 @@ var PptxEditor = class {
|
|
|
1771
1996
|
type: SLIDE_RELATIONSHIP_TYPE,
|
|
1772
1997
|
target: `slides/slide${partIndex}.xml`
|
|
1773
1998
|
});
|
|
1999
|
+
addRelationship(this.pkg, slidePartPath, {
|
|
2000
|
+
type: SLIDE_LAYOUT_REL_TYPE,
|
|
2001
|
+
target: buildRelativeTarget(slidePartPath, SLIDE_LAYOUT_PART_PATH)
|
|
2002
|
+
});
|
|
1774
2003
|
const slideId = nextSlideId(sldIdLst);
|
|
1775
2004
|
sldIdLst.children.push(el("p:sldId", {
|
|
1776
2005
|
id: String(slideId),
|
package/package.json
CHANGED