@stll/folio-core 0.58.2 → 0.58.3
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.
|
@@ -6,7 +6,7 @@ import { mergeParagraphNumbering, paragraphNumberingReference, paragraphNumberin
|
|
|
6
6
|
import { getParagraphText } from "../paragraphParser.js";
|
|
7
7
|
import { cloneParagraphWithoutPropertySource } from "../paragraphPropertySource.js";
|
|
8
8
|
import { getRunText } from "../runParser.js";
|
|
9
|
-
import { TaggedError } from "better-result";
|
|
9
|
+
import { TaggedError, panic } from "better-result";
|
|
10
10
|
//#region src/docx/server/createBilingualDocument.ts
|
|
11
11
|
/**
|
|
12
12
|
* Bilingual document transform: body -> two-column table, one row per block.
|
|
@@ -135,6 +135,11 @@ function createBilingualDocument(source, options) {
|
|
|
135
135
|
sectionRows.push(buildRow(block, copy, styleById, textWidth));
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
+
if (block.type !== "table") {
|
|
139
|
+
flushSection();
|
|
140
|
+
content.push(block);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
138
143
|
const paragraphs = collectTableParagraphs(block).filter((paragraph) => isTranslatableParagraph(paragraph, options.editableParagraphIds)).map((paragraph) => ({
|
|
139
144
|
paraId: paragraph.paraId,
|
|
140
145
|
sourceText: getParagraphText(paragraph)
|
|
@@ -201,12 +206,20 @@ const tableRowHandle = (index) => `table-${index}`;
|
|
|
201
206
|
const flattenBlocks = (content) => {
|
|
202
207
|
const out = [];
|
|
203
208
|
const visit = (block) => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
switch (block.type) {
|
|
210
|
+
case "paragraph":
|
|
211
|
+
case "table":
|
|
212
|
+
case "preservedBlock":
|
|
213
|
+
case "bookmarkStart":
|
|
214
|
+
case "bookmarkEnd":
|
|
215
|
+
out.push(block);
|
|
216
|
+
return;
|
|
217
|
+
case "blockSdt":
|
|
218
|
+
case "blockCustomXml":
|
|
219
|
+
for (const child of block.content) visit(child);
|
|
220
|
+
return;
|
|
221
|
+
default: panic("Unsupported bilingual body block");
|
|
207
222
|
}
|
|
208
|
-
if (block.type !== "blockSdt" && block.type !== "blockCustomXml") return;
|
|
209
|
-
for (const child of block.content) visit(child);
|
|
210
223
|
};
|
|
211
224
|
for (const block of content) visit(block);
|
|
212
225
|
return out;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.3",
|
|
4
4
|
"description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-model",
|