Add whole-book vs selected-chapters export workflow
- Export menu (PDF/DOCX/ODT) opens a workflow to export the entire book or only selected chapters, with a canonical-order checklist + Select/Clear All - Selected exports pass an ordered chapter list through the shared pipeline so output follows book order (not click order); empty selection is rejected - Filenames use a ' - Selected Chapters' suffix for partial exports - PDF renders only the chosen chapters into the print container; DOCX/ODT build from the selected chapters in order
This commit is contained in:
parent
7037cd9fc0
commit
beaf8715d8
6 changed files with 284 additions and 31 deletions
|
|
@ -183,6 +183,20 @@ check(
|
|||
idxAlpha >= 0 && idxAlpha < idxBeta && idxBeta < idxGamma && idxGamma < idxUnicode && idxUnicode < idxPics
|
||||
);
|
||||
|
||||
// The explicitly passed chapter list is the single source of truth for export
|
||||
// ordering: a non-canonical subset exports in the passed order (and only those
|
||||
// chapters), not the book's stored order.
|
||||
const subsetBuf = await mod.buildDocx(bookDir, [chapters.ch3, chapters.ch1, chapters.ch2]);
|
||||
const subsetZip = await JSZip.loadAsync(subsetBuf);
|
||||
const subsetXml = await subsetZip.file("word/document.xml").async("string");
|
||||
const sText = stripTags(subsetXml);
|
||||
const sG = sText.indexOf("Gamma");
|
||||
const sA = sText.indexOf("Alpha");
|
||||
const sB = sText.indexOf("Beta");
|
||||
check("docx subset honors the passed order (Gamma, Alpha, Beta)", sG >= 0 && sG < sA && sA < sB);
|
||||
check("docx subset excludes unselected chapters", !sText.includes("Unicode") && !sText.includes("Pics"));
|
||||
|
||||
|
||||
const mediaFiles = Object.keys(docxZip.files).filter((f) => f.startsWith("word/media/"));
|
||||
check("docx embeds the image (no data loss)", mediaFiles.length >= 1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue