@stll/folio-core 0.8.0 → 0.10.0
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/README.md +39 -0
- package/dist/ai-edits/apply.js +18 -4
- package/dist/ai-edits/headless.d.ts +73 -6
- package/dist/ai-edits/headless.js +299 -60
- package/dist/ai-edits/index.d.ts +3 -3
- package/dist/ai-edits/index.js +2 -1
- package/dist/ai-edits/snapshot.js +40 -3
- package/dist/ai-edits/types.d.ts +2 -1
- package/dist/compat/eigenpal.d.ts +6 -4
- package/dist/compat/eigenpal.js +5 -3
- package/dist/controller/latestRequestGate.d.ts +13 -0
- package/dist/controller/latestRequestGate.js +16 -0
- package/dist/controller/layoutPipeline.js +13 -1
- package/dist/document-operations.d.ts +20 -4
- package/dist/document-operations.js +36 -15
- package/dist/document-stories.d.ts +10 -0
- package/dist/document-stories.js +27 -0
- package/dist/docx/blockContentParser.js +2 -2
- package/dist/docx/commentParser.js +1 -1
- package/dist/docx/compatibility.d.ts +3 -7
- package/dist/docx/compatibility.js +0 -11
- package/dist/docx/corePropertiesParser.d.ts +8 -0
- package/dist/docx/corePropertiesParser.js +53 -0
- package/dist/docx/encryption/agileDecryption.js +1 -1
- package/dist/docx/encryption/encryptionInfo.js +1 -1
- package/dist/docx/encryption/openEncryptedDocx.js +1 -1
- package/dist/docx/fontTableParser.d.ts +6 -0
- package/dist/docx/fontTableParser.js +72 -0
- package/dist/docx/groupDrawingParser.js +7 -2
- package/dist/docx/headerFooterParser.js +1 -1
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/metadataPrivacy.d.ts +40 -0
- package/dist/docx/metadataPrivacy.js +131 -0
- package/dist/docx/normalizeBaseDirection.js +1 -1
- package/dist/docx/numberingParser.js +1 -0
- package/dist/docx/paragraphParser.js +12 -1
- package/dist/docx/parser.d.ts +1 -1
- package/dist/docx/parser.js +16 -10
- package/dist/docx/rezip.d.ts +5 -4
- package/dist/docx/rezip.js +76 -13
- package/dist/docx/runConsolidator.js +4 -0
- package/dist/docx/runParser.js +19 -1
- package/dist/docx/selectiveSave.js +3 -3
- package/dist/docx/serializer/fontTableSerializer.d.ts +6 -0
- package/dist/docx/serializer/fontTableSerializer.js +26 -0
- package/dist/docx/serializer/headerFooterSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +4 -0
- package/dist/docx/serializer/runSerializer.js +7 -0
- package/dist/docx/serializer/settingsSerializer.d.ts +6 -0
- package/dist/docx/serializer/settingsSerializer.js +16 -0
- package/dist/docx/serializer/stylesSerializer.d.ts +6 -0
- package/dist/docx/serializer/stylesSerializer.js +56 -0
- package/dist/docx/serializer/tableSerializer.js +25 -26
- package/dist/docx/serializer/themeSerializer.d.ts +6 -0
- package/dist/docx/serializer/themeSerializer.js +36 -0
- package/dist/docx/settingsParser.js +46 -0
- package/dist/docx/styleParser.js +26 -1
- package/dist/docx/tableParser.js +11 -1
- package/dist/docx/vmlImageParser.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +5916 -5916
- package/dist/i18n/messages/catalogs.gen.js +5910 -5910
- package/dist/index.d.ts +6 -4
- package/dist/index.js +5 -3
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +3 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +3 -1
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +3 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +6 -1
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +14 -2
- package/dist/layout-bridge/convert/toFlowBlocks.js +52 -14
- package/dist/layout-bridge/engine/measuring/index.d.ts +2 -1
- package/dist/layout-bridge/engine/measuring/index.js +2 -1
- package/dist/layout-engine/index.js +36 -28
- package/dist/layout-engine/measure/cache.js +6 -3
- package/dist/layout-engine/measure/effectiveLineBreakPolicy.d.ts +29 -0
- package/dist/layout-engine/measure/effectiveLineBreakPolicy.js +60 -0
- package/dist/layout-engine/measure/font-metrics.worker.js +1 -0
- package/dist/layout-engine/measure/index.d.ts +2 -1
- package/dist/layout-engine/measure/index.js +2 -1
- package/dist/layout-engine/measure/lineBreakProvider.d.ts +33 -0
- package/dist/layout-engine/measure/lineBreakProvider.js +252 -0
- package/dist/layout-engine/measure/lineBreaks.d.ts +7 -2
- package/dist/layout-engine/measure/lineBreaks.js +11 -18
- package/dist/layout-engine/measure/listMarkerWidth.d.ts +1 -0
- package/dist/layout-engine/measure/listMarkerWidth.js +12 -6
- package/dist/layout-engine/measure/measureBlocks.d.ts +1 -2
- package/dist/layout-engine/measure/measureBlocks.js +6 -36
- package/dist/layout-engine/measure/measureContainer.js +32 -9
- package/dist/layout-engine/measure/measureHelpers.js +5 -2
- package/dist/layout-engine/measure/measureParagraph.js +332 -73
- package/dist/layout-engine/measure/measureTypes.d.ts +2 -1
- package/dist/layout-engine/measure/measureWorker.d.ts +2 -2
- package/dist/layout-engine/measure/measureWorker.js +8 -19
- package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +3 -14
- package/dist/layout-engine/measure/tableCellFloating.d.ts +10 -3
- package/dist/layout-engine/measure/tableCellFloating.js +51 -37
- package/dist/layout-engine/measure/tableCellFlow.d.ts +27 -0
- package/dist/layout-engine/measure/tableCellFlow.js +73 -0
- package/dist/layout-engine/measure/tableCellGrid.js +1 -1
- package/dist/layout-engine/measure/textMeasurementPolicy.d.ts +18 -0
- package/dist/layout-engine/measure/textMeasurementPolicy.js +24 -0
- package/dist/layout-engine/renderedBreakReconciliation.d.ts +6 -1
- package/dist/layout-engine/renderedBreakReconciliation.js +34 -11
- package/dist/layout-engine/tableRowBreak.d.ts +5 -2
- package/dist/layout-engine/tableRowBreak.js +62 -29
- package/dist/layout-engine/types.d.ts +43 -8
- package/dist/layout-painter/anchoredImagePosition.d.ts +23 -0
- package/dist/layout-painter/anchoredImagePosition.js +95 -0
- package/dist/layout-painter/borderStroke.d.ts +23 -0
- package/dist/layout-painter/borderStroke.js +39 -0
- package/dist/layout-painter/renderImage.d.ts +5 -4
- package/dist/layout-painter/renderImage.js +18 -4
- package/dist/layout-painter/renderPage.d.ts +2 -27
- package/dist/layout-painter/renderPage.js +13 -99
- package/dist/layout-painter/renderParagraph.js +41 -23
- package/dist/layout-painter/renderTable.d.ts +2 -0
- package/dist/layout-painter/renderTable.js +223 -43
- package/dist/managers/DocumentLoaderManager.d.ts +1 -1
- package/dist/managers/DocumentLoaderManager.js +2 -2
- package/dist/prosemirror/attrs/index.d.ts +4 -2
- package/dist/prosemirror/attrs/index.js +22 -2
- package/dist/prosemirror/commands/propertyChangeScope.js +1 -1
- package/dist/prosemirror/conversion/effectiveTableCellFormatting.d.ts +62 -0
- package/dist/prosemirror/conversion/effectiveTableCellFormatting.js +131 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +34 -18
- package/dist/prosemirror/conversion/toProseDoc.js +81 -77
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +7 -2
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +1 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +1 -0
- package/dist/prosemirror/extensions/marks/HighlightExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/LanguageExtension.d.ts +7 -0
- package/dist/prosemirror/extensions/marks/LanguageExtension.js +30 -0
- package/dist/prosemirror/extensions/marks/RunShadingExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +1 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +12 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +3 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +4 -2
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/marks.d.ts +6 -1
- package/dist/prosemirror/schema/nodes.d.ts +15 -12
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
- package/dist/prosemirror/utils/tabCalculator.d.ts +3 -1
- package/dist/prosemirror/utils/tabCalculator.js +12 -10
- package/dist/prosemirror/validation.js +4 -1
- package/dist/redline.d.ts +26 -11
- package/dist/redline.js +107 -64
- package/dist/server.d.ts +9 -5
- package/dist/server.js +8 -4
- package/dist/style-sets/extract.d.ts +35 -0
- package/dist/style-sets/extract.js +123 -0
- package/dist/style-sets/stellaStyle.d.ts +13 -0
- package/dist/style-sets/stellaStyle.js +516 -0
- package/dist/style-sets/types.d.ts +31 -0
- package/dist/style-sets/types.js +5 -0
- package/dist/utils/createDocument.d.ts +12 -2
- package/dist/utils/createDocument.js +42 -31
- package/dist/utils/fontResolver.js +6 -6
- package/dist/utils/formatToStyle.js +1 -1
- package/dist/utils/paragraphFormattingMerge.d.ts +14 -3
- package/dist/utils/paragraphFormattingMerge.js +14 -4
- package/dist/version-comparison.d.ts +65 -11
- package/dist/version-comparison.js +187 -29
- package/package.json +5 -1
- package/dist/docx/capabilities.d.ts +0 -41
- package/dist/docx/capabilities.js +0 -322
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { emuToPixels } from "../utils/units.js";
|
|
2
2
|
import { getTableRowLeadingWidth, isFloatingImageRun, isFloatingTextBoxBlock, tableColumnsArePinned } from "../layout-engine/types.js";
|
|
3
3
|
import { measureParagraph } from "../layout-engine/measure/measureParagraph.js";
|
|
4
|
+
import { resolveAnchoredImagePosition } from "./anchoredImagePosition.js";
|
|
5
|
+
import { applyImageVisualAttrs, hasImageCrop, hasImageVisualAttrs } from "./renderImage.js";
|
|
6
|
+
import { borderStrokeToCss, resolveCssBorderStroke } from "./borderStroke.js";
|
|
4
7
|
import { getAutomaticTextColorForBackground } from "./documentColors.js";
|
|
5
8
|
import { renderParagraphFragment } from "./renderParagraph.js";
|
|
9
|
+
import { createTableCellFlowState, finishTableCellFlow, placeTableCellBlock } from "../layout-engine/measure/tableCellFlow.js";
|
|
6
10
|
import { buildTableCellFloatingZones, getTableCellContentWidth, getTableCellFloatingImages } from "../layout-engine/measure/tableCellFloating.js";
|
|
7
11
|
import { renderTextBoxFragment } from "./renderTextBox.js";
|
|
8
12
|
//#region src/layout-painter/renderTable.ts
|
|
@@ -28,13 +32,21 @@ const TABLE_CLASS_NAMES = {
|
|
|
28
32
|
tableEdgeHandleBottom: "layout-table-edge-handle-bottom",
|
|
29
33
|
tableEdgeHandleRight: "layout-table-edge-handle-right"
|
|
30
34
|
};
|
|
31
|
-
|
|
35
|
+
const CELL_DIAGONAL_BORDER_CLASS = "layout-table-cell-diagonal-border";
|
|
36
|
+
function renderCellContent({ cell, cellMeasure, context, doc, contentWidthOverride, pageContentPosition }) {
|
|
32
37
|
const contentEl = doc.createElement("div");
|
|
33
38
|
contentEl.className = TABLE_CLASS_NAMES.cellContent;
|
|
34
39
|
contentEl.style.position = "relative";
|
|
35
|
-
const contentWidth = getTableCellContentWidth(cell, cellMeasure);
|
|
40
|
+
const contentWidth = contentWidthOverride ?? getTableCellContentWidth(cell, cellMeasure);
|
|
36
41
|
contentEl.style.width = `${contentWidth}px`;
|
|
37
|
-
const cellFloatingImages = getTableCellFloatingImages(cell, cellMeasure, contentWidth)
|
|
42
|
+
const cellFloatingImages = getTableCellFloatingImages(cell, cellMeasure, contentWidth, pageContentPosition ? (run, paragraphY) => {
|
|
43
|
+
const position = resolveAnchoredImagePosition(run, pageContentPosition.y + paragraphY, pageContentPosition.geometry);
|
|
44
|
+
return {
|
|
45
|
+
x: position.x - pageContentPosition.x,
|
|
46
|
+
y: position.y - pageContentPosition.y,
|
|
47
|
+
side: position.side
|
|
48
|
+
};
|
|
49
|
+
} : void 0);
|
|
38
50
|
const floatingZones = buildTableCellFloatingZones(cellFloatingImages, contentWidth);
|
|
39
51
|
const floatingLayers = [];
|
|
40
52
|
if (cellFloatingImages.length > 0) {
|
|
@@ -62,14 +74,24 @@ function renderCellContent(cell, cellMeasure, context, doc) {
|
|
|
62
74
|
imgEl.style.width = `${img.width}px`;
|
|
63
75
|
imgEl.style.height = `${img.height}px`;
|
|
64
76
|
imgEl.style.display = "block";
|
|
77
|
+
imgEl.style.maxWidth = "none";
|
|
78
|
+
imgEl.style.maxHeight = "none";
|
|
65
79
|
if (img.alt) imgEl.alt = img.alt;
|
|
66
80
|
if (img.transform) imgEl.style.transform = img.transform;
|
|
81
|
+
if (hasImageVisualAttrs(img)) {
|
|
82
|
+
if (hasImageCrop(img)) {
|
|
83
|
+
imgContainer.style.width = `${img.width}px`;
|
|
84
|
+
imgContainer.style.height = `${img.height}px`;
|
|
85
|
+
imgContainer.style.overflow = "hidden";
|
|
86
|
+
}
|
|
87
|
+
applyImageVisualAttrs(imgEl, img);
|
|
88
|
+
}
|
|
67
89
|
imgContainer.append(imgEl);
|
|
68
90
|
floatingLayer.append(imgContainer);
|
|
69
91
|
}
|
|
70
92
|
floatingLayers.push(floatingLayer);
|
|
71
93
|
}
|
|
72
|
-
|
|
94
|
+
const flowState = createTableCellFlowState();
|
|
73
95
|
let anchorParagraphY = 0;
|
|
74
96
|
let floatingTextBoxesLayer;
|
|
75
97
|
for (let i = 0; i < cell.blocks.length; i++) {
|
|
@@ -78,17 +100,18 @@ function renderCellContent(cell, cellMeasure, context, doc) {
|
|
|
78
100
|
if (block?.kind === "paragraph" && measure?.kind === "paragraph") {
|
|
79
101
|
const paragraphBlock = block;
|
|
80
102
|
let paragraphMeasure = measure;
|
|
81
|
-
if (floatingZones.length > 0) paragraphMeasure = measureParagraph(paragraphBlock, contentWidth, {
|
|
103
|
+
if (floatingZones.length > 0 || contentWidthOverride !== void 0) paragraphMeasure = measureParagraph(paragraphBlock, contentWidth, {
|
|
82
104
|
floatingZones,
|
|
83
|
-
paragraphYOffset:
|
|
105
|
+
paragraphYOffset: placeTableCellBlock({ ...flowState }, paragraphBlock, paragraphMeasure).contentTop
|
|
84
106
|
});
|
|
107
|
+
const placement = placeTableCellBlock(flowState, paragraphBlock, paragraphMeasure);
|
|
85
108
|
const syntheticFragment = {
|
|
86
109
|
kind: "paragraph",
|
|
87
110
|
blockId: paragraphBlock.id,
|
|
88
111
|
x: 0,
|
|
89
112
|
y: 0,
|
|
90
113
|
width: contentWidth,
|
|
91
|
-
height:
|
|
114
|
+
height: placement.contentHeight,
|
|
92
115
|
fromLine: 0,
|
|
93
116
|
toLine: paragraphMeasure.lines.length,
|
|
94
117
|
...paragraphBlock.pmStart !== void 0 ? { pmStart: paragraphBlock.pmStart } : {},
|
|
@@ -101,18 +124,23 @@ function renderCellContent(cell, cellMeasure, context, doc) {
|
|
|
101
124
|
const fragEl = renderParagraphFragment(syntheticFragment, paragraphBlock, paragraphMeasure, cellContext, { document: doc });
|
|
102
125
|
fragEl.style.position = "relative";
|
|
103
126
|
fragEl.style.boxSizing = "border-box";
|
|
104
|
-
fragEl.style.height = `${
|
|
105
|
-
|
|
106
|
-
if (spaceBefore > 0) fragEl.style.paddingTop = `${spaceBefore}px`;
|
|
127
|
+
fragEl.style.height = `${placement.leadingSpacing + placement.contentHeight}px`;
|
|
128
|
+
if (placement.leadingSpacing > 0) fragEl.style.paddingTop = `${placement.leadingSpacing}px`;
|
|
107
129
|
contentEl.append(fragEl);
|
|
108
|
-
anchorParagraphY =
|
|
109
|
-
cumulativeY += paragraphMeasure.totalHeight;
|
|
130
|
+
anchorParagraphY = placement.contentTop;
|
|
110
131
|
} else if (block?.kind === "table" && measure?.kind === "table") {
|
|
111
|
-
const
|
|
132
|
+
const tableBlock = block;
|
|
133
|
+
const tableMeasure = measure;
|
|
134
|
+
const nestedTableEl = renderNestedTable(tableBlock, tableMeasure, context, doc);
|
|
112
135
|
nestedTableEl.style.position = "relative";
|
|
136
|
+
const placement = placeTableCellBlock(flowState, tableBlock, tableMeasure);
|
|
137
|
+
if (placement.leadingSpacing > 0) {
|
|
138
|
+
const spacer = doc.createElement("div");
|
|
139
|
+
spacer.style.height = `${placement.leadingSpacing}px`;
|
|
140
|
+
contentEl.append(spacer);
|
|
141
|
+
}
|
|
113
142
|
contentEl.append(nestedTableEl);
|
|
114
|
-
|
|
115
|
-
anchorParagraphY = cumulativeY;
|
|
143
|
+
anchorParagraphY = flowState.height;
|
|
116
144
|
} else if (block?.kind === "textBox" && measure?.kind === "textBox") {
|
|
117
145
|
const textBoxBlock = block;
|
|
118
146
|
const textBoxMeasure = measure;
|
|
@@ -137,14 +165,20 @@ function renderCellContent(cell, cellMeasure, context, doc) {
|
|
|
137
165
|
floatingTextBoxesLayer.append(textBoxEl);
|
|
138
166
|
continue;
|
|
139
167
|
}
|
|
168
|
+
const placement = placeTableCellBlock(flowState, textBoxBlock, textBoxMeasure);
|
|
169
|
+
if (placement.leadingSpacing > 0) {
|
|
170
|
+
const spacer = doc.createElement("div");
|
|
171
|
+
spacer.style.height = `${placement.leadingSpacing}px`;
|
|
172
|
+
contentEl.append(spacer);
|
|
173
|
+
}
|
|
140
174
|
textBoxEl.style.position = "relative";
|
|
141
175
|
textBoxEl.style.left = "0";
|
|
142
176
|
textBoxEl.style.top = "0";
|
|
143
177
|
contentEl.append(textBoxEl);
|
|
144
|
-
|
|
145
|
-
anchorParagraphY = cumulativeY;
|
|
178
|
+
anchorParagraphY = flowState.height;
|
|
146
179
|
}
|
|
147
180
|
}
|
|
181
|
+
contentEl.style.height = `${finishTableCellFlow(flowState)}px`;
|
|
148
182
|
if (floatingTextBoxesLayer) floatingLayers.push(floatingTextBoxesLayer);
|
|
149
183
|
return {
|
|
150
184
|
content: contentEl,
|
|
@@ -217,7 +251,21 @@ function renderNestedTable(block, measure, context, doc) {
|
|
|
217
251
|
y += rowMeasure.height;
|
|
218
252
|
continue;
|
|
219
253
|
}
|
|
220
|
-
const rowEl = renderTableRow(
|
|
254
|
+
const rowEl = renderTableRow({
|
|
255
|
+
row,
|
|
256
|
+
rowMeasure,
|
|
257
|
+
rowIndex,
|
|
258
|
+
y,
|
|
259
|
+
columnWidths: measure.columnWidths,
|
|
260
|
+
totalRows: block.rows.length,
|
|
261
|
+
context,
|
|
262
|
+
doc,
|
|
263
|
+
spanningCells,
|
|
264
|
+
rowYPositions,
|
|
265
|
+
bidi: block.bidi === true,
|
|
266
|
+
columnsPinned,
|
|
267
|
+
cellGrid
|
|
268
|
+
});
|
|
221
269
|
tableEl.append(rowEl);
|
|
222
270
|
y += rowMeasure.height;
|
|
223
271
|
}
|
|
@@ -229,18 +277,46 @@ function renderNestedTable(block, measure, context, doc) {
|
|
|
229
277
|
*/
|
|
230
278
|
function applyBorder(el, side, border) {
|
|
231
279
|
const styleProp = `border${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
232
|
-
if (!border || border.style === "none" || border.style === "nil"
|
|
233
|
-
else
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
280
|
+
if (!border || border.style === "none" || border.style === "nil") el.style[styleProp] = "none";
|
|
281
|
+
else el.style[styleProp] = borderStrokeToCss(border);
|
|
282
|
+
}
|
|
283
|
+
function renderCellDiagonalBorder({ border, direction, cellWidth, cellHeight, doc }) {
|
|
284
|
+
if (!hasVisibleBorder(border)) return null;
|
|
285
|
+
const line = doc.createElement("div");
|
|
286
|
+
const stroke = resolveCssBorderStroke(border ?? {});
|
|
287
|
+
const strokeWidth = stroke.width;
|
|
288
|
+
const color = stroke.color;
|
|
289
|
+
const length = Math.hypot(cellWidth, cellHeight);
|
|
290
|
+
const angle = Math.atan2(cellHeight, cellWidth);
|
|
291
|
+
line.className = CELL_DIAGONAL_BORDER_CLASS;
|
|
292
|
+
line.dataset["direction"] = direction;
|
|
293
|
+
line.style.position = "absolute";
|
|
294
|
+
line.style.left = "0";
|
|
295
|
+
line.style.top = direction === "top-left-to-bottom-right" ? `${-strokeWidth / 2}px` : `${cellHeight - strokeWidth / 2}px`;
|
|
296
|
+
line.style.width = `${length}px`;
|
|
297
|
+
line.style.height = `${strokeWidth}px`;
|
|
298
|
+
line.style.transformOrigin = "0 50%";
|
|
299
|
+
line.style.transform = `rotate(${direction === "top-left-to-bottom-right" ? angle : -angle}rad)`;
|
|
300
|
+
line.style.pointerEvents = "none";
|
|
301
|
+
line.style.zIndex = "1";
|
|
302
|
+
switch (border?.style) {
|
|
303
|
+
case "dashed":
|
|
304
|
+
line.style.backgroundImage = `repeating-linear-gradient(to right, ${color} 0, ${color} ${strokeWidth * 3}px, transparent ${strokeWidth * 3}px, transparent ${strokeWidth * 5}px)`;
|
|
305
|
+
break;
|
|
306
|
+
case "dotted":
|
|
307
|
+
line.style.backgroundImage = `radial-gradient(circle at ${strokeWidth / 2}px 50%, ${color} ${strokeWidth / 2}px, transparent ${strokeWidth / 2}px)`;
|
|
308
|
+
line.style.backgroundSize = `${strokeWidth * 2}px ${strokeWidth}px`;
|
|
309
|
+
break;
|
|
310
|
+
case "double":
|
|
311
|
+
line.style.backgroundImage = `linear-gradient(to bottom, ${color} 0, ${color} 33%, transparent 33%, transparent 67%, ${color} 67%, ${color} 100%)`;
|
|
312
|
+
break;
|
|
313
|
+
default:
|
|
314
|
+
line.style.backgroundColor = color;
|
|
315
|
+
break;
|
|
238
316
|
}
|
|
317
|
+
return line;
|
|
239
318
|
}
|
|
240
|
-
|
|
241
|
-
* Render a single table cell
|
|
242
|
-
*/
|
|
243
|
-
function renderTableCell(cell, cellMeasure, x, rowHeight, borderFlags, columnsPinned, context, doc) {
|
|
319
|
+
function renderTableCell({ cell, cellMeasure, x, rowHeight, borderFlags, columnsPinned, context, doc, contentClip, pageContentPosition }) {
|
|
244
320
|
const cellEl = doc.createElement("div");
|
|
245
321
|
cellEl.className = TABLE_CLASS_NAMES.cell;
|
|
246
322
|
cellEl.style.position = "absolute";
|
|
@@ -283,13 +359,55 @@ function renderTableCell(cell, cellMeasure, x, rowHeight, borderFlags, columnsPi
|
|
|
283
359
|
default: break;
|
|
284
360
|
}
|
|
285
361
|
}
|
|
286
|
-
const
|
|
362
|
+
const contentWidthOverride = cell.textDirection === "btLr" ? Math.max(1, rowHeight - padTop - padBottom) : void 0;
|
|
363
|
+
const renderedContent = renderCellContent({
|
|
364
|
+
cell,
|
|
365
|
+
cellMeasure,
|
|
366
|
+
context,
|
|
367
|
+
doc,
|
|
368
|
+
...contentWidthOverride !== void 0 ? { contentWidthOverride } : {},
|
|
369
|
+
...pageContentPosition ? { pageContentPosition: {
|
|
370
|
+
geometry: pageContentPosition.geometry,
|
|
371
|
+
x: pageContentPosition.x + padLeft,
|
|
372
|
+
y: pageContentPosition.y + padTop
|
|
373
|
+
} } : {}
|
|
374
|
+
});
|
|
375
|
+
if (cell.textDirection === "btLr") {
|
|
376
|
+
renderedContent.content.style.position = "absolute";
|
|
377
|
+
renderedContent.content.style.left = "50%";
|
|
378
|
+
renderedContent.content.style.top = "50%";
|
|
379
|
+
renderedContent.content.style.transform = "translate(-50%, -50%) rotate(-90deg)";
|
|
380
|
+
}
|
|
287
381
|
if (renderedContent.floatingLayers.length > 0) {
|
|
288
382
|
renderedContent.content.style.height = "100%";
|
|
289
383
|
renderedContent.content.style.overflow = "hidden";
|
|
290
384
|
cellEl.style.overflow = "visible";
|
|
291
385
|
}
|
|
386
|
+
if (contentClip) {
|
|
387
|
+
const contentHeight = Math.max(0, rowHeight - padTop - padBottom);
|
|
388
|
+
const clipTop = Math.min(contentHeight, Math.max(0, contentClip.top - padTop));
|
|
389
|
+
const clipBottom = Math.min(contentHeight, Math.max(clipTop, contentClip.bottom - padTop));
|
|
390
|
+
renderedContent.content.style.height = `${contentHeight}px`;
|
|
391
|
+
renderedContent.content.style.overflow = "hidden";
|
|
392
|
+
renderedContent.content.style.clipPath = `inset(${clipTop}px 0 ${contentHeight - clipBottom}px 0)`;
|
|
393
|
+
}
|
|
292
394
|
cellEl.append(renderedContent.content);
|
|
395
|
+
const topLeftToBottomRight = renderCellDiagonalBorder({
|
|
396
|
+
border: cell.borders?.topLeftToBottomRight,
|
|
397
|
+
direction: "top-left-to-bottom-right",
|
|
398
|
+
cellWidth: cellMeasure.width,
|
|
399
|
+
cellHeight: rowHeight,
|
|
400
|
+
doc
|
|
401
|
+
});
|
|
402
|
+
if (topLeftToBottomRight) cellEl.append(topLeftToBottomRight);
|
|
403
|
+
const topRightToBottomLeft = renderCellDiagonalBorder({
|
|
404
|
+
border: cell.borders?.topRightToBottomLeft,
|
|
405
|
+
direction: "top-right-to-bottom-left",
|
|
406
|
+
cellWidth: cellMeasure.width,
|
|
407
|
+
cellHeight: rowHeight,
|
|
408
|
+
doc
|
|
409
|
+
});
|
|
410
|
+
if (topRightToBottomLeft) cellEl.append(topRightToBottomLeft);
|
|
293
411
|
for (const floatingLayer of renderedContent.floatingLayers) {
|
|
294
412
|
floatingLayer.style.left = `${padLeft}px`;
|
|
295
413
|
floatingLayer.style.top = `${padTop}px`;
|
|
@@ -323,11 +441,8 @@ function buildTableCellGrid(block, columnCount) {
|
|
|
323
441
|
}
|
|
324
442
|
return grid;
|
|
325
443
|
}
|
|
326
|
-
const hasVisibleBorder = (border) => border !== void 0 && border.
|
|
327
|
-
|
|
328
|
-
* Render a table row with rowSpan support
|
|
329
|
-
*/
|
|
330
|
-
function renderTableRow(row, rowMeasure, rowIndex, y, columnWidths, totalRows, context, doc, spanningCells, rowYPositions, isFirstRowInFragment, bidi = false, columnsPinned = false, cellGrid) {
|
|
444
|
+
const hasVisibleBorder = (border) => border !== void 0 && border.style !== "none" && border.style !== "nil";
|
|
445
|
+
function renderTableRow({ row, rowMeasure, rowIndex, y, columnWidths, totalRows, context, doc, spanningCells, rowYPositions, isFirstRowInFragment, bidi = false, columnsPinned = false, cellGrid, contentClip, pageContentPosition }) {
|
|
331
446
|
const rowEl = doc.createElement("div");
|
|
332
447
|
rowEl.className = TABLE_CLASS_NAMES.row;
|
|
333
448
|
const tableWidth = bidi ? columnWidths.reduce((sum, columnWidth) => sum + columnWidth, 0) : 0;
|
|
@@ -374,12 +489,27 @@ function renderTableRow(row, rowMeasure, rowIndex, y, columnWidths, totalRows, c
|
|
|
374
489
|
const leftCell = cellGrid?.get(tableCellGridKey(rowIndex, leftNeighborColumn));
|
|
375
490
|
const drawTop = isFirstRow || !hasVisibleBorder(aboveCell?.borders?.bottom);
|
|
376
491
|
const drawLeft = isFirstCol || !hasVisibleBorder(leftCell?.borders?.right);
|
|
377
|
-
const cellEl = renderTableCell(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
492
|
+
const cellEl = renderTableCell({
|
|
493
|
+
cell,
|
|
494
|
+
cellMeasure,
|
|
495
|
+
x: cellLeft,
|
|
496
|
+
rowHeight: cellHeight,
|
|
497
|
+
borderFlags: {
|
|
498
|
+
drawTop,
|
|
499
|
+
isLastRow,
|
|
500
|
+
drawLeft,
|
|
501
|
+
isLastCol
|
|
502
|
+
},
|
|
503
|
+
columnsPinned,
|
|
504
|
+
context,
|
|
505
|
+
doc,
|
|
506
|
+
...contentClip ? { contentClip } : {},
|
|
507
|
+
...pageContentPosition ? { pageContentPosition: {
|
|
508
|
+
geometry: pageContentPosition.geometry,
|
|
509
|
+
x: pageContentPosition.x + cellLeft,
|
|
510
|
+
y: pageContentPosition.y
|
|
511
|
+
} } : {}
|
|
512
|
+
});
|
|
383
513
|
cellEl.dataset["cellIndex"] = String(cellIndex);
|
|
384
514
|
cellEl.dataset["columnIndex"] = String(columnIndex);
|
|
385
515
|
if (rowSpan > 1) cellEl.dataset["rowSpan"] = String(rowSpan);
|
|
@@ -418,6 +548,11 @@ function renderTableRow(row, rowMeasure, rowIndex, y, columnWidths, totalRows, c
|
|
|
418
548
|
*/
|
|
419
549
|
function renderTableFragment(fragment, block, measure, context, options = {}) {
|
|
420
550
|
const doc = options.document ?? document;
|
|
551
|
+
const tablePageContentPosition = options.pageGeometry ? {
|
|
552
|
+
geometry: options.pageGeometry,
|
|
553
|
+
x: fragment.x - options.pageGeometry.marginLeft,
|
|
554
|
+
y: fragment.y - options.pageGeometry.marginTop
|
|
555
|
+
} : void 0;
|
|
421
556
|
const tableEl = doc.createElement("div");
|
|
422
557
|
tableEl.className = TABLE_CLASS_NAMES.table;
|
|
423
558
|
tableEl.style.position = "absolute";
|
|
@@ -469,7 +604,26 @@ function renderTableFragment(fragment, block, measure, context, options = {}) {
|
|
|
469
604
|
y += hdrRowMeasure.height;
|
|
470
605
|
continue;
|
|
471
606
|
}
|
|
472
|
-
const rowEl = renderTableRow(
|
|
607
|
+
const rowEl = renderTableRow({
|
|
608
|
+
row: hdrRow,
|
|
609
|
+
rowMeasure: hdrRowMeasure,
|
|
610
|
+
rowIndex: hdrIdx,
|
|
611
|
+
y,
|
|
612
|
+
columnWidths: measure.columnWidths,
|
|
613
|
+
totalRows: block.rows.length,
|
|
614
|
+
context,
|
|
615
|
+
doc,
|
|
616
|
+
spanningCells,
|
|
617
|
+
rowYPositions,
|
|
618
|
+
isFirstRowInFragment: hdrIdx === 0,
|
|
619
|
+
bidi: block.bidi === true,
|
|
620
|
+
columnsPinned,
|
|
621
|
+
cellGrid,
|
|
622
|
+
...tablePageContentPosition ? { pageContentPosition: {
|
|
623
|
+
...tablePageContentPosition,
|
|
624
|
+
y: tablePageContentPosition.y + y
|
|
625
|
+
} } : {}
|
|
626
|
+
});
|
|
473
627
|
rowEl.dataset["repeatedHeader"] = "true";
|
|
474
628
|
tableEl.append(rowEl);
|
|
475
629
|
y += hdrRowMeasure.height;
|
|
@@ -496,8 +650,34 @@ function renderTableFragment(fragment, block, measure, context, options = {}) {
|
|
|
496
650
|
y += rowMeasure.height;
|
|
497
651
|
continue;
|
|
498
652
|
}
|
|
499
|
-
const isFirstRowInFragment = headerRowCount > 0 && fragment.continuesFromPrev ? false : fragment.continuesFromPrev && rowIndex === fragment.fromRow;
|
|
500
|
-
const
|
|
653
|
+
const isFirstRowInFragment = headerRowCount > 0 && fragment.continuesFromPrev ? false : fragment.continuesFromPrev === true && rowIndex === fragment.fromRow;
|
|
654
|
+
const rowTopClip = rowIndex === fragment.fromRow ? fragment.topClip : void 0;
|
|
655
|
+
const rowBottomClip = rowIndex === fragment.toRow - 1 ? fragment.bottomClip : void 0;
|
|
656
|
+
const contentClip = rowTopClip !== void 0 || rowBottomClip !== void 0 ? {
|
|
657
|
+
top: rowTopClip ?? 0,
|
|
658
|
+
bottom: rowBottomClip ?? rowMeasure.height
|
|
659
|
+
} : void 0;
|
|
660
|
+
const rowEl = renderTableRow({
|
|
661
|
+
row,
|
|
662
|
+
rowMeasure,
|
|
663
|
+
rowIndex,
|
|
664
|
+
y,
|
|
665
|
+
columnWidths: measure.columnWidths,
|
|
666
|
+
totalRows: block.rows.length,
|
|
667
|
+
context,
|
|
668
|
+
doc,
|
|
669
|
+
spanningCells,
|
|
670
|
+
rowYPositions,
|
|
671
|
+
isFirstRowInFragment,
|
|
672
|
+
bidi: block.bidi === true,
|
|
673
|
+
columnsPinned,
|
|
674
|
+
cellGrid,
|
|
675
|
+
...contentClip ? { contentClip } : {},
|
|
676
|
+
...tablePageContentPosition ? { pageContentPosition: {
|
|
677
|
+
...tablePageContentPosition,
|
|
678
|
+
y: tablePageContentPosition.y + y
|
|
679
|
+
} } : {}
|
|
680
|
+
});
|
|
501
681
|
contentParent.append(rowEl);
|
|
502
682
|
y += rowMeasure.height;
|
|
503
683
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
|
-
import { DocxCompatibility } from "../docx/compatibility.js";
|
|
3
2
|
import { DocxInput } from "../utils/docxInput.js";
|
|
3
|
+
import { DocxCompatibility } from "../docx/compatibility.js";
|
|
4
4
|
|
|
5
5
|
//#region src/managers/DocumentLoaderManager.d.ts
|
|
6
6
|
type DocumentLoadState = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { inspectDocxCompatibility } from "../docx/compatibility.js";
|
|
2
|
-
import { resetAuthorColors } from "../utils/authorColors.js";
|
|
3
1
|
import { loadFontsWithMapping } from "../utils/fontLoader.js";
|
|
4
2
|
import { parseDocx } from "../docx/parser.js";
|
|
3
|
+
import { inspectDocxCompatibility } from "../docx/compatibility.js";
|
|
4
|
+
import { resetAuthorColors } from "../utils/authorColors.js";
|
|
5
5
|
import { recordDocumentLoadPhase } from "../layout-engine/layoutInstrumentation.js";
|
|
6
6
|
//#region src/managers/DocumentLoaderManager.ts
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "../schema/nodes.js";
|
|
2
|
-
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
|
|
2
|
+
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
|
|
3
3
|
import { Mark, Node } from "prosemirror-model";
|
|
4
4
|
|
|
5
5
|
//#region src/prosemirror/attrs/index.d.ts
|
|
@@ -54,6 +54,8 @@ declare const readFontSizeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<
|
|
|
54
54
|
declare const expectFontSizeMarkAttrs: (mark: Mark) => FontSizeAttrs;
|
|
55
55
|
declare const readFontFamilyMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<FontFamilyAttrs>;
|
|
56
56
|
declare const expectFontFamilyMarkAttrs: (mark: Mark) => FontFamilyAttrs;
|
|
57
|
+
declare const readLanguageMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<LanguageAttrs>;
|
|
58
|
+
declare const expectLanguageMarkAttrs: (mark: Mark) => LanguageAttrs;
|
|
57
59
|
declare const readCharacterSpacingMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<CharacterSpacingAttrs>;
|
|
58
60
|
declare const expectCharacterSpacingMarkAttrs: (mark: Mark) => CharacterSpacingAttrs;
|
|
59
61
|
declare const readEmphasisMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<EmphasisMarkAttrs>;
|
|
@@ -77,4 +79,4 @@ declare const mergeTableAttrs: (node: Node, patch: NodeAttrPatch<TableAttrs>) =>
|
|
|
77
79
|
declare const mergeTableRowAttrs: (node: Node, patch: NodeAttrPatch<TableRowAttrs>) => TableRowAttrs;
|
|
78
80
|
declare const mergeTableCellAttrs: (node: Node, patch: NodeAttrPatch<TableCellAttrs>) => TableCellAttrs;
|
|
79
81
|
//#endregion
|
|
80
|
-
export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
82
|
+
export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
@@ -128,6 +128,7 @@ const highlightAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
|
128
128
|
const runShadingAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
129
129
|
const fontSizeAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
130
130
|
const fontFamilyAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
131
|
+
const languageAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
131
132
|
const characterSpacingAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
132
133
|
const characterStyleAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
133
134
|
const emphasisMarkAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -145,6 +146,9 @@ const readParagraphAttrs = (node) => {
|
|
|
145
146
|
optionalString(attrs, "textId", "paragraph.attrs.textId", issues);
|
|
146
147
|
optionalOneOf(attrs, "alignment", "paragraph.attrs.alignment", issues, PARAGRAPH_ALIGNMENT_VALUES);
|
|
147
148
|
optionalString(attrs, "styleId", "paragraph.attrs.styleId", issues);
|
|
149
|
+
optionalBoolean(attrs, "kinsoku", "paragraph.attrs.kinsoku", issues);
|
|
150
|
+
optionalBoolean(attrs, "overflowPunctuation", "paragraph.attrs.overflowPunctuation", issues);
|
|
151
|
+
optionalBoolean(attrs, "suppressAutoHyphens", "paragraph.attrs.suppressAutoHyphens", issues);
|
|
148
152
|
optionalNumber(attrs, "spaceBefore", "paragraph.attrs.spaceBefore", issues);
|
|
149
153
|
optionalNumber(attrs, "spaceAfter", "paragraph.attrs.spaceAfter", issues);
|
|
150
154
|
optionalNumber(attrs, "lineSpacing", "paragraph.attrs.lineSpacing", issues);
|
|
@@ -161,6 +165,7 @@ const readParagraphAttrs = (node) => {
|
|
|
161
165
|
optionalBoolean(attrs, "listMarkerHidden", "paragraph.attrs.listMarkerHidden", issues);
|
|
162
166
|
optionalString(attrs, "listMarkerFontFamily", "paragraph.attrs.listMarkerFontFamily", issues);
|
|
163
167
|
optionalNumber(attrs, "listMarkerFontSize", "paragraph.attrs.listMarkerFontSize", issues);
|
|
168
|
+
optionalBoolean(attrs, "listMarkerBold", "paragraph.attrs.listMarkerBold", issues);
|
|
164
169
|
optionalOneOf(attrs, "listMarkerAlignment", "paragraph.attrs.listMarkerAlignment", issues, [
|
|
165
170
|
"left",
|
|
166
171
|
"center",
|
|
@@ -264,13 +269,16 @@ const readTableCellAttrs = (node) => {
|
|
|
264
269
|
optionalOneOf(attrs, "widthType", "tableCell.attrs.widthType", issues, TABLE_WIDTH_TYPE_VALUES);
|
|
265
270
|
optionalOneOf(attrs, "verticalAlign", "tableCell.attrs.verticalAlign", issues, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES);
|
|
266
271
|
optionalString(attrs, "backgroundColor", "tableCell.attrs.backgroundColor", issues);
|
|
272
|
+
optionalString(attrs, "_resolvedBackgroundColor", "tableCell.attrs._resolvedBackgroundColor", issues);
|
|
267
273
|
optionalOneOf(attrs, "textDirection", "tableCell.attrs.textDirection", issues, TABLE_CELL_TEXT_DIRECTION_VALUES);
|
|
268
274
|
optionalBoolean(attrs, "noWrap", "tableCell.attrs.noWrap", issues);
|
|
269
275
|
optionalBorderMap(attrs, "borders", "tableCell.attrs.borders", issues, [
|
|
270
276
|
"top",
|
|
271
277
|
"bottom",
|
|
272
278
|
"left",
|
|
273
|
-
"right"
|
|
279
|
+
"right",
|
|
280
|
+
"topLeftToBottomRight",
|
|
281
|
+
"topRightToBottomLeft"
|
|
274
282
|
]);
|
|
275
283
|
optionalInsetMap(attrs, "margins", "tableCell.attrs.margins", issues);
|
|
276
284
|
optionalRecord(attrs, "_originalFormatting", "tableCell.attrs._originalFormatting", issues);
|
|
@@ -298,12 +306,14 @@ const readImageAttrs = (node) => {
|
|
|
298
306
|
optionalNumber(attrs, "distLeft", "image.attrs.distLeft", issues);
|
|
299
307
|
optionalNumber(attrs, "distRight", "image.attrs.distRight", issues);
|
|
300
308
|
optionalImagePosition(attrs, "position", "image.attrs.position", issues);
|
|
309
|
+
optionalBoolean(attrs, "layoutInCell", "image.attrs.layoutInCell", issues);
|
|
301
310
|
optionalNumber(attrs, "borderWidth", "image.attrs.borderWidth", issues);
|
|
302
311
|
optionalString(attrs, "borderColor", "image.attrs.borderColor", issues);
|
|
303
312
|
optionalString(attrs, "borderStyle", "image.attrs.borderStyle", issues);
|
|
304
313
|
optionalOneOf(attrs, "wrapText", "image.attrs.wrapText", issues, IMAGE_WRAP_TEXT_VALUES);
|
|
305
314
|
optionalString(attrs, "hlinkHref", "image.attrs.hlinkHref", issues);
|
|
306
315
|
optionalString(attrs, "_docxRawXml", "image.attrs._docxRawXml", issues);
|
|
316
|
+
optionalBoolean(attrs, "_docxObjectPreview", "image.attrs._docxObjectPreview", issues);
|
|
307
317
|
return attrsResult(attrs, issues);
|
|
308
318
|
};
|
|
309
319
|
const expectImageAttrs = (node) => expectCachedNodeAttrs(node, imageAttrsCache, readImageAttrs, "image attrs");
|
|
@@ -520,6 +530,16 @@ const readFontFamilyMarkAttrs = (mark) => {
|
|
|
520
530
|
return attrsResult(attrs, issues);
|
|
521
531
|
};
|
|
522
532
|
const expectFontFamilyMarkAttrs = (mark) => expectCachedMarkAttrs(mark, fontFamilyAttrsCache, readFontFamilyMarkAttrs, "font family attrs");
|
|
533
|
+
const readLanguageMarkAttrs = (mark) => {
|
|
534
|
+
const attrs = attrsRecord(mark.attrs);
|
|
535
|
+
const issues = [];
|
|
536
|
+
expectMarkType(mark, "language", issues);
|
|
537
|
+
optionalString(attrs, "val", "language.attrs.val", issues);
|
|
538
|
+
optionalString(attrs, "eastAsia", "language.attrs.eastAsia", issues);
|
|
539
|
+
optionalString(attrs, "bidi", "language.attrs.bidi", issues);
|
|
540
|
+
return attrsResult(attrs, issues);
|
|
541
|
+
};
|
|
542
|
+
const expectLanguageMarkAttrs = (mark) => expectCachedMarkAttrs(mark, languageAttrsCache, readLanguageMarkAttrs, "language attrs");
|
|
523
543
|
const readCharacterSpacingMarkAttrs = (mark) => {
|
|
524
544
|
const attrs = attrsRecord(mark.attrs);
|
|
525
545
|
const issues = [];
|
|
@@ -1229,4 +1249,4 @@ const optionalEmptyHyperlinkArray = (value, issues) => {
|
|
|
1229
1249
|
}
|
|
1230
1250
|
};
|
|
1231
1251
|
//#endregion
|
|
1232
|
-
export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
1252
|
+
export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { directionFromBidi } from "../paragraphDirection.js";
|
|
2
1
|
import { setAutospacingBaseValue } from "../autospacingBase.js";
|
|
2
|
+
import { directionFromBidi } from "../paragraphDirection.js";
|
|
3
3
|
//#region src/prosemirror/commands/propertyChangeScope.ts
|
|
4
4
|
/**
|
|
5
5
|
* Paragraph attrs governed by a `w:pPrChange` — the attrs
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
|
|
3
|
+
//#region src/prosemirror/conversion/effectiveTableCellFormatting.d.ts
|
|
4
|
+
type TableCellMarginsAttrs = {
|
|
5
|
+
top?: number;
|
|
6
|
+
bottom?: number;
|
|
7
|
+
left?: number;
|
|
8
|
+
right?: number;
|
|
9
|
+
};
|
|
10
|
+
type EffectiveTableCellWidth = {
|
|
11
|
+
type: "none";
|
|
12
|
+
} | {
|
|
13
|
+
type: "value";
|
|
14
|
+
source: "direct" | "grid";
|
|
15
|
+
value: number;
|
|
16
|
+
widthType: document_d_exports.TableWidthType;
|
|
17
|
+
};
|
|
18
|
+
type EffectiveTableCellBackground = {
|
|
19
|
+
type: "none";
|
|
20
|
+
source: "none" | "direct" | "style";
|
|
21
|
+
} | {
|
|
22
|
+
type: "color";
|
|
23
|
+
source: "direct" | "style";
|
|
24
|
+
rgb: string;
|
|
25
|
+
};
|
|
26
|
+
type EffectiveTableCellFormatting = Readonly<{
|
|
27
|
+
width: EffectiveTableCellWidth;
|
|
28
|
+
background: EffectiveTableCellBackground;
|
|
29
|
+
borders: document_d_exports.TableCellBorders | undefined;
|
|
30
|
+
margins: TableCellMarginsAttrs | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
type TableCellPosition = {
|
|
33
|
+
isFirstRow?: boolean;
|
|
34
|
+
isLastRow?: boolean;
|
|
35
|
+
isFirstColumn?: boolean;
|
|
36
|
+
isLastColumn?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type ResolveEffectiveTableCellFormattingOptions = {
|
|
39
|
+
directFormatting: document_d_exports.TableCellFormatting | undefined;
|
|
40
|
+
styleFormatting: document_d_exports.TableCellFormatting | undefined;
|
|
41
|
+
tableBorders: document_d_exports.TableBorders | undefined;
|
|
42
|
+
position: TableCellPosition;
|
|
43
|
+
gridWidthPercent: number | undefined;
|
|
44
|
+
defaultMargins: TableCellMarginsAttrs | undefined;
|
|
45
|
+
theme: document_d_exports.Theme | null | undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Resolve the display-facing table-cell cascade without mutating authored
|
|
49
|
+
* OOXML formatting. Source discriminators keep inherited values distinct from
|
|
50
|
+
* direct values that the editor may later override.
|
|
51
|
+
*/
|
|
52
|
+
declare const resolveEffectiveTableCellFormatting: ({
|
|
53
|
+
directFormatting,
|
|
54
|
+
styleFormatting,
|
|
55
|
+
tableBorders,
|
|
56
|
+
position,
|
|
57
|
+
gridWidthPercent,
|
|
58
|
+
defaultMargins,
|
|
59
|
+
theme
|
|
60
|
+
}: ResolveEffectiveTableCellFormattingOptions) => EffectiveTableCellFormatting;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { TableCellMarginsAttrs, TableCellPosition, resolveEffectiveTableCellFormatting };
|