@stll/folio-core 0.47.3 → 0.47.5
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/ai-edits/headless.js +46 -11
- package/dist/compare/inline-atoms.js +218 -31
- package/dist/compare/section-boundary-properties.js +1 -0
- package/dist/content-controls/mutateContentControls.js +1 -3
- package/dist/docx/commentRangeIntegrity.js +7 -0
- package/dist/docx/documentParser.js +55 -3
- package/dist/docx/inlineWrapperContent.d.ts +18 -16
- package/dist/docx/inlineWrapperContent.js +18 -16
- package/dist/docx/normalizeBaseDirection.js +4 -0
- package/dist/docx/rezip.js +1 -0
- package/dist/docx/serializer/documentSerializer.js +16 -1
- package/dist/docx/serializer/paragraphSerializer.js +8 -0
- package/dist/docx/serializer/tableSerializer.js +5 -2
- package/dist/docx/server/createBilingualDocument.js +23 -14
- package/dist/docx/tableParser.js +101 -75
- package/dist/markdown/renderRuns.js +4 -0
- package/dist/markdown/renderTable.js +46 -12
- package/dist/prosemirror/attrs/index.js +67 -3
- package/dist/prosemirror/commentReferenceAttrs.js +2 -2
- package/dist/prosemirror/commentReferenceIntegrity.d.ts +7 -3
- package/dist/prosemirror/commentReferenceIntegrity.js +9 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +74 -18
- package/dist/prosemirror/conversion/toProseDoc.js +75 -42
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +13 -6
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +24 -6
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +9 -5
- package/dist/prosemirror/extensions/nodes/TableExtension.js +2 -2
- package/dist/prosemirror/schema/marks.d.ts +11 -0
- package/dist/prosemirror/schema/nodes.d.ts +6 -4
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -1
- package/dist/prosemirror/trackedRunInlineAtoms.js +1 -1
- package/dist/prosemirror/validation.js +48 -7
- package/dist/types/content.d.ts +2 -2
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/mergeDocumentContent.js +1 -7
- package/package.json +2 -2
|
@@ -16,6 +16,7 @@ import { panic } from "better-result";
|
|
|
16
16
|
* extend the wrapper over text the author wrote outside it.
|
|
17
17
|
*/
|
|
18
18
|
const INLINE_WRAPPER_MARK_NAME = "inlineWrapper";
|
|
19
|
+
const INLINE_WRAPPER_HYPERLINK_ORIGIN_ATTRIBUTE = "data-inline-wrapper-hyperlink-origin";
|
|
19
20
|
/** What a tagged layer's element name is spelled as on the rendered span. */
|
|
20
21
|
const TAGGED_ELEMENT_ATTRIBUTES = {
|
|
21
22
|
smartTag: "data-smart-tag-element",
|
|
@@ -54,22 +55,39 @@ const InlineWrapperExtension = createMarkExtension({
|
|
|
54
55
|
name: INLINE_WRAPPER_MARK_NAME,
|
|
55
56
|
schemaMarkName: INLINE_WRAPPER_MARK_NAME,
|
|
56
57
|
markSpec: {
|
|
57
|
-
attrs: {
|
|
58
|
-
|
|
59
|
-
stack: { default: null }
|
|
58
|
+
attrs: {
|
|
59
|
+
/** Outermost first. `null` is no wrapper, which is the absence of the mark. */
|
|
60
|
+
stack: { default: null },
|
|
61
|
+
_docxHyperlinkIndex: { default: null },
|
|
62
|
+
_docxInsideHyperlinkStackStart: { default: null }
|
|
63
|
+
},
|
|
60
64
|
inclusive: false,
|
|
61
65
|
parseDOM: [{
|
|
62
66
|
tag: `[${INLINE_WRAPPER_STACK_ATTRIBUTE}]`,
|
|
63
67
|
getAttrs(dom) {
|
|
64
68
|
const stack = parseInlineWrapperStack(dom.getAttribute(INLINE_WRAPPER_STACK_ATTRIBUTE));
|
|
65
|
-
|
|
69
|
+
if (stack === null) return false;
|
|
70
|
+
const origin = dom.getAttribute(INLINE_WRAPPER_HYPERLINK_ORIGIN_ATTRIBUTE);
|
|
71
|
+
if (origin === null) return { stack };
|
|
72
|
+
const match = /^(\d+):(\d+)$/u.exec(origin);
|
|
73
|
+
if (match === null) return false;
|
|
74
|
+
const hyperlinkIndex = Number(match[1]);
|
|
75
|
+
const stackStart = Number(match[2]);
|
|
76
|
+
if (!Number.isSafeInteger(hyperlinkIndex) || !Number.isSafeInteger(stackStart) || stackStart >= stack.length) return false;
|
|
77
|
+
return {
|
|
78
|
+
stack,
|
|
79
|
+
_docxHyperlinkIndex: hyperlinkIndex,
|
|
80
|
+
_docxInsideHyperlinkStackStart: stackStart
|
|
81
|
+
};
|
|
66
82
|
}
|
|
67
83
|
}],
|
|
68
84
|
toDOM(mark) {
|
|
69
|
-
const { stack } = expectInlineWrapperMarkAttrs(mark);
|
|
85
|
+
const { stack, _docxHyperlinkIndex, _docxInsideHyperlinkStackStart } = expectInlineWrapperMarkAttrs(mark);
|
|
70
86
|
const innermost = stack.at(-1);
|
|
71
87
|
if (innermost === void 0) panic("An inline wrapper mark carries at least one layer");
|
|
72
|
-
|
|
88
|
+
const attributes = { [INLINE_WRAPPER_STACK_ATTRIBUTE]: serializeInlineWrapperStack(stack) };
|
|
89
|
+
if (typeof _docxHyperlinkIndex === "number" && typeof _docxInsideHyperlinkStackStart === "number") attributes[INLINE_WRAPPER_HYPERLINK_ORIGIN_ATTRIBUTE] = `${_docxHyperlinkIndex}:${_docxInsideHyperlinkStackStart}`;
|
|
90
|
+
return layerElement(innermost, attributes);
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
93
|
});
|
|
@@ -13,11 +13,15 @@ const surveyCommentReferences = (doc) => {
|
|
|
13
13
|
doc.descendants((node, position) => {
|
|
14
14
|
if (node.type.name === "commentReference") {
|
|
15
15
|
const attrs = readCommentReferenceAttrs(node);
|
|
16
|
-
references.push({
|
|
17
|
-
|
|
16
|
+
references.push(attrs.ok ? {
|
|
17
|
+
status: "valid",
|
|
18
|
+
commentId: attrs.value.commentId,
|
|
18
19
|
position,
|
|
19
|
-
size: node.nodeSize
|
|
20
|
-
|
|
20
|
+
size: node.nodeSize
|
|
21
|
+
} : {
|
|
22
|
+
status: "malformed",
|
|
23
|
+
position,
|
|
24
|
+
size: node.nodeSize
|
|
21
25
|
});
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
@@ -60,7 +64,7 @@ const CommentReferenceExtension = createNodeExtension({
|
|
|
60
64
|
tag: "span[data-docx-comment-reference]",
|
|
61
65
|
getAttrs(dom) {
|
|
62
66
|
const raw = dom.getAttribute("data-docx-comment-reference");
|
|
63
|
-
if (raw === null ||
|
|
67
|
+
if (raw === null || !/^-?(?:0|[1-9]\d*)$/.test(raw)) return false;
|
|
64
68
|
const commentId = Number(raw);
|
|
65
69
|
return Number.isSafeInteger(commentId) ? { commentId } : false;
|
|
66
70
|
}
|
|
@@ -367,7 +367,7 @@ const statedCellWidth = (value, type) => ({
|
|
|
367
367
|
}
|
|
368
368
|
});
|
|
369
369
|
const tableCellSpec = {
|
|
370
|
-
content: "(paragraph | table | textBox | preservedBlock | blockBookmarkBoundary)+",
|
|
370
|
+
content: "(paragraph | table | textBox | blockSdt | preservedBlock | blockBookmarkBoundary)+",
|
|
371
371
|
tableRole: "cell",
|
|
372
372
|
isolating: true,
|
|
373
373
|
attrs: {
|
|
@@ -436,7 +436,7 @@ const tableCellSpec = {
|
|
|
436
436
|
}
|
|
437
437
|
};
|
|
438
438
|
const tableHeaderSpec = {
|
|
439
|
-
content: "(paragraph | table | textBox | preservedBlock | blockBookmarkBoundary)+",
|
|
439
|
+
content: "(paragraph | table | textBox | blockSdt | preservedBlock | blockBookmarkBoundary)+",
|
|
440
440
|
tableRole: "header_cell",
|
|
441
441
|
isolating: true,
|
|
442
442
|
attrs: {
|
|
@@ -170,6 +170,17 @@ type InlineWrapperKind = InlineWrapperLayer["kind"];
|
|
|
170
170
|
*/
|
|
171
171
|
type InlineWrapperAttrs = {
|
|
172
172
|
stack: readonly InlineWrapperLayer[];
|
|
173
|
+
/**
|
|
174
|
+
* The imported hyperlink whose children the suffix of `stack` came from.
|
|
175
|
+
*
|
|
176
|
+
* ProseMirror stores marks as an unordered set, so a link mark and a wrapper
|
|
177
|
+
* mark otherwise cannot say whether `<w:bdo>` surrounded `<w:hyperlink>` or
|
|
178
|
+
* was one of its children. This is parser provenance, not editable wrapper
|
|
179
|
+
* data: it is meaningful only alongside the matching hyperlink mark.
|
|
180
|
+
*/
|
|
181
|
+
_docxHyperlinkIndex?: number;
|
|
182
|
+
/** The first stack layer authored inside `_docxHyperlinkIndex`. */
|
|
183
|
+
_docxInsideHyperlinkStackStart?: number;
|
|
173
184
|
};
|
|
174
185
|
declare const COMPLEX_SCRIPT_RUN_PROPERTY_KEYS: readonly ["boldCs", "italicCs", "fontSizeCs"];
|
|
175
186
|
type ComplexScriptRunPropertyKey = (typeof COMPLEX_SCRIPT_RUN_PROPERTY_KEYS)[number];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
|
-
import { TrackedChangeProvenance } from "./marks.js";
|
|
2
|
+
import { InlineWrapperLayer, TrackedChangeProvenance } from "./marks.js";
|
|
3
3
|
import "../../types/index.js";
|
|
4
4
|
import { OutlineStyleAttr } from "../../types/documentEnumValues.js";
|
|
5
5
|
import { SpacingExplicit } from "../../types/formatting.js";
|
|
@@ -212,9 +212,9 @@ type ParagraphAttrs = {
|
|
|
212
212
|
id: number;
|
|
213
213
|
name: string;
|
|
214
214
|
}[];
|
|
215
|
-
/**
|
|
216
|
-
* Preserve
|
|
217
|
-
*
|
|
215
|
+
/** A `w:hyperlink` with no projectable leaf cannot be represented as a text mark.
|
|
216
|
+
* Preserve its metadata and any empty transparent-wrapper children at the
|
|
217
|
+
* paragraph boundary so an editor round trip does not drop either element. */
|
|
218
218
|
_emptyHyperlinks?: {
|
|
219
219
|
/** ProseMirror inline offset where the zero-width hyperlink appeared. */
|
|
220
220
|
offset: number;
|
|
@@ -225,6 +225,8 @@ type ParagraphAttrs = {
|
|
|
225
225
|
target?: document_d_exports.Hyperlink["target"];
|
|
226
226
|
history?: document_d_exports.Hyperlink["history"];
|
|
227
227
|
docLocation?: document_d_exports.Hyperlink["docLocation"];
|
|
228
|
+
/** Empty transparent-wrapper nests authored as children of this link. */
|
|
229
|
+
_docxEmptyWrapperStacks?: readonly (readonly InlineWrapperLayer[])[];
|
|
228
230
|
}[];
|
|
229
231
|
/**
|
|
230
232
|
* Run-in heading flag: this paragraph's mark carries
|
|
@@ -16,7 +16,7 @@ declare const TRACKED_RUN_INLINE_ATOM_DISPOSITIONS: Readonly<{
|
|
|
16
16
|
readonly hardBreak: "carry";
|
|
17
17
|
readonly image: "carry";
|
|
18
18
|
readonly math: "carry";
|
|
19
|
-
readonly moveRangeBoundary: "
|
|
19
|
+
readonly moveRangeBoundary: "carry";
|
|
20
20
|
readonly pageBreakRun: "page-break-carrier";
|
|
21
21
|
readonly preservedXml: "carry";
|
|
22
22
|
readonly rangeAnchor: "transparent";
|
|
@@ -15,7 +15,7 @@ const TRACKED_RUN_INLINE_ATOM_DISPOSITIONS = Object.freeze({
|
|
|
15
15
|
hardBreak: "carry",
|
|
16
16
|
image: "carry",
|
|
17
17
|
math: "carry",
|
|
18
|
-
moveRangeBoundary: "
|
|
18
|
+
moveRangeBoundary: "carry",
|
|
19
19
|
pageBreakRun: "page-break-carrier",
|
|
20
20
|
preservedXml: "carry",
|
|
21
21
|
rangeAnchor: "transparent",
|
|
@@ -49,7 +49,7 @@ const validateBookmarkBoundaryStructure = (doc, issues) => {
|
|
|
49
49
|
const { id, name, path, paragraph, origin } = boundary;
|
|
50
50
|
const previousOrigin = startedBy.get(id);
|
|
51
51
|
if (previousOrigin !== void 0) {
|
|
52
|
-
if (origin === "attr" && previousOrigin === "attr") return false;
|
|
52
|
+
if (origin === "paragraph-attr" && previousOrigin === "paragraph-attr") return false;
|
|
53
53
|
issues.push({
|
|
54
54
|
path,
|
|
55
55
|
message: `${describeBookmark(id, name)} has more than one start boundary (${paragraph}).`
|
|
@@ -81,7 +81,7 @@ const validateBookmarkBoundaryStructure = (doc, issues) => {
|
|
|
81
81
|
name: bookmark.name,
|
|
82
82
|
path: bookmarkPath,
|
|
83
83
|
paragraph: enclosingParagraph,
|
|
84
|
-
origin: "attr"
|
|
84
|
+
origin: "paragraph-attr"
|
|
85
85
|
})) openedAttrBookmarks.push({
|
|
86
86
|
id: bookmark.id,
|
|
87
87
|
path: bookmarkPath
|
|
@@ -100,21 +100,62 @@ const validateBookmarkBoundaryStructure = (doc, issues) => {
|
|
|
100
100
|
name: attrs.name ?? null,
|
|
101
101
|
path,
|
|
102
102
|
paragraph: enclosingParagraph,
|
|
103
|
-
origin: "
|
|
103
|
+
origin: "boundary"
|
|
104
104
|
});
|
|
105
105
|
else registerEnd(attrs.id, path, enclosingParagraph);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
let positionedBookmarks = [];
|
|
109
|
+
if (node.type.name === "table") {
|
|
110
|
+
const result = readTableAttrs(node);
|
|
111
|
+
if (result.ok) positionedBookmarks = result.value._bookmarks ?? [];
|
|
112
|
+
} else if (node.type.name === "tableRow") {
|
|
113
|
+
const result = readTableRowAttrs(node);
|
|
114
|
+
if (result.ok) positionedBookmarks = result.value._bookmarks ?? [];
|
|
115
|
+
}
|
|
116
|
+
const positionedBookmarksByChildIndex = /* @__PURE__ */ new Map();
|
|
117
|
+
for (const [index, positioned] of positionedBookmarks.entries()) {
|
|
118
|
+
const markerPath = `${path}.${node.type.name}.attrs._bookmarks[${index}]`;
|
|
119
|
+
if (positioned.index > node.childCount) {
|
|
120
|
+
issues.push({
|
|
121
|
+
path: `${markerPath}.index`,
|
|
122
|
+
message: `Expected a child position between 0 and ${node.childCount}.`
|
|
123
|
+
});
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const markers = positionedBookmarksByChildIndex.get(positioned.index);
|
|
127
|
+
const atPosition = {
|
|
128
|
+
marker: positioned.marker,
|
|
129
|
+
path: markerPath
|
|
130
|
+
};
|
|
131
|
+
if (markers === void 0) positionedBookmarksByChildIndex.set(positioned.index, [atPosition]);
|
|
132
|
+
else markers.push(atPosition);
|
|
133
|
+
}
|
|
134
|
+
const visitPositionedBookmarks = (childIndex) => {
|
|
135
|
+
for (const { marker, path: markerPath } of positionedBookmarksByChildIndex.get(childIndex) ?? []) if (marker.type === "bookmarkStart") registerStart({
|
|
136
|
+
id: marker.id,
|
|
137
|
+
name: marker.name,
|
|
138
|
+
path: markerPath,
|
|
139
|
+
paragraph: enclosingParagraph,
|
|
140
|
+
origin: "positioned"
|
|
141
|
+
});
|
|
142
|
+
else if (open.has(marker.id)) registerEnd(marker.id, markerPath, enclosingParagraph);
|
|
143
|
+
};
|
|
108
144
|
node.forEach((child, _offset, index) => {
|
|
145
|
+
visitPositionedBookmarks(index);
|
|
109
146
|
visit(child, `${path}.content[${index}]`, enclosingParagraph);
|
|
110
147
|
});
|
|
148
|
+
visitPositionedBookmarks(node.childCount);
|
|
111
149
|
for (const { id, path: bookmarkPath } of openedAttrBookmarks) registerEnd(id, bookmarkPath, enclosingParagraph);
|
|
112
150
|
};
|
|
113
151
|
visit(doc, "doc", "the document root");
|
|
114
|
-
for (const boundary of open.values())
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
152
|
+
for (const boundary of open.values()) {
|
|
153
|
+
if (boundary.origin === "positioned") continue;
|
|
154
|
+
issues.push({
|
|
155
|
+
path: boundary.path,
|
|
156
|
+
message: `${describeBookmark(boundary.id, boundary.name)} has no matching end boundary (${boundary.paragraph}).`
|
|
157
|
+
});
|
|
158
|
+
}
|
|
118
159
|
};
|
|
119
160
|
const assertValidProseMirrorDocument = (doc, context) => {
|
|
120
161
|
if (validDocumentCache.has(doc)) return;
|
package/dist/types/content.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BlockContent, BlockSdt, BookmarkEnd, BookmarkStart, BreakContent, Column, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, ComplexField, Deletion, DisplacedByCustomXml, DocumentBody, DrawingContent, DrawingRawXmlMode, EffectExtentSlots, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, ImageWrapPolygon, InlineSdt, Insertion, InstrTextContent, LineNumberRestart, MathEquation, MoveFrom, MoveFromRangeEnd, MoveFromRangeStart, MoveTo, MoveToRangeEnd, MoveToRangeStart, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, PageOrientation, Paragraph, ParagraphContent, ParagraphPropertyChange, PositionalTab, PositionedBookmarkMarker, PreservedAttribute, PreservedBlock, PreservedInline, PropertyChangeInfo, Run, RunContent, RunPropertyChange, SdtProperties, SdtType, Section, SectionProperties, SectionStart, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, SymbolContent, TabContent, Table, TableCell, TableCellBlock, TableCellPropertyChange, TableRow, TableRowPropertyChange, TableStructuralChangeInfo, TextBox, TextContent, TrackedChangeInfo, TrackedRunChange, TrackedRunContent, VerticalAlign, WrapDistanceSlots } from "@stll/docx-core/model";
|
|
2
|
-
export type { BlockContent, BlockSdt, BookmarkEnd, BookmarkStart, BreakContent, Column, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, ComplexField, Deletion, DisplacedByCustomXml, DocumentBody, DrawingContent, DrawingRawXmlMode, EffectExtentSlots, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, ImageWrapPolygon, InlineSdt, Insertion, InstrTextContent, LineNumberRestart, MathEquation, MoveFrom, MoveFromRangeEnd, MoveFromRangeStart, MoveTo, MoveToRangeEnd, MoveToRangeStart, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, PageOrientation, Paragraph, ParagraphContent, ParagraphPropertyChange, PositionalTab, PositionedBookmarkMarker, PreservedAttribute, PreservedBlock, PreservedInline, PropertyChangeInfo, Run, RunContent, RunPropertyChange, SdtProperties, SdtType, Section, SectionProperties, SectionStart, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, SymbolContent, TabContent, Table, TableCell, TableCellBlock, TableCellPropertyChange, TableRow, TableRowPropertyChange, TableStructuralChangeInfo, TextBox, TextContent, TrackedChangeInfo, TrackedRunChange, TrackedRunContent, VerticalAlign, WrapDistanceSlots };
|
|
1
|
+
import { BlockContent, BlockSdt, BookmarkEnd, BookmarkStart, BreakContent, Column, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, ComplexField, Deletion, DisplacedByCustomXml, DocumentBackground, DocumentBackgroundDrawing, DocumentBody, DrawingContent, DrawingRawXmlMode, EffectExtentSlots, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, ImageWrapPolygon, InlineSdt, Insertion, InstrTextContent, LineNumberRestart, MathEquation, MoveFrom, MoveFromRangeEnd, MoveFromRangeStart, MoveTo, MoveToRangeEnd, MoveToRangeStart, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, PageOrientation, Paragraph, ParagraphContent, ParagraphPropertyChange, PositionalTab, PositionedBookmarkMarker, PreservedAttribute, PreservedBlock, PreservedInline, PropertyChangeInfo, Run, RunContent, RunPropertyChange, SdtProperties, SdtType, Section, SectionProperties, SectionStart, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, SymbolContent, TabContent, Table, TableCell, TableCellBlock, TableCellPropertyChange, TableRow, TableRowPropertyChange, TableStructuralChangeInfo, TextBox, TextContent, TrackedChangeInfo, TrackedRunChange, TrackedRunContent, VerticalAlign, WrapDistanceSlots } from "@stll/docx-core/model";
|
|
2
|
+
export type { BlockContent, BlockSdt, BookmarkEnd, BookmarkStart, BreakContent, Column, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, ComplexField, Deletion, DisplacedByCustomXml, DocumentBackground, DocumentBackgroundDrawing, DocumentBody, DrawingContent, DrawingRawXmlMode, EffectExtentSlots, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, ImageWrapPolygon, InlineSdt, Insertion, InstrTextContent, LineNumberRestart, MathEquation, MoveFrom, MoveFromRangeEnd, MoveFromRangeStart, MoveTo, MoveToRangeEnd, MoveToRangeStart, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, PageOrientation, Paragraph, ParagraphContent, ParagraphPropertyChange, PositionalTab, PositionedBookmarkMarker, PreservedAttribute, PreservedBlock, PreservedInline, PropertyChangeInfo, Run, RunContent, RunPropertyChange, SdtProperties, SdtType, Section, SectionProperties, SectionStart, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, SymbolContent, TabContent, Table, TableCell, TableCellBlock, TableCellPropertyChange, TableRow, TableRowPropertyChange, TableStructuralChangeInfo, TextBox, TextContent, TrackedChangeInfo, TrackedRunChange, TrackedRunContent, VerticalAlign, WrapDistanceSlots };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ type ComplexField = document_d_exports.ComplexField;
|
|
|
12
12
|
type ConditionalFormatStyle = document_d_exports.ConditionalFormatStyle;
|
|
13
13
|
type DocDefaults = document_d_exports.DocDefaults;
|
|
14
14
|
type Document = document_d_exports.Document;
|
|
15
|
+
type DocumentBackground = document_d_exports.DocumentBackground;
|
|
16
|
+
type DocumentBackgroundDrawing = document_d_exports.DocumentBackgroundDrawing;
|
|
15
17
|
type DocumentBody = document_d_exports.DocumentBody;
|
|
16
18
|
type DocxConformanceClass = document_d_exports.DocxConformanceClass;
|
|
17
19
|
type DocxPackage = document_d_exports.DocxPackage;
|
|
@@ -115,4 +117,4 @@ type ThemeFont = document_d_exports.ThemeFont;
|
|
|
115
117
|
type ThemeFontScheme = document_d_exports.ThemeFontScheme;
|
|
116
118
|
type UnderlineStyle = document_d_exports.UnderlineStyle;
|
|
117
119
|
type VerticalAlign = document_d_exports.VerticalAlign;
|
|
118
|
-
export type { AbstractNumbering, BlockContent, BookmarkEnd, BookmarkStart, BorderSpec, BreakContent, CellMargins, ColorValue, Column, ComplexField, ConditionalFormatStyle, DocDefaults, Document, DocumentBody, DocxConformanceClass, DocxPackage, DrawingContent, DrawingRawXmlMode, EmbeddedFontRef, EmphasisMark, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FloatingTableProperties, FontCharset, FontInfo, FontTable, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, InstrTextContent, LevelLegacy, LevelOverride, LevelSuffix, LineNumberRestart, LineSpacingRule, ListLevel, ListRendering, MediaFile, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, NumberFormat, NumberingDefinitions, NumberingInstance, PageOrientation, Paragraph, ParagraphAlignment, ParagraphContent, ParagraphFormatting, PositionalTab, Relationship, RelationshipMap, RelationshipType, Run, RunContent, SchemeColorSlot, Section, SectionProperties, SectionStart, ShadingProperties, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, Style, StyleDefinitions, StyleType, SymbolContent, TabContent, TabLeader, TabStop, TabStopAlignment, Table, TableBorders, TableCell, TableCellFormatting, TableFormatting, TableGridChange, TableLook, TableMeasurement, TableRow, TableRowFormatting, TableWidthType, TextBox, TextContent, TextEffect, TextFormatting, Theme, ThemeColor, ThemeColorScheme, ThemeColorValue, ThemeFont, ThemeFontScheme, UnderlineStyle, VerticalAlign };
|
|
120
|
+
export type { AbstractNumbering, BlockContent, BookmarkEnd, BookmarkStart, BorderSpec, BreakContent, CellMargins, ColorValue, Column, ComplexField, ConditionalFormatStyle, DocDefaults, Document, DocumentBackground, DocumentBackgroundDrawing, DocumentBody, DocxConformanceClass, DocxPackage, DrawingContent, DrawingRawXmlMode, EmbeddedFontRef, EmphasisMark, Endnote, EndnotePosition, EndnoteProperties, Field, FieldCharContent, FieldType, FloatingTableProperties, FontCharset, FontInfo, FontTable, FooterReference, Footnote, FootnotePosition, FootnoteProperties, HeaderFooter, HeaderFooterType, HeaderReference, Hyperlink, Image, ImageCrop, ImagePadding, ImagePosition, ImageSize, ImageTransform, ImageWrap, InstrTextContent, LevelLegacy, LevelOverride, LevelSuffix, LineNumberRestart, LineSpacingRule, ListLevel, ListRendering, MediaFile, NoBreakHyphenContent, NoteNumberRestart, NoteReferenceContent, NumberFormat, NumberingDefinitions, NumberingInstance, PageOrientation, Paragraph, ParagraphAlignment, ParagraphContent, ParagraphFormatting, PositionalTab, Relationship, RelationshipMap, RelationshipType, Run, RunContent, SchemeColorSlot, Section, SectionProperties, SectionStart, ShadingProperties, Shape, ShapeContent, ShapeFill, ShapeGeometryAdjustment, ShapeOutline, ShapeTextBody, ShapeType, SimpleField, SoftHyphenContent, Style, StyleDefinitions, StyleType, SymbolContent, TabContent, TabLeader, TabStop, TabStopAlignment, Table, TableBorders, TableCell, TableCellFormatting, TableFormatting, TableGridChange, TableLook, TableMeasurement, TableRow, TableRowFormatting, TableWidthType, TextBox, TextContent, TextEffect, TextFormatting, Theme, ThemeColor, ThemeColorScheme, ThemeColorValue, ThemeFont, ThemeFontScheme, UnderlineStyle, VerticalAlign };
|
|
@@ -92,12 +92,6 @@ function remapBlock(block, numIdRemap, abstractNumIdRemap) {
|
|
|
92
92
|
};
|
|
93
93
|
return block;
|
|
94
94
|
}
|
|
95
|
-
/** A cell holds no content control, so the walk stays inside its own union. */
|
|
96
|
-
function remapCellBlock(block, numIdRemap, abstractNumIdRemap) {
|
|
97
|
-
if (block.type === "paragraph") return remapParagraph(block, numIdRemap, abstractNumIdRemap);
|
|
98
|
-
if (block.type === "table") return remapTable(block, numIdRemap, abstractNumIdRemap);
|
|
99
|
-
return block;
|
|
100
|
-
}
|
|
101
95
|
function remapTable(table, numIdRemap, abstractNumIdRemap) {
|
|
102
96
|
return {
|
|
103
97
|
...table,
|
|
@@ -105,7 +99,7 @@ function remapTable(table, numIdRemap, abstractNumIdRemap) {
|
|
|
105
99
|
...row,
|
|
106
100
|
cells: row.cells.map((cell) => ({
|
|
107
101
|
...cell,
|
|
108
|
-
content: cell.content.map((item) =>
|
|
102
|
+
content: cell.content.map((item) => remapBlock(item, numIdRemap, abstractNumIdRemap))
|
|
109
103
|
}))
|
|
110
104
|
}))
|
|
111
105
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.5",
|
|
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",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"perf": "bun scripts/profile-editor.ts"
|
|
129
129
|
},
|
|
130
130
|
"dependencies": {
|
|
131
|
-
"@stll/docx-core": "^0.25.
|
|
131
|
+
"@stll/docx-core": "^0.25.3",
|
|
132
132
|
"@stll/docx-utils": "^0.1.0",
|
|
133
133
|
"@stll/template-conditions": ">=0.4.0 <1.0.0",
|
|
134
134
|
"better-result": "3.0.1",
|