oasis-editor 0.0.88 → 0.0.90
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/{OasisEditorApp-Bx4I4GCm.js → OasisEditorApp-2b7y3aGj.js} +1996 -646
- package/dist/assets/{importDocxWorker-BcELKms0.js → importDocxWorker-BN5o1geV.js} +1 -1
- package/dist/core/commands/table/tableCommandUtils.d.ts +2 -1
- package/dist/core/commands/table/tableFloatingCommands.d.ts +5 -0
- package/dist/core/commands/table.d.ts +1 -0
- package/dist/core/model/index.d.ts +2 -2
- package/dist/core/model/types/layout.d.ts +4 -0
- package/dist/core/model/types/nodes.d.ts +23 -7
- package/dist/core/model/types/primitives.d.ts +19 -0
- package/dist/core/model/types/styles.d.ts +63 -6
- package/dist/core/model.d.ts +1 -0
- package/dist/core/tableStyleResolver.d.ts +20 -0
- package/dist/export/docx/tableXml.d.ts +1 -0
- package/dist/export/pdf/OasisPdfWriter.d.ts +6 -102
- package/dist/export/pdf/draw/drawFragment.d.ts +15 -1
- package/dist/export/pdf/draw/drawTextBoxShape.d.ts +1 -0
- package/dist/export/pdf/writer/PdfContentStream.d.ts +20 -0
- package/dist/export/pdf/writer/PdfDocumentSerializer.d.ts +5 -0
- package/dist/export/pdf/writer/PdfFontTable.d.ts +38 -0
- package/dist/export/pdf/writer/PdfImageTable.d.ts +12 -0
- package/dist/export/pdf/writer/pdfPrimitives.d.ts +20 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +107 -0
- package/dist/i18n/locales/en.d.ts +18 -0
- package/dist/i18n/locales/pt-BR.d.ts +18 -0
- package/dist/import/docx/tableProperties.d.ts +2 -1
- package/dist/import/docx/tables.d.ts +1 -1
- package/dist/{index-Ds5uOUe8.js → index-DcElQi6c.js} +1946 -1204
- package/dist/layoutProjection/floatingObjects.d.ts +15 -1
- package/dist/layoutProjection/paginationTrack.d.ts +2 -0
- package/dist/layoutProjection/paragraphPagination.d.ts +2 -2
- package/dist/oasis-editor.js +50 -50
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/canvas/CanvasLayoutSnapshot.d.ts +1 -1
- package/dist/ui/canvas/CanvasTableLayout.d.ts +7 -1
- package/dist/ui/canvas/canvasBorders.d.ts +2 -0
- package/dist/ui/canvas/canvasSnapshotTypes.d.ts +12 -0
- package/dist/ui/components/Dialogs/TablePropertiesDialog.d.ts +22 -1
- package/dist/ui/editorUiTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1650,6 +1650,24 @@ const en = {
|
|
|
1650
1650
|
"table.wrapAround": "Around",
|
|
1651
1651
|
"table.positioning": "Positioning...",
|
|
1652
1652
|
"table.positioningReadOnly": "Floating table positioning is preserved for DOCX round-trip and is not editable yet.",
|
|
1653
|
+
"table.horizontalAnchor": "Horizontal relative to",
|
|
1654
|
+
"table.verticalAnchor": "Vertical relative to",
|
|
1655
|
+
"table.anchorMargin": "Margin",
|
|
1656
|
+
"table.anchorPage": "Page",
|
|
1657
|
+
"table.anchorText": "Text",
|
|
1658
|
+
"table.positionX": "Horizontal position (pt)",
|
|
1659
|
+
"table.positionY": "Vertical position (pt)",
|
|
1660
|
+
"table.horizontalAlignment": "Horizontal alignment",
|
|
1661
|
+
"table.explicitOffset": "Explicit offset",
|
|
1662
|
+
"table.distanceTop": "Top distance (pt)",
|
|
1663
|
+
"table.distanceRight": "Right distance (pt)",
|
|
1664
|
+
"table.distanceBottom": "Bottom distance (pt)",
|
|
1665
|
+
"table.distanceLeft": "Left distance (pt)",
|
|
1666
|
+
"table.allowOverlap": "Allow overlap",
|
|
1667
|
+
"table.borderStart": "Start",
|
|
1668
|
+
"table.borderEnd": "End",
|
|
1669
|
+
"table.borderTlBr": "Diagonal down",
|
|
1670
|
+
"table.borderTrBl": "Diagonal up",
|
|
1653
1671
|
"table.rowHeight": "Preferred height",
|
|
1654
1672
|
"table.rowHeightRule": "Row height is",
|
|
1655
1673
|
"table.rowAuto": "Auto",
|
|
@@ -2108,6 +2126,24 @@ const ptBR = {
|
|
|
2108
2126
|
"table.wrapAround": "Ao redor",
|
|
2109
2127
|
"table.positioning": "Posicionamento...",
|
|
2110
2128
|
"table.positioningReadOnly": "O posicionamento de tabela flutuante é preservado no DOCX e ainda não é editável.",
|
|
2129
|
+
"table.horizontalAnchor": "Horizontal relativo a",
|
|
2130
|
+
"table.verticalAnchor": "Vertical relativo a",
|
|
2131
|
+
"table.anchorMargin": "Margem",
|
|
2132
|
+
"table.anchorPage": "Página",
|
|
2133
|
+
"table.anchorText": "Texto",
|
|
2134
|
+
"table.positionX": "Posição horizontal (pt)",
|
|
2135
|
+
"table.positionY": "Posição vertical (pt)",
|
|
2136
|
+
"table.horizontalAlignment": "Alinhamento horizontal",
|
|
2137
|
+
"table.explicitOffset": "Deslocamento explícito",
|
|
2138
|
+
"table.distanceTop": "Distância superior (pt)",
|
|
2139
|
+
"table.distanceRight": "Distância direita (pt)",
|
|
2140
|
+
"table.distanceBottom": "Distância inferior (pt)",
|
|
2141
|
+
"table.distanceLeft": "Distância esquerda (pt)",
|
|
2142
|
+
"table.allowOverlap": "Permitir sobreposição",
|
|
2143
|
+
"table.borderStart": "Início",
|
|
2144
|
+
"table.borderEnd": "Fim",
|
|
2145
|
+
"table.borderTlBr": "Diagonal descendente",
|
|
2146
|
+
"table.borderTrBl": "Diagonal ascendente",
|
|
2111
2147
|
"table.rowHeight": "Altura preferencial",
|
|
2112
2148
|
"table.rowHeightRule": "Altura da linha",
|
|
2113
2149
|
"table.rowAuto": "Automática",
|
|
@@ -2483,7 +2519,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2483
2519
|
onCleanup(() => {
|
|
2484
2520
|
cancelled = true;
|
|
2485
2521
|
});
|
|
2486
|
-
import("./OasisEditorApp-
|
|
2522
|
+
import("./OasisEditorApp-2b7y3aGj.js").then((m) => {
|
|
2487
2523
|
cancelled = true;
|
|
2488
2524
|
setProgress(1);
|
|
2489
2525
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -3074,6 +3110,16 @@ const DEFAULT_TEXT_STYLE = asRequired({
|
|
|
3074
3110
|
noProof: false,
|
|
3075
3111
|
webHidden: false,
|
|
3076
3112
|
specVanish: false,
|
|
3113
|
+
rtl: false,
|
|
3114
|
+
complexScript: false,
|
|
3115
|
+
snapToGrid: true,
|
|
3116
|
+
fitText: null,
|
|
3117
|
+
emphasisMark: null,
|
|
3118
|
+
textBorder: null,
|
|
3119
|
+
outline: false,
|
|
3120
|
+
shadow: false,
|
|
3121
|
+
emboss: false,
|
|
3122
|
+
imprint: false,
|
|
3077
3123
|
textEffect: null,
|
|
3078
3124
|
characterScale: null,
|
|
3079
3125
|
characterSpacing: null,
|
|
@@ -3771,6 +3817,198 @@ function getParagraphs(state) {
|
|
|
3771
3817
|
getBlockParagraphs
|
|
3772
3818
|
);
|
|
3773
3819
|
}
|
|
3820
|
+
function resolveEffectiveTableStyle(table, styles) {
|
|
3821
|
+
var _a;
|
|
3822
|
+
const named = resolveNamedTableStyle((_a = table.style) == null ? void 0 : _a.styleId, styles);
|
|
3823
|
+
return mergeTableStyles(named.tableStyle, table.style);
|
|
3824
|
+
}
|
|
3825
|
+
function resolveTableParagraphInheritance(tableStyle, paragraphStyleId, styles) {
|
|
3826
|
+
if (!tableStyle) return void 0;
|
|
3827
|
+
const effectiveStyleId = paragraphStyleId ?? resolveDefaultParagraphStyleId(styles);
|
|
3828
|
+
const named = resolveNamedParagraphStyle(effectiveStyleId, styles);
|
|
3829
|
+
const inherited = {};
|
|
3830
|
+
for (const [key, value] of Object.entries(tableStyle)) {
|
|
3831
|
+
if (!(key in named)) {
|
|
3832
|
+
inherited[key] = value;
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
return Object.keys(inherited).length > 0 ? inherited : void 0;
|
|
3836
|
+
}
|
|
3837
|
+
function mergeTableStyles(base, next) {
|
|
3838
|
+
const conditionalFormats = {
|
|
3839
|
+
...(base == null ? void 0 : base.conditionalFormats) ?? {}
|
|
3840
|
+
};
|
|
3841
|
+
for (const [key, incoming] of Object.entries(
|
|
3842
|
+
(next == null ? void 0 : next.conditionalFormats) ?? {}
|
|
3843
|
+
)) {
|
|
3844
|
+
const previous = conditionalFormats[key];
|
|
3845
|
+
conditionalFormats[key] = {
|
|
3846
|
+
...previous ?? {},
|
|
3847
|
+
...incoming,
|
|
3848
|
+
textStyle: { ...previous == null ? void 0 : previous.textStyle, ...incoming.textStyle },
|
|
3849
|
+
paragraphStyle: {
|
|
3850
|
+
...previous == null ? void 0 : previous.paragraphStyle,
|
|
3851
|
+
...incoming.paragraphStyle
|
|
3852
|
+
},
|
|
3853
|
+
rowStyle: { ...previous == null ? void 0 : previous.rowStyle, ...incoming.rowStyle },
|
|
3854
|
+
cellStyle: { ...previous == null ? void 0 : previous.cellStyle, ...incoming.cellStyle },
|
|
3855
|
+
borders: { ...previous == null ? void 0 : previous.borders, ...incoming.borders },
|
|
3856
|
+
tableStyle: mergeTableStyles(previous == null ? void 0 : previous.tableStyle, incoming.tableStyle)
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
return {
|
|
3860
|
+
...base ?? {},
|
|
3861
|
+
...next ?? {},
|
|
3862
|
+
defaultCellMargins: {
|
|
3863
|
+
...(base == null ? void 0 : base.defaultCellMargins) ?? {},
|
|
3864
|
+
...(next == null ? void 0 : next.defaultCellMargins) ?? {}
|
|
3865
|
+
},
|
|
3866
|
+
borders: { ...(base == null ? void 0 : base.borders) ?? {}, ...(next == null ? void 0 : next.borders) ?? {} },
|
|
3867
|
+
...Object.keys(conditionalFormats).length > 0 ? { conditionalFormats } : {}
|
|
3868
|
+
};
|
|
3869
|
+
}
|
|
3870
|
+
function resolveNamedTableStyle(styleId, styles, seen = /* @__PURE__ */ new Set()) {
|
|
3871
|
+
var _a;
|
|
3872
|
+
if (!styles) return { tableStyle: {} };
|
|
3873
|
+
const effectiveId = styleId ?? ((_a = Object.values(styles).find(
|
|
3874
|
+
(style2) => style2.type === "table" && style2.isDefault
|
|
3875
|
+
)) == null ? void 0 : _a.id);
|
|
3876
|
+
if (!effectiveId || seen.has(effectiveId)) return { tableStyle: {} };
|
|
3877
|
+
const named = styles[effectiveId];
|
|
3878
|
+
if (!named || named.type !== "table") return { tableStyle: {} };
|
|
3879
|
+
seen.add(effectiveId);
|
|
3880
|
+
const parent = resolveNamedTableStyle(named.basedOn, styles, seen);
|
|
3881
|
+
return {
|
|
3882
|
+
tableStyle: mergeTableStyles(parent.tableStyle, named.tableStyle),
|
|
3883
|
+
paragraphStyle: {
|
|
3884
|
+
...parent.paragraphStyle ?? {},
|
|
3885
|
+
...named.paragraphStyle ?? {}
|
|
3886
|
+
},
|
|
3887
|
+
textStyle: {
|
|
3888
|
+
...parent.textStyle ?? {},
|
|
3889
|
+
...named.textStyle ?? {}
|
|
3890
|
+
}
|
|
3891
|
+
};
|
|
3892
|
+
}
|
|
3893
|
+
function conditionalKeys(options) {
|
|
3894
|
+
const { rowIndex, columnIndex, rowCount, columnCount, tableStyle } = options;
|
|
3895
|
+
const look = tableStyle.tblLook ?? {
|
|
3896
|
+
firstRow: true,
|
|
3897
|
+
lastRow: false,
|
|
3898
|
+
firstCol: true,
|
|
3899
|
+
lastCol: false,
|
|
3900
|
+
noHBand: false,
|
|
3901
|
+
noVBand: false
|
|
3902
|
+
};
|
|
3903
|
+
const firstRow = look.firstRow && rowIndex === 0;
|
|
3904
|
+
const lastRow = look.lastRow && rowIndex === rowCount - 1 && rowIndex !== 0;
|
|
3905
|
+
const firstCol = look.firstCol && columnIndex === 0;
|
|
3906
|
+
const lastCol = look.lastCol && columnIndex === columnCount - 1 && columnIndex !== 0;
|
|
3907
|
+
const keys = ["wholeTable"];
|
|
3908
|
+
if (!look.noHBand && !firstRow && !lastRow) {
|
|
3909
|
+
const body = rowIndex - (look.firstRow ? 1 : 0);
|
|
3910
|
+
keys.push(
|
|
3911
|
+
Math.floor(body / Math.max(1, tableStyle.rowBandSize ?? 1)) % 2 === 0 ? "band1Horz" : "band2Horz"
|
|
3912
|
+
);
|
|
3913
|
+
}
|
|
3914
|
+
if (!look.noVBand && !firstCol && !lastCol) {
|
|
3915
|
+
const body = columnIndex - (look.firstCol ? 1 : 0);
|
|
3916
|
+
keys.push(
|
|
3917
|
+
Math.floor(body / Math.max(1, tableStyle.colBandSize ?? 1)) % 2 === 0 ? "band1Vert" : "band2Vert"
|
|
3918
|
+
);
|
|
3919
|
+
}
|
|
3920
|
+
if (lastCol) keys.push("lastCol");
|
|
3921
|
+
if (firstCol) keys.push("firstCol");
|
|
3922
|
+
if (lastRow) keys.push("lastRow");
|
|
3923
|
+
if (firstRow) keys.push("firstRow");
|
|
3924
|
+
if (firstRow && firstCol) keys.push("nwCell");
|
|
3925
|
+
if (firstRow && lastCol) keys.push("neCell");
|
|
3926
|
+
if (lastRow && firstCol) keys.push("swCell");
|
|
3927
|
+
if (lastRow && lastCol) keys.push("seCell");
|
|
3928
|
+
for (const flags of [options.rowFlags, options.cellFlags]) {
|
|
3929
|
+
for (const [key, enabled2] of Object.entries(flags ?? {})) {
|
|
3930
|
+
if (enabled2 && !keys.includes(key)) keys.push(key);
|
|
3931
|
+
if (enabled2 === false) {
|
|
3932
|
+
const index = keys.indexOf(key);
|
|
3933
|
+
if (index >= 0) keys.splice(index, 1);
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
return keys;
|
|
3938
|
+
}
|
|
3939
|
+
function mergeConditionals(keys, formats) {
|
|
3940
|
+
const merged = {};
|
|
3941
|
+
for (const key of keys) {
|
|
3942
|
+
const next = formats == null ? void 0 : formats[key];
|
|
3943
|
+
if (!next) continue;
|
|
3944
|
+
if (next.shading) merged.shading = next.shading;
|
|
3945
|
+
if (next.textStyle)
|
|
3946
|
+
merged.textStyle = { ...merged.textStyle, ...next.textStyle };
|
|
3947
|
+
if (next.paragraphStyle)
|
|
3948
|
+
merged.paragraphStyle = {
|
|
3949
|
+
...merged.paragraphStyle,
|
|
3950
|
+
...next.paragraphStyle
|
|
3951
|
+
};
|
|
3952
|
+
if (next.rowStyle)
|
|
3953
|
+
merged.rowStyle = { ...merged.rowStyle, ...next.rowStyle };
|
|
3954
|
+
if (next.cellStyle)
|
|
3955
|
+
merged.cellStyle = { ...merged.cellStyle, ...next.cellStyle };
|
|
3956
|
+
if (next.borders) merged.borders = { ...merged.borders, ...next.borders };
|
|
3957
|
+
if (next.tableStyle)
|
|
3958
|
+
merged.tableStyle = mergeTableStyles(merged.tableStyle, next.tableStyle);
|
|
3959
|
+
}
|
|
3960
|
+
return merged;
|
|
3961
|
+
}
|
|
3962
|
+
function resolveEffectiveTableCellFormatting(options) {
|
|
3963
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
3964
|
+
const { table, rowIndex, cellIndex, visualColumnIndex, columnCount, styles } = options;
|
|
3965
|
+
const named = resolveNamedTableStyle((_a = table.style) == null ? void 0 : _a.styleId, styles);
|
|
3966
|
+
const baseTableStyle = mergeTableStyles(named.tableStyle, table.style);
|
|
3967
|
+
const row = table.rows[rowIndex];
|
|
3968
|
+
const cell = row == null ? void 0 : row.cells[cellIndex];
|
|
3969
|
+
const keys = conditionalKeys({
|
|
3970
|
+
rowIndex,
|
|
3971
|
+
columnIndex: visualColumnIndex,
|
|
3972
|
+
rowCount: table.rows.length,
|
|
3973
|
+
columnCount,
|
|
3974
|
+
tableStyle: baseTableStyle,
|
|
3975
|
+
rowFlags: row == null ? void 0 : row.conditionalStyle,
|
|
3976
|
+
cellFlags: cell == null ? void 0 : cell.conditionalStyle
|
|
3977
|
+
});
|
|
3978
|
+
const conditional = mergeConditionals(
|
|
3979
|
+
keys,
|
|
3980
|
+
baseTableStyle.conditionalFormats
|
|
3981
|
+
);
|
|
3982
|
+
const conditionalCell = {
|
|
3983
|
+
...((_b = baseTableStyle.defaultCellMargins) == null ? void 0 : _b.top) !== void 0 ? { paddingTop: baseTableStyle.defaultCellMargins.top } : {},
|
|
3984
|
+
...((_c = baseTableStyle.defaultCellMargins) == null ? void 0 : _c.right) !== void 0 ? { paddingRight: baseTableStyle.defaultCellMargins.right } : {},
|
|
3985
|
+
...((_d = baseTableStyle.defaultCellMargins) == null ? void 0 : _d.bottom) !== void 0 ? { paddingBottom: baseTableStyle.defaultCellMargins.bottom } : {},
|
|
3986
|
+
...((_e = baseTableStyle.defaultCellMargins) == null ? void 0 : _e.left) !== void 0 ? { paddingLeft: baseTableStyle.defaultCellMargins.left } : {},
|
|
3987
|
+
...((_f = baseTableStyle.defaultCellMargins) == null ? void 0 : _f.start) !== void 0 ? { paddingStart: baseTableStyle.defaultCellMargins.start } : {},
|
|
3988
|
+
...((_g = baseTableStyle.defaultCellMargins) == null ? void 0 : _g.end) !== void 0 ? { paddingEnd: baseTableStyle.defaultCellMargins.end } : {},
|
|
3989
|
+
...rowIndex === 0 && ((_h = baseTableStyle.borders) == null ? void 0 : _h.borderTop) ? { borderTop: baseTableStyle.borders.borderTop } : rowIndex > 0 && ((_i = baseTableStyle.borders) == null ? void 0 : _i.borderInsideH) ? { borderTop: baseTableStyle.borders.borderInsideH } : {},
|
|
3990
|
+
...rowIndex === table.rows.length - 1 && ((_j = baseTableStyle.borders) == null ? void 0 : _j.borderBottom) ? { borderBottom: baseTableStyle.borders.borderBottom } : rowIndex < table.rows.length - 1 && ((_k = baseTableStyle.borders) == null ? void 0 : _k.borderInsideH) ? { borderBottom: baseTableStyle.borders.borderInsideH } : {},
|
|
3991
|
+
...visualColumnIndex === 0 && ((_l = baseTableStyle.borders) == null ? void 0 : _l.borderLeft) ? { borderLeft: baseTableStyle.borders.borderLeft } : visualColumnIndex > 0 && ((_m = baseTableStyle.borders) == null ? void 0 : _m.borderInsideV) ? { borderLeft: baseTableStyle.borders.borderInsideV } : {},
|
|
3992
|
+
...visualColumnIndex === columnCount - 1 && ((_n = baseTableStyle.borders) == null ? void 0 : _n.borderRight) ? { borderRight: baseTableStyle.borders.borderRight } : visualColumnIndex < columnCount - 1 && ((_o = baseTableStyle.borders) == null ? void 0 : _o.borderInsideV) ? { borderRight: baseTableStyle.borders.borderInsideV } : {},
|
|
3993
|
+
...conditional.cellStyle ?? {},
|
|
3994
|
+
...conditional.borders ?? {},
|
|
3995
|
+
...conditional.shading ? { shading: conditional.shading } : {}
|
|
3996
|
+
};
|
|
3997
|
+
return {
|
|
3998
|
+
tableStyle: mergeTableStyles(baseTableStyle, conditional.tableStyle),
|
|
3999
|
+
rowStyle: { ...conditional.rowStyle ?? {}, ...(row == null ? void 0 : row.style) ?? {} },
|
|
4000
|
+
cellStyle: { ...conditionalCell, ...(cell == null ? void 0 : cell.style) ?? {} },
|
|
4001
|
+
paragraphStyle: {
|
|
4002
|
+
...named.paragraphStyle ?? {},
|
|
4003
|
+
...conditional.paragraphStyle ?? {}
|
|
4004
|
+
},
|
|
4005
|
+
textStyle: {
|
|
4006
|
+
...named.textStyle ?? {},
|
|
4007
|
+
...conditional.textStyle ?? {}
|
|
4008
|
+
},
|
|
4009
|
+
conditionalKeys: keys
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
3774
4012
|
function findParagraphIndex(paragraphs, paragraphId) {
|
|
3775
4013
|
const index = paragraphs.findIndex(
|
|
3776
4014
|
(paragraph) => paragraph.id === paragraphId
|
|
@@ -4766,7 +5004,7 @@ function ToolIcon(props) {
|
|
|
4766
5004
|
children: (render2) => render2()()
|
|
4767
5005
|
});
|
|
4768
5006
|
}
|
|
4769
|
-
var _tmpl$$P = /* @__PURE__ */ template(`<div class=oasis-menubar role=menubar>`), _tmpl$2$y = /* @__PURE__ */ template(`<div class=oasis-menubar-dropdown role=menu>`), _tmpl$3$m = /* @__PURE__ */ template(`<div class=oasis-menubar-menu><div class=oasis-menubar-button role=menuitem aria-haspopup=true>`), _tmpl$4$
|
|
5007
|
+
var _tmpl$$P = /* @__PURE__ */ template(`<div class=oasis-menubar role=menubar>`), _tmpl$2$y = /* @__PURE__ */ template(`<div class=oasis-menubar-dropdown role=menu>`), _tmpl$3$m = /* @__PURE__ */ template(`<div class=oasis-menubar-menu><div class=oasis-menubar-button role=menuitem aria-haspopup=true>`), _tmpl$4$h = /* @__PURE__ */ template(`<div class=oasis-menubar-separator role=separator>`), _tmpl$5$e = /* @__PURE__ */ template(`<span class=oasis-menubar-item-icon aria-hidden=true>`), _tmpl$6$7 = /* @__PURE__ */ template(`<span class=oasis-menubar-shortcut>`), _tmpl$7$3 = /* @__PURE__ */ template(`<i class=oasis-menubar-submenu-icon data-lucide=chevron-right>`), _tmpl$8$2 = /* @__PURE__ */ template(`<div class=oasis-menubar-submenu role=menu>`), _tmpl$9$1 = /* @__PURE__ */ template(`<div class=oasis-menubar-item role=menuitem><span class=oasis-menubar-item-main><span>`);
|
|
4770
5008
|
function Menubar(props) {
|
|
4771
5009
|
const t = useI18n();
|
|
4772
5010
|
const [activeMenu, setActiveMenu] = createSignal(null);
|
|
@@ -4900,7 +5138,7 @@ function MenuNode(props) {
|
|
|
4900
5138
|
} = props;
|
|
4901
5139
|
const isSeparator = (_a = node.item) == null ? void 0 : _a.separator;
|
|
4902
5140
|
if (isSeparator) {
|
|
4903
|
-
return _tmpl$4$
|
|
5141
|
+
return _tmpl$4$h();
|
|
4904
5142
|
}
|
|
4905
5143
|
const hasChildren = node.children.length > 0;
|
|
4906
5144
|
const [showSub, setShowSub] = createSignal(false);
|
|
@@ -11830,7 +12068,7 @@ function emuToPx$1(value) {
|
|
|
11830
12068
|
function clampFinite(value, fallback) {
|
|
11831
12069
|
return Number.isFinite(value) ? value : fallback;
|
|
11832
12070
|
}
|
|
11833
|
-
function resolveAlignedOffset(align, containerSize, boxSize) {
|
|
12071
|
+
function resolveAlignedOffset(align, containerSize, boxSize, pageIndex = 0) {
|
|
11834
12072
|
switch (align) {
|
|
11835
12073
|
case "left":
|
|
11836
12074
|
case "top":
|
|
@@ -11841,10 +12079,52 @@ function resolveAlignedOffset(align, containerSize, boxSize) {
|
|
|
11841
12079
|
case "right":
|
|
11842
12080
|
case "bottom":
|
|
11843
12081
|
return containerSize - boxSize;
|
|
12082
|
+
case "inside":
|
|
12083
|
+
return pageIndex % 2 === 0 ? 0 : containerSize - boxSize;
|
|
12084
|
+
case "outside":
|
|
12085
|
+
return pageIndex % 2 === 0 ? containerSize - boxSize : 0;
|
|
11844
12086
|
default:
|
|
11845
12087
|
return null;
|
|
11846
12088
|
}
|
|
11847
12089
|
}
|
|
12090
|
+
function resolveFloatingTableRect(options) {
|
|
12091
|
+
const {
|
|
12092
|
+
floating,
|
|
12093
|
+
pageSettings,
|
|
12094
|
+
contentLeft,
|
|
12095
|
+
contentTop,
|
|
12096
|
+
contentWidth,
|
|
12097
|
+
anchorTop,
|
|
12098
|
+
width,
|
|
12099
|
+
height,
|
|
12100
|
+
pageIndex
|
|
12101
|
+
} = options;
|
|
12102
|
+
const horizontalPage = floating.horizontalAnchor === "page";
|
|
12103
|
+
const verticalPage = floating.verticalAnchor === "page";
|
|
12104
|
+
const verticalMargin = floating.verticalAnchor === "margin";
|
|
12105
|
+
const hBase = horizontalPage ? 0 : contentLeft;
|
|
12106
|
+
const hSize = horizontalPage ? pageSettings.width : contentWidth;
|
|
12107
|
+
const vBase = verticalPage ? 0 : verticalMargin ? contentTop : anchorTop;
|
|
12108
|
+
const vSize = verticalPage ? pageSettings.height : verticalMargin ? Math.max(1, pageSettings.height - contentTop) : Math.max(1, pageSettings.height - anchorTop);
|
|
12109
|
+
const alignedX = resolveAlignedOffset(
|
|
12110
|
+
floating.xAlign,
|
|
12111
|
+
hSize,
|
|
12112
|
+
width,
|
|
12113
|
+
pageIndex
|
|
12114
|
+
);
|
|
12115
|
+
const alignedY = resolveAlignedOffset(
|
|
12116
|
+
floating.yAlign,
|
|
12117
|
+
vSize,
|
|
12118
|
+
height,
|
|
12119
|
+
pageIndex
|
|
12120
|
+
);
|
|
12121
|
+
return {
|
|
12122
|
+
x: hBase + (alignedX ?? (floating.x ?? 0) * PX_PER_POINT),
|
|
12123
|
+
y: vBase + (alignedY ?? (floating.y ?? 0) * PX_PER_POINT),
|
|
12124
|
+
width: Math.max(1, width),
|
|
12125
|
+
height: Math.max(1, height)
|
|
12126
|
+
};
|
|
12127
|
+
}
|
|
11848
12128
|
function getTextBoxFloatingGeometry(textBox, heightOverride) {
|
|
11849
12129
|
return {
|
|
11850
12130
|
width: textBox.width,
|
|
@@ -12168,7 +12448,7 @@ function projectParagraphLayout(paragraph, pageIndex, totalPages, styles, conten
|
|
|
12168
12448
|
cacheForParagraph.set(cacheKey, result);
|
|
12169
12449
|
return result;
|
|
12170
12450
|
}
|
|
12171
|
-
function projectParagraphLayoutWithExclusions(paragraph, pageSettings, contentWidth, measurer = domTextMeasurer, pageIndex, totalPages, styles, defaultTabStop, resolveTextBoxHeight) {
|
|
12451
|
+
function projectParagraphLayoutWithExclusions(paragraph, pageSettings, contentWidth, measurer = domTextMeasurer, pageIndex, totalPages, styles, defaultTabStop, resolveTextBoxHeight, externalExclusions = []) {
|
|
12172
12452
|
const preliminary = projectParagraphLayout(
|
|
12173
12453
|
paragraph,
|
|
12174
12454
|
pageIndex,
|
|
@@ -12187,7 +12467,7 @@ function projectParagraphLayoutWithExclusions(paragraph, pageSettings, contentWi
|
|
|
12187
12467
|
return (((_a = f.textBox) == null ? void 0 : _a.floating) ?? ((_b = f.image) == null ? void 0 : _b.floating)) !== void 0;
|
|
12188
12468
|
}
|
|
12189
12469
|
);
|
|
12190
|
-
if (!hasFloatingObject && !paragraph.dropCap) {
|
|
12470
|
+
if (!hasFloatingObject && !paragraph.dropCap && externalExclusions.length === 0) {
|
|
12191
12471
|
return preliminary;
|
|
12192
12472
|
}
|
|
12193
12473
|
const fontSize = estimateParagraphFontSize(paragraph, styles);
|
|
@@ -12199,6 +12479,7 @@ function projectParagraphLayoutWithExclusions(paragraph, pageSettings, contentWi
|
|
|
12199
12479
|
contentWidth,
|
|
12200
12480
|
resolveTextBoxHeight
|
|
12201
12481
|
}) : [];
|
|
12482
|
+
exclusions.push(...externalExclusions);
|
|
12202
12483
|
if (paragraph.dropCap) {
|
|
12203
12484
|
const dropCapExclusion = resolveDropCapExclusion({
|
|
12204
12485
|
dropCap: paragraph.dropCap,
|
|
@@ -12624,12 +12905,65 @@ function getCachedTableColumnGeometry(table, contentWidthPx) {
|
|
|
12624
12905
|
}
|
|
12625
12906
|
function estimateTableRowHeight(row, styles, measurer, defaultTabStop, contentWidth, table, rowIndex) {
|
|
12626
12907
|
var _a, _b;
|
|
12627
|
-
|
|
12908
|
+
const tableEntries = table ? buildTableCellLayout(table) : [];
|
|
12909
|
+
const columnCount = Math.max(
|
|
12910
|
+
1,
|
|
12911
|
+
...tableEntries.map(
|
|
12912
|
+
(entry) => entry.visualColumnIndex + Math.max(1, entry.colSpan)
|
|
12913
|
+
)
|
|
12914
|
+
);
|
|
12915
|
+
const rowFormatting = table && rowIndex !== void 0 ? (() => {
|
|
12916
|
+
const entry = tableEntries.find(
|
|
12917
|
+
(candidate) => candidate.rowIndex === rowIndex
|
|
12918
|
+
);
|
|
12919
|
+
return entry ? resolveEffectiveTableCellFormatting({
|
|
12920
|
+
table,
|
|
12921
|
+
rowIndex,
|
|
12922
|
+
cellIndex: entry.cellIndex,
|
|
12923
|
+
visualColumnIndex: entry.visualColumnIndex,
|
|
12924
|
+
columnCount,
|
|
12925
|
+
styles
|
|
12926
|
+
}) : void 0;
|
|
12927
|
+
})() : void 0;
|
|
12928
|
+
if ((_a = (rowFormatting == null ? void 0 : rowFormatting.rowStyle) ?? row.style) == null ? void 0 : _a.hidden) {
|
|
12628
12929
|
return 0;
|
|
12629
12930
|
}
|
|
12630
12931
|
const geometry = table && typeof contentWidth === "number" ? getCachedTableColumnGeometry(table, contentWidth) : null;
|
|
12631
|
-
const cellHeights = row.cells.map((
|
|
12932
|
+
const cellHeights = row.cells.map((sourceCell, cellIndex) => {
|
|
12632
12933
|
var _a2;
|
|
12934
|
+
const entry = rowIndex !== void 0 ? tableEntries.find(
|
|
12935
|
+
(candidate) => candidate.rowIndex === rowIndex && candidate.cellIndex === cellIndex
|
|
12936
|
+
) : void 0;
|
|
12937
|
+
const formatting = table && rowIndex !== void 0 && entry ? resolveEffectiveTableCellFormatting({
|
|
12938
|
+
table,
|
|
12939
|
+
rowIndex,
|
|
12940
|
+
cellIndex,
|
|
12941
|
+
visualColumnIndex: entry.visualColumnIndex,
|
|
12942
|
+
columnCount,
|
|
12943
|
+
styles
|
|
12944
|
+
}) : void 0;
|
|
12945
|
+
const cell = {
|
|
12946
|
+
...sourceCell,
|
|
12947
|
+
style: (formatting == null ? void 0 : formatting.cellStyle) ?? sourceCell.style,
|
|
12948
|
+
blocks: sourceCell.blocks.map((paragraph) => {
|
|
12949
|
+
var _a3;
|
|
12950
|
+
return {
|
|
12951
|
+
...paragraph,
|
|
12952
|
+
style: {
|
|
12953
|
+
...resolveTableParagraphInheritance(
|
|
12954
|
+
formatting == null ? void 0 : formatting.paragraphStyle,
|
|
12955
|
+
(_a3 = paragraph.style) == null ? void 0 : _a3.styleId,
|
|
12956
|
+
styles
|
|
12957
|
+
),
|
|
12958
|
+
...paragraph.style
|
|
12959
|
+
},
|
|
12960
|
+
runs: paragraph.runs.map((run) => ({
|
|
12961
|
+
...run,
|
|
12962
|
+
styles: { ...formatting == null ? void 0 : formatting.textStyle, ...run.styles }
|
|
12963
|
+
}))
|
|
12964
|
+
};
|
|
12965
|
+
})
|
|
12966
|
+
};
|
|
12633
12967
|
if (cell.vMerge === "continue") return 0;
|
|
12634
12968
|
let columnWidthPx;
|
|
12635
12969
|
if (geometry && typeof rowIndex === "number") {
|
|
@@ -12686,13 +13020,16 @@ function estimateTableRowHeight(row, styles, measurer, defaultTabStop, contentWi
|
|
|
12686
13020
|
...cellHeights,
|
|
12687
13021
|
DEFAULT_FONT_SIZE$1 * DEFAULT_LINE_HEIGHT
|
|
12688
13022
|
);
|
|
12689
|
-
const explicitHeight = parseTableRowHeightToPx(
|
|
13023
|
+
const explicitHeight = parseTableRowHeightToPx(
|
|
13024
|
+
(_b = (rowFormatting == null ? void 0 : rowFormatting.rowStyle) ?? row.style) == null ? void 0 : _b.height
|
|
13025
|
+
);
|
|
12690
13026
|
return Math.max(contentHeight, explicitHeight ?? 0) + DEFAULT_TABLE_ROW_VERTICAL_SPACING;
|
|
12691
13027
|
}
|
|
12692
13028
|
function getTableHeaderRowCount(table) {
|
|
13029
|
+
var _a;
|
|
12693
13030
|
let count = 0;
|
|
12694
13031
|
for (const row of table.rows) {
|
|
12695
|
-
if (!row.isHeader) {
|
|
13032
|
+
if (!(((_a = row.style) == null ? void 0 : _a.isHeader) ?? row.isHeader)) {
|
|
12696
13033
|
break;
|
|
12697
13034
|
}
|
|
12698
13035
|
count += 1;
|
|
@@ -12801,6 +13138,7 @@ function projectHeaderFooterBlocksWithDependencies(blocks, deps, context2 = {})
|
|
|
12801
13138
|
defaultTabStop
|
|
12802
13139
|
} = context2;
|
|
12803
13140
|
return blocks.map((block, index) => {
|
|
13141
|
+
var _a, _b;
|
|
12804
13142
|
if (block.type === "paragraph") {
|
|
12805
13143
|
const layout = deps.projectParagraphLayout(
|
|
12806
13144
|
block,
|
|
@@ -12822,18 +13160,20 @@ function projectHeaderFooterBlocksWithDependencies(blocks, deps, context2 = {})
|
|
|
12822
13160
|
sourceBlock: block
|
|
12823
13161
|
};
|
|
12824
13162
|
}
|
|
13163
|
+
const tableHeight = (measuredHeights == null ? void 0 : measuredHeights[block.id]) ?? deps.estimateTableBlockHeight(
|
|
13164
|
+
block,
|
|
13165
|
+
styles,
|
|
13166
|
+
contentWidth,
|
|
13167
|
+
measurer,
|
|
13168
|
+
defaultTabStop
|
|
13169
|
+
);
|
|
12825
13170
|
return {
|
|
12826
13171
|
blockId: block.id,
|
|
12827
13172
|
sourceBlockId: block.id,
|
|
12828
13173
|
blockType: block.type,
|
|
12829
13174
|
globalIndex: index,
|
|
12830
|
-
estimatedHeight: (
|
|
12831
|
-
|
|
12832
|
-
styles,
|
|
12833
|
-
contentWidth,
|
|
12834
|
-
measurer,
|
|
12835
|
-
defaultTabStop
|
|
12836
|
-
),
|
|
13175
|
+
estimatedHeight: ((_a = block.style) == null ? void 0 : _a.floating) ? 0 : tableHeight,
|
|
13176
|
+
floatingTableHeight: ((_b = block.style) == null ? void 0 : _b.floating) ? tableHeight : void 0,
|
|
12837
13177
|
sourceBlock: block
|
|
12838
13178
|
};
|
|
12839
13179
|
});
|
|
@@ -12933,6 +13273,7 @@ class PaginationTrack {
|
|
|
12933
13273
|
__publicField(this, "pages");
|
|
12934
13274
|
__publicField(this, "blocks");
|
|
12935
13275
|
__publicField(this, "height");
|
|
13276
|
+
__publicField(this, "floatingExclusions", []);
|
|
12936
13277
|
this.pageOffset = pageOffset;
|
|
12937
13278
|
this.maxPageHeight = maxPageHeight;
|
|
12938
13279
|
this.reservedHeightByPageIndex = reservedHeightByPageIndex;
|
|
@@ -12977,6 +13318,7 @@ class PaginationTrack {
|
|
|
12977
13318
|
});
|
|
12978
13319
|
this.blocks = [];
|
|
12979
13320
|
this.height = 0;
|
|
13321
|
+
this.floatingExclusions = [];
|
|
12980
13322
|
}
|
|
12981
13323
|
/** Flushes the trailing track and guarantees at least one page exists. */
|
|
12982
13324
|
finalize() {
|
|
@@ -12996,6 +13338,21 @@ class PaginationTrack {
|
|
|
12996
13338
|
}
|
|
12997
13339
|
}
|
|
12998
13340
|
const TEXT_BOX_AUTOFIT_SAFETY_PX$1 = 2;
|
|
13341
|
+
function registerParagraphFloatingExclusions(options) {
|
|
13342
|
+
const exclusions = collectParagraphFloatingExclusions({
|
|
13343
|
+
fragments: options.layout.fragments,
|
|
13344
|
+
preliminaryLines: options.layout.lines,
|
|
13345
|
+
pageSettings: options.params.pageSettings,
|
|
13346
|
+
contentWidth: options.params.contentWidth,
|
|
13347
|
+
resolveTextBoxHeight: options.resolveTextBoxHeight
|
|
13348
|
+
});
|
|
13349
|
+
options.track.floatingExclusions.push(
|
|
13350
|
+
...exclusions.map((exclusion) => ({
|
|
13351
|
+
...exclusion,
|
|
13352
|
+
y: exclusion.y + options.blockTop
|
|
13353
|
+
}))
|
|
13354
|
+
);
|
|
13355
|
+
}
|
|
12999
13356
|
function estimateTextBoxAutoFitHeight(textBox, styles, measurer, pageIndex, totalPages, defaultTabStop) {
|
|
13000
13357
|
var _a, _b, _c, _d, _e;
|
|
13001
13358
|
if (!((_a = textBox.body) == null ? void 0 : _a.autoFit)) {
|
|
@@ -13052,6 +13409,14 @@ function paginateParagraphBlock(track, params, sourceBlock, nextBlock, index) {
|
|
|
13052
13409
|
measuredParagraphLayouts
|
|
13053
13410
|
} = params;
|
|
13054
13411
|
const pageIndex = track.pageIndex;
|
|
13412
|
+
const resolveTextBoxHeight = (textBox) => estimateTextBoxAutoFitHeight(
|
|
13413
|
+
textBox,
|
|
13414
|
+
styles,
|
|
13415
|
+
measurer,
|
|
13416
|
+
pageIndex,
|
|
13417
|
+
totalPages,
|
|
13418
|
+
defaultTabStop
|
|
13419
|
+
);
|
|
13055
13420
|
const projectedParagraphLayout = projectParagraphLayoutWithExclusions(
|
|
13056
13421
|
sourceBlock,
|
|
13057
13422
|
pageSettings,
|
|
@@ -13061,14 +13426,11 @@ function paginateParagraphBlock(track, params, sourceBlock, nextBlock, index) {
|
|
|
13061
13426
|
totalPages,
|
|
13062
13427
|
styles,
|
|
13063
13428
|
defaultTabStop,
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
totalPages,
|
|
13070
|
-
defaultTabStop
|
|
13071
|
-
)
|
|
13429
|
+
resolveTextBoxHeight,
|
|
13430
|
+
track.floatingExclusions.map((exclusion) => ({
|
|
13431
|
+
...exclusion,
|
|
13432
|
+
y: exclusion.y - track.height
|
|
13433
|
+
}))
|
|
13072
13434
|
);
|
|
13073
13435
|
const measuredParagraphLayout = measuredParagraphLayouts == null ? void 0 : measuredParagraphLayouts[sourceBlock.id];
|
|
13074
13436
|
const paragraphLayout = measuredParagraphLayout && isMeasuredLayoutCurrent(projectedParagraphLayout, measuredParagraphLayout) ? applyMeasuredLineGeometry(
|
|
@@ -13150,6 +13512,13 @@ function paginateParagraphBlock(track, params, sourceBlock, nextBlock, index) {
|
|
|
13150
13512
|
sourceBlock
|
|
13151
13513
|
});
|
|
13152
13514
|
track.height += measuredHeight;
|
|
13515
|
+
registerParagraphFloatingExclusions({
|
|
13516
|
+
track,
|
|
13517
|
+
layout: paragraphLayout,
|
|
13518
|
+
blockTop: track.height - measuredHeight + (paragraphStyle.spacingBefore ?? 0),
|
|
13519
|
+
params,
|
|
13520
|
+
resolveTextBoxHeight
|
|
13521
|
+
});
|
|
13153
13522
|
return;
|
|
13154
13523
|
}
|
|
13155
13524
|
let startLineIndex = 0;
|
|
@@ -13261,6 +13630,15 @@ function paginateParagraphBlock(track, params, sourceBlock, nextBlock, index) {
|
|
|
13261
13630
|
sourceBlock
|
|
13262
13631
|
});
|
|
13263
13632
|
track.height += measuredHeight;
|
|
13633
|
+
if (startLineIndex === 0) {
|
|
13634
|
+
registerParagraphFloatingExclusions({
|
|
13635
|
+
track,
|
|
13636
|
+
layout: segmentLayout,
|
|
13637
|
+
blockTop: track.height - measuredHeight + (paragraphStyle.spacingBefore ?? 0),
|
|
13638
|
+
params,
|
|
13639
|
+
resolveTextBoxHeight
|
|
13640
|
+
});
|
|
13641
|
+
}
|
|
13264
13642
|
startLineIndex = lineEndIndex;
|
|
13265
13643
|
segmentIndex += 1;
|
|
13266
13644
|
if (startLineIndex < paragraphLayout.lines.length) {
|
|
@@ -13453,7 +13831,21 @@ function positionsFinishedRow(row, ends) {
|
|
|
13453
13831
|
}
|
|
13454
13832
|
);
|
|
13455
13833
|
}
|
|
13834
|
+
function resolveFloatingTableWidth(table, contentWidth) {
|
|
13835
|
+
var _a, _b;
|
|
13836
|
+
const width = (_a = table.style) == null ? void 0 : _a.width;
|
|
13837
|
+
if (typeof width === "number") return width * PX_PER_POINT;
|
|
13838
|
+
if (typeof width === "string" && width.endsWith("%")) {
|
|
13839
|
+
const percent = Number.parseFloat(width);
|
|
13840
|
+
if (Number.isFinite(percent)) return contentWidth * (percent / 100);
|
|
13841
|
+
}
|
|
13842
|
+
if ((_b = table.gridCols) == null ? void 0 : _b.length) {
|
|
13843
|
+
return table.gridCols.reduce((sum, value) => sum + value, 0) * PX_PER_POINT;
|
|
13844
|
+
}
|
|
13845
|
+
return contentWidth;
|
|
13846
|
+
}
|
|
13456
13847
|
function paginateTableBlock(track, params, sourceBlock, index) {
|
|
13848
|
+
var _a;
|
|
13457
13849
|
const { contentWidth, measurer, styles, defaultTabStop, measuredHeights } = params;
|
|
13458
13850
|
const tableHeight = (measuredHeights == null ? void 0 : measuredHeights[sourceBlock.id]) ?? estimateTableBlockHeight(
|
|
13459
13851
|
sourceBlock,
|
|
@@ -13462,6 +13854,60 @@ function paginateTableBlock(track, params, sourceBlock, index) {
|
|
|
13462
13854
|
measurer,
|
|
13463
13855
|
defaultTabStop
|
|
13464
13856
|
);
|
|
13857
|
+
if ((_a = sourceBlock.style) == null ? void 0 : _a.floating) {
|
|
13858
|
+
track.blocks.push({
|
|
13859
|
+
blockId: sourceBlock.id,
|
|
13860
|
+
sourceBlockId: sourceBlock.id,
|
|
13861
|
+
blockType: sourceBlock.type,
|
|
13862
|
+
globalIndex: index,
|
|
13863
|
+
estimatedHeight: 0,
|
|
13864
|
+
floatingTableHeight: tableHeight,
|
|
13865
|
+
sourceBlock
|
|
13866
|
+
});
|
|
13867
|
+
const pageContentLeft = params.pageSettings.margins.left + params.pageSettings.margins.gutter;
|
|
13868
|
+
const pageContentTop = getPageBodyTop(params.pageSettings);
|
|
13869
|
+
const raw = resolveFloatingTableRect({
|
|
13870
|
+
floating: sourceBlock.style.floating,
|
|
13871
|
+
pageSettings: params.pageSettings,
|
|
13872
|
+
contentLeft: pageContentLeft,
|
|
13873
|
+
contentTop: pageContentTop,
|
|
13874
|
+
contentWidth,
|
|
13875
|
+
anchorTop: pageContentTop + track.height,
|
|
13876
|
+
width: resolveFloatingTableWidth(sourceBlock, contentWidth),
|
|
13877
|
+
height: tableHeight,
|
|
13878
|
+
pageIndex: track.pageIndex
|
|
13879
|
+
});
|
|
13880
|
+
const exclusion = {
|
|
13881
|
+
x: raw.x - pageContentLeft - (sourceBlock.style.floating.distanceLeft ?? 0) * PX_PER_POINT,
|
|
13882
|
+
y: raw.y - pageContentTop - (sourceBlock.style.floating.distanceTop ?? 0) * PX_PER_POINT,
|
|
13883
|
+
width: raw.width + ((sourceBlock.style.floating.distanceLeft ?? 0) + (sourceBlock.style.floating.distanceRight ?? 0)) * PX_PER_POINT,
|
|
13884
|
+
height: raw.height + ((sourceBlock.style.floating.distanceTop ?? 0) + (sourceBlock.style.floating.distanceBottom ?? 0)) * PX_PER_POINT,
|
|
13885
|
+
wrap: "square",
|
|
13886
|
+
sourceRunId: `table:${sourceBlock.id}`
|
|
13887
|
+
};
|
|
13888
|
+
let collisionOffsetY = 0;
|
|
13889
|
+
if (sourceBlock.style.tblOverlap === "never") {
|
|
13890
|
+
for (const existing of track.floatingExclusions) {
|
|
13891
|
+
if (!existing.sourceRunId.startsWith("table:")) continue;
|
|
13892
|
+
const overlaps = exclusion.x < existing.x + existing.width && exclusion.x + exclusion.width > existing.x && exclusion.y + collisionOffsetY < existing.y + existing.height && exclusion.y + collisionOffsetY + exclusion.height > existing.y;
|
|
13893
|
+
if (overlaps) {
|
|
13894
|
+
collisionOffsetY = Math.max(
|
|
13895
|
+
collisionOffsetY,
|
|
13896
|
+
existing.y + existing.height - exclusion.y
|
|
13897
|
+
);
|
|
13898
|
+
}
|
|
13899
|
+
}
|
|
13900
|
+
}
|
|
13901
|
+
const layoutBlock = track.blocks.at(-1);
|
|
13902
|
+
if (layoutBlock && collisionOffsetY > 0) {
|
|
13903
|
+
layoutBlock.floatingTableOffsetY = collisionOffsetY;
|
|
13904
|
+
}
|
|
13905
|
+
track.floatingExclusions.push({
|
|
13906
|
+
...exclusion,
|
|
13907
|
+
y: exclusion.y + collisionOffsetY
|
|
13908
|
+
});
|
|
13909
|
+
return;
|
|
13910
|
+
}
|
|
13465
13911
|
const maxHeightForCurrentPage = track.currentMaxHeight;
|
|
13466
13912
|
const firstRow = sourceBlock.rows[0];
|
|
13467
13913
|
const canSplitSingleRow = canSplitTableRow(firstRow);
|
|
@@ -14705,7 +15151,7 @@ function parseDimensionToPx(value) {
|
|
|
14705
15151
|
const parsed = Number.parseFloat(trimmed);
|
|
14706
15152
|
return Number.isFinite(parsed) ? parsed : null;
|
|
14707
15153
|
}
|
|
14708
|
-
function
|
|
15154
|
+
function resolveCanvasTableWidth(table, contentWidth) {
|
|
14709
15155
|
var _a;
|
|
14710
15156
|
const raw = (_a = table.style) == null ? void 0 : _a.width;
|
|
14711
15157
|
if (typeof raw === "number") return Math.max(24, toPx(raw));
|
|
@@ -14784,9 +15230,9 @@ function resolveVerticalContentOffset(cell, contentHeightPx, contentNaturalHeigh
|
|
|
14784
15230
|
return 0;
|
|
14785
15231
|
}
|
|
14786
15232
|
function buildCanvasTableLayout(options) {
|
|
14787
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
15233
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
14788
15234
|
const {
|
|
14789
|
-
table,
|
|
15235
|
+
table: sourceTable,
|
|
14790
15236
|
state,
|
|
14791
15237
|
pageIndex,
|
|
14792
15238
|
originX,
|
|
@@ -14794,7 +15240,11 @@ function buildCanvasTableLayout(options) {
|
|
|
14794
15240
|
contentWidth,
|
|
14795
15241
|
estimatedHeight
|
|
14796
15242
|
} = options;
|
|
14797
|
-
const
|
|
15243
|
+
const table = {
|
|
15244
|
+
...sourceTable,
|
|
15245
|
+
style: resolveEffectiveTableStyle(sourceTable, state.document.styles)
|
|
15246
|
+
};
|
|
15247
|
+
const tableWidth = resolveCanvasTableWidth(table, contentWidth);
|
|
14798
15248
|
const tableLeft = originX + resolveTableIndentLeft(table);
|
|
14799
15249
|
const tableEntries = buildTableCellLayout(table);
|
|
14800
15250
|
const unsupported = [];
|
|
@@ -14842,15 +15292,62 @@ function buildCanvasTableLayout(options) {
|
|
|
14842
15292
|
(entry) => [`${entry.rowIndex}:${entry.cellIndex}`, entry]
|
|
14843
15293
|
)
|
|
14844
15294
|
);
|
|
15295
|
+
const effectiveRowStyles = table.rows.map((row, rowIndex) => {
|
|
15296
|
+
const entry = tableEntries.find(
|
|
15297
|
+
(candidate) => candidate.rowIndex === rowIndex
|
|
15298
|
+
);
|
|
15299
|
+
return entry ? resolveEffectiveTableCellFormatting({
|
|
15300
|
+
table: sourceTable,
|
|
15301
|
+
rowIndex,
|
|
15302
|
+
cellIndex: entry.cellIndex,
|
|
15303
|
+
visualColumnIndex: entry.visualColumnIndex,
|
|
15304
|
+
columnCount: visualColumnCount,
|
|
15305
|
+
styles: state.document.styles
|
|
15306
|
+
}).rowStyle : row.style;
|
|
15307
|
+
});
|
|
14845
15308
|
const prepared = [];
|
|
14846
15309
|
for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
|
|
14847
15310
|
const row = table.rows[rowIndex];
|
|
14848
|
-
if ((_f =
|
|
15311
|
+
if ((_f = effectiveRowStyles[rowIndex]) == null ? void 0 : _f.hidden) {
|
|
14849
15312
|
continue;
|
|
14850
15313
|
}
|
|
14851
15314
|
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
14852
|
-
const
|
|
15315
|
+
const sourceCell = row.cells[cellIndex];
|
|
14853
15316
|
const entry = cellEntriesByKey.get(`${rowIndex}:${cellIndex}`);
|
|
15317
|
+
if (!entry) {
|
|
15318
|
+
continue;
|
|
15319
|
+
}
|
|
15320
|
+
const formatting = resolveEffectiveTableCellFormatting({
|
|
15321
|
+
table: sourceTable,
|
|
15322
|
+
rowIndex,
|
|
15323
|
+
cellIndex,
|
|
15324
|
+
visualColumnIndex: entry.visualColumnIndex,
|
|
15325
|
+
columnCount: visualColumnCount,
|
|
15326
|
+
styles: state.document.styles
|
|
15327
|
+
});
|
|
15328
|
+
const cell = {
|
|
15329
|
+
...sourceCell,
|
|
15330
|
+
style: formatting.cellStyle,
|
|
15331
|
+
blocks: sourceCell.blocks.map((paragraph) => {
|
|
15332
|
+
var _a2;
|
|
15333
|
+
return {
|
|
15334
|
+
...paragraph,
|
|
15335
|
+
style: {
|
|
15336
|
+
...resolveTableParagraphInheritance(
|
|
15337
|
+
formatting.paragraphStyle,
|
|
15338
|
+
(_a2 = paragraph.style) == null ? void 0 : _a2.styleId,
|
|
15339
|
+
state.document.styles
|
|
15340
|
+
),
|
|
15341
|
+
...paragraph.style
|
|
15342
|
+
},
|
|
15343
|
+
runs: paragraph.runs.map((run) => ({
|
|
15344
|
+
...run,
|
|
15345
|
+
styles: { ...formatting.textStyle, ...run.styles }
|
|
15346
|
+
}))
|
|
15347
|
+
};
|
|
15348
|
+
})
|
|
15349
|
+
};
|
|
15350
|
+
const effectiveRow = formatting.rowStyle;
|
|
14854
15351
|
const rowSpan = Math.max(1, cell.rowSpan ?? 1);
|
|
14855
15352
|
if (rowSpan > 1) {
|
|
14856
15353
|
unsupported.push("unsupported:v-span");
|
|
@@ -14858,9 +15355,6 @@ function buildCanvasTableLayout(options) {
|
|
|
14858
15355
|
if (cell.vMerge === "continue" || cell.vMerge === "restart") {
|
|
14859
15356
|
unsupported.push("unsupported:v-merge");
|
|
14860
15357
|
}
|
|
14861
|
-
if (!entry) {
|
|
14862
|
-
continue;
|
|
14863
|
-
}
|
|
14864
15358
|
const visualCol = entry.visualColumnIndex;
|
|
14865
15359
|
const colSpan = Math.max(1, entry.colSpan);
|
|
14866
15360
|
const width = Math.max(
|
|
@@ -14868,11 +15362,23 @@ function buildCanvasTableLayout(options) {
|
|
|
14868
15362
|
(columnOffsets[visualCol + colSpan] ?? tableWidth) - (columnOffsets[visualCol] ?? 0)
|
|
14869
15363
|
);
|
|
14870
15364
|
const padding = resolveCellPadding(cell);
|
|
15365
|
+
const logicalLeft = ((_g = table.style) == null ? void 0 : _g.bidiVisual) ? (_h = cell.style) == null ? void 0 : _h.borderEnd : (_i = cell.style) == null ? void 0 : _i.borderStart;
|
|
15366
|
+
const logicalRight = ((_j = table.style) == null ? void 0 : _j.bidiVisual) ? (_k = cell.style) == null ? void 0 : _k.borderStart : (_l = cell.style) == null ? void 0 : _l.borderEnd;
|
|
14871
15367
|
const borders = {
|
|
14872
|
-
top: resolveBorder((
|
|
14873
|
-
right: resolveBorder(((
|
|
14874
|
-
bottom: resolveBorder((
|
|
14875
|
-
left: resolveBorder(((
|
|
15368
|
+
top: resolveBorder((_m = cell.style) == null ? void 0 : _m.borderTop),
|
|
15369
|
+
right: resolveBorder(((_n = cell.style) == null ? void 0 : _n.borderRight) ?? logicalRight),
|
|
15370
|
+
bottom: resolveBorder((_o = cell.style) == null ? void 0 : _o.borderBottom),
|
|
15371
|
+
left: resolveBorder(((_p = cell.style) == null ? void 0 : _p.borderLeft) ?? logicalLeft),
|
|
15372
|
+
...((_q = cell.style) == null ? void 0 : _q.borderTopLeftToBottomRight) ? {
|
|
15373
|
+
topLeftToBottomRight: resolveBorder(
|
|
15374
|
+
cell.style.borderTopLeftToBottomRight
|
|
15375
|
+
)
|
|
15376
|
+
} : {},
|
|
15377
|
+
...((_r = cell.style) == null ? void 0 : _r.borderTopRightToBottomLeft) ? {
|
|
15378
|
+
topRightToBottomLeft: resolveBorder(
|
|
15379
|
+
cell.style.borderTopRightToBottomLeft
|
|
15380
|
+
)
|
|
15381
|
+
} : {}
|
|
14876
15382
|
};
|
|
14877
15383
|
const contentWidthPx = Math.max(
|
|
14878
15384
|
MIN_TABLE_CELL_CONTENT_WIDTH_PX,
|
|
@@ -14881,8 +15387,8 @@ function buildCanvasTableLayout(options) {
|
|
|
14881
15387
|
const verticalMode = resolveCellVerticalMode(cell);
|
|
14882
15388
|
const isRotated = verticalMode === "rotate-cw" || verticalMode === "rotate-ccw";
|
|
14883
15389
|
const isStacked = verticalMode === "stack";
|
|
14884
|
-
const explicitRowHeightPx = parseDimensionToPx(
|
|
14885
|
-
const wrapWidth = isRotated || ((
|
|
15390
|
+
const explicitRowHeightPx = parseDimensionToPx(effectiveRow.height);
|
|
15391
|
+
const wrapWidth = isRotated || ((_s = cell.style) == null ? void 0 : _s.noWrap) ? isRotated && explicitRowHeightPx !== null && explicitRowHeightPx > 0 ? Math.max(
|
|
14886
15392
|
MIN_TABLE_CELL_CONTENT_WIDTH_PX,
|
|
14887
15393
|
explicitRowHeightPx - borders.top.width - borders.bottom.width - padding.top - padding.bottom
|
|
14888
15394
|
) : NO_WRAP_WIDTH_PX : contentWidthPx;
|
|
@@ -14906,7 +15412,7 @@ function buildCanvasTableLayout(options) {
|
|
|
14906
15412
|
spacingAfter
|
|
14907
15413
|
});
|
|
14908
15414
|
const hasExplicitRowHeight = explicitRowHeightPx !== null && explicitRowHeightPx > 0;
|
|
14909
|
-
const paragraphStyleSize = ((
|
|
15415
|
+
const paragraphStyleSize = ((_u = (_t = paragraph.runs[0]) == null ? void 0 : _t.styles) == null ? void 0 : _u.fontSize) ?? 14.6667;
|
|
14910
15416
|
contentNaturalHeightPx = Math.max(
|
|
14911
15417
|
contentNaturalHeightPx,
|
|
14912
15418
|
hasExplicitRowHeight ? paragraphStyleSize * 1.25 : stackLength
|
|
@@ -14920,7 +15426,7 @@ function buildCanvasTableLayout(options) {
|
|
|
14920
15426
|
state.document.styles,
|
|
14921
15427
|
wrapWidth,
|
|
14922
15428
|
void 0,
|
|
14923
|
-
(
|
|
15429
|
+
(_v = state.document.settings) == null ? void 0 : _v.defaultTabStop
|
|
14924
15430
|
);
|
|
14925
15431
|
const linesBottom = projected.lines.length > 0 ? Math.max(...projected.lines.map((line) => line.top + line.height)) : 1;
|
|
14926
15432
|
let effectiveSpacingBefore = spacingBefore;
|
|
@@ -14987,17 +15493,18 @@ function buildCanvasTableLayout(options) {
|
|
|
14987
15493
|
}
|
|
14988
15494
|
const rowCount = Math.max(1, table.rows.length);
|
|
14989
15495
|
const explicitRowHeights = table.rows.map((row) => {
|
|
14990
|
-
|
|
14991
|
-
|
|
15496
|
+
const rowIndex = table.rows.indexOf(row);
|
|
15497
|
+
const effective = effectiveRowStyles[rowIndex];
|
|
15498
|
+
if (effective == null ? void 0 : effective.hidden) {
|
|
14992
15499
|
return 0;
|
|
14993
15500
|
}
|
|
14994
|
-
const explicit = parseDimensionToPx(
|
|
15501
|
+
const explicit = parseDimensionToPx(effective == null ? void 0 : effective.height);
|
|
14995
15502
|
return explicit !== null && explicit > 0 ? explicit : null;
|
|
14996
15503
|
});
|
|
14997
15504
|
const fallbackPerRow = estimatedHeight > 0 ? estimatedHeight / rowCount : DEFAULT_TABLE_ROW_HEIGHT;
|
|
14998
15505
|
const rowHeights = [];
|
|
14999
15506
|
for (let rowIndex = 0; rowIndex < table.rows.length; rowIndex += 1) {
|
|
15000
|
-
if ((
|
|
15507
|
+
if ((_w = effectiveRowStyles[rowIndex]) == null ? void 0 : _w.hidden) {
|
|
15001
15508
|
rowHeights[rowIndex] = 0;
|
|
15002
15509
|
continue;
|
|
15003
15510
|
}
|
|
@@ -15081,12 +15588,13 @@ function buildCanvasTableLayout(options) {
|
|
|
15081
15588
|
contentTop,
|
|
15082
15589
|
contentWidth: contentWidthPx,
|
|
15083
15590
|
contentHeight: contentHeightPx,
|
|
15084
|
-
shading: (
|
|
15591
|
+
shading: (_x = cell.style) == null ? void 0 : _x.shading,
|
|
15085
15592
|
anchorPosition,
|
|
15086
15593
|
padding,
|
|
15087
15594
|
borders,
|
|
15088
15595
|
paragraphs,
|
|
15089
|
-
verticalMode: cellEntry.verticalMode
|
|
15596
|
+
verticalMode: cellEntry.verticalMode,
|
|
15597
|
+
revision: ((_y = cell.style) == null ? void 0 : _y.revision) ?? (((_z = cell.style) == null ? void 0 : _z.propertyRevision) ? { ...cell.style.propertyRevision, type: "property" } : void 0)
|
|
15090
15598
|
});
|
|
15091
15599
|
}
|
|
15092
15600
|
return {
|
|
@@ -15443,6 +15951,7 @@ function buildCanvasLayoutSnapshot(options) {
|
|
|
15443
15951
|
const floatingImages = [];
|
|
15444
15952
|
const inlineTextBoxes = [];
|
|
15445
15953
|
const floatingTextBoxes = [];
|
|
15954
|
+
const floatingTables = [];
|
|
15446
15955
|
const unsupportedRegions = [];
|
|
15447
15956
|
for (const page of documentLayout.pages) {
|
|
15448
15957
|
const pageElement = canvasPages.find(
|
|
@@ -15478,7 +15987,7 @@ function buildCanvasLayoutSnapshot(options) {
|
|
|
15478
15987
|
const contentLeft = pageRect.left + page.pageSettings.margins.left + page.pageSettings.margins.gutter;
|
|
15479
15988
|
const contentWidth = getPageContentWidth(page.pageSettings);
|
|
15480
15989
|
const collectParagraphBlock = (zone, blocks, startTop, options2 = {}) => {
|
|
15481
|
-
var _a;
|
|
15990
|
+
var _a, _b, _c;
|
|
15482
15991
|
let cursorY = startTop;
|
|
15483
15992
|
let blockContentLeft = options2.contentLeft ?? contentLeft;
|
|
15484
15993
|
let blockContentWidth = options2.contentWidth ?? contentWidth;
|
|
@@ -15592,15 +16101,45 @@ function buildCanvasLayoutSnapshot(options) {
|
|
|
15592
16101
|
})
|
|
15593
16102
|
);
|
|
15594
16103
|
} else if (block.sourceBlock.type === "table") {
|
|
16104
|
+
const floating = (_b = block.sourceBlock.style) == null ? void 0 : _b.floating;
|
|
16105
|
+
const floatingRect = floating ? resolveFloatingTableRect({
|
|
16106
|
+
floating,
|
|
16107
|
+
pageSettings: page.pageSettings,
|
|
16108
|
+
contentLeft: blockContentLeft - pageRect.left,
|
|
16109
|
+
contentTop: startTop - pageRect.top,
|
|
16110
|
+
contentWidth: blockContentWidth,
|
|
16111
|
+
anchorTop: cursorY - pageRect.top,
|
|
16112
|
+
width: resolveCanvasTableWidth(
|
|
16113
|
+
block.sourceBlock,
|
|
16114
|
+
blockContentWidth
|
|
16115
|
+
),
|
|
16116
|
+
height: block.floatingTableHeight ?? 1,
|
|
16117
|
+
pageIndex: page.index
|
|
16118
|
+
}) : void 0;
|
|
16119
|
+
if (floatingRect) {
|
|
16120
|
+
floatingRect.y += block.floatingTableOffsetY ?? 0;
|
|
16121
|
+
}
|
|
16122
|
+
if (floatingRect) {
|
|
16123
|
+
floatingTables.push({
|
|
16124
|
+
tableId: block.sourceBlock.id,
|
|
16125
|
+
zone,
|
|
16126
|
+
footnoteId: blockFootnoteId,
|
|
16127
|
+
pageIndex: page.index,
|
|
16128
|
+
left: pageRect.left + floatingRect.x,
|
|
16129
|
+
top: pageRect.top + floatingRect.y,
|
|
16130
|
+
width: floatingRect.width,
|
|
16131
|
+
height: floatingRect.height
|
|
16132
|
+
});
|
|
16133
|
+
}
|
|
15595
16134
|
const segmentTable = block.tableSegment ? buildSegmentTable(block.sourceBlock, block.tableSegment) : block.sourceBlock;
|
|
15596
16135
|
const tableLayout = buildCanvasTableLayout({
|
|
15597
16136
|
table: segmentTable,
|
|
15598
16137
|
state,
|
|
15599
16138
|
pageIndex: page.index,
|
|
15600
|
-
originX: blockContentLeft,
|
|
15601
|
-
originY: cursorY,
|
|
16139
|
+
originX: floatingRect ? pageRect.left + floatingRect.x : blockContentLeft,
|
|
16140
|
+
originY: floatingRect ? pageRect.top + floatingRect.y : cursorY,
|
|
15602
16141
|
contentWidth: blockContentWidth,
|
|
15603
|
-
estimatedHeight: block.estimatedHeight
|
|
16142
|
+
estimatedHeight: block.floatingTableHeight ?? block.estimatedHeight
|
|
15604
16143
|
});
|
|
15605
16144
|
for (const reason of tableLayout.unsupported) {
|
|
15606
16145
|
unsupportedRegions.push({
|
|
@@ -15678,7 +16217,8 @@ function buildCanvasLayoutSnapshot(options) {
|
|
|
15678
16217
|
top: cell.top,
|
|
15679
16218
|
width: cell.width,
|
|
15680
16219
|
height: cell.height,
|
|
15681
|
-
anchorPosition: cell.anchorPosition
|
|
16220
|
+
anchorPosition: cell.anchorPosition,
|
|
16221
|
+
revisionId: (_c = cell.revision) == null ? void 0 : _c.id
|
|
15682
16222
|
}
|
|
15683
16223
|
});
|
|
15684
16224
|
inlineImages.push(
|
|
@@ -15801,6 +16341,7 @@ function buildCanvasLayoutSnapshot(options) {
|
|
|
15801
16341
|
floatingImages,
|
|
15802
16342
|
inlineTextBoxes,
|
|
15803
16343
|
floatingTextBoxes,
|
|
16344
|
+
floatingTables,
|
|
15804
16345
|
unsupportedRegions
|
|
15805
16346
|
};
|
|
15806
16347
|
}
|
|
@@ -15856,7 +16397,7 @@ function getCaretRectFromSnapshot(snapshot, position2, paragraphOffset) {
|
|
|
15856
16397
|
);
|
|
15857
16398
|
return rectFromBox(slot.left, slot.top, 1, slot.height || line.height);
|
|
15858
16399
|
}
|
|
15859
|
-
var _tmpl$$N = /* @__PURE__ */ template(`<span class=oasis-outline-title>`), _tmpl$2$x = /* @__PURE__ */ template(`<div class=oasis-outline-list>`), _tmpl$3$l = /* @__PURE__ */ template(`<div class=oasis-outline-panel><div class=oasis-outline-header><button class=oasis-outline-toggle><i>`), _tmpl$4$
|
|
16400
|
+
var _tmpl$$N = /* @__PURE__ */ template(`<span class=oasis-outline-title>`), _tmpl$2$x = /* @__PURE__ */ template(`<div class=oasis-outline-list>`), _tmpl$3$l = /* @__PURE__ */ template(`<div class=oasis-outline-panel><div class=oasis-outline-header><button class=oasis-outline-toggle><i>`), _tmpl$4$g = /* @__PURE__ */ template(`<div class=oasis-outline-empty>`), _tmpl$5$d = /* @__PURE__ */ template(`<div class=oasis-outline-item>`);
|
|
15860
16401
|
function OutlinePanel(props) {
|
|
15861
16402
|
const t = useI18n();
|
|
15862
16403
|
const [collapsed, setCollapsed] = createSignal(props.defaultCollapsed ?? false);
|
|
@@ -15949,7 +16490,7 @@ function OutlinePanel(props) {
|
|
|
15949
16490
|
},
|
|
15950
16491
|
get fallback() {
|
|
15951
16492
|
return (() => {
|
|
15952
|
-
var _el$7 = _tmpl$4$
|
|
16493
|
+
var _el$7 = _tmpl$4$g();
|
|
15953
16494
|
insert(_el$7, () => t("outline.empty"));
|
|
15954
16495
|
return _el$7;
|
|
15955
16496
|
})();
|
|
@@ -16424,7 +16965,7 @@ function Popover(props) {
|
|
|
16424
16965
|
}
|
|
16425
16966
|
})];
|
|
16426
16967
|
}
|
|
16427
|
-
var _tmpl$$J = /* @__PURE__ */ template(`<div>`), _tmpl$2$u = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-dropdown>`), _tmpl$3$k = /* @__PURE__ */ template(`<i>`), _tmpl$4$
|
|
16968
|
+
var _tmpl$$J = /* @__PURE__ */ template(`<div>`), _tmpl$2$u = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-dropdown>`), _tmpl$3$k = /* @__PURE__ */ template(`<i>`), _tmpl$4$f = /* @__PURE__ */ template(`<span class=oasis-editor-tool-button-label>`), _tmpl$5$c = /* @__PURE__ */ template(`<i data-lucide=chevron-down class=oasis-editor-dropdown-chevron>`), _tmpl$6$6 = /* @__PURE__ */ template(`<button type=button class="oasis-editor-tool-button oasis-editor-tool-button-dropdown"aria-haspopup=menu>`);
|
|
16428
16969
|
function Menu(props) {
|
|
16429
16970
|
const [open, setOpen] = createSignal(false);
|
|
16430
16971
|
const ariaLabel = () => props.tooltip || props.label || "";
|
|
@@ -16462,7 +17003,7 @@ function Menu(props) {
|
|
|
16462
17003
|
return props.label;
|
|
16463
17004
|
},
|
|
16464
17005
|
get children() {
|
|
16465
|
-
var _el$5 = _tmpl$4$
|
|
17006
|
+
var _el$5 = _tmpl$4$f();
|
|
16466
17007
|
insert(_el$5, () => props.label);
|
|
16467
17008
|
return _el$5;
|
|
16468
17009
|
}
|
|
@@ -16620,7 +17161,7 @@ function SplitButton(props) {
|
|
|
16620
17161
|
});
|
|
16621
17162
|
}
|
|
16622
17163
|
delegateEvents(["click"]);
|
|
16623
|
-
var _tmpl$$F = /* @__PURE__ */ template(`<i data-lucide=type>`), _tmpl$2$t = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-menu-action role=menuitem><span class=oasis-editor-color-menu-action-swatch></span><span>`), _tmpl$3$j = /* @__PURE__ */ template(`<div class=oasis-editor-color-menu-section><div class=oasis-editor-color-menu-heading></div><div class=oasis-editor-color-theme-grid>`), _tmpl$4$
|
|
17164
|
+
var _tmpl$$F = /* @__PURE__ */ template(`<i data-lucide=type>`), _tmpl$2$t = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-menu-action role=menuitem><span class=oasis-editor-color-menu-action-swatch></span><span>`), _tmpl$3$j = /* @__PURE__ */ template(`<div class=oasis-editor-color-menu-section><div class=oasis-editor-color-menu-heading></div><div class=oasis-editor-color-theme-grid>`), _tmpl$4$e = /* @__PURE__ */ template(`<div class=oasis-editor-color-menu-section><div class=oasis-editor-color-menu-heading></div><div class=oasis-editor-color-standard-grid>`), _tmpl$5$b = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-menu-action role=menuitem><span class="oasis-editor-color-menu-action-swatch oasis-editor-color-menu-more-swatch"></span><span>`), _tmpl$6$5 = /* @__PURE__ */ template(`<input type=color class=oasis-editor-color-custom-input>`), _tmpl$7$2 = /* @__PURE__ */ template(`<span class=oasis-editor-color-split-icon><i></i><span class=oasis-editor-color-split-indicator>`), _tmpl$8$1 = /* @__PURE__ */ template(`<i data-lucide=slash>`), _tmpl$9 = /* @__PURE__ */ template(`<div class=oasis-editor-color-theme-column>`), _tmpl$0 = /* @__PURE__ */ template(`<button type=button class=oasis-editor-color-swatch>`);
|
|
16624
17165
|
const normalizeColor = (value) => (value == null ? void 0 : value.trim().toLowerCase()) ?? "";
|
|
16625
17166
|
function ColorPicker(props) {
|
|
16626
17167
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
@@ -16743,7 +17284,7 @@ function ColorPicker(props) {
|
|
|
16743
17284
|
}));
|
|
16744
17285
|
return _el$5;
|
|
16745
17286
|
})(), (() => {
|
|
16746
|
-
var _el$8 = _tmpl$4$
|
|
17287
|
+
var _el$8 = _tmpl$4$e(), _el$9 = _el$8.firstChild, _el$0 = _el$9.nextSibling;
|
|
16747
17288
|
insert(_el$9, () => props.standardColorsLabel);
|
|
16748
17289
|
insert(_el$0, createComponent(For, {
|
|
16749
17290
|
get each() {
|
|
@@ -16808,7 +17349,7 @@ function ColorPicker(props) {
|
|
|
16808
17349
|
});
|
|
16809
17350
|
}
|
|
16810
17351
|
delegateEvents(["click", "input"]);
|
|
16811
|
-
var _tmpl$$E = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-status>`), _tmpl$2$s = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-grid>`), _tmpl$3$i = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-dropdown>`), _tmpl$4$
|
|
17352
|
+
var _tmpl$$E = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-status>`), _tmpl$2$s = /* @__PURE__ */ template(`<div class=oasis-editor-table-grid-picker-grid>`), _tmpl$3$i = /* @__PURE__ */ template(`<div class=oasis-editor-toolbar-dropdown>`), _tmpl$4$d = /* @__PURE__ */ template(`<button type=button class=oasis-editor-tool-button><i>`), _tmpl$5$a = /* @__PURE__ */ template(`<button type=button class=oasis-editor-table-grid-picker-cell>`);
|
|
16812
17353
|
function GridPicker(props) {
|
|
16813
17354
|
const t = useI18n();
|
|
16814
17355
|
const [isOpen, setIsOpen] = createSignal(false);
|
|
@@ -16895,7 +17436,7 @@ function GridPicker(props) {
|
|
|
16895
17436
|
col: 0
|
|
16896
17437
|
}),
|
|
16897
17438
|
trigger: (api) => (() => {
|
|
16898
|
-
var _el$4 = _tmpl$4$
|
|
17439
|
+
var _el$4 = _tmpl$4$d(), _el$5 = _el$4.firstChild;
|
|
16899
17440
|
_el$4.$$click = () => api.toggle();
|
|
16900
17441
|
use((el) => api.ref(el), _el$4);
|
|
16901
17442
|
createRenderEffect((_p$) => {
|
|
@@ -17021,7 +17562,7 @@ const DEFAULT_PALETTE = {
|
|
|
17021
17562
|
standardColors: STANDARD_COLORS,
|
|
17022
17563
|
allowCustom: true
|
|
17023
17564
|
};
|
|
17024
|
-
var _tmpl$$D = /* @__PURE__ */ template(`<button type=button class=oasis-editor-style-gallery-card role=option><span>`), _tmpl$2$r = /* @__PURE__ */ template(`<div class=oasis-editor-style-gallery-grid>`), _tmpl$3$h = /* @__PURE__ */ template(`<div class=oasis-editor-style-gallery><div class=oasis-editor-style-gallery-ribbon><div class=oasis-editor-style-gallery-strip role=listbox></div><button type=button class=oasis-editor-style-gallery-expand aria-haspopup=listbox><i data-lucide=chevron-down>`), _tmpl$4$
|
|
17565
|
+
var _tmpl$$D = /* @__PURE__ */ template(`<button type=button class=oasis-editor-style-gallery-card role=option><span>`), _tmpl$2$r = /* @__PURE__ */ template(`<div class=oasis-editor-style-gallery-grid>`), _tmpl$3$h = /* @__PURE__ */ template(`<div class=oasis-editor-style-gallery><div class=oasis-editor-style-gallery-ribbon><div class=oasis-editor-style-gallery-strip role=listbox></div><button type=button class=oasis-editor-style-gallery-expand aria-haspopup=listbox><i data-lucide=chevron-down>`), _tmpl$4$c = /* @__PURE__ */ template(`<option>`);
|
|
17025
17566
|
function getQuickStyles(styles) {
|
|
17026
17567
|
const applicable = styles.filter((style2) => style2.type !== "table" && (!style2.semiHidden || style2.unhideWhenUsed && style2.isUsed));
|
|
17027
17568
|
const hasQuickStyles = applicable.some((style2) => style2.qFormat === true);
|
|
@@ -17156,7 +17697,7 @@ function StyleGallery(props) {
|
|
|
17156
17697
|
return styles();
|
|
17157
17698
|
},
|
|
17158
17699
|
children: (style2) => (() => {
|
|
17159
|
-
var _el$8 = _tmpl$4$
|
|
17700
|
+
var _el$8 = _tmpl$4$c();
|
|
17160
17701
|
insert(_el$8, () => style2.name);
|
|
17161
17702
|
createRenderEffect(() => _el$8.value = style2.id);
|
|
17162
17703
|
return _el$8;
|
|
@@ -20037,6 +20578,36 @@ function underlineStyleDashArray(underlineStyle) {
|
|
|
20037
20578
|
return void 0;
|
|
20038
20579
|
}
|
|
20039
20580
|
}
|
|
20581
|
+
function drawEdge(ctx, border, x1, y1, x2, y2) {
|
|
20582
|
+
if (!border || border.type === "none" || border.width <= 0) {
|
|
20583
|
+
return;
|
|
20584
|
+
}
|
|
20585
|
+
ctx.save();
|
|
20586
|
+
ctx.beginPath();
|
|
20587
|
+
ctx.strokeStyle = border.color;
|
|
20588
|
+
ctx.lineWidth = border.width;
|
|
20589
|
+
if (border.type === "dashed") {
|
|
20590
|
+
ctx.setLineDash([5, 3]);
|
|
20591
|
+
} else if (border.type === "dotted") {
|
|
20592
|
+
ctx.setLineDash([1, 3]);
|
|
20593
|
+
} else {
|
|
20594
|
+
ctx.setLineDash([]);
|
|
20595
|
+
}
|
|
20596
|
+
ctx.moveTo(x1, y1);
|
|
20597
|
+
ctx.lineTo(x2, y2);
|
|
20598
|
+
ctx.stroke();
|
|
20599
|
+
ctx.restore();
|
|
20600
|
+
}
|
|
20601
|
+
function drawBorderBox(ctx, left, top, width, height, borders) {
|
|
20602
|
+
const right = left + width;
|
|
20603
|
+
const bottom = top + height;
|
|
20604
|
+
drawEdge(ctx, borders.top, left, top, right, top);
|
|
20605
|
+
drawEdge(ctx, borders.right, right, top, right, bottom);
|
|
20606
|
+
drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
|
|
20607
|
+
drawEdge(ctx, borders.left, left, top, left, bottom);
|
|
20608
|
+
drawEdge(ctx, borders.topLeftToBottomRight, left, top, right, bottom);
|
|
20609
|
+
drawEdge(ctx, borders.topRightToBottomLeft, right, top, left, bottom);
|
|
20610
|
+
}
|
|
20040
20611
|
const canvasTextLogger = createEditorLogger("canvas-text");
|
|
20041
20612
|
const loggedCanvasFontKeys = /* @__PURE__ */ new Set();
|
|
20042
20613
|
const MAX_CANVAS_FONT_LOGS = 40;
|
|
@@ -20293,6 +20864,16 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20293
20864
|
styles.highlight
|
|
20294
20865
|
);
|
|
20295
20866
|
}
|
|
20867
|
+
if (styles.textBorder) {
|
|
20868
|
+
drawFragmentBorder(
|
|
20869
|
+
ctx,
|
|
20870
|
+
line,
|
|
20871
|
+
fragment,
|
|
20872
|
+
originX,
|
|
20873
|
+
originY,
|
|
20874
|
+
styles.textBorder
|
|
20875
|
+
);
|
|
20876
|
+
}
|
|
20296
20877
|
if (fragment.image && !fragment.image.floating) {
|
|
20297
20878
|
const slot = slotByOffset.get(fragment.startOffset);
|
|
20298
20879
|
if (slot) {
|
|
@@ -20367,6 +20948,18 @@ function drawParagraph(ctx, paragraph, lines, state, originX, originY, onUpdate,
|
|
|
20367
20948
|
"doubleStrike"
|
|
20368
20949
|
);
|
|
20369
20950
|
}
|
|
20951
|
+
if (styles.emphasisMark) {
|
|
20952
|
+
drawFragmentEmphasis(
|
|
20953
|
+
ctx,
|
|
20954
|
+
line,
|
|
20955
|
+
fragment,
|
|
20956
|
+
slotByOffset,
|
|
20957
|
+
originX,
|
|
20958
|
+
originY,
|
|
20959
|
+
styles.emphasisMark,
|
|
20960
|
+
styles.color ?? "#000000"
|
|
20961
|
+
);
|
|
20962
|
+
}
|
|
20370
20963
|
ctx.restore();
|
|
20371
20964
|
}
|
|
20372
20965
|
const isLastLine = line.index === lines.length - 1;
|
|
@@ -20446,6 +21039,82 @@ function drawScaledText(ctx, text, x, y, scale) {
|
|
|
20446
21039
|
ctx.fillText(text, 0, 0);
|
|
20447
21040
|
ctx.restore();
|
|
20448
21041
|
}
|
|
21042
|
+
function drawStyledText(ctx, text, x, y, scale, styles) {
|
|
21043
|
+
if (!styles.outline && !styles.shadow && !styles.emboss && !styles.imprint) {
|
|
21044
|
+
drawScaledText(ctx, text, x, y, scale);
|
|
21045
|
+
return;
|
|
21046
|
+
}
|
|
21047
|
+
if (styles.emboss || styles.imprint) {
|
|
21048
|
+
const offset = styles.imprint ? 1 : -1;
|
|
21049
|
+
ctx.save();
|
|
21050
|
+
ctx.shadowColor = "transparent";
|
|
21051
|
+
ctx.fillStyle = "rgba(255,255,255,0.75)";
|
|
21052
|
+
drawScaledText(ctx, text, x + offset, y + offset, scale);
|
|
21053
|
+
ctx.restore();
|
|
21054
|
+
}
|
|
21055
|
+
ctx.save();
|
|
21056
|
+
if (styles.shadow) {
|
|
21057
|
+
ctx.shadowColor = "rgba(0,0,0,0.45)";
|
|
21058
|
+
ctx.shadowOffsetX = 1;
|
|
21059
|
+
ctx.shadowOffsetY = 1;
|
|
21060
|
+
ctx.shadowBlur = 1;
|
|
21061
|
+
}
|
|
21062
|
+
if (styles.outline) {
|
|
21063
|
+
ctx.strokeStyle = ctx.fillStyle;
|
|
21064
|
+
ctx.lineWidth = 0.75;
|
|
21065
|
+
if (scale === 1) {
|
|
21066
|
+
ctx.strokeText(text, x, y);
|
|
21067
|
+
} else {
|
|
21068
|
+
ctx.translate(x, y);
|
|
21069
|
+
ctx.scale(scale, 1);
|
|
21070
|
+
ctx.strokeText(text, 0, 0);
|
|
21071
|
+
}
|
|
21072
|
+
} else {
|
|
21073
|
+
drawScaledText(ctx, text, x, y, scale);
|
|
21074
|
+
}
|
|
21075
|
+
ctx.restore();
|
|
21076
|
+
}
|
|
21077
|
+
function drawFragmentBorder(ctx, line, fragment, originX, originY, border) {
|
|
21078
|
+
if (border.type === "none" || border.width <= 0) return;
|
|
21079
|
+
const bounds = resolveFragmentPaintBounds(line, fragment);
|
|
21080
|
+
if (!bounds) return;
|
|
21081
|
+
const edge = { ...border, width: Math.max(0.5, border.width * PX_PER_POINT) };
|
|
21082
|
+
drawBorderBox(
|
|
21083
|
+
ctx,
|
|
21084
|
+
originX + bounds.left,
|
|
21085
|
+
originY + line.top + 1,
|
|
21086
|
+
Math.max(0, bounds.right - bounds.left),
|
|
21087
|
+
Math.max(2, line.height - 2),
|
|
21088
|
+
{ top: edge, right: edge, bottom: edge, left: edge }
|
|
21089
|
+
);
|
|
21090
|
+
}
|
|
21091
|
+
const EMPHASIS_GLYPH = {
|
|
21092
|
+
dot: "•",
|
|
21093
|
+
comma: "‚",
|
|
21094
|
+
circle: "○",
|
|
21095
|
+
underDot: "•"
|
|
21096
|
+
};
|
|
21097
|
+
function drawFragmentEmphasis(ctx, line, fragment, slotByOffset, originX, originY, mark, color) {
|
|
21098
|
+
if (mark === "none") return;
|
|
21099
|
+
const glyph = EMPHASIS_GLYPH[mark];
|
|
21100
|
+
if (!glyph) return;
|
|
21101
|
+
const below = mark === "underDot";
|
|
21102
|
+
const y = below ? originY + line.top + line.height + 1 : originY + line.top + 2;
|
|
21103
|
+
ctx.save();
|
|
21104
|
+
ctx.fillStyle = color;
|
|
21105
|
+
ctx.textAlign = "center";
|
|
21106
|
+
ctx.textBaseline = below ? "top" : "bottom";
|
|
21107
|
+
ctx.font = `400 ${Math.max(6, line.height * 0.35)}px Calibri`;
|
|
21108
|
+
for (const char of fragment.chars) {
|
|
21109
|
+
if (char.char === "\n" || char.char === " " || char.char === " ") continue;
|
|
21110
|
+
const slot = slotByOffset.get(char.paragraphOffset);
|
|
21111
|
+
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
21112
|
+
if (!slot) continue;
|
|
21113
|
+
const centerX = nextSlot ? (slot.left + nextSlot.left) / 2 : slot.left + line.height * 0.25;
|
|
21114
|
+
ctx.fillText(glyph, originX + centerX, y);
|
|
21115
|
+
}
|
|
21116
|
+
ctx.restore();
|
|
21117
|
+
}
|
|
20449
21118
|
function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, styles, originX, baselineY) {
|
|
20450
21119
|
const scale = styles.characterScale && styles.characterScale > 0 ? styles.characterScale / 100 : 1;
|
|
20451
21120
|
const hasManualCharacterSpacing = styles.characterSpacing !== void 0 && styles.characterSpacing !== null && styles.characterSpacing !== 0;
|
|
@@ -20457,7 +21126,14 @@ function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, s
|
|
|
20457
21126
|
segmentLeft = null;
|
|
20458
21127
|
return;
|
|
20459
21128
|
}
|
|
20460
|
-
|
|
21129
|
+
drawStyledText(
|
|
21130
|
+
ctx,
|
|
21131
|
+
segmentText,
|
|
21132
|
+
originX + segmentLeft,
|
|
21133
|
+
baselineY,
|
|
21134
|
+
scale,
|
|
21135
|
+
styles
|
|
21136
|
+
);
|
|
20461
21137
|
segmentText = "";
|
|
20462
21138
|
segmentLeft = null;
|
|
20463
21139
|
};
|
|
@@ -20489,7 +21165,14 @@ function drawTextFragment(ctx, paragraph, line, fragment, slotByOffset, state, s
|
|
|
20489
21165
|
const renderedChar = getRenderedChar(char.char, styles);
|
|
20490
21166
|
if (hasManualCharacterSpacing) {
|
|
20491
21167
|
flushSegment();
|
|
20492
|
-
|
|
21168
|
+
drawStyledText(
|
|
21169
|
+
ctx,
|
|
21170
|
+
renderedChar,
|
|
21171
|
+
originX + slot.left,
|
|
21172
|
+
baselineY,
|
|
21173
|
+
scale,
|
|
21174
|
+
styles
|
|
21175
|
+
);
|
|
20493
21176
|
continue;
|
|
20494
21177
|
}
|
|
20495
21178
|
if (char.char === " ") {
|
|
@@ -20574,34 +21257,6 @@ function drawWavyLine(ctx, x1, x2, y) {
|
|
|
20574
21257
|
}
|
|
20575
21258
|
ctx.stroke();
|
|
20576
21259
|
}
|
|
20577
|
-
function drawEdge(ctx, border, x1, y1, x2, y2) {
|
|
20578
|
-
if (!border || border.type === "none" || border.width <= 0) {
|
|
20579
|
-
return;
|
|
20580
|
-
}
|
|
20581
|
-
ctx.save();
|
|
20582
|
-
ctx.beginPath();
|
|
20583
|
-
ctx.strokeStyle = border.color;
|
|
20584
|
-
ctx.lineWidth = border.width;
|
|
20585
|
-
if (border.type === "dashed") {
|
|
20586
|
-
ctx.setLineDash([5, 3]);
|
|
20587
|
-
} else if (border.type === "dotted") {
|
|
20588
|
-
ctx.setLineDash([1, 3]);
|
|
20589
|
-
} else {
|
|
20590
|
-
ctx.setLineDash([]);
|
|
20591
|
-
}
|
|
20592
|
-
ctx.moveTo(x1, y1);
|
|
20593
|
-
ctx.lineTo(x2, y2);
|
|
20594
|
-
ctx.stroke();
|
|
20595
|
-
ctx.restore();
|
|
20596
|
-
}
|
|
20597
|
-
function drawBorderBox(ctx, left, top, width, height, borders) {
|
|
20598
|
-
const right = left + width;
|
|
20599
|
-
const bottom = top + height;
|
|
20600
|
-
drawEdge(ctx, borders.top, left, top, right, top);
|
|
20601
|
-
drawEdge(ctx, borders.right, right, top, right, bottom);
|
|
20602
|
-
drawEdge(ctx, borders.bottom, left, bottom, right, bottom);
|
|
20603
|
-
drawEdge(ctx, borders.left, left, top, left, bottom);
|
|
20604
|
-
}
|
|
20605
21260
|
const __vite_import_meta_env__ = { "DEV": false };
|
|
20606
21261
|
function drawVerticalCell(ctx, cell, state, pageIndex, onUpdate, painters) {
|
|
20607
21262
|
const box = {
|
|
@@ -20675,6 +21330,20 @@ function drawTable(ctx, table, tableSegment, state, originX, originY, contentWid
|
|
|
20675
21330
|
cell.height,
|
|
20676
21331
|
cell.borders
|
|
20677
21332
|
);
|
|
21333
|
+
if (cell.revision) {
|
|
21334
|
+
const color = cell.revision.type === "insert" ? "#059669" : cell.revision.type === "delete" ? "#dc2626" : "#d97706";
|
|
21335
|
+
ctx.save();
|
|
21336
|
+
ctx.strokeStyle = color;
|
|
21337
|
+
ctx.lineWidth = 2;
|
|
21338
|
+
ctx.setLineDash([5, 3]);
|
|
21339
|
+
ctx.strokeRect(
|
|
21340
|
+
cell.left + 1,
|
|
21341
|
+
cell.top + 1,
|
|
21342
|
+
cell.width - 2,
|
|
21343
|
+
cell.height - 2
|
|
21344
|
+
);
|
|
21345
|
+
ctx.restore();
|
|
21346
|
+
}
|
|
20678
21347
|
if (cell.verticalMode === "horizontal") {
|
|
20679
21348
|
for (const paragraphLayout of cell.paragraphs) {
|
|
20680
21349
|
drawParagraph(
|
|
@@ -20770,6 +21439,7 @@ function drawParagraphDecorations(ctx, paragraphStyle, lines, originX, contentTo
|
|
|
20770
21439
|
}
|
|
20771
21440
|
}
|
|
20772
21441
|
function renderBlockList(ctx, state, blocks, originX, originY, contentWidth, pageIndex, onUpdate, pageSettings) {
|
|
21442
|
+
var _a;
|
|
20773
21443
|
let cursorY = originY;
|
|
20774
21444
|
for (const block of blocks) {
|
|
20775
21445
|
if (block.sourceBlock.type === "paragraph" && block.layout) {
|
|
@@ -20865,6 +21535,37 @@ function renderBlockList(ctx, state, blocks, originX, originY, contentWidth, pag
|
|
|
20865
21535
|
});
|
|
20866
21536
|
}
|
|
20867
21537
|
} else if (block.sourceBlock.type === "table") {
|
|
21538
|
+
const floating = (_a = block.sourceBlock.style) == null ? void 0 : _a.floating;
|
|
21539
|
+
if (floating && pageSettings) {
|
|
21540
|
+
const width = resolveCanvasTableWidth(block.sourceBlock, contentWidth);
|
|
21541
|
+
const rect = resolveFloatingTableRect({
|
|
21542
|
+
floating,
|
|
21543
|
+
pageSettings,
|
|
21544
|
+
contentLeft: originX,
|
|
21545
|
+
contentTop: originY,
|
|
21546
|
+
contentWidth,
|
|
21547
|
+
anchorTop: cursorY,
|
|
21548
|
+
width,
|
|
21549
|
+
height: block.floatingTableHeight ?? 1,
|
|
21550
|
+
pageIndex
|
|
21551
|
+
});
|
|
21552
|
+
rect.y += block.floatingTableOffsetY ?? 0;
|
|
21553
|
+
drawTable(
|
|
21554
|
+
ctx,
|
|
21555
|
+
block.sourceBlock,
|
|
21556
|
+
void 0,
|
|
21557
|
+
state,
|
|
21558
|
+
rect.x,
|
|
21559
|
+
rect.y,
|
|
21560
|
+
contentWidth,
|
|
21561
|
+
rect.height,
|
|
21562
|
+
pageIndex,
|
|
21563
|
+
onUpdate,
|
|
21564
|
+
canvasBlockPainters
|
|
21565
|
+
);
|
|
21566
|
+
cursorY += Math.max(0, block.estimatedHeight);
|
|
21567
|
+
continue;
|
|
21568
|
+
}
|
|
20868
21569
|
drawTable(
|
|
20869
21570
|
ctx,
|
|
20870
21571
|
block.sourceBlock,
|
|
@@ -21220,7 +21921,7 @@ function createCanvasPageRenderer(options) {
|
|
|
21220
21921
|
}
|
|
21221
21922
|
};
|
|
21222
21923
|
}
|
|
21223
|
-
var _tmpl$$v = /* @__PURE__ */ template(`<div class="oasis-editor-paper-stack oasis-editor-canvas-stack"style=position:relative>`), _tmpl$2$m = /* @__PURE__ */ template(`<div class=oasis-editor-canvas-page-slot style=position:relative>`), _tmpl$3$f = /* @__PURE__ */ template(`<div class=oasis-editor-paper data-renderer=canvas data-testid=editor-page style=position:relative;z-index:1><canvas>`);
|
|
21924
|
+
var _tmpl$$v = /* @__PURE__ */ template(`<div class="oasis-editor-paper-stack oasis-editor-canvas-stack"style=position:relative>`), _tmpl$2$m = /* @__PURE__ */ template(`<div class=oasis-editor-canvas-page-slot style=position:relative>`), _tmpl$3$f = /* @__PURE__ */ template(`<div class=oasis-editor-paper data-renderer=canvas data-testid=editor-page style=position:relative;z-index:1><canvas>`), _tmpl$4$b = /* @__PURE__ */ template(`<div class=oasis-editor-table-revision-hit style=position:absolute;pointer-events:auto;background:transparent>`);
|
|
21224
21925
|
const canvasTextMeasurer = {
|
|
21225
21926
|
composeMeasuredParagraphLines: (options) => domTextMeasurer.composeMeasuredParagraphLines(options),
|
|
21226
21927
|
resolveRenderedLineHeightPx: (styles, lineHeightMultiple) => domTextMeasurer.resolveRenderedLineHeightPx(styles, lineHeightMultiple)
|
|
@@ -21332,6 +22033,12 @@ function CanvasEditorSurface(props) {
|
|
|
21332
22033
|
},
|
|
21333
22034
|
get onSurfaceDblClick() {
|
|
21334
22035
|
return props.onSurfaceDblClick;
|
|
22036
|
+
},
|
|
22037
|
+
get onRevisionMouseEnter() {
|
|
22038
|
+
return props.onRevisionMouseEnter;
|
|
22039
|
+
},
|
|
22040
|
+
get onRevisionMouseLeave() {
|
|
22041
|
+
return props.onRevisionMouseLeave;
|
|
21335
22042
|
}
|
|
21336
22043
|
}), null);
|
|
21337
22044
|
return _el$2;
|
|
@@ -21348,6 +22055,57 @@ function CanvasPage(props) {
|
|
|
21348
22055
|
getPage: () => props.page,
|
|
21349
22056
|
getState: () => props.state
|
|
21350
22057
|
});
|
|
22058
|
+
const revisionCells = createMemo(() => {
|
|
22059
|
+
var _a;
|
|
22060
|
+
const result = [];
|
|
22061
|
+
let cursorY = props.page.bodyTop ?? props.page.pageSettings.margins.top;
|
|
22062
|
+
const columns = getPageColumnRects(props.page.pageSettings);
|
|
22063
|
+
for (const block of props.page.blocks) {
|
|
22064
|
+
if (block.sourceBlock.type === "table") {
|
|
22065
|
+
const column = columns[block.columnIndex ?? 0] ?? columns[0];
|
|
22066
|
+
const sourceTable = block.tableSegment ? buildSegmentTable(block.sourceBlock, block.tableSegment) : block.sourceBlock;
|
|
22067
|
+
let originX = column.left;
|
|
22068
|
+
let originY = cursorY;
|
|
22069
|
+
const floating = (_a = sourceTable.style) == null ? void 0 : _a.floating;
|
|
22070
|
+
if (floating) {
|
|
22071
|
+
const rect = resolveFloatingTableRect({
|
|
22072
|
+
floating,
|
|
22073
|
+
pageSettings: props.page.pageSettings,
|
|
22074
|
+
contentLeft: column.left,
|
|
22075
|
+
contentTop: props.page.bodyTop ?? props.page.pageSettings.margins.top,
|
|
22076
|
+
contentWidth: column.width,
|
|
22077
|
+
anchorTop: cursorY,
|
|
22078
|
+
width: resolveCanvasTableWidth(sourceTable, column.width),
|
|
22079
|
+
height: block.floatingTableHeight ?? 1,
|
|
22080
|
+
pageIndex: props.page.index
|
|
22081
|
+
});
|
|
22082
|
+
originX = rect.x;
|
|
22083
|
+
originY = rect.y + (block.floatingTableOffsetY ?? 0);
|
|
22084
|
+
}
|
|
22085
|
+
const layout = buildCanvasTableLayout({
|
|
22086
|
+
table: sourceTable,
|
|
22087
|
+
state: props.state,
|
|
22088
|
+
pageIndex: props.page.index,
|
|
22089
|
+
originX,
|
|
22090
|
+
originY,
|
|
22091
|
+
contentWidth: column.width,
|
|
22092
|
+
estimatedHeight: block.floatingTableHeight ?? block.estimatedHeight
|
|
22093
|
+
});
|
|
22094
|
+
for (const cell of layout.cells) {
|
|
22095
|
+
if (!cell.revision) continue;
|
|
22096
|
+
result.push({
|
|
22097
|
+
id: cell.revision.id,
|
|
22098
|
+
left: cell.left,
|
|
22099
|
+
top: cell.top,
|
|
22100
|
+
width: cell.width,
|
|
22101
|
+
height: cell.height
|
|
22102
|
+
});
|
|
22103
|
+
}
|
|
22104
|
+
}
|
|
22105
|
+
cursorY += Math.max(0, block.estimatedHeight);
|
|
22106
|
+
}
|
|
22107
|
+
return result;
|
|
22108
|
+
});
|
|
21351
22109
|
createEffect(() => {
|
|
21352
22110
|
props.page;
|
|
21353
22111
|
props.state.document;
|
|
@@ -21381,6 +22139,36 @@ function CanvasPage(props) {
|
|
|
21381
22139
|
addEventListener(_el$3, "mousedown", props.onSurfaceMouseDown, true);
|
|
21382
22140
|
var _ref$ = canvasRef;
|
|
21383
22141
|
typeof _ref$ === "function" ? use(_ref$, _el$4) : canvasRef = _el$4;
|
|
22142
|
+
insert(_el$3, createComponent(For, {
|
|
22143
|
+
get each() {
|
|
22144
|
+
return revisionCells();
|
|
22145
|
+
},
|
|
22146
|
+
children: (revision) => (() => {
|
|
22147
|
+
var _el$5 = _tmpl$4$b();
|
|
22148
|
+
addEventListener(_el$5, "mousedown", props.onSurfaceMouseDown, true);
|
|
22149
|
+
_el$5.addEventListener("mouseleave", (event) => {
|
|
22150
|
+
var _a;
|
|
22151
|
+
return (_a = props.onRevisionMouseLeave) == null ? void 0 : _a.call(props, revision.id, event);
|
|
22152
|
+
});
|
|
22153
|
+
_el$5.addEventListener("mouseenter", (event) => props.onRevisionMouseEnter(revision.id, event));
|
|
22154
|
+
createRenderEffect((_p$) => {
|
|
22155
|
+
var _v$4 = revision.id, _v$5 = `${revision.left}px`, _v$6 = `${revision.top}px`, _v$7 = `${revision.width}px`, _v$8 = `${revision.height}px`;
|
|
22156
|
+
_v$4 !== _p$.e && setAttribute(_el$5, "data-revision-id", _p$.e = _v$4);
|
|
22157
|
+
_v$5 !== _p$.t && setStyleProperty(_el$5, "left", _p$.t = _v$5);
|
|
22158
|
+
_v$6 !== _p$.a && setStyleProperty(_el$5, "top", _p$.a = _v$6);
|
|
22159
|
+
_v$7 !== _p$.o && setStyleProperty(_el$5, "width", _p$.o = _v$7);
|
|
22160
|
+
_v$8 !== _p$.i && setStyleProperty(_el$5, "height", _p$.i = _v$8);
|
|
22161
|
+
return _p$;
|
|
22162
|
+
}, {
|
|
22163
|
+
e: void 0,
|
|
22164
|
+
t: void 0,
|
|
22165
|
+
a: void 0,
|
|
22166
|
+
o: void 0,
|
|
22167
|
+
i: void 0
|
|
22168
|
+
});
|
|
22169
|
+
return _el$5;
|
|
22170
|
+
})()
|
|
22171
|
+
}), null);
|
|
21384
22172
|
createRenderEffect((_p$) => {
|
|
21385
22173
|
var _v$ = props.index, _v$2 = `${props.page.pageSettings.width}px`, _v$3 = `${props.page.pageSettings.height}px`;
|
|
21386
22174
|
_v$ !== _p$.e && setAttribute(_el$3, "data-page-index", _p$.e = _v$);
|
|
@@ -22075,7 +22863,11 @@ function RevisionOverlay(props) {
|
|
|
22075
22863
|
return "Data desconhecida";
|
|
22076
22864
|
}
|
|
22077
22865
|
};
|
|
22078
|
-
const label = () =>
|
|
22866
|
+
const label = () => {
|
|
22867
|
+
if (props.box.type === "insert") return "Inserido por";
|
|
22868
|
+
if (props.box.type === "delete") return "Excluído por";
|
|
22869
|
+
return "Alterado por";
|
|
22870
|
+
};
|
|
22079
22871
|
return (() => {
|
|
22080
22872
|
var _el$ = _tmpl$$r(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild;
|
|
22081
22873
|
_el$4.nextSibling;
|
|
@@ -31868,330 +32660,6 @@ function parseParagraphList(paragraphProperties, numberingMaps) {
|
|
|
31868
32660
|
indent: effective.indent
|
|
31869
32661
|
};
|
|
31870
32662
|
}
|
|
31871
|
-
function stripUndefined(value) {
|
|
31872
|
-
const entries2 = Object.entries(value).filter(([, v]) => v !== void 0);
|
|
31873
|
-
return entries2.length > 0 ? Object.fromEntries(entries2) : void 0;
|
|
31874
|
-
}
|
|
31875
|
-
function emptyOrUndefined(obj) {
|
|
31876
|
-
return Object.keys(obj).length > 0 ? obj : void 0;
|
|
31877
|
-
}
|
|
31878
|
-
function mergeStyles(base, local) {
|
|
31879
|
-
return emptyOrUndefined({ ...base ?? {}, ...local ?? {} });
|
|
31880
|
-
}
|
|
31881
|
-
function parseShdFill(element) {
|
|
31882
|
-
return normalizeImportedHexColor(getAttributeValue(element, "fill"));
|
|
31883
|
-
}
|
|
31884
|
-
function normalizeImportedRunStyle(style2, paragraphStyleId) {
|
|
31885
|
-
if (!style2) {
|
|
31886
|
-
return void 0;
|
|
31887
|
-
}
|
|
31888
|
-
const effective = resolveEffectiveTextStyleForParagraph(
|
|
31889
|
-
style2,
|
|
31890
|
-
paragraphStyleId,
|
|
31891
|
-
DEFAULT_EDITOR_STYLES
|
|
31892
|
-
);
|
|
31893
|
-
const defaultEffective = resolveEffectiveTextStyleForParagraph(
|
|
31894
|
-
void 0,
|
|
31895
|
-
paragraphStyleId,
|
|
31896
|
-
DEFAULT_EDITOR_STYLES
|
|
31897
|
-
);
|
|
31898
|
-
const dd = (e, d) => e !== d ? e : void 0;
|
|
31899
|
-
const hd = (raw, e, d) => raw !== void 0 ? raw : dd(e, d);
|
|
31900
|
-
return stripUndefined({
|
|
31901
|
-
styleId: style2.styleId,
|
|
31902
|
-
bold: hd(style2.bold, effective.bold, defaultEffective.bold),
|
|
31903
|
-
italic: hd(style2.italic, effective.italic, defaultEffective.italic),
|
|
31904
|
-
underline: dd(effective.underline, defaultEffective.underline),
|
|
31905
|
-
underlineStyle: dd(
|
|
31906
|
-
effective.underlineStyle,
|
|
31907
|
-
defaultEffective.underlineStyle
|
|
31908
|
-
),
|
|
31909
|
-
underlineColor: dd(
|
|
31910
|
-
effective.underlineColor,
|
|
31911
|
-
defaultEffective.underlineColor
|
|
31912
|
-
),
|
|
31913
|
-
strike: hd(style2.strike, effective.strike, defaultEffective.strike),
|
|
31914
|
-
doubleStrike: hd(
|
|
31915
|
-
style2.doubleStrike,
|
|
31916
|
-
effective.doubleStrike,
|
|
31917
|
-
defaultEffective.doubleStrike
|
|
31918
|
-
),
|
|
31919
|
-
superscript: dd(effective.superscript, defaultEffective.superscript),
|
|
31920
|
-
subscript: dd(effective.subscript, defaultEffective.subscript),
|
|
31921
|
-
smallCaps: hd(
|
|
31922
|
-
style2.smallCaps,
|
|
31923
|
-
effective.smallCaps,
|
|
31924
|
-
defaultEffective.smallCaps
|
|
31925
|
-
),
|
|
31926
|
-
allCaps: hd(style2.allCaps, effective.allCaps, defaultEffective.allCaps),
|
|
31927
|
-
hidden: hd(style2.hidden, effective.hidden, defaultEffective.hidden),
|
|
31928
|
-
noProof: hd(style2.noProof, effective.noProof, defaultEffective.noProof),
|
|
31929
|
-
webHidden: hd(
|
|
31930
|
-
style2.webHidden,
|
|
31931
|
-
effective.webHidden,
|
|
31932
|
-
defaultEffective.webHidden
|
|
31933
|
-
),
|
|
31934
|
-
specVanish: hd(
|
|
31935
|
-
style2.specVanish,
|
|
31936
|
-
effective.specVanish,
|
|
31937
|
-
defaultEffective.specVanish
|
|
31938
|
-
),
|
|
31939
|
-
textEffect: dd(effective.textEffect, defaultEffective.textEffect),
|
|
31940
|
-
characterScale: dd(
|
|
31941
|
-
effective.characterScale,
|
|
31942
|
-
defaultEffective.characterScale
|
|
31943
|
-
),
|
|
31944
|
-
characterSpacing: dd(
|
|
31945
|
-
effective.characterSpacing,
|
|
31946
|
-
defaultEffective.characterSpacing
|
|
31947
|
-
),
|
|
31948
|
-
baselineShift: dd(effective.baselineShift, defaultEffective.baselineShift),
|
|
31949
|
-
kerningThreshold: dd(
|
|
31950
|
-
effective.kerningThreshold,
|
|
31951
|
-
defaultEffective.kerningThreshold
|
|
31952
|
-
),
|
|
31953
|
-
ligatures: dd(effective.ligatures, defaultEffective.ligatures),
|
|
31954
|
-
numberSpacing: dd(effective.numberSpacing, defaultEffective.numberSpacing),
|
|
31955
|
-
numberForm: dd(effective.numberForm, defaultEffective.numberForm),
|
|
31956
|
-
stylisticSet: dd(effective.stylisticSet, defaultEffective.stylisticSet),
|
|
31957
|
-
contextualAlternates: dd(
|
|
31958
|
-
effective.contextualAlternates,
|
|
31959
|
-
defaultEffective.contextualAlternates
|
|
31960
|
-
),
|
|
31961
|
-
fontFamily: hd(
|
|
31962
|
-
style2.fontFamily,
|
|
31963
|
-
effective.fontFamily,
|
|
31964
|
-
defaultEffective.fontFamily
|
|
31965
|
-
),
|
|
31966
|
-
fontSize: hd(style2.fontSize, effective.fontSize, defaultEffective.fontSize),
|
|
31967
|
-
color: dd(effective.color, defaultEffective.color),
|
|
31968
|
-
highlight: dd(effective.highlight, defaultEffective.highlight),
|
|
31969
|
-
shading: dd(effective.shading, defaultEffective.shading),
|
|
31970
|
-
language: dd(effective.language, defaultEffective.language),
|
|
31971
|
-
link: dd(effective.link, defaultEffective.link)
|
|
31972
|
-
});
|
|
31973
|
-
}
|
|
31974
|
-
function parseRunStyle(runProperties, theme) {
|
|
31975
|
-
if (!runProperties) {
|
|
31976
|
-
return void 0;
|
|
31977
|
-
}
|
|
31978
|
-
const styles = {};
|
|
31979
|
-
const styleId = parseStyleIdProperty(runProperties, "rStyle");
|
|
31980
|
-
if (styleId) {
|
|
31981
|
-
styles.styleId = styleId;
|
|
31982
|
-
}
|
|
31983
|
-
const bold = parseOnOffProperty(runProperties, "b");
|
|
31984
|
-
const boldCs = parseOnOffProperty(runProperties, "bCs");
|
|
31985
|
-
if (bold !== void 0 || boldCs !== void 0) {
|
|
31986
|
-
styles.bold = bold === true || boldCs === true;
|
|
31987
|
-
}
|
|
31988
|
-
const italic = parseOnOffProperty(runProperties, "i");
|
|
31989
|
-
const italicCs = parseOnOffProperty(runProperties, "iCs");
|
|
31990
|
-
if (italic !== void 0 || italicCs !== void 0) {
|
|
31991
|
-
styles.italic = italic === true || italicCs === true;
|
|
31992
|
-
}
|
|
31993
|
-
const strike = parseOnOffProperty(runProperties, "strike");
|
|
31994
|
-
if (strike !== void 0) {
|
|
31995
|
-
styles.strike = strike;
|
|
31996
|
-
}
|
|
31997
|
-
const doubleStrike = parseOnOffProperty(runProperties, "dstrike");
|
|
31998
|
-
if (doubleStrike !== void 0) {
|
|
31999
|
-
styles.doubleStrike = doubleStrike;
|
|
32000
|
-
}
|
|
32001
|
-
const smallCaps = parseOnOffProperty(runProperties, "smallCaps");
|
|
32002
|
-
if (smallCaps !== void 0) {
|
|
32003
|
-
styles.smallCaps = smallCaps;
|
|
32004
|
-
}
|
|
32005
|
-
const allCaps = parseOnOffProperty(runProperties, "caps");
|
|
32006
|
-
if (allCaps !== void 0) {
|
|
32007
|
-
styles.allCaps = allCaps;
|
|
32008
|
-
}
|
|
32009
|
-
const hidden = parseOnOffProperty(runProperties, "vanish");
|
|
32010
|
-
if (hidden !== void 0) {
|
|
32011
|
-
styles.hidden = hidden;
|
|
32012
|
-
}
|
|
32013
|
-
const noProof = parseOnOffProperty(runProperties, "noProof");
|
|
32014
|
-
if (noProof !== void 0) {
|
|
32015
|
-
styles.noProof = noProof;
|
|
32016
|
-
}
|
|
32017
|
-
const webHidden = parseOnOffProperty(runProperties, "webHidden");
|
|
32018
|
-
if (webHidden !== void 0) {
|
|
32019
|
-
styles.webHidden = webHidden;
|
|
32020
|
-
}
|
|
32021
|
-
const specVanish = parseOnOffProperty(runProperties, "specVanish");
|
|
32022
|
-
if (specVanish !== void 0) {
|
|
32023
|
-
styles.specVanish = specVanish;
|
|
32024
|
-
}
|
|
32025
|
-
const textEffect = getAttributeValue(
|
|
32026
|
-
getFirstChildByTagNameNS(runProperties, WORD_NS, "effect"),
|
|
32027
|
-
"val"
|
|
32028
|
-
);
|
|
32029
|
-
if (textEffect) {
|
|
32030
|
-
styles.textEffect = textEffect;
|
|
32031
|
-
}
|
|
32032
|
-
const characterScale = getAttributeValue(
|
|
32033
|
-
getFirstChildByTagNameNS(runProperties, WORD_NS, "w"),
|
|
32034
|
-
"val"
|
|
32035
|
-
);
|
|
32036
|
-
if (characterScale) {
|
|
32037
|
-
const parsed = Number(characterScale);
|
|
32038
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
32039
|
-
styles.characterScale = parsed;
|
|
32040
|
-
}
|
|
32041
|
-
}
|
|
32042
|
-
const characterSpacing = getAttributeValue(
|
|
32043
|
-
getFirstChildByTagNameNS(runProperties, WORD_NS, "spacing"),
|
|
32044
|
-
"val"
|
|
32045
|
-
);
|
|
32046
|
-
if (characterSpacing) {
|
|
32047
|
-
const parsed = twipsToPoints(characterSpacing);
|
|
32048
|
-
if (parsed !== void 0) {
|
|
32049
|
-
styles.characterSpacing = parsed;
|
|
32050
|
-
}
|
|
32051
|
-
}
|
|
32052
|
-
const baselineShift = getAttributeValue(
|
|
32053
|
-
getFirstChildByTagNameNS(runProperties, WORD_NS, "position"),
|
|
32054
|
-
"val"
|
|
32055
|
-
);
|
|
32056
|
-
if (baselineShift) {
|
|
32057
|
-
const parsed = Number(baselineShift);
|
|
32058
|
-
if (Number.isFinite(parsed)) {
|
|
32059
|
-
styles.baselineShift = parsed / 2;
|
|
32060
|
-
}
|
|
32061
|
-
}
|
|
32062
|
-
const kerningThreshold = getAttributeValue(
|
|
32063
|
-
getFirstChildByTagNameNS(runProperties, WORD_NS, "kern"),
|
|
32064
|
-
"val"
|
|
32065
|
-
);
|
|
32066
|
-
if (kerningThreshold) {
|
|
32067
|
-
const parsed = Number(kerningThreshold);
|
|
32068
|
-
if (Number.isFinite(parsed) && parsed >= 0) {
|
|
32069
|
-
styles.kerningThreshold = parsed / 2;
|
|
32070
|
-
}
|
|
32071
|
-
}
|
|
32072
|
-
const ligatures = getAttributeValue(
|
|
32073
|
-
getFirstChildByTagNameNS(runProperties, WORD14_NS, "ligatures"),
|
|
32074
|
-
"val"
|
|
32075
|
-
);
|
|
32076
|
-
if (ligatures === "none" || ligatures === "standard" || ligatures === "contextual" || ligatures === "historical" || ligatures === "standardContextual") {
|
|
32077
|
-
styles.ligatures = ligatures;
|
|
32078
|
-
}
|
|
32079
|
-
const numberSpacing = getAttributeValue(
|
|
32080
|
-
getFirstChildByTagNameNS(runProperties, WORD14_NS, "numSpacing"),
|
|
32081
|
-
"val"
|
|
32082
|
-
);
|
|
32083
|
-
if (numberSpacing === "proportional" || numberSpacing === "tabular") {
|
|
32084
|
-
styles.numberSpacing = numberSpacing;
|
|
32085
|
-
}
|
|
32086
|
-
const numberForm = getAttributeValue(
|
|
32087
|
-
getFirstChildByTagNameNS(runProperties, WORD14_NS, "numForm"),
|
|
32088
|
-
"val"
|
|
32089
|
-
);
|
|
32090
|
-
if (numberForm === "lining" || numberForm === "oldStyle") {
|
|
32091
|
-
styles.numberForm = numberForm;
|
|
32092
|
-
}
|
|
32093
|
-
const stylisticSet = getAttributeValue(
|
|
32094
|
-
getFirstChildByTagNameNS(runProperties, WORD14_NS, "stylisticSets"),
|
|
32095
|
-
"val"
|
|
32096
|
-
);
|
|
32097
|
-
if (stylisticSet) {
|
|
32098
|
-
const parsed = /^[0-9a-fA-F]+$/.test(stylisticSet) && stylisticSet.length > 2 ? Number.parseInt(stylisticSet, 16) : Number(stylisticSet);
|
|
32099
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
32100
|
-
for (let set = 1; set <= 20; set += 1) {
|
|
32101
|
-
if ((parsed & 1 << set - 1) !== 0) {
|
|
32102
|
-
styles.stylisticSet = set;
|
|
32103
|
-
break;
|
|
32104
|
-
}
|
|
32105
|
-
}
|
|
32106
|
-
}
|
|
32107
|
-
}
|
|
32108
|
-
const contextualAlternates = getAttributeValue(
|
|
32109
|
-
getFirstChildByTagNameNS(runProperties, WORD14_NS, "cntxtAlts"),
|
|
32110
|
-
"val"
|
|
32111
|
-
);
|
|
32112
|
-
if (contextualAlternates === null) {
|
|
32113
|
-
if (getFirstChildByTagNameNS(runProperties, WORD14_NS, "cntxtAlts")) {
|
|
32114
|
-
styles.contextualAlternates = true;
|
|
32115
|
-
}
|
|
32116
|
-
} else if (isWordTrue(contextualAlternates)) {
|
|
32117
|
-
styles.contextualAlternates = true;
|
|
32118
|
-
}
|
|
32119
|
-
const underline = getFirstChildByTagNameNS(runProperties, WORD_NS, "u");
|
|
32120
|
-
const underlineValue = getAttributeValue(underline, "val");
|
|
32121
|
-
if (underline && underlineValue !== "none") {
|
|
32122
|
-
styles.underline = true;
|
|
32123
|
-
if (underlineValue && underlineValue !== "single") {
|
|
32124
|
-
styles.underlineStyle = underlineValue;
|
|
32125
|
-
}
|
|
32126
|
-
const underlineColor = getAttributeValue(underline, "color");
|
|
32127
|
-
if (underlineColor && underlineColor !== "auto") {
|
|
32128
|
-
styles.underlineColor = normalizeImportedHexColor(underlineColor);
|
|
32129
|
-
}
|
|
32130
|
-
}
|
|
32131
|
-
const vertAlign = getFirstChildByTagNameNS(
|
|
32132
|
-
runProperties,
|
|
32133
|
-
WORD_NS,
|
|
32134
|
-
"vertAlign"
|
|
32135
|
-
);
|
|
32136
|
-
const vertAlignValue = getAttributeValue(vertAlign, "val");
|
|
32137
|
-
if (vertAlignValue === "superscript") {
|
|
32138
|
-
styles.superscript = true;
|
|
32139
|
-
}
|
|
32140
|
-
if (vertAlignValue === "subscript") {
|
|
32141
|
-
styles.subscript = true;
|
|
32142
|
-
}
|
|
32143
|
-
const fonts = getFirstChildByTagNameNS(runProperties, WORD_NS, "rFonts");
|
|
32144
|
-
const fontFamily = getAttributeValue(fonts, "ascii") ?? getAttributeValue(fonts, "hAnsi") ?? getAttributeValue(fonts, "cs") ?? getAttributeValue(fonts, "eastAsia") ?? resolveThemeFont(fonts, theme.fonts);
|
|
32145
|
-
if (fontFamily) {
|
|
32146
|
-
styles.fontFamily = normalizeImportedFontFamily(fontFamily);
|
|
32147
|
-
}
|
|
32148
|
-
const size = getFirstChildByTagNameNS(runProperties, WORD_NS, "sz") ?? getFirstChildByTagNameNS(runProperties, WORD_NS, "szCs");
|
|
32149
|
-
const sizeValue = getAttributeValue(size, "val");
|
|
32150
|
-
if (sizeValue) {
|
|
32151
|
-
const parsed = halfPointsToPx(sizeValue);
|
|
32152
|
-
if (parsed !== null) {
|
|
32153
|
-
styles.fontSize = parsed;
|
|
32154
|
-
}
|
|
32155
|
-
}
|
|
32156
|
-
const color = getFirstChildByTagNameNS(runProperties, WORD_NS, "color");
|
|
32157
|
-
const colorValue = getAttributeValue(color, "val");
|
|
32158
|
-
if (colorValue && colorValue !== "auto") {
|
|
32159
|
-
styles.color = normalizeImportedHexColor(colorValue);
|
|
32160
|
-
} else if (colorValue !== "auto") {
|
|
32161
|
-
const themeColor = resolveThemeColor(color, theme.colors);
|
|
32162
|
-
if (themeColor) {
|
|
32163
|
-
styles.color = themeColor;
|
|
32164
|
-
}
|
|
32165
|
-
}
|
|
32166
|
-
const highlight = getFirstChildByTagNameNS(
|
|
32167
|
-
runProperties,
|
|
32168
|
-
WORD_NS,
|
|
32169
|
-
"highlight"
|
|
32170
|
-
);
|
|
32171
|
-
const highlightValue = getAttributeValue(highlight, "val");
|
|
32172
|
-
if (highlightValue && highlightValue !== "none") {
|
|
32173
|
-
styles.highlight = highlightValue;
|
|
32174
|
-
}
|
|
32175
|
-
const shd = getFirstChildByTagNameNS(runProperties, WORD_NS, "shd");
|
|
32176
|
-
const shdFill = parseShdFill(shd);
|
|
32177
|
-
if (shdFill) {
|
|
32178
|
-
styles.shading = shdFill;
|
|
32179
|
-
}
|
|
32180
|
-
const language = getFirstChildByTagNameNS(runProperties, WORD_NS, "lang");
|
|
32181
|
-
if (language) {
|
|
32182
|
-
const value = getAttributeValue(language, "val");
|
|
32183
|
-
const eastAsia = getAttributeValue(language, "eastAsia");
|
|
32184
|
-
const bidi = getAttributeValue(language, "bidi");
|
|
32185
|
-
const parsedLanguage = {};
|
|
32186
|
-
if (value) parsedLanguage.value = value;
|
|
32187
|
-
if (eastAsia) parsedLanguage.eastAsia = eastAsia;
|
|
32188
|
-
if (bidi) parsedLanguage.bidi = bidi;
|
|
32189
|
-
if (Object.keys(parsedLanguage).length > 0) {
|
|
32190
|
-
styles.language = parsedLanguage;
|
|
32191
|
-
}
|
|
32192
|
-
}
|
|
32193
|
-
return emptyOrUndefined(styles);
|
|
32194
|
-
}
|
|
32195
32663
|
function parseDocxBorder(borderNode) {
|
|
32196
32664
|
if (!borderNode) {
|
|
32197
32665
|
return void 0;
|
|
@@ -32252,6 +32720,399 @@ function parseDocxTableBorders(container) {
|
|
|
32252
32720
|
)
|
|
32253
32721
|
};
|
|
32254
32722
|
}
|
|
32723
|
+
function stripUndefined(value) {
|
|
32724
|
+
const entries2 = Object.entries(value).filter(([, v]) => v !== void 0);
|
|
32725
|
+
return entries2.length > 0 ? Object.fromEntries(entries2) : void 0;
|
|
32726
|
+
}
|
|
32727
|
+
function emptyOrUndefined(obj) {
|
|
32728
|
+
return Object.keys(obj).length > 0 ? obj : void 0;
|
|
32729
|
+
}
|
|
32730
|
+
function mergeStyles(base, local) {
|
|
32731
|
+
return emptyOrUndefined({ ...base ?? {}, ...local ?? {} });
|
|
32732
|
+
}
|
|
32733
|
+
function parseShdFill(element) {
|
|
32734
|
+
return normalizeImportedHexColor(getAttributeValue(element, "fill"));
|
|
32735
|
+
}
|
|
32736
|
+
function normalizeImportedRunStyle(style2, paragraphStyleId) {
|
|
32737
|
+
if (!style2) {
|
|
32738
|
+
return void 0;
|
|
32739
|
+
}
|
|
32740
|
+
const effective = resolveEffectiveTextStyleForParagraph(
|
|
32741
|
+
style2,
|
|
32742
|
+
paragraphStyleId,
|
|
32743
|
+
DEFAULT_EDITOR_STYLES
|
|
32744
|
+
);
|
|
32745
|
+
const defaultEffective = resolveEffectiveTextStyleForParagraph(
|
|
32746
|
+
void 0,
|
|
32747
|
+
paragraphStyleId,
|
|
32748
|
+
DEFAULT_EDITOR_STYLES
|
|
32749
|
+
);
|
|
32750
|
+
const dd = (e, d) => e !== d ? e : void 0;
|
|
32751
|
+
const hd = (raw, e, d) => raw !== void 0 ? raw : dd(e, d);
|
|
32752
|
+
return stripUndefined({
|
|
32753
|
+
styleId: style2.styleId,
|
|
32754
|
+
bold: hd(style2.bold, effective.bold, defaultEffective.bold),
|
|
32755
|
+
italic: hd(style2.italic, effective.italic, defaultEffective.italic),
|
|
32756
|
+
underline: dd(effective.underline, defaultEffective.underline),
|
|
32757
|
+
underlineStyle: dd(
|
|
32758
|
+
effective.underlineStyle,
|
|
32759
|
+
defaultEffective.underlineStyle
|
|
32760
|
+
),
|
|
32761
|
+
underlineColor: dd(
|
|
32762
|
+
effective.underlineColor,
|
|
32763
|
+
defaultEffective.underlineColor
|
|
32764
|
+
),
|
|
32765
|
+
strike: hd(style2.strike, effective.strike, defaultEffective.strike),
|
|
32766
|
+
doubleStrike: hd(
|
|
32767
|
+
style2.doubleStrike,
|
|
32768
|
+
effective.doubleStrike,
|
|
32769
|
+
defaultEffective.doubleStrike
|
|
32770
|
+
),
|
|
32771
|
+
superscript: dd(effective.superscript, defaultEffective.superscript),
|
|
32772
|
+
subscript: dd(effective.subscript, defaultEffective.subscript),
|
|
32773
|
+
smallCaps: hd(
|
|
32774
|
+
style2.smallCaps,
|
|
32775
|
+
effective.smallCaps,
|
|
32776
|
+
defaultEffective.smallCaps
|
|
32777
|
+
),
|
|
32778
|
+
allCaps: hd(style2.allCaps, effective.allCaps, defaultEffective.allCaps),
|
|
32779
|
+
hidden: hd(style2.hidden, effective.hidden, defaultEffective.hidden),
|
|
32780
|
+
noProof: hd(style2.noProof, effective.noProof, defaultEffective.noProof),
|
|
32781
|
+
webHidden: hd(
|
|
32782
|
+
style2.webHidden,
|
|
32783
|
+
effective.webHidden,
|
|
32784
|
+
defaultEffective.webHidden
|
|
32785
|
+
),
|
|
32786
|
+
specVanish: hd(
|
|
32787
|
+
style2.specVanish,
|
|
32788
|
+
effective.specVanish,
|
|
32789
|
+
defaultEffective.specVanish
|
|
32790
|
+
),
|
|
32791
|
+
rtl: hd(style2.rtl, effective.rtl, defaultEffective.rtl),
|
|
32792
|
+
complexScript: hd(
|
|
32793
|
+
style2.complexScript,
|
|
32794
|
+
effective.complexScript,
|
|
32795
|
+
defaultEffective.complexScript
|
|
32796
|
+
),
|
|
32797
|
+
snapToGrid: hd(
|
|
32798
|
+
style2.snapToGrid,
|
|
32799
|
+
effective.snapToGrid,
|
|
32800
|
+
defaultEffective.snapToGrid
|
|
32801
|
+
),
|
|
32802
|
+
outline: hd(style2.outline, effective.outline, defaultEffective.outline),
|
|
32803
|
+
shadow: hd(style2.shadow, effective.shadow, defaultEffective.shadow),
|
|
32804
|
+
emboss: hd(style2.emboss, effective.emboss, defaultEffective.emboss),
|
|
32805
|
+
imprint: hd(style2.imprint, effective.imprint, defaultEffective.imprint),
|
|
32806
|
+
fitText: dd(effective.fitText, defaultEffective.fitText),
|
|
32807
|
+
emphasisMark: dd(effective.emphasisMark, defaultEffective.emphasisMark),
|
|
32808
|
+
textBorder: dd(effective.textBorder, defaultEffective.textBorder),
|
|
32809
|
+
textEffect: dd(effective.textEffect, defaultEffective.textEffect),
|
|
32810
|
+
characterScale: dd(
|
|
32811
|
+
effective.characterScale,
|
|
32812
|
+
defaultEffective.characterScale
|
|
32813
|
+
),
|
|
32814
|
+
characterSpacing: dd(
|
|
32815
|
+
effective.characterSpacing,
|
|
32816
|
+
defaultEffective.characterSpacing
|
|
32817
|
+
),
|
|
32818
|
+
baselineShift: dd(effective.baselineShift, defaultEffective.baselineShift),
|
|
32819
|
+
kerningThreshold: dd(
|
|
32820
|
+
effective.kerningThreshold,
|
|
32821
|
+
defaultEffective.kerningThreshold
|
|
32822
|
+
),
|
|
32823
|
+
ligatures: dd(effective.ligatures, defaultEffective.ligatures),
|
|
32824
|
+
numberSpacing: dd(effective.numberSpacing, defaultEffective.numberSpacing),
|
|
32825
|
+
numberForm: dd(effective.numberForm, defaultEffective.numberForm),
|
|
32826
|
+
stylisticSet: dd(effective.stylisticSet, defaultEffective.stylisticSet),
|
|
32827
|
+
contextualAlternates: dd(
|
|
32828
|
+
effective.contextualAlternates,
|
|
32829
|
+
defaultEffective.contextualAlternates
|
|
32830
|
+
),
|
|
32831
|
+
fontFamily: hd(
|
|
32832
|
+
style2.fontFamily,
|
|
32833
|
+
effective.fontFamily,
|
|
32834
|
+
defaultEffective.fontFamily
|
|
32835
|
+
),
|
|
32836
|
+
fontSize: hd(style2.fontSize, effective.fontSize, defaultEffective.fontSize),
|
|
32837
|
+
color: dd(effective.color, defaultEffective.color),
|
|
32838
|
+
highlight: dd(effective.highlight, defaultEffective.highlight),
|
|
32839
|
+
shading: dd(effective.shading, defaultEffective.shading),
|
|
32840
|
+
language: dd(effective.language, defaultEffective.language),
|
|
32841
|
+
link: dd(effective.link, defaultEffective.link)
|
|
32842
|
+
});
|
|
32843
|
+
}
|
|
32844
|
+
function parseRunStyle(runProperties, theme) {
|
|
32845
|
+
if (!runProperties) {
|
|
32846
|
+
return void 0;
|
|
32847
|
+
}
|
|
32848
|
+
const styles = {};
|
|
32849
|
+
const styleId = parseStyleIdProperty(runProperties, "rStyle");
|
|
32850
|
+
if (styleId) {
|
|
32851
|
+
styles.styleId = styleId;
|
|
32852
|
+
}
|
|
32853
|
+
const bold = parseOnOffProperty(runProperties, "b");
|
|
32854
|
+
const boldCs = parseOnOffProperty(runProperties, "bCs");
|
|
32855
|
+
if (bold !== void 0 || boldCs !== void 0) {
|
|
32856
|
+
styles.bold = bold === true || boldCs === true;
|
|
32857
|
+
}
|
|
32858
|
+
const italic = parseOnOffProperty(runProperties, "i");
|
|
32859
|
+
const italicCs = parseOnOffProperty(runProperties, "iCs");
|
|
32860
|
+
if (italic !== void 0 || italicCs !== void 0) {
|
|
32861
|
+
styles.italic = italic === true || italicCs === true;
|
|
32862
|
+
}
|
|
32863
|
+
const strike = parseOnOffProperty(runProperties, "strike");
|
|
32864
|
+
if (strike !== void 0) {
|
|
32865
|
+
styles.strike = strike;
|
|
32866
|
+
}
|
|
32867
|
+
const doubleStrike = parseOnOffProperty(runProperties, "dstrike");
|
|
32868
|
+
if (doubleStrike !== void 0) {
|
|
32869
|
+
styles.doubleStrike = doubleStrike;
|
|
32870
|
+
}
|
|
32871
|
+
const smallCaps = parseOnOffProperty(runProperties, "smallCaps");
|
|
32872
|
+
if (smallCaps !== void 0) {
|
|
32873
|
+
styles.smallCaps = smallCaps;
|
|
32874
|
+
}
|
|
32875
|
+
const allCaps = parseOnOffProperty(runProperties, "caps");
|
|
32876
|
+
if (allCaps !== void 0) {
|
|
32877
|
+
styles.allCaps = allCaps;
|
|
32878
|
+
}
|
|
32879
|
+
const hidden = parseOnOffProperty(runProperties, "vanish");
|
|
32880
|
+
if (hidden !== void 0) {
|
|
32881
|
+
styles.hidden = hidden;
|
|
32882
|
+
}
|
|
32883
|
+
const noProof = parseOnOffProperty(runProperties, "noProof");
|
|
32884
|
+
if (noProof !== void 0) {
|
|
32885
|
+
styles.noProof = noProof;
|
|
32886
|
+
}
|
|
32887
|
+
const webHidden = parseOnOffProperty(runProperties, "webHidden");
|
|
32888
|
+
if (webHidden !== void 0) {
|
|
32889
|
+
styles.webHidden = webHidden;
|
|
32890
|
+
}
|
|
32891
|
+
const specVanish = parseOnOffProperty(runProperties, "specVanish");
|
|
32892
|
+
if (specVanish !== void 0) {
|
|
32893
|
+
styles.specVanish = specVanish;
|
|
32894
|
+
}
|
|
32895
|
+
const rtl = parseOnOffProperty(runProperties, "rtl");
|
|
32896
|
+
if (rtl !== void 0) {
|
|
32897
|
+
styles.rtl = rtl;
|
|
32898
|
+
}
|
|
32899
|
+
const complexScript = parseOnOffProperty(runProperties, "cs");
|
|
32900
|
+
if (complexScript !== void 0) {
|
|
32901
|
+
styles.complexScript = complexScript;
|
|
32902
|
+
}
|
|
32903
|
+
const snapToGrid = parseOnOffProperty(runProperties, "snapToGrid");
|
|
32904
|
+
if (snapToGrid !== void 0) {
|
|
32905
|
+
styles.snapToGrid = snapToGrid;
|
|
32906
|
+
}
|
|
32907
|
+
const outline = parseOnOffProperty(runProperties, "outline");
|
|
32908
|
+
if (outline !== void 0) {
|
|
32909
|
+
styles.outline = outline;
|
|
32910
|
+
}
|
|
32911
|
+
const shadow = parseOnOffProperty(runProperties, "shadow");
|
|
32912
|
+
if (shadow !== void 0) {
|
|
32913
|
+
styles.shadow = shadow;
|
|
32914
|
+
}
|
|
32915
|
+
const emboss = parseOnOffProperty(runProperties, "emboss");
|
|
32916
|
+
if (emboss !== void 0) {
|
|
32917
|
+
styles.emboss = emboss;
|
|
32918
|
+
}
|
|
32919
|
+
const imprint = parseOnOffProperty(runProperties, "imprint");
|
|
32920
|
+
if (imprint !== void 0) {
|
|
32921
|
+
styles.imprint = imprint;
|
|
32922
|
+
}
|
|
32923
|
+
const emphasisMark = getAttributeValue(
|
|
32924
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "em"),
|
|
32925
|
+
"val"
|
|
32926
|
+
);
|
|
32927
|
+
if (emphasisMark === "dot" || emphasisMark === "comma" || emphasisMark === "circle" || emphasisMark === "underDot" || emphasisMark === "none") {
|
|
32928
|
+
styles.emphasisMark = emphasisMark;
|
|
32929
|
+
}
|
|
32930
|
+
const fitText = getAttributeValue(
|
|
32931
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "fitText"),
|
|
32932
|
+
"val"
|
|
32933
|
+
);
|
|
32934
|
+
if (fitText) {
|
|
32935
|
+
const parsed = twipsToPoints(fitText);
|
|
32936
|
+
if (parsed !== void 0 && parsed > 0) {
|
|
32937
|
+
styles.fitText = parsed;
|
|
32938
|
+
}
|
|
32939
|
+
}
|
|
32940
|
+
const textBorder = parseDocxBorder(
|
|
32941
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "bdr")
|
|
32942
|
+
);
|
|
32943
|
+
if (textBorder) {
|
|
32944
|
+
styles.textBorder = textBorder;
|
|
32945
|
+
}
|
|
32946
|
+
const textEffect = getAttributeValue(
|
|
32947
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "effect"),
|
|
32948
|
+
"val"
|
|
32949
|
+
);
|
|
32950
|
+
if (textEffect) {
|
|
32951
|
+
styles.textEffect = textEffect;
|
|
32952
|
+
}
|
|
32953
|
+
const characterScale = getAttributeValue(
|
|
32954
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "w"),
|
|
32955
|
+
"val"
|
|
32956
|
+
);
|
|
32957
|
+
if (characterScale) {
|
|
32958
|
+
const parsed = Number(characterScale);
|
|
32959
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
32960
|
+
styles.characterScale = parsed;
|
|
32961
|
+
}
|
|
32962
|
+
}
|
|
32963
|
+
const characterSpacing = getAttributeValue(
|
|
32964
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "spacing"),
|
|
32965
|
+
"val"
|
|
32966
|
+
);
|
|
32967
|
+
if (characterSpacing) {
|
|
32968
|
+
const parsed = twipsToPoints(characterSpacing);
|
|
32969
|
+
if (parsed !== void 0) {
|
|
32970
|
+
styles.characterSpacing = parsed;
|
|
32971
|
+
}
|
|
32972
|
+
}
|
|
32973
|
+
const baselineShift = getAttributeValue(
|
|
32974
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "position"),
|
|
32975
|
+
"val"
|
|
32976
|
+
);
|
|
32977
|
+
if (baselineShift) {
|
|
32978
|
+
const parsed = Number(baselineShift);
|
|
32979
|
+
if (Number.isFinite(parsed)) {
|
|
32980
|
+
styles.baselineShift = parsed / 2;
|
|
32981
|
+
}
|
|
32982
|
+
}
|
|
32983
|
+
const kerningThreshold = getAttributeValue(
|
|
32984
|
+
getFirstChildByTagNameNS(runProperties, WORD_NS, "kern"),
|
|
32985
|
+
"val"
|
|
32986
|
+
);
|
|
32987
|
+
if (kerningThreshold) {
|
|
32988
|
+
const parsed = Number(kerningThreshold);
|
|
32989
|
+
if (Number.isFinite(parsed) && parsed >= 0) {
|
|
32990
|
+
styles.kerningThreshold = parsed / 2;
|
|
32991
|
+
}
|
|
32992
|
+
}
|
|
32993
|
+
const ligatures = getAttributeValue(
|
|
32994
|
+
getFirstChildByTagNameNS(runProperties, WORD14_NS, "ligatures"),
|
|
32995
|
+
"val"
|
|
32996
|
+
);
|
|
32997
|
+
if (ligatures === "none" || ligatures === "standard" || ligatures === "contextual" || ligatures === "historical" || ligatures === "standardContextual") {
|
|
32998
|
+
styles.ligatures = ligatures;
|
|
32999
|
+
}
|
|
33000
|
+
const numberSpacing = getAttributeValue(
|
|
33001
|
+
getFirstChildByTagNameNS(runProperties, WORD14_NS, "numSpacing"),
|
|
33002
|
+
"val"
|
|
33003
|
+
);
|
|
33004
|
+
if (numberSpacing === "proportional" || numberSpacing === "tabular") {
|
|
33005
|
+
styles.numberSpacing = numberSpacing;
|
|
33006
|
+
}
|
|
33007
|
+
const numberForm = getAttributeValue(
|
|
33008
|
+
getFirstChildByTagNameNS(runProperties, WORD14_NS, "numForm"),
|
|
33009
|
+
"val"
|
|
33010
|
+
);
|
|
33011
|
+
if (numberForm === "lining" || numberForm === "oldStyle") {
|
|
33012
|
+
styles.numberForm = numberForm;
|
|
33013
|
+
}
|
|
33014
|
+
const stylisticSet = getAttributeValue(
|
|
33015
|
+
getFirstChildByTagNameNS(runProperties, WORD14_NS, "stylisticSets"),
|
|
33016
|
+
"val"
|
|
33017
|
+
);
|
|
33018
|
+
if (stylisticSet) {
|
|
33019
|
+
const parsed = /^[0-9a-fA-F]+$/.test(stylisticSet) && stylisticSet.length > 2 ? Number.parseInt(stylisticSet, 16) : Number(stylisticSet);
|
|
33020
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
33021
|
+
for (let set = 1; set <= 20; set += 1) {
|
|
33022
|
+
if ((parsed & 1 << set - 1) !== 0) {
|
|
33023
|
+
styles.stylisticSet = set;
|
|
33024
|
+
break;
|
|
33025
|
+
}
|
|
33026
|
+
}
|
|
33027
|
+
}
|
|
33028
|
+
}
|
|
33029
|
+
const contextualAlternates = getAttributeValue(
|
|
33030
|
+
getFirstChildByTagNameNS(runProperties, WORD14_NS, "cntxtAlts"),
|
|
33031
|
+
"val"
|
|
33032
|
+
);
|
|
33033
|
+
if (contextualAlternates === null) {
|
|
33034
|
+
if (getFirstChildByTagNameNS(runProperties, WORD14_NS, "cntxtAlts")) {
|
|
33035
|
+
styles.contextualAlternates = true;
|
|
33036
|
+
}
|
|
33037
|
+
} else if (isWordTrue(contextualAlternates)) {
|
|
33038
|
+
styles.contextualAlternates = true;
|
|
33039
|
+
}
|
|
33040
|
+
const underline = getFirstChildByTagNameNS(runProperties, WORD_NS, "u");
|
|
33041
|
+
const underlineValue = getAttributeValue(underline, "val");
|
|
33042
|
+
if (underline && underlineValue !== "none") {
|
|
33043
|
+
styles.underline = true;
|
|
33044
|
+
if (underlineValue && underlineValue !== "single") {
|
|
33045
|
+
styles.underlineStyle = underlineValue;
|
|
33046
|
+
}
|
|
33047
|
+
const underlineColor = getAttributeValue(underline, "color");
|
|
33048
|
+
if (underlineColor && underlineColor !== "auto") {
|
|
33049
|
+
styles.underlineColor = normalizeImportedHexColor(underlineColor);
|
|
33050
|
+
}
|
|
33051
|
+
}
|
|
33052
|
+
const vertAlign = getFirstChildByTagNameNS(
|
|
33053
|
+
runProperties,
|
|
33054
|
+
WORD_NS,
|
|
33055
|
+
"vertAlign"
|
|
33056
|
+
);
|
|
33057
|
+
const vertAlignValue = getAttributeValue(vertAlign, "val");
|
|
33058
|
+
if (vertAlignValue === "superscript") {
|
|
33059
|
+
styles.superscript = true;
|
|
33060
|
+
}
|
|
33061
|
+
if (vertAlignValue === "subscript") {
|
|
33062
|
+
styles.subscript = true;
|
|
33063
|
+
}
|
|
33064
|
+
const fonts = getFirstChildByTagNameNS(runProperties, WORD_NS, "rFonts");
|
|
33065
|
+
const fontFamily = getAttributeValue(fonts, "ascii") ?? getAttributeValue(fonts, "hAnsi") ?? getAttributeValue(fonts, "cs") ?? getAttributeValue(fonts, "eastAsia") ?? resolveThemeFont(fonts, theme.fonts);
|
|
33066
|
+
if (fontFamily) {
|
|
33067
|
+
styles.fontFamily = normalizeImportedFontFamily(fontFamily);
|
|
33068
|
+
}
|
|
33069
|
+
const size = getFirstChildByTagNameNS(runProperties, WORD_NS, "sz") ?? getFirstChildByTagNameNS(runProperties, WORD_NS, "szCs");
|
|
33070
|
+
const sizeValue = getAttributeValue(size, "val");
|
|
33071
|
+
if (sizeValue) {
|
|
33072
|
+
const parsed = halfPointsToPx(sizeValue);
|
|
33073
|
+
if (parsed !== null) {
|
|
33074
|
+
styles.fontSize = parsed;
|
|
33075
|
+
}
|
|
33076
|
+
}
|
|
33077
|
+
const color = getFirstChildByTagNameNS(runProperties, WORD_NS, "color");
|
|
33078
|
+
const colorValue = getAttributeValue(color, "val");
|
|
33079
|
+
if (colorValue && colorValue !== "auto") {
|
|
33080
|
+
styles.color = normalizeImportedHexColor(colorValue);
|
|
33081
|
+
} else if (colorValue !== "auto") {
|
|
33082
|
+
const themeColor = resolveThemeColor(color, theme.colors);
|
|
33083
|
+
if (themeColor) {
|
|
33084
|
+
styles.color = themeColor;
|
|
33085
|
+
}
|
|
33086
|
+
}
|
|
33087
|
+
const highlight = getFirstChildByTagNameNS(
|
|
33088
|
+
runProperties,
|
|
33089
|
+
WORD_NS,
|
|
33090
|
+
"highlight"
|
|
33091
|
+
);
|
|
33092
|
+
const highlightValue = getAttributeValue(highlight, "val");
|
|
33093
|
+
if (highlightValue && highlightValue !== "none") {
|
|
33094
|
+
styles.highlight = highlightValue;
|
|
33095
|
+
}
|
|
33096
|
+
const shd = getFirstChildByTagNameNS(runProperties, WORD_NS, "shd");
|
|
33097
|
+
const shdFill = parseShdFill(shd);
|
|
33098
|
+
if (shdFill) {
|
|
33099
|
+
styles.shading = shdFill;
|
|
33100
|
+
}
|
|
33101
|
+
const language = getFirstChildByTagNameNS(runProperties, WORD_NS, "lang");
|
|
33102
|
+
if (language) {
|
|
33103
|
+
const value = getAttributeValue(language, "val");
|
|
33104
|
+
const eastAsia = getAttributeValue(language, "eastAsia");
|
|
33105
|
+
const bidi = getAttributeValue(language, "bidi");
|
|
33106
|
+
const parsedLanguage = {};
|
|
33107
|
+
if (value) parsedLanguage.value = value;
|
|
33108
|
+
if (eastAsia) parsedLanguage.eastAsia = eastAsia;
|
|
33109
|
+
if (bidi) parsedLanguage.bidi = bidi;
|
|
33110
|
+
if (Object.keys(parsedLanguage).length > 0) {
|
|
33111
|
+
styles.language = parsedLanguage;
|
|
33112
|
+
}
|
|
33113
|
+
}
|
|
33114
|
+
return emptyOrUndefined(styles);
|
|
33115
|
+
}
|
|
32255
33116
|
function normalizeImportedParagraphStyle(style2) {
|
|
32256
33117
|
if (!style2) {
|
|
32257
33118
|
return void 0;
|
|
@@ -32478,23 +33339,508 @@ function parseParagraphStyle$1(paragraphProperties) {
|
|
|
32478
33339
|
}
|
|
32479
33340
|
return emptyOrUndefined(style2);
|
|
32480
33341
|
}
|
|
32481
|
-
function
|
|
32482
|
-
if (!
|
|
33342
|
+
function parseDocxWidthValue(element) {
|
|
33343
|
+
if (!element) {
|
|
33344
|
+
return void 0;
|
|
33345
|
+
}
|
|
33346
|
+
const type = getAttributeValue(element, "type");
|
|
33347
|
+
const raw = getAttributeValue(element, "w");
|
|
33348
|
+
if (type === "auto") {
|
|
33349
|
+
return "auto";
|
|
33350
|
+
}
|
|
33351
|
+
if (type === "pct") {
|
|
33352
|
+
if (!raw) {
|
|
33353
|
+
return void 0;
|
|
33354
|
+
}
|
|
33355
|
+
const pct = raw.trim().endsWith("%") ? Number.parseFloat(raw) : Number(raw) / 50;
|
|
33356
|
+
return Number.isFinite(pct) ? `${Math.round(pct * 1e4) / 1e4}%` : void 0;
|
|
33357
|
+
}
|
|
33358
|
+
return twipsToPoints(raw);
|
|
33359
|
+
}
|
|
33360
|
+
function parsePositiveIntegerProperty(parent, localName) {
|
|
33361
|
+
const element = getFirstChildByTagNameNS(parent, WORD_NS, localName);
|
|
33362
|
+
const raw = getAttributeValue(element, "val");
|
|
33363
|
+
const parsed = raw ? Number(raw) : Number.NaN;
|
|
33364
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : void 0;
|
|
33365
|
+
}
|
|
33366
|
+
function parseTableConditionalFlags(properties) {
|
|
33367
|
+
const element = getFirstChildByTagNameNS(properties, WORD_NS, "cnfStyle");
|
|
33368
|
+
if (!element) return void 0;
|
|
33369
|
+
const names = [
|
|
33370
|
+
["firstRow", "firstRow"],
|
|
33371
|
+
["lastRow", "lastRow"],
|
|
33372
|
+
["firstColumn", "firstCol"],
|
|
33373
|
+
["lastColumn", "lastCol"],
|
|
33374
|
+
["oddVBand", "band1Vert"],
|
|
33375
|
+
["evenVBand", "band2Vert"],
|
|
33376
|
+
["oddHBand", "band1Horz"],
|
|
33377
|
+
["evenHBand", "band2Horz"],
|
|
33378
|
+
["firstRowFirstColumn", "nwCell"],
|
|
33379
|
+
["firstRowLastColumn", "neCell"],
|
|
33380
|
+
["lastRowFirstColumn", "swCell"],
|
|
33381
|
+
["lastRowLastColumn", "seCell"]
|
|
33382
|
+
];
|
|
33383
|
+
const rawBits = getAttributeValue(element, "val") ?? "";
|
|
33384
|
+
const flags = {};
|
|
33385
|
+
names.forEach(([attribute, key], index) => {
|
|
33386
|
+
const explicit = getAttributeValue(element, attribute);
|
|
33387
|
+
if (explicit === "1" || explicit === "true" || explicit === "on") {
|
|
33388
|
+
flags[key] = true;
|
|
33389
|
+
} else if (explicit === "0" || explicit === "false" || explicit === "off") {
|
|
33390
|
+
flags[key] = false;
|
|
33391
|
+
} else if (rawBits.length === 12 && rawBits[index] === "1") {
|
|
33392
|
+
flags[key] = true;
|
|
33393
|
+
}
|
|
33394
|
+
});
|
|
33395
|
+
return Object.keys(flags).length > 0 ? flags : void 0;
|
|
33396
|
+
}
|
|
33397
|
+
function parseRevisionMetadata(element) {
|
|
33398
|
+
const rawDate = getAttributeValue(element, "date");
|
|
33399
|
+
const parsedDate = rawDate ? Date.parse(rawDate) : Number.NaN;
|
|
33400
|
+
return {
|
|
33401
|
+
id: getAttributeValue(element, "id") ?? `revision:${element.localName}`,
|
|
33402
|
+
author: getAttributeValue(element, "author") ?? "Unknown",
|
|
33403
|
+
date: Number.isFinite(parsedDate) ? parsedDate : 0
|
|
33404
|
+
};
|
|
33405
|
+
}
|
|
33406
|
+
function parseFloatingTableProperties(tblPr) {
|
|
33407
|
+
const tblpPr = getFirstChildByTagNameNS(tblPr, WORD_NS, "tblpPr");
|
|
33408
|
+
if (!tblpPr || !tblpPr.attributes || tblpPr.attributes.length === 0) {
|
|
33409
|
+
return void 0;
|
|
33410
|
+
}
|
|
33411
|
+
const attrs = {};
|
|
33412
|
+
for (let index = 0; index < tblpPr.attributes.length; index += 1) {
|
|
33413
|
+
const attr = tblpPr.attributes.item(index);
|
|
33414
|
+
if ((attr == null ? void 0 : attr.namespaceURI) === WORD_NS || (attr == null ? void 0 : attr.prefix) === "w") {
|
|
33415
|
+
attrs[attr.localName || attr.name.replace(/^w:/, "")] = attr.value;
|
|
33416
|
+
}
|
|
33417
|
+
}
|
|
33418
|
+
const point = (name) => twipsToPoints(attrs[name] ?? null);
|
|
33419
|
+
const horizontalAnchor = attrs.horzAnchor === "margin" || attrs.horzAnchor === "page" || attrs.horzAnchor === "text" ? attrs.horzAnchor : void 0;
|
|
33420
|
+
const verticalAnchor = attrs.vertAnchor === "margin" || attrs.vertAnchor === "page" || attrs.vertAnchor === "text" ? attrs.vertAnchor : void 0;
|
|
33421
|
+
const xAlign = attrs.tblpXSpec === "left" || attrs.tblpXSpec === "center" || attrs.tblpXSpec === "right" || attrs.tblpXSpec === "inside" || attrs.tblpXSpec === "outside" ? attrs.tblpXSpec : void 0;
|
|
33422
|
+
const yAlign = attrs.tblpYSpec === "top" || attrs.tblpYSpec === "center" || attrs.tblpYSpec === "bottom" || attrs.tblpYSpec === "inside" || attrs.tblpYSpec === "outside" ? attrs.tblpYSpec : void 0;
|
|
33423
|
+
return {
|
|
33424
|
+
...horizontalAnchor ? { horizontalAnchor } : {},
|
|
33425
|
+
...verticalAnchor ? { verticalAnchor } : {},
|
|
33426
|
+
...point("tblpX") !== void 0 ? { x: point("tblpX") } : {},
|
|
33427
|
+
...point("tblpY") !== void 0 ? { y: point("tblpY") } : {},
|
|
33428
|
+
...xAlign ? { xAlign } : {},
|
|
33429
|
+
...yAlign ? { yAlign } : {},
|
|
33430
|
+
...point("topFromText") !== void 0 ? { distanceTop: point("topFromText") } : {},
|
|
33431
|
+
...point("rightFromText") !== void 0 ? { distanceRight: point("rightFromText") } : {},
|
|
33432
|
+
...point("bottomFromText") !== void 0 ? { distanceBottom: point("bottomFromText") } : {},
|
|
33433
|
+
...point("leftFromText") !== void 0 ? { distanceLeft: point("leftFromText") } : {}
|
|
33434
|
+
};
|
|
33435
|
+
}
|
|
33436
|
+
function parseCellMargins(container) {
|
|
33437
|
+
if (!container) {
|
|
33438
|
+
return void 0;
|
|
33439
|
+
}
|
|
33440
|
+
const edgePt = (edge) => twipsToPoints(
|
|
33441
|
+
getAttributeValue(
|
|
33442
|
+
getFirstChildByTagNameNS(container, WORD_NS, edge),
|
|
33443
|
+
"w"
|
|
33444
|
+
)
|
|
33445
|
+
);
|
|
33446
|
+
const margins = {};
|
|
33447
|
+
const top = edgePt("top");
|
|
33448
|
+
const right = edgePt("right");
|
|
33449
|
+
const bottom = edgePt("bottom");
|
|
33450
|
+
const left = edgePt("left");
|
|
33451
|
+
const start = edgePt("start");
|
|
33452
|
+
const end = edgePt("end");
|
|
33453
|
+
if (top !== void 0) margins.top = top;
|
|
33454
|
+
if (right !== void 0) margins.right = right;
|
|
33455
|
+
if (bottom !== void 0) margins.bottom = bottom;
|
|
33456
|
+
if (left !== void 0) margins.left = left;
|
|
33457
|
+
if (start !== void 0) margins.start = start;
|
|
33458
|
+
if (end !== void 0) margins.end = end;
|
|
33459
|
+
return Object.keys(margins).length > 0 ? margins : void 0;
|
|
33460
|
+
}
|
|
33461
|
+
function parseTableLayout(tblPr) {
|
|
33462
|
+
const value = getAttributeValue(
|
|
33463
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblLayout"),
|
|
33464
|
+
"type"
|
|
33465
|
+
);
|
|
33466
|
+
return value === "fixed" || value === "autofit" ? value : void 0;
|
|
33467
|
+
}
|
|
33468
|
+
function parseTableStyle(tblPr, tableStyleId) {
|
|
33469
|
+
const style2 = {};
|
|
33470
|
+
if (tableStyleId) {
|
|
33471
|
+
style2.styleId = tableStyleId;
|
|
33472
|
+
}
|
|
33473
|
+
const altTitle = getAttributeValue(
|
|
33474
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblCaption"),
|
|
33475
|
+
"val"
|
|
33476
|
+
);
|
|
33477
|
+
if (altTitle) {
|
|
33478
|
+
style2.altTitle = altTitle;
|
|
33479
|
+
}
|
|
33480
|
+
const altDescription = getAttributeValue(
|
|
33481
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblDescription"),
|
|
33482
|
+
"val"
|
|
33483
|
+
);
|
|
33484
|
+
if (altDescription) {
|
|
33485
|
+
style2.altDescription = altDescription;
|
|
33486
|
+
}
|
|
33487
|
+
const width = parseDocxWidthValue(
|
|
33488
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblW")
|
|
33489
|
+
);
|
|
33490
|
+
if (width !== void 0) {
|
|
33491
|
+
style2.width = width;
|
|
33492
|
+
}
|
|
33493
|
+
const indentLeft = parseDocxWidthValue(
|
|
33494
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblInd")
|
|
33495
|
+
);
|
|
33496
|
+
if (indentLeft !== void 0) {
|
|
33497
|
+
style2.indentLeft = indentLeft;
|
|
33498
|
+
}
|
|
33499
|
+
const jc = getAttributeValue(
|
|
33500
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "jc"),
|
|
33501
|
+
"val"
|
|
33502
|
+
);
|
|
33503
|
+
if (jc === "left" || jc === "center" || jc === "right") {
|
|
33504
|
+
style2.align = jc;
|
|
33505
|
+
}
|
|
33506
|
+
const layout = parseTableLayout(tblPr);
|
|
33507
|
+
if (layout) {
|
|
33508
|
+
style2.layout = layout;
|
|
33509
|
+
}
|
|
33510
|
+
const cellSpacing = parseDocxWidthValue(
|
|
33511
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblCellSpacing")
|
|
33512
|
+
);
|
|
33513
|
+
if (cellSpacing !== void 0) {
|
|
33514
|
+
style2.cellSpacing = cellSpacing;
|
|
33515
|
+
}
|
|
33516
|
+
const borders = parseDocxTableBorders(
|
|
33517
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblBorders")
|
|
33518
|
+
);
|
|
33519
|
+
if (Object.keys(borders).length > 0) style2.borders = borders;
|
|
33520
|
+
const defaultCellMargins = parseCellMargins(
|
|
33521
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblCellMar")
|
|
33522
|
+
);
|
|
33523
|
+
if (defaultCellMargins) {
|
|
33524
|
+
style2.defaultCellMargins = defaultCellMargins;
|
|
33525
|
+
}
|
|
33526
|
+
const bidiVisual = tblPr ? parseOnOffProperty(tblPr, "bidiVisual") : void 0;
|
|
33527
|
+
if (bidiVisual !== void 0) {
|
|
33528
|
+
style2.bidiVisual = bidiVisual;
|
|
33529
|
+
}
|
|
33530
|
+
const tblOverlap = getAttributeValue(
|
|
33531
|
+
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblOverlap"),
|
|
33532
|
+
"val"
|
|
33533
|
+
);
|
|
33534
|
+
if (tblOverlap === "overlap" || tblOverlap === "never") {
|
|
33535
|
+
style2.tblOverlap = tblOverlap;
|
|
33536
|
+
}
|
|
33537
|
+
const floating = parseFloatingTableProperties(tblPr);
|
|
33538
|
+
if (floating) {
|
|
33539
|
+
style2.floating = floating;
|
|
33540
|
+
}
|
|
33541
|
+
const rowBandSize = parsePositiveIntegerProperty(
|
|
33542
|
+
tblPr,
|
|
33543
|
+
"tblStyleRowBandSize"
|
|
33544
|
+
);
|
|
33545
|
+
if (rowBandSize !== void 0) style2.rowBandSize = rowBandSize;
|
|
33546
|
+
const colBandSize = parsePositiveIntegerProperty(
|
|
33547
|
+
tblPr,
|
|
33548
|
+
"tblStyleColBandSize"
|
|
33549
|
+
);
|
|
33550
|
+
if (colBandSize !== void 0) style2.colBandSize = colBandSize;
|
|
33551
|
+
const tblLook = getFirstChildByTagNameNS(tblPr, WORD_NS, "tblLook");
|
|
33552
|
+
if (tblLook) {
|
|
33553
|
+
const raw = getAttributeValue(tblLook, "val");
|
|
33554
|
+
const mask = raw ? Number.parseInt(raw, 16) : Number.NaN;
|
|
33555
|
+
const flag = (name, bit, fallback) => {
|
|
33556
|
+
const value = getAttributeValue(tblLook, name);
|
|
33557
|
+
if (value !== null && value !== "") {
|
|
33558
|
+
return value === "1" || value === "true" || value === "on";
|
|
33559
|
+
}
|
|
33560
|
+
return Number.isFinite(mask) ? (mask & bit) !== 0 : fallback;
|
|
33561
|
+
};
|
|
33562
|
+
style2.tblLook = {
|
|
33563
|
+
firstRow: flag("firstRow", 32, true),
|
|
33564
|
+
lastRow: flag("lastRow", 64, false),
|
|
33565
|
+
firstCol: flag("firstColumn", 128, true),
|
|
33566
|
+
lastCol: flag("lastColumn", 256, false),
|
|
33567
|
+
noHBand: flag("noHBand", 512, false),
|
|
33568
|
+
noVBand: flag("noVBand", 1024, false)
|
|
33569
|
+
};
|
|
33570
|
+
}
|
|
33571
|
+
const change = getFirstChildByTagNameNS(tblPr, WORD_NS, "tblPrChange");
|
|
33572
|
+
const previousProperties = getFirstChildByTagNameNS(change, WORD_NS, "tblPr");
|
|
33573
|
+
if (change && previousProperties) {
|
|
33574
|
+
style2.revision = {
|
|
33575
|
+
...parseRevisionMetadata(change),
|
|
33576
|
+
type: "property",
|
|
33577
|
+
previous: parseTableStyle(previousProperties) ?? {}
|
|
33578
|
+
};
|
|
33579
|
+
}
|
|
33580
|
+
return emptyOrUndefined(style2);
|
|
33581
|
+
}
|
|
33582
|
+
function parseTableRowStyle(rowProperties) {
|
|
33583
|
+
if (!rowProperties) {
|
|
33584
|
+
return void 0;
|
|
33585
|
+
}
|
|
32483
33586
|
const style2 = {};
|
|
32484
|
-
const
|
|
32485
|
-
if (
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
33587
|
+
const isHeader = parseOnOffProperty(rowProperties, "tblHeader");
|
|
33588
|
+
if (isHeader !== void 0) style2.isHeader = isHeader;
|
|
33589
|
+
const gridBefore = parsePositiveIntegerProperty(rowProperties, "gridBefore");
|
|
33590
|
+
if (gridBefore !== void 0) {
|
|
33591
|
+
style2.gridBefore = gridBefore;
|
|
33592
|
+
}
|
|
33593
|
+
const gridAfter = parsePositiveIntegerProperty(rowProperties, "gridAfter");
|
|
33594
|
+
if (gridAfter !== void 0) {
|
|
33595
|
+
style2.gridAfter = gridAfter;
|
|
33596
|
+
}
|
|
33597
|
+
const widthBefore = parseDocxWidthValue(
|
|
33598
|
+
getFirstChildByTagNameNS(rowProperties, WORD_NS, "wBefore")
|
|
33599
|
+
);
|
|
33600
|
+
if (widthBefore !== void 0) {
|
|
33601
|
+
style2.widthBefore = widthBefore;
|
|
33602
|
+
}
|
|
33603
|
+
const widthAfter = parseDocxWidthValue(
|
|
33604
|
+
getFirstChildByTagNameNS(rowProperties, WORD_NS, "wAfter")
|
|
33605
|
+
);
|
|
33606
|
+
if (widthAfter !== void 0) {
|
|
33607
|
+
style2.widthAfter = widthAfter;
|
|
33608
|
+
}
|
|
33609
|
+
const trHeight = getFirstChildByTagNameNS(rowProperties, WORD_NS, "trHeight");
|
|
33610
|
+
const height = twipsToPoints(getAttributeValue(trHeight, "val"));
|
|
33611
|
+
if (height !== void 0) {
|
|
33612
|
+
style2.height = height;
|
|
33613
|
+
}
|
|
33614
|
+
const hRule = getAttributeValue(trHeight, "hRule");
|
|
33615
|
+
if (hRule === "auto" || hRule === "exact" || hRule === "atLeast") {
|
|
33616
|
+
style2.heightRule = hRule;
|
|
33617
|
+
}
|
|
33618
|
+
const cellSpacing = parseDocxWidthValue(
|
|
33619
|
+
getFirstChildByTagNameNS(rowProperties, WORD_NS, "tblCellSpacing")
|
|
33620
|
+
);
|
|
33621
|
+
if (cellSpacing !== void 0) {
|
|
33622
|
+
style2.cellSpacing = cellSpacing;
|
|
33623
|
+
}
|
|
33624
|
+
const cantSplit = parseOnOffProperty(rowProperties, "cantSplit");
|
|
33625
|
+
if (cantSplit !== void 0) {
|
|
33626
|
+
style2.cantSplit = cantSplit;
|
|
33627
|
+
}
|
|
33628
|
+
const hidden = parseOnOffProperty(rowProperties, "hidden");
|
|
33629
|
+
if (hidden !== void 0) {
|
|
33630
|
+
style2.hidden = hidden;
|
|
33631
|
+
}
|
|
33632
|
+
const change = getFirstChildByTagNameNS(rowProperties, WORD_NS, "trPrChange");
|
|
33633
|
+
const previousProperties = getFirstChildByTagNameNS(change, WORD_NS, "trPr");
|
|
33634
|
+
if (change && previousProperties) {
|
|
33635
|
+
style2.propertyRevision = {
|
|
33636
|
+
...parseRevisionMetadata(change),
|
|
33637
|
+
type: "property",
|
|
33638
|
+
previous: parseTableRowStyle(previousProperties) ?? {}
|
|
33639
|
+
};
|
|
33640
|
+
}
|
|
33641
|
+
const inserted = getFirstChildByTagNameNS(rowProperties, WORD_NS, "ins");
|
|
33642
|
+
const deleted = getFirstChildByTagNameNS(rowProperties, WORD_NS, "del");
|
|
33643
|
+
const structural = inserted ?? deleted;
|
|
33644
|
+
if (structural) {
|
|
33645
|
+
style2.revision = {
|
|
33646
|
+
...parseRevisionMetadata(structural),
|
|
33647
|
+
type: inserted ? "insert" : "delete"
|
|
33648
|
+
};
|
|
33649
|
+
}
|
|
33650
|
+
return emptyOrUndefined(style2);
|
|
33651
|
+
}
|
|
33652
|
+
function getTableCellColSpan(cellProperties) {
|
|
33653
|
+
if (!cellProperties) {
|
|
33654
|
+
return 1;
|
|
33655
|
+
}
|
|
33656
|
+
const gridSpan = getFirstChildByTagNameNS(
|
|
33657
|
+
cellProperties,
|
|
33658
|
+
WORD_NS,
|
|
33659
|
+
"gridSpan"
|
|
33660
|
+
);
|
|
33661
|
+
const value = getAttributeValue(gridSpan, "val");
|
|
33662
|
+
const parsed = value ? Number(value) : 1;
|
|
33663
|
+
return Number.isFinite(parsed) && parsed > 1 ? Math.floor(parsed) : 1;
|
|
33664
|
+
}
|
|
33665
|
+
function getTableCellVMerge(cellProperties) {
|
|
33666
|
+
if (!cellProperties) {
|
|
33667
|
+
return void 0;
|
|
33668
|
+
}
|
|
33669
|
+
const vMerge = getFirstChildByTagNameNS(cellProperties, WORD_NS, "vMerge");
|
|
33670
|
+
if (!vMerge) {
|
|
33671
|
+
return void 0;
|
|
33672
|
+
}
|
|
33673
|
+
const value = getAttributeValue(vMerge, "val");
|
|
33674
|
+
return value === "restart" ? "restart" : "continue";
|
|
33675
|
+
}
|
|
33676
|
+
function parseTableCellVerticalAlign(cellProperties) {
|
|
33677
|
+
if (!cellProperties) {
|
|
33678
|
+
return void 0;
|
|
33679
|
+
}
|
|
33680
|
+
const vAlign = getFirstChildByTagNameNS(cellProperties, WORD_NS, "vAlign");
|
|
33681
|
+
const value = getAttributeValue(vAlign, "val");
|
|
33682
|
+
if (value === "top" || value === "bottom") {
|
|
33683
|
+
return value;
|
|
33684
|
+
}
|
|
33685
|
+
if (value === "center") {
|
|
33686
|
+
return "middle";
|
|
33687
|
+
}
|
|
33688
|
+
return void 0;
|
|
33689
|
+
}
|
|
33690
|
+
function parseTableCellBorders(cellProperties) {
|
|
33691
|
+
if (!cellProperties) {
|
|
33692
|
+
return {};
|
|
33693
|
+
}
|
|
33694
|
+
return parseDocxBoxBorders(
|
|
33695
|
+
getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcBorders")
|
|
33696
|
+
);
|
|
33697
|
+
}
|
|
33698
|
+
function parseTableCellStyle(cellProperties, tableDefaultMargins) {
|
|
33699
|
+
if (!cellProperties) {
|
|
33700
|
+
{
|
|
33701
|
+
return void 0;
|
|
33702
|
+
}
|
|
33703
|
+
}
|
|
33704
|
+
const style2 = {
|
|
33705
|
+
...{},
|
|
33706
|
+
...{},
|
|
33707
|
+
...{},
|
|
33708
|
+
...{},
|
|
33709
|
+
...{},
|
|
33710
|
+
...{}
|
|
33711
|
+
};
|
|
33712
|
+
const shading = getFirstChildByTagNameNS(cellProperties, WORD_NS, "shd");
|
|
33713
|
+
const fill = parseShdFill(shading);
|
|
33714
|
+
if (fill) {
|
|
33715
|
+
style2.shading = fill;
|
|
33716
|
+
}
|
|
33717
|
+
const cellWidth = getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcW");
|
|
33718
|
+
const cellWidthType = getAttributeValue(cellWidth, "type");
|
|
33719
|
+
const cellWidthValue = getAttributeValue(cellWidth, "w");
|
|
33720
|
+
if (cellWidthType === "dxa") {
|
|
33721
|
+
const width = twipsToPoints(cellWidthValue);
|
|
33722
|
+
if (width !== void 0) {
|
|
33723
|
+
style2.width = width;
|
|
33724
|
+
}
|
|
33725
|
+
} else if (cellWidthType === "pct" && cellWidthValue) {
|
|
33726
|
+
const pct = Number(cellWidthValue);
|
|
33727
|
+
if (Number.isFinite(pct)) {
|
|
33728
|
+
style2.width = `${Math.round(pct / 50 * 1e4) / 1e4}%`;
|
|
33729
|
+
}
|
|
33730
|
+
}
|
|
33731
|
+
const tcMar = parseCellMargins(
|
|
33732
|
+
getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcMar")
|
|
33733
|
+
);
|
|
33734
|
+
if (tcMar) {
|
|
33735
|
+
if (tcMar.top !== void 0) style2.paddingTop = tcMar.top;
|
|
33736
|
+
if (tcMar.bottom !== void 0) style2.paddingBottom = tcMar.bottom;
|
|
33737
|
+
if (tcMar.left !== void 0) style2.paddingLeft = tcMar.left;
|
|
33738
|
+
if (tcMar.right !== void 0) style2.paddingRight = tcMar.right;
|
|
33739
|
+
if (tcMar.start !== void 0) style2.paddingStart = tcMar.start;
|
|
33740
|
+
if (tcMar.end !== void 0) style2.paddingEnd = tcMar.end;
|
|
33741
|
+
}
|
|
33742
|
+
const verticalAlign = parseTableCellVerticalAlign(cellProperties);
|
|
33743
|
+
if (verticalAlign) {
|
|
33744
|
+
style2.verticalAlign = verticalAlign;
|
|
33745
|
+
}
|
|
33746
|
+
const textDirection = parseTextDirection(
|
|
33747
|
+
getAttributeValue(
|
|
33748
|
+
getFirstChildByTagNameNS(cellProperties, WORD_NS, "textDirection"),
|
|
33749
|
+
"val"
|
|
33750
|
+
)
|
|
33751
|
+
);
|
|
33752
|
+
if (textDirection) {
|
|
33753
|
+
style2.textDirection = textDirection;
|
|
33754
|
+
}
|
|
33755
|
+
const noWrap = parseOnOffProperty(cellProperties, "noWrap");
|
|
33756
|
+
if (noWrap !== void 0) {
|
|
33757
|
+
style2.noWrap = noWrap;
|
|
33758
|
+
}
|
|
33759
|
+
const fitText = parseOnOffProperty(cellProperties, "tcFitText");
|
|
33760
|
+
if (fitText !== void 0) {
|
|
33761
|
+
style2.fitText = fitText;
|
|
33762
|
+
}
|
|
33763
|
+
const hideMark = parseOnOffProperty(cellProperties, "hideMark");
|
|
33764
|
+
if (hideMark !== void 0) {
|
|
33765
|
+
style2.hideMark = hideMark;
|
|
33766
|
+
}
|
|
33767
|
+
const headers = getAttributeValue(
|
|
33768
|
+
getFirstChildByTagNameNS(cellProperties, WORD_NS, "headers"),
|
|
33769
|
+
"val"
|
|
33770
|
+
);
|
|
33771
|
+
if (headers) {
|
|
33772
|
+
style2.headers = headers;
|
|
33773
|
+
}
|
|
33774
|
+
const change = getFirstChildByTagNameNS(
|
|
33775
|
+
cellProperties,
|
|
33776
|
+
WORD_NS,
|
|
33777
|
+
"tcPrChange"
|
|
33778
|
+
);
|
|
33779
|
+
const previousProperties = getFirstChildByTagNameNS(change, WORD_NS, "tcPr");
|
|
33780
|
+
if (change && previousProperties) {
|
|
33781
|
+
style2.propertyRevision = {
|
|
33782
|
+
...parseRevisionMetadata(change),
|
|
33783
|
+
type: "property",
|
|
33784
|
+
previous: parseTableCellStyle(previousProperties) ?? {}
|
|
33785
|
+
};
|
|
33786
|
+
}
|
|
33787
|
+
const inserted = getFirstChildByTagNameNS(cellProperties, WORD_NS, "cellIns");
|
|
33788
|
+
const deleted = getFirstChildByTagNameNS(cellProperties, WORD_NS, "cellDel");
|
|
33789
|
+
const merged = getFirstChildByTagNameNS(cellProperties, WORD_NS, "cellMerge");
|
|
33790
|
+
const structural = inserted ?? deleted ?? merged;
|
|
33791
|
+
if (structural) {
|
|
33792
|
+
const originalMerge = getAttributeValue(structural, "vMergeOrig");
|
|
33793
|
+
style2.revision = {
|
|
33794
|
+
...parseRevisionMetadata(structural),
|
|
33795
|
+
type: inserted ? "insert" : deleted ? "delete" : "merge",
|
|
33796
|
+
...merged && originalMerge ? {
|
|
33797
|
+
previous: {
|
|
33798
|
+
vMerge: originalMerge === "restart" ? "restart" : "continue"
|
|
33799
|
+
}
|
|
33800
|
+
} : {}
|
|
33801
|
+
};
|
|
33802
|
+
}
|
|
33803
|
+
for (const [key, border] of Object.entries(
|
|
33804
|
+
parseTableCellBorders(cellProperties)
|
|
33805
|
+
)) {
|
|
33806
|
+
if (border) {
|
|
33807
|
+
style2[key] = border;
|
|
33808
|
+
}
|
|
33809
|
+
}
|
|
33810
|
+
return emptyOrUndefined(style2);
|
|
33811
|
+
}
|
|
33812
|
+
function isTableHeaderRow(rowNode) {
|
|
33813
|
+
const rowProperties = getFirstChildByTagNameNS(rowNode, WORD_NS, "trPr");
|
|
33814
|
+
return rowProperties ? parseOnOffProperty(rowProperties, "tblHeader") === true : false;
|
|
33815
|
+
}
|
|
33816
|
+
function collapseCellAutospacing(paragraphs, flags) {
|
|
33817
|
+
var _a, _b;
|
|
33818
|
+
const styleOf = (paragraph) => paragraph.style ?? (paragraph.style = {});
|
|
33819
|
+
const lastIndex = paragraphs.length - 1;
|
|
33820
|
+
for (let index = 0; index < paragraphs.length; index += 1) {
|
|
33821
|
+
const flag = flags[index];
|
|
33822
|
+
if (!flag) {
|
|
33823
|
+
continue;
|
|
33824
|
+
}
|
|
33825
|
+
if (index === 0 && flag.before) {
|
|
33826
|
+
styleOf(paragraphs[index]).spacingBefore = 0;
|
|
33827
|
+
}
|
|
33828
|
+
if (index === lastIndex && flag.after) {
|
|
33829
|
+
styleOf(paragraphs[index]).spacingAfter = 0;
|
|
33830
|
+
}
|
|
33831
|
+
}
|
|
33832
|
+
for (let index = 0; index < lastIndex; index += 1) {
|
|
33833
|
+
if (!((_a = flags[index]) == null ? void 0 : _a.after) || !((_b = flags[index + 1]) == null ? void 0 : _b.before)) {
|
|
33834
|
+
continue;
|
|
33835
|
+
}
|
|
33836
|
+
const prev = styleOf(paragraphs[index]);
|
|
33837
|
+
const next = styleOf(paragraphs[index + 1]);
|
|
33838
|
+
if ((prev.spacingAfter ?? 0) >= (next.spacingBefore ?? 0)) {
|
|
33839
|
+
next.spacingBefore = 0;
|
|
33840
|
+
} else {
|
|
33841
|
+
prev.spacingAfter = 0;
|
|
32491
33842
|
}
|
|
32492
33843
|
}
|
|
32493
|
-
const cantSplit = parseOnOffProperty(trPr, "cantSplit");
|
|
32494
|
-
if (cantSplit !== void 0) style2.cantSplit = cantSplit;
|
|
32495
|
-
const hidden = parseOnOffProperty(trPr, "hidden");
|
|
32496
|
-
if (hidden !== void 0) style2.hidden = hidden;
|
|
32497
|
-
return Object.keys(style2).length > 0 ? style2 : void 0;
|
|
32498
33844
|
}
|
|
32499
33845
|
function parseImportedStyles(stylesXml, theme) {
|
|
32500
33846
|
if (!stylesXml) {
|
|
@@ -32566,8 +33912,6 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
32566
33912
|
let tableStyle;
|
|
32567
33913
|
if (type === "table") {
|
|
32568
33914
|
const tblPr = getFirstChildByTagNameNS(styleElement, WORD_NS, "tblPr");
|
|
32569
|
-
const tblInd = getFirstChildByTagNameNS(tblPr, WORD_NS, "tblInd");
|
|
32570
|
-
const indentLeft = twipsToPoints(getAttributeValue(tblInd, "w"));
|
|
32571
33915
|
const parseBandSize = (localName) => {
|
|
32572
33916
|
const raw = getAttributeValue(
|
|
32573
33917
|
getFirstChildByTagNameNS(tblPr, WORD_NS, localName),
|
|
@@ -32587,6 +33931,10 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
32587
33931
|
const condType = getAttributeValue(tblStylePr, "type");
|
|
32588
33932
|
if (!condType) continue;
|
|
32589
33933
|
const tcPr = getFirstChildByTagNameNS(tblStylePr, WORD_NS, "tcPr");
|
|
33934
|
+
const conditionalCellStyle = parseTableCellStyle(tcPr);
|
|
33935
|
+
const conditionalTableStyle = parseTableStyle(
|
|
33936
|
+
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "tblPr")
|
|
33937
|
+
);
|
|
32590
33938
|
const shd = getFirstChildByTagNameNS(tcPr, WORD_NS, "shd");
|
|
32591
33939
|
const fill = parseShdFill(shd);
|
|
32592
33940
|
const condTextStyle = parseRunStyle(
|
|
@@ -32601,22 +33949,23 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
32601
33949
|
const condParagraphStyle = parseParagraphStyle$1(
|
|
32602
33950
|
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "pPr")
|
|
32603
33951
|
);
|
|
32604
|
-
const condRowStyle =
|
|
33952
|
+
const condRowStyle = parseTableRowStyle(
|
|
32605
33953
|
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "trPr")
|
|
32606
33954
|
);
|
|
32607
|
-
if (fill || condTextStyle || condBorders || condParagraphStyle || condRowStyle) {
|
|
33955
|
+
if (fill || condTextStyle || condBorders || condParagraphStyle || condRowStyle || conditionalCellStyle || conditionalTableStyle) {
|
|
32608
33956
|
conditionalFormats[condType] = {
|
|
32609
33957
|
...fill ? { shading: fill } : {},
|
|
32610
33958
|
...condTextStyle ? { textStyle: condTextStyle } : {},
|
|
32611
33959
|
...condBorders ? { borders: condBorders } : {},
|
|
32612
33960
|
...condParagraphStyle ? { paragraphStyle: condParagraphStyle } : {},
|
|
32613
|
-
...condRowStyle ? { rowStyle: condRowStyle } : {}
|
|
33961
|
+
...condRowStyle ? { rowStyle: condRowStyle } : {},
|
|
33962
|
+
...conditionalCellStyle ? { cellStyle: conditionalCellStyle } : {},
|
|
33963
|
+
...conditionalTableStyle ? { tableStyle: conditionalTableStyle } : {}
|
|
32614
33964
|
};
|
|
32615
33965
|
}
|
|
32616
33966
|
}
|
|
32617
33967
|
tableStyle = {
|
|
32618
|
-
styleId: id,
|
|
32619
|
-
indentLeft,
|
|
33968
|
+
...parseTableStyle(tblPr, id) ?? { styleId: id },
|
|
32620
33969
|
...rowBandSize !== void 0 ? { rowBandSize } : {},
|
|
32621
33970
|
...colBandSize !== void 0 ? { colBandSize } : {},
|
|
32622
33971
|
...Object.keys(conditionalFormats).length > 0 ? { conditionalFormats } : {}
|
|
@@ -32630,6 +33979,7 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
32630
33979
|
id,
|
|
32631
33980
|
name,
|
|
32632
33981
|
type,
|
|
33982
|
+
isDefault: isWordTrue(getAttributeValue(styleElement, "default")),
|
|
32633
33983
|
basedOn,
|
|
32634
33984
|
nextStyle,
|
|
32635
33985
|
qFormat,
|
|
@@ -34057,7 +35407,7 @@ async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, a
|
|
|
34057
35407
|
};
|
|
34058
35408
|
}
|
|
34059
35409
|
const paragraphStyle = normalizeImportedParagraphStyle(
|
|
34060
|
-
|
|
35410
|
+
styleWithListIndent
|
|
34061
35411
|
);
|
|
34062
35412
|
const dropCapFrame = parseDropCapFrame(paragraphProperties, runs);
|
|
34063
35413
|
if (dropCapFrame) {
|
|
@@ -34101,8 +35451,7 @@ async function parseParagraphNode(paragraphNode, numberingMaps, zip, relsMap, as
|
|
|
34101
35451
|
relsMap,
|
|
34102
35452
|
assets,
|
|
34103
35453
|
theme,
|
|
34104
|
-
parseNestedBlocks
|
|
34105
|
-
inheritedStyle
|
|
35454
|
+
parseNestedBlocks
|
|
34106
35455
|
);
|
|
34107
35456
|
return parsed.paragraphs[0] ?? createEditorParagraphFromRuns([{ text: "" }]);
|
|
34108
35457
|
}
|
|
@@ -34124,521 +35473,7 @@ function parseTableLook(tblPr) {
|
|
|
34124
35473
|
noVBand: attr("noVBand") ?? bit(1024) ?? false
|
|
34125
35474
|
};
|
|
34126
35475
|
}
|
|
34127
|
-
function
|
|
34128
|
-
const isFirstRow = look.firstRow && rowIndex === 0;
|
|
34129
|
-
const isLastRow = look.lastRow && rowIndex === rowCount - 1 && rowIndex !== 0;
|
|
34130
|
-
const isFirstCol = look.firstCol && colIndex === 0;
|
|
34131
|
-
const isLastCol = look.lastCol && colIndex === colCount - 1 && colIndex !== 0;
|
|
34132
|
-
const keys = [];
|
|
34133
|
-
if (!look.noHBand && !isFirstRow && !isLastRow) {
|
|
34134
|
-
const bodyRow = rowIndex - (look.firstRow ? 1 : 0);
|
|
34135
|
-
const band = Math.floor(bodyRow / Math.max(1, rowBandSize)) % 2;
|
|
34136
|
-
keys.push(band === 0 ? "band1Horz" : "band2Horz");
|
|
34137
|
-
}
|
|
34138
|
-
if (!look.noVBand && !isFirstCol && !isLastCol) {
|
|
34139
|
-
const bodyCol = colIndex - (look.firstCol ? 1 : 0);
|
|
34140
|
-
const band = Math.floor(bodyCol / Math.max(1, colBandSize)) % 2;
|
|
34141
|
-
keys.push(band === 0 ? "band1Vert" : "band2Vert");
|
|
34142
|
-
}
|
|
34143
|
-
if (isLastCol) keys.push("lastCol");
|
|
34144
|
-
if (isFirstCol) keys.push("firstCol");
|
|
34145
|
-
if (isLastRow) keys.push("lastRow");
|
|
34146
|
-
if (isFirstRow) keys.push("firstRow");
|
|
34147
|
-
if (isFirstRow && isFirstCol) keys.push("nwCell");
|
|
34148
|
-
if (isFirstRow && isLastCol) keys.push("neCell");
|
|
34149
|
-
if (isLastRow && isFirstCol) keys.push("swCell");
|
|
34150
|
-
if (isLastRow && isLastCol) keys.push("seCell");
|
|
34151
|
-
return keys;
|
|
34152
|
-
}
|
|
34153
|
-
function mergeConditionalFormats(keys, conditionals) {
|
|
34154
|
-
const merged = {};
|
|
34155
|
-
if (!conditionals) {
|
|
34156
|
-
return merged;
|
|
34157
|
-
}
|
|
34158
|
-
for (const key of keys) {
|
|
34159
|
-
const cond = conditionals[key];
|
|
34160
|
-
if (!cond) continue;
|
|
34161
|
-
if (cond.shading) merged.shading = cond.shading;
|
|
34162
|
-
if (cond.textStyle) {
|
|
34163
|
-
merged.textStyle = { ...merged.textStyle, ...cond.textStyle };
|
|
34164
|
-
}
|
|
34165
|
-
if (cond.borders) {
|
|
34166
|
-
merged.borders = { ...merged.borders, ...cond.borders };
|
|
34167
|
-
}
|
|
34168
|
-
if (cond.paragraphStyle) {
|
|
34169
|
-
merged.paragraphStyle = {
|
|
34170
|
-
...merged.paragraphStyle,
|
|
34171
|
-
...cond.paragraphStyle
|
|
34172
|
-
};
|
|
34173
|
-
}
|
|
34174
|
-
if (cond.rowStyle) {
|
|
34175
|
-
merged.rowStyle = { ...merged.rowStyle, ...cond.rowStyle };
|
|
34176
|
-
}
|
|
34177
|
-
}
|
|
34178
|
-
return merged;
|
|
34179
|
-
}
|
|
34180
|
-
function applyConditionalTextStyle(paragraphs, textStyle) {
|
|
34181
|
-
if (!textStyle || Object.keys(textStyle).length === 0) {
|
|
34182
|
-
return;
|
|
34183
|
-
}
|
|
34184
|
-
for (const paragraph of paragraphs) {
|
|
34185
|
-
for (const run of paragraph.runs) {
|
|
34186
|
-
run.styles = { ...textStyle, ...run.styles };
|
|
34187
|
-
}
|
|
34188
|
-
}
|
|
34189
|
-
}
|
|
34190
|
-
function tableStyleParagraphInheritance(tableStylePPr, paragraphStyleId, styles) {
|
|
34191
|
-
if (!tableStylePPr) {
|
|
34192
|
-
return void 0;
|
|
34193
|
-
}
|
|
34194
|
-
const effectiveStyleId = paragraphStyleId ?? resolveDefaultParagraphStyleId(styles);
|
|
34195
|
-
const paragraphStyleDelta = resolveNamedParagraphStyle(
|
|
34196
|
-
effectiveStyleId,
|
|
34197
|
-
styles
|
|
34198
|
-
);
|
|
34199
|
-
const definedByParagraphStyle = new Set(Object.keys(paragraphStyleDelta));
|
|
34200
|
-
const filtered = {};
|
|
34201
|
-
for (const [key, value] of Object.entries(tableStylePPr)) {
|
|
34202
|
-
if (!definedByParagraphStyle.has(key)) {
|
|
34203
|
-
filtered[key] = value;
|
|
34204
|
-
}
|
|
34205
|
-
}
|
|
34206
|
-
return emptyOrUndefined(filtered);
|
|
34207
|
-
}
|
|
34208
|
-
function parseDocxWidthValue(element) {
|
|
34209
|
-
if (!element) {
|
|
34210
|
-
return void 0;
|
|
34211
|
-
}
|
|
34212
|
-
const type = getAttributeValue(element, "type");
|
|
34213
|
-
const raw = getAttributeValue(element, "w");
|
|
34214
|
-
if (type === "auto") {
|
|
34215
|
-
return "auto";
|
|
34216
|
-
}
|
|
34217
|
-
if (type === "pct") {
|
|
34218
|
-
if (!raw) {
|
|
34219
|
-
return void 0;
|
|
34220
|
-
}
|
|
34221
|
-
const pct = raw.trim().endsWith("%") ? Number.parseFloat(raw) : Number(raw) / 50;
|
|
34222
|
-
return Number.isFinite(pct) ? `${Math.round(pct * 1e4) / 1e4}%` : void 0;
|
|
34223
|
-
}
|
|
34224
|
-
return twipsToPoints(raw);
|
|
34225
|
-
}
|
|
34226
|
-
function parsePositiveIntegerProperty(parent, localName) {
|
|
34227
|
-
const element = getFirstChildByTagNameNS(parent, WORD_NS, localName);
|
|
34228
|
-
const raw = getAttributeValue(element, "val");
|
|
34229
|
-
const parsed = raw ? Number(raw) : Number.NaN;
|
|
34230
|
-
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : void 0;
|
|
34231
|
-
}
|
|
34232
|
-
function serializeChildXml(parent, localNames) {
|
|
34233
|
-
if (!parent) {
|
|
34234
|
-
return void 0;
|
|
34235
|
-
}
|
|
34236
|
-
const names = new Set(localNames);
|
|
34237
|
-
const serializer = new XMLSerializer();
|
|
34238
|
-
const result = [];
|
|
34239
|
-
const children2 = parent.childNodes;
|
|
34240
|
-
for (let index = 0; index < children2.length; index += 1) {
|
|
34241
|
-
const node = children2[index];
|
|
34242
|
-
if ((node == null ? void 0 : node.nodeType) === node.ELEMENT_NODE && node.namespaceURI === WORD_NS && names.has(node.localName ?? "")) {
|
|
34243
|
-
result.push(serializer.serializeToString(node));
|
|
34244
|
-
}
|
|
34245
|
-
}
|
|
34246
|
-
return result.length > 0 ? result : void 0;
|
|
34247
|
-
}
|
|
34248
|
-
function parseFloatingTableProperties(tblPr) {
|
|
34249
|
-
const tblpPr = getFirstChildByTagNameNS(tblPr, WORD_NS, "tblpPr");
|
|
34250
|
-
if (!tblpPr || !tblpPr.attributes || tblpPr.attributes.length === 0) {
|
|
34251
|
-
return void 0;
|
|
34252
|
-
}
|
|
34253
|
-
const floating = {};
|
|
34254
|
-
for (let index = 0; index < tblpPr.attributes.length; index += 1) {
|
|
34255
|
-
const attr = tblpPr.attributes.item(index);
|
|
34256
|
-
if ((attr == null ? void 0 : attr.namespaceURI) === WORD_NS || (attr == null ? void 0 : attr.prefix) === "w") {
|
|
34257
|
-
floating[attr.localName || attr.name.replace(/^w:/, "")] = attr.value;
|
|
34258
|
-
}
|
|
34259
|
-
}
|
|
34260
|
-
return Object.keys(floating).length > 0 ? floating : void 0;
|
|
34261
|
-
}
|
|
34262
|
-
function parseCellMargins(container) {
|
|
34263
|
-
if (!container) {
|
|
34264
|
-
return void 0;
|
|
34265
|
-
}
|
|
34266
|
-
const edgePt = (edge) => twipsToPoints(
|
|
34267
|
-
getAttributeValue(getFirstChildByTagNameNS(container, WORD_NS, edge), "w")
|
|
34268
|
-
);
|
|
34269
|
-
const margins = {};
|
|
34270
|
-
const top = edgePt("top");
|
|
34271
|
-
const right = edgePt("right");
|
|
34272
|
-
const bottom = edgePt("bottom");
|
|
34273
|
-
const left = edgePt("left");
|
|
34274
|
-
const start = edgePt("start");
|
|
34275
|
-
const end = edgePt("end");
|
|
34276
|
-
if (top !== void 0) margins.top = top;
|
|
34277
|
-
if (right !== void 0) margins.right = right;
|
|
34278
|
-
if (bottom !== void 0) margins.bottom = bottom;
|
|
34279
|
-
if (left !== void 0) margins.left = left;
|
|
34280
|
-
if (start !== void 0) margins.start = start;
|
|
34281
|
-
if (end !== void 0) margins.end = end;
|
|
34282
|
-
return Object.keys(margins).length > 0 ? margins : void 0;
|
|
34283
|
-
}
|
|
34284
|
-
function parseTableLayout(tblPr) {
|
|
34285
|
-
const value = getAttributeValue(
|
|
34286
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblLayout"),
|
|
34287
|
-
"type"
|
|
34288
|
-
);
|
|
34289
|
-
return value === "fixed" || value === "autofit" ? value : void 0;
|
|
34290
|
-
}
|
|
34291
|
-
function parseTableStyle(tblPr, tableStyleId) {
|
|
34292
|
-
const style2 = {};
|
|
34293
|
-
if (tableStyleId) {
|
|
34294
|
-
style2.styleId = tableStyleId;
|
|
34295
|
-
}
|
|
34296
|
-
const altTitle = getAttributeValue(
|
|
34297
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblCaption"),
|
|
34298
|
-
"val"
|
|
34299
|
-
);
|
|
34300
|
-
if (altTitle) {
|
|
34301
|
-
style2.altTitle = altTitle;
|
|
34302
|
-
}
|
|
34303
|
-
const altDescription = getAttributeValue(
|
|
34304
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblDescription"),
|
|
34305
|
-
"val"
|
|
34306
|
-
);
|
|
34307
|
-
if (altDescription) {
|
|
34308
|
-
style2.altDescription = altDescription;
|
|
34309
|
-
}
|
|
34310
|
-
const width = parseDocxWidthValue(
|
|
34311
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblW")
|
|
34312
|
-
);
|
|
34313
|
-
if (width !== void 0) {
|
|
34314
|
-
style2.width = width;
|
|
34315
|
-
}
|
|
34316
|
-
const indentLeft = parseDocxWidthValue(
|
|
34317
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblInd")
|
|
34318
|
-
);
|
|
34319
|
-
if (indentLeft !== void 0) {
|
|
34320
|
-
style2.indentLeft = indentLeft;
|
|
34321
|
-
}
|
|
34322
|
-
const jc = getAttributeValue(
|
|
34323
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "jc"),
|
|
34324
|
-
"val"
|
|
34325
|
-
);
|
|
34326
|
-
if (jc === "left" || jc === "center" || jc === "right") {
|
|
34327
|
-
style2.align = jc;
|
|
34328
|
-
}
|
|
34329
|
-
const layout = parseTableLayout(tblPr);
|
|
34330
|
-
if (layout) {
|
|
34331
|
-
style2.layout = layout;
|
|
34332
|
-
}
|
|
34333
|
-
const cellSpacing = parseDocxWidthValue(
|
|
34334
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblCellSpacing")
|
|
34335
|
-
);
|
|
34336
|
-
if (cellSpacing !== void 0) {
|
|
34337
|
-
style2.cellSpacing = cellSpacing;
|
|
34338
|
-
}
|
|
34339
|
-
const defaultCellMargins = parseCellMargins(
|
|
34340
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblCellMar")
|
|
34341
|
-
);
|
|
34342
|
-
if (defaultCellMargins) {
|
|
34343
|
-
style2.defaultCellMargins = defaultCellMargins;
|
|
34344
|
-
}
|
|
34345
|
-
const bidiVisual = tblPr ? parseOnOffProperty(tblPr, "bidiVisual") : void 0;
|
|
34346
|
-
if (bidiVisual !== void 0) {
|
|
34347
|
-
style2.bidiVisual = bidiVisual;
|
|
34348
|
-
}
|
|
34349
|
-
const tblOverlap = getAttributeValue(
|
|
34350
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblOverlap"),
|
|
34351
|
-
"val"
|
|
34352
|
-
);
|
|
34353
|
-
if (tblOverlap) {
|
|
34354
|
-
style2.tblOverlap = tblOverlap;
|
|
34355
|
-
}
|
|
34356
|
-
const floating = parseFloatingTableProperties(tblPr);
|
|
34357
|
-
if (floating) {
|
|
34358
|
-
style2.floating = floating;
|
|
34359
|
-
}
|
|
34360
|
-
const revisionXml = serializeChildXml(tblPr, ["tblPrChange"]);
|
|
34361
|
-
if (revisionXml) {
|
|
34362
|
-
style2.revisionXml = revisionXml;
|
|
34363
|
-
}
|
|
34364
|
-
return emptyOrUndefined(style2);
|
|
34365
|
-
}
|
|
34366
|
-
function parseTableRowStyle(rowProperties) {
|
|
34367
|
-
if (!rowProperties) {
|
|
34368
|
-
return void 0;
|
|
34369
|
-
}
|
|
34370
|
-
const style2 = {};
|
|
34371
|
-
const gridBefore = parsePositiveIntegerProperty(rowProperties, "gridBefore");
|
|
34372
|
-
if (gridBefore !== void 0) {
|
|
34373
|
-
style2.gridBefore = gridBefore;
|
|
34374
|
-
}
|
|
34375
|
-
const gridAfter = parsePositiveIntegerProperty(rowProperties, "gridAfter");
|
|
34376
|
-
if (gridAfter !== void 0) {
|
|
34377
|
-
style2.gridAfter = gridAfter;
|
|
34378
|
-
}
|
|
34379
|
-
const widthBefore = parseDocxWidthValue(
|
|
34380
|
-
getFirstChildByTagNameNS(rowProperties, WORD_NS, "wBefore")
|
|
34381
|
-
);
|
|
34382
|
-
if (widthBefore !== void 0) {
|
|
34383
|
-
style2.widthBefore = widthBefore;
|
|
34384
|
-
}
|
|
34385
|
-
const widthAfter = parseDocxWidthValue(
|
|
34386
|
-
getFirstChildByTagNameNS(rowProperties, WORD_NS, "wAfter")
|
|
34387
|
-
);
|
|
34388
|
-
if (widthAfter !== void 0) {
|
|
34389
|
-
style2.widthAfter = widthAfter;
|
|
34390
|
-
}
|
|
34391
|
-
const trHeight = getFirstChildByTagNameNS(rowProperties, WORD_NS, "trHeight");
|
|
34392
|
-
const height = twipsToPoints(getAttributeValue(trHeight, "val"));
|
|
34393
|
-
if (height !== void 0) {
|
|
34394
|
-
style2.height = height;
|
|
34395
|
-
}
|
|
34396
|
-
const hRule = getAttributeValue(trHeight, "hRule");
|
|
34397
|
-
if (hRule === "auto" || hRule === "exact" || hRule === "atLeast") {
|
|
34398
|
-
style2.heightRule = hRule;
|
|
34399
|
-
}
|
|
34400
|
-
const cellSpacing = parseDocxWidthValue(
|
|
34401
|
-
getFirstChildByTagNameNS(rowProperties, WORD_NS, "tblCellSpacing")
|
|
34402
|
-
);
|
|
34403
|
-
if (cellSpacing !== void 0) {
|
|
34404
|
-
style2.cellSpacing = cellSpacing;
|
|
34405
|
-
}
|
|
34406
|
-
const cantSplit = parseOnOffProperty(rowProperties, "cantSplit");
|
|
34407
|
-
if (cantSplit !== void 0) {
|
|
34408
|
-
style2.cantSplit = cantSplit;
|
|
34409
|
-
}
|
|
34410
|
-
const hidden = parseOnOffProperty(rowProperties, "hidden");
|
|
34411
|
-
if (hidden !== void 0) {
|
|
34412
|
-
style2.hidden = hidden;
|
|
34413
|
-
}
|
|
34414
|
-
const revisionXml = serializeChildXml(rowProperties, [
|
|
34415
|
-
"trPrChange",
|
|
34416
|
-
"ins",
|
|
34417
|
-
"del"
|
|
34418
|
-
]);
|
|
34419
|
-
if (revisionXml) {
|
|
34420
|
-
style2.revisionXml = revisionXml;
|
|
34421
|
-
}
|
|
34422
|
-
return emptyOrUndefined(style2);
|
|
34423
|
-
}
|
|
34424
|
-
function getTableCellColSpan(cellProperties) {
|
|
34425
|
-
if (!cellProperties) {
|
|
34426
|
-
return 1;
|
|
34427
|
-
}
|
|
34428
|
-
const gridSpan = getFirstChildByTagNameNS(
|
|
34429
|
-
cellProperties,
|
|
34430
|
-
WORD_NS,
|
|
34431
|
-
"gridSpan"
|
|
34432
|
-
);
|
|
34433
|
-
const value = getAttributeValue(gridSpan, "val");
|
|
34434
|
-
const parsed = value ? Number(value) : 1;
|
|
34435
|
-
return Number.isFinite(parsed) && parsed > 1 ? Math.floor(parsed) : 1;
|
|
34436
|
-
}
|
|
34437
|
-
function getTableCellVMerge(cellProperties) {
|
|
34438
|
-
if (!cellProperties) {
|
|
34439
|
-
return void 0;
|
|
34440
|
-
}
|
|
34441
|
-
const vMerge = getFirstChildByTagNameNS(cellProperties, WORD_NS, "vMerge");
|
|
34442
|
-
if (!vMerge) {
|
|
34443
|
-
return void 0;
|
|
34444
|
-
}
|
|
34445
|
-
const value = getAttributeValue(vMerge, "val");
|
|
34446
|
-
return value === "restart" ? "restart" : "continue";
|
|
34447
|
-
}
|
|
34448
|
-
function parseTableCellVerticalAlign(cellProperties) {
|
|
34449
|
-
if (!cellProperties) {
|
|
34450
|
-
return void 0;
|
|
34451
|
-
}
|
|
34452
|
-
const vAlign = getFirstChildByTagNameNS(cellProperties, WORD_NS, "vAlign");
|
|
34453
|
-
const value = getAttributeValue(vAlign, "val");
|
|
34454
|
-
if (value === "top" || value === "bottom") {
|
|
34455
|
-
return value;
|
|
34456
|
-
}
|
|
34457
|
-
if (value === "center") {
|
|
34458
|
-
return "middle";
|
|
34459
|
-
}
|
|
34460
|
-
return void 0;
|
|
34461
|
-
}
|
|
34462
|
-
function parseTableCellBorders(cellProperties) {
|
|
34463
|
-
if (!cellProperties) {
|
|
34464
|
-
return {};
|
|
34465
|
-
}
|
|
34466
|
-
return parseDocxBoxBorders(
|
|
34467
|
-
getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcBorders")
|
|
34468
|
-
);
|
|
34469
|
-
}
|
|
34470
|
-
function parseTableCellStyle(cellProperties, tableDefaultMargins) {
|
|
34471
|
-
if (!cellProperties) {
|
|
34472
|
-
if (!tableDefaultMargins) {
|
|
34473
|
-
return void 0;
|
|
34474
|
-
}
|
|
34475
|
-
return emptyOrUndefined({
|
|
34476
|
-
paddingTop: tableDefaultMargins.top,
|
|
34477
|
-
paddingRight: tableDefaultMargins.right,
|
|
34478
|
-
paddingBottom: tableDefaultMargins.bottom,
|
|
34479
|
-
paddingLeft: tableDefaultMargins.left,
|
|
34480
|
-
paddingStart: tableDefaultMargins.start,
|
|
34481
|
-
paddingEnd: tableDefaultMargins.end
|
|
34482
|
-
});
|
|
34483
|
-
}
|
|
34484
|
-
const style2 = {
|
|
34485
|
-
...(tableDefaultMargins == null ? void 0 : tableDefaultMargins.top) !== void 0 ? { paddingTop: tableDefaultMargins.top } : {},
|
|
34486
|
-
...(tableDefaultMargins == null ? void 0 : tableDefaultMargins.right) !== void 0 ? { paddingRight: tableDefaultMargins.right } : {},
|
|
34487
|
-
...(tableDefaultMargins == null ? void 0 : tableDefaultMargins.bottom) !== void 0 ? { paddingBottom: tableDefaultMargins.bottom } : {},
|
|
34488
|
-
...(tableDefaultMargins == null ? void 0 : tableDefaultMargins.left) !== void 0 ? { paddingLeft: tableDefaultMargins.left } : {},
|
|
34489
|
-
...(tableDefaultMargins == null ? void 0 : tableDefaultMargins.start) !== void 0 ? { paddingStart: tableDefaultMargins.start } : {},
|
|
34490
|
-
...(tableDefaultMargins == null ? void 0 : tableDefaultMargins.end) !== void 0 ? { paddingEnd: tableDefaultMargins.end } : {}
|
|
34491
|
-
};
|
|
34492
|
-
const shading = getFirstChildByTagNameNS(cellProperties, WORD_NS, "shd");
|
|
34493
|
-
const fill = parseShdFill(shading);
|
|
34494
|
-
if (fill) {
|
|
34495
|
-
style2.shading = fill;
|
|
34496
|
-
}
|
|
34497
|
-
const cellWidth = getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcW");
|
|
34498
|
-
const cellWidthType = getAttributeValue(cellWidth, "type");
|
|
34499
|
-
const cellWidthValue = getAttributeValue(cellWidth, "w");
|
|
34500
|
-
if (cellWidthType === "dxa") {
|
|
34501
|
-
const width = twipsToPoints(cellWidthValue);
|
|
34502
|
-
if (width !== void 0) {
|
|
34503
|
-
style2.width = width;
|
|
34504
|
-
}
|
|
34505
|
-
} else if (cellWidthType === "pct" && cellWidthValue) {
|
|
34506
|
-
const pct = Number(cellWidthValue);
|
|
34507
|
-
if (Number.isFinite(pct)) {
|
|
34508
|
-
style2.width = `${Math.round(pct / 50 * 1e4) / 1e4}%`;
|
|
34509
|
-
}
|
|
34510
|
-
}
|
|
34511
|
-
const tcMar = parseCellMargins(
|
|
34512
|
-
getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcMar")
|
|
34513
|
-
);
|
|
34514
|
-
if (tcMar) {
|
|
34515
|
-
if (tcMar.top !== void 0) style2.paddingTop = tcMar.top;
|
|
34516
|
-
if (tcMar.bottom !== void 0) style2.paddingBottom = tcMar.bottom;
|
|
34517
|
-
if (tcMar.left !== void 0) style2.paddingLeft = tcMar.left;
|
|
34518
|
-
if (tcMar.right !== void 0) style2.paddingRight = tcMar.right;
|
|
34519
|
-
if (tcMar.start !== void 0) style2.paddingStart = tcMar.start;
|
|
34520
|
-
if (tcMar.end !== void 0) style2.paddingEnd = tcMar.end;
|
|
34521
|
-
}
|
|
34522
|
-
const verticalAlign = parseTableCellVerticalAlign(cellProperties);
|
|
34523
|
-
if (verticalAlign) {
|
|
34524
|
-
style2.verticalAlign = verticalAlign;
|
|
34525
|
-
}
|
|
34526
|
-
const textDirection = parseTextDirection(
|
|
34527
|
-
getAttributeValue(
|
|
34528
|
-
getFirstChildByTagNameNS(cellProperties, WORD_NS, "textDirection"),
|
|
34529
|
-
"val"
|
|
34530
|
-
)
|
|
34531
|
-
);
|
|
34532
|
-
if (textDirection) {
|
|
34533
|
-
style2.textDirection = textDirection;
|
|
34534
|
-
}
|
|
34535
|
-
const noWrap = parseOnOffProperty(cellProperties, "noWrap");
|
|
34536
|
-
if (noWrap !== void 0) {
|
|
34537
|
-
style2.noWrap = noWrap;
|
|
34538
|
-
}
|
|
34539
|
-
const fitText = parseOnOffProperty(cellProperties, "tcFitText");
|
|
34540
|
-
if (fitText !== void 0) {
|
|
34541
|
-
style2.fitText = fitText;
|
|
34542
|
-
}
|
|
34543
|
-
const hideMark = parseOnOffProperty(cellProperties, "hideMark");
|
|
34544
|
-
if (hideMark !== void 0) {
|
|
34545
|
-
style2.hideMark = hideMark;
|
|
34546
|
-
}
|
|
34547
|
-
const headers = getAttributeValue(
|
|
34548
|
-
getFirstChildByTagNameNS(cellProperties, WORD_NS, "headers"),
|
|
34549
|
-
"val"
|
|
34550
|
-
);
|
|
34551
|
-
if (headers) {
|
|
34552
|
-
style2.headers = headers;
|
|
34553
|
-
}
|
|
34554
|
-
const revisionXml = serializeChildXml(cellProperties, [
|
|
34555
|
-
"tcPrChange",
|
|
34556
|
-
"cellIns",
|
|
34557
|
-
"cellDel",
|
|
34558
|
-
"cellMerge"
|
|
34559
|
-
]);
|
|
34560
|
-
if (revisionXml) {
|
|
34561
|
-
style2.revisionXml = revisionXml;
|
|
34562
|
-
}
|
|
34563
|
-
for (const [key, border] of Object.entries(
|
|
34564
|
-
parseTableCellBorders(cellProperties)
|
|
34565
|
-
)) {
|
|
34566
|
-
if (border) {
|
|
34567
|
-
style2[key] = border;
|
|
34568
|
-
}
|
|
34569
|
-
}
|
|
34570
|
-
return emptyOrUndefined(style2);
|
|
34571
|
-
}
|
|
34572
|
-
function isTableHeaderRow(rowNode) {
|
|
34573
|
-
const rowProperties = getFirstChildByTagNameNS(rowNode, WORD_NS, "trPr");
|
|
34574
|
-
return rowProperties ? parseOnOffProperty(rowProperties, "tblHeader") === true : false;
|
|
34575
|
-
}
|
|
34576
|
-
function collapseCellAutospacing(paragraphs, flags) {
|
|
34577
|
-
var _a, _b;
|
|
34578
|
-
const styleOf = (paragraph) => paragraph.style ?? (paragraph.style = {});
|
|
34579
|
-
const lastIndex = paragraphs.length - 1;
|
|
34580
|
-
for (let index = 0; index < paragraphs.length; index += 1) {
|
|
34581
|
-
const flag = flags[index];
|
|
34582
|
-
if (!flag) {
|
|
34583
|
-
continue;
|
|
34584
|
-
}
|
|
34585
|
-
if (index === 0 && flag.before) {
|
|
34586
|
-
styleOf(paragraphs[index]).spacingBefore = 0;
|
|
34587
|
-
}
|
|
34588
|
-
if (index === lastIndex && flag.after) {
|
|
34589
|
-
styleOf(paragraphs[index]).spacingAfter = 0;
|
|
34590
|
-
}
|
|
34591
|
-
}
|
|
34592
|
-
for (let index = 0; index < lastIndex; index += 1) {
|
|
34593
|
-
if (!((_a = flags[index]) == null ? void 0 : _a.after) || !((_b = flags[index + 1]) == null ? void 0 : _b.before)) {
|
|
34594
|
-
continue;
|
|
34595
|
-
}
|
|
34596
|
-
const prev = styleOf(paragraphs[index]);
|
|
34597
|
-
const next = styleOf(paragraphs[index + 1]);
|
|
34598
|
-
if ((prev.spacingAfter ?? 0) >= (next.spacingBefore ?? 0)) {
|
|
34599
|
-
next.spacingBefore = 0;
|
|
34600
|
-
} else {
|
|
34601
|
-
prev.spacingAfter = 0;
|
|
34602
|
-
}
|
|
34603
|
-
}
|
|
34604
|
-
}
|
|
34605
|
-
function applyTableBordersToRows(rows, tblBorders) {
|
|
34606
|
-
if (Object.keys(tblBorders).length === 0) {
|
|
34607
|
-
return;
|
|
34608
|
-
}
|
|
34609
|
-
const lastRowIndex = rows.length - 1;
|
|
34610
|
-
for (let rowIndex = 0; rowIndex <= lastRowIndex; rowIndex += 1) {
|
|
34611
|
-
const row = rows[rowIndex];
|
|
34612
|
-
const lastColIndex = row.cells.length - 1;
|
|
34613
|
-
for (let colIndex = 0; colIndex <= lastColIndex; colIndex += 1) {
|
|
34614
|
-
const cell = row.cells[colIndex];
|
|
34615
|
-
const style2 = cell.style ?? {};
|
|
34616
|
-
if (rowIndex === 0 && style2.borderTop === void 0 && tblBorders.borderTop) {
|
|
34617
|
-
style2.borderTop = tblBorders.borderTop;
|
|
34618
|
-
}
|
|
34619
|
-
if (rowIndex === lastRowIndex && style2.borderBottom === void 0 && tblBorders.borderBottom) {
|
|
34620
|
-
style2.borderBottom = tblBorders.borderBottom;
|
|
34621
|
-
}
|
|
34622
|
-
if (colIndex === 0 && style2.borderLeft === void 0 && tblBorders.borderLeft) {
|
|
34623
|
-
style2.borderLeft = tblBorders.borderLeft;
|
|
34624
|
-
}
|
|
34625
|
-
if (colIndex === lastColIndex && style2.borderRight === void 0 && tblBorders.borderRight) {
|
|
34626
|
-
style2.borderRight = tblBorders.borderRight;
|
|
34627
|
-
}
|
|
34628
|
-
if (rowIndex < lastRowIndex && style2.borderBottom === void 0 && tblBorders.borderInsideH) {
|
|
34629
|
-
style2.borderBottom = tblBorders.borderInsideH;
|
|
34630
|
-
}
|
|
34631
|
-
if (colIndex < lastColIndex && style2.borderRight === void 0 && tblBorders.borderInsideV) {
|
|
34632
|
-
style2.borderRight = tblBorders.borderInsideV;
|
|
34633
|
-
}
|
|
34634
|
-
if (Object.keys(style2).length > 0 && cell.style !== style2) {
|
|
34635
|
-
cell.style = style2;
|
|
34636
|
-
}
|
|
34637
|
-
}
|
|
34638
|
-
}
|
|
34639
|
-
}
|
|
34640
|
-
async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, styles) {
|
|
34641
|
-
var _a, _b;
|
|
35476
|
+
async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, _styles) {
|
|
34642
35477
|
const gridCols = [];
|
|
34643
35478
|
const tblGrid = getFirstChildByTagNameNS(tableNode, WORD_NS, "tblGrid");
|
|
34644
35479
|
if (tblGrid) {
|
|
@@ -34660,39 +35495,14 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34660
35495
|
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblStyle"),
|
|
34661
35496
|
"val"
|
|
34662
35497
|
);
|
|
34663
|
-
const inheritedParagraphStyle = tableStyleId && ((_a = styles == null ? void 0 : styles[tableStyleId]) == null ? void 0 : _a.paragraphStyle) ? styles[tableStyleId].paragraphStyle : void 0;
|
|
34664
|
-
const tblBorders = parseDocxTableBorders(
|
|
34665
|
-
getFirstChildByTagNameNS(tblPr, WORD_NS, "tblBorders")
|
|
34666
|
-
);
|
|
34667
|
-
const tableStyleDef = tableStyleId ? (_b = styles == null ? void 0 : styles[tableStyleId]) == null ? void 0 : _b.tableStyle : void 0;
|
|
34668
35498
|
const directTableStyle = parseTableStyle(tblPr, tableStyleId ?? void 0);
|
|
34669
|
-
const tableDefaultMargins = directTableStyle == null ? void 0 : directTableStyle.defaultCellMargins;
|
|
34670
|
-
const tblConditionals = (tableStyleDef == null ? void 0 : tableStyleDef.conditionalFormats) ?? void 0;
|
|
34671
35499
|
const look = parseTableLook(tblPr);
|
|
34672
|
-
const rowBandSize = (tableStyleDef == null ? void 0 : tableStyleDef.rowBandSize) ?? 1;
|
|
34673
|
-
const colBandSize = (tableStyleDef == null ? void 0 : tableStyleDef.colBandSize) ?? 1;
|
|
34674
35500
|
const rowNodes = getChildrenByTagNameNS(tableNode, WORD_NS, "tr");
|
|
34675
|
-
const rowCount = rowNodes.length;
|
|
34676
|
-
const colCount = gridCols.length > 0 ? gridCols.length : rowNodes.reduce(
|
|
34677
|
-
(max, node) => Math.max(max, getChildrenByTagNameNS(node, WORD_NS, "tc").length),
|
|
34678
|
-
0
|
|
34679
|
-
);
|
|
34680
35501
|
const rows = [];
|
|
34681
35502
|
for (let rowIndex = 0; rowIndex < rowNodes.length; rowIndex += 1) {
|
|
34682
35503
|
const rowNode = rowNodes[rowIndex];
|
|
34683
35504
|
const rowProperties = getFirstChildByTagNameNS(rowNode, WORD_NS, "trPr");
|
|
34684
|
-
const
|
|
34685
|
-
rowProperties,
|
|
34686
|
-
WORD_NS,
|
|
34687
|
-
"cnfStyle"
|
|
34688
|
-
);
|
|
34689
|
-
const explicitRowKeys = [];
|
|
34690
|
-
if (getAttributeValue(cnfStyle, "firstRow") === "1") {
|
|
34691
|
-
explicitRowKeys.push("firstRow");
|
|
34692
|
-
}
|
|
34693
|
-
if (getAttributeValue(cnfStyle, "lastRow") === "1") {
|
|
34694
|
-
explicitRowKeys.push("lastRow");
|
|
34695
|
-
}
|
|
35505
|
+
const rowConditionalStyle = parseTableConditionalFlags(rowProperties);
|
|
34696
35506
|
const cellNodes = getChildrenByTagNameNS(rowNode, WORD_NS, "tc");
|
|
34697
35507
|
const cells = [];
|
|
34698
35508
|
for (let colIndex = 0; colIndex < cellNodes.length; colIndex += 1) {
|
|
@@ -34709,19 +35519,6 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34709
35519
|
WORD_NS,
|
|
34710
35520
|
"p"
|
|
34711
35521
|
)) {
|
|
34712
|
-
const paragraphStyleId = getAttributeValue(
|
|
34713
|
-
getFirstChildByTagNameNS(
|
|
34714
|
-
getFirstChildByTagNameNS(paragraphNode, WORD_NS, "pPr"),
|
|
34715
|
-
WORD_NS,
|
|
34716
|
-
"pStyle"
|
|
34717
|
-
),
|
|
34718
|
-
"val"
|
|
34719
|
-
) ?? void 0;
|
|
34720
|
-
const cellInheritedStyle = tableStyleParagraphInheritance(
|
|
34721
|
-
inheritedParagraphStyle,
|
|
34722
|
-
paragraphStyleId,
|
|
34723
|
-
styles
|
|
34724
|
-
);
|
|
34725
35522
|
paragraphs.push(
|
|
34726
35523
|
await parseParagraphNode(
|
|
34727
35524
|
paragraphNode,
|
|
@@ -34730,8 +35527,7 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34730
35527
|
relsMap,
|
|
34731
35528
|
assets,
|
|
34732
35529
|
theme,
|
|
34733
|
-
parseNestedBlocks
|
|
34734
|
-
cellInheritedStyle
|
|
35530
|
+
parseNestedBlocks
|
|
34735
35531
|
)
|
|
34736
35532
|
);
|
|
34737
35533
|
autospacingFlags.push(
|
|
@@ -34743,55 +35539,14 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34743
35539
|
collapseCellAutospacing(paragraphs, autospacingFlags);
|
|
34744
35540
|
const colSpan = getTableCellColSpan(cellProperties);
|
|
34745
35541
|
const vMerge = getTableCellVMerge(cellProperties);
|
|
34746
|
-
const cellStyle = parseTableCellStyle(cellProperties
|
|
34747
|
-
const conditional = mergeConditionalFormats(
|
|
34748
|
-
[
|
|
34749
|
-
...resolveCellConditionalKeys(
|
|
34750
|
-
rowIndex,
|
|
34751
|
-
colIndex,
|
|
34752
|
-
rowCount,
|
|
34753
|
-
colCount,
|
|
34754
|
-
look,
|
|
34755
|
-
rowBandSize,
|
|
34756
|
-
colBandSize
|
|
34757
|
-
),
|
|
34758
|
-
...explicitRowKeys
|
|
34759
|
-
],
|
|
34760
|
-
tblConditionals
|
|
34761
|
-
);
|
|
34762
|
-
applyConditionalTextStyle(paragraphs, conditional.textStyle);
|
|
34763
|
-
if (conditional.paragraphStyle) {
|
|
34764
|
-
const condPStyle = conditional.paragraphStyle;
|
|
34765
|
-
for (const paragraph of paragraphs) {
|
|
34766
|
-
paragraph.style = { ...condPStyle, ...paragraph.style };
|
|
34767
|
-
}
|
|
34768
|
-
}
|
|
35542
|
+
const cellStyle = parseTableCellStyle(cellProperties);
|
|
34769
35543
|
const cell = createEditorTableCell(
|
|
34770
35544
|
paragraphs.length > 0 ? paragraphs : [createEditorParagraphFromRuns([{ text: "" }])],
|
|
34771
35545
|
colSpan,
|
|
34772
35546
|
vMerge === "restart" ? { rowSpan: 1, vMerge } : vMerge ? { vMerge } : void 0
|
|
34773
35547
|
);
|
|
34774
|
-
|
|
34775
|
-
|
|
34776
|
-
if (resolvedShading) {
|
|
34777
|
-
mergedStyle.shading = resolvedShading;
|
|
34778
|
-
}
|
|
34779
|
-
if (conditional.borders) {
|
|
34780
|
-
for (const edge of [
|
|
34781
|
-
"borderTop",
|
|
34782
|
-
"borderRight",
|
|
34783
|
-
"borderBottom",
|
|
34784
|
-
"borderLeft"
|
|
34785
|
-
]) {
|
|
34786
|
-
const border = conditional.borders[edge];
|
|
34787
|
-
if (mergedStyle[edge] === void 0 && border) {
|
|
34788
|
-
mergedStyle[edge] = border;
|
|
34789
|
-
}
|
|
34790
|
-
}
|
|
34791
|
-
}
|
|
34792
|
-
if (Object.keys(mergedStyle).length > 0) {
|
|
34793
|
-
cell.style = mergedStyle;
|
|
34794
|
-
}
|
|
35548
|
+
if (cellStyle) cell.style = cellStyle;
|
|
35549
|
+
cell.conditionalStyle = parseTableConditionalFlags(cellProperties);
|
|
34795
35550
|
if (vMerge === "continue") {
|
|
34796
35551
|
cell.blocks = [];
|
|
34797
35552
|
}
|
|
@@ -34805,33 +35560,13 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34805
35560
|
if (rowStyle) {
|
|
34806
35561
|
row.style = rowStyle;
|
|
34807
35562
|
}
|
|
34808
|
-
|
|
34809
|
-
const rowKeys = resolveCellConditionalKeys(
|
|
34810
|
-
rowIndex,
|
|
34811
|
-
0,
|
|
34812
|
-
rowCount,
|
|
34813
|
-
Math.max(1, colCount),
|
|
34814
|
-
look,
|
|
34815
|
-
rowBandSize,
|
|
34816
|
-
colBandSize
|
|
34817
|
-
).filter(
|
|
34818
|
-
(k) => k === "firstRow" || k === "lastRow" || k === "band1Horz" || k === "band2Horz"
|
|
34819
|
-
);
|
|
34820
|
-
const mergedRowConditional = mergeConditionalFormats(
|
|
34821
|
-
[...explicitRowKeys, ...rowKeys],
|
|
34822
|
-
tblConditionals
|
|
34823
|
-
);
|
|
34824
|
-
if (mergedRowConditional.rowStyle) {
|
|
34825
|
-
row.style = { ...mergedRowConditional.rowStyle, ...row.style };
|
|
34826
|
-
}
|
|
34827
|
-
}
|
|
35563
|
+
row.conditionalStyle = rowConditionalStyle;
|
|
34828
35564
|
const tblPrEx = getFirstChildByTagNameNS(rowNode, WORD_NS, "tblPrEx");
|
|
34829
35565
|
if (tblPrEx) {
|
|
34830
35566
|
row.tblPrExXml = new XMLSerializer().serializeToString(tblPrEx);
|
|
34831
35567
|
}
|
|
34832
35568
|
rows.push(row);
|
|
34833
35569
|
}
|
|
34834
|
-
applyTableBordersToRows(rows, tblBorders);
|
|
34835
35570
|
for (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) {
|
|
34836
35571
|
const row = rows[rowIndex];
|
|
34837
35572
|
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
@@ -34865,9 +35600,21 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
34865
35600
|
table.style = { tblLook: look };
|
|
34866
35601
|
}
|
|
34867
35602
|
if (tblGridChangeXml) {
|
|
34868
|
-
|
|
34869
|
-
tblGridChangeXml
|
|
35603
|
+
const previousGrid = getFirstChildByTagNameNS(
|
|
35604
|
+
tblGridChangeXml,
|
|
35605
|
+
WORD_NS,
|
|
35606
|
+
"tblGrid"
|
|
34870
35607
|
);
|
|
35608
|
+
const previous = previousGrid ? getChildrenByTagNameNS(previousGrid, WORD_NS, "gridCol").map((gridCol) => twipsToPoints(getAttributeValue(gridCol, "w"))).filter((width) => width !== void 0) : [];
|
|
35609
|
+
const rawDate = getAttributeValue(tblGridChangeXml, "date");
|
|
35610
|
+
const parsedDate = rawDate ? Date.parse(rawDate) : Number.NaN;
|
|
35611
|
+
table.gridRevision = {
|
|
35612
|
+
id: getAttributeValue(tblGridChangeXml, "id") ?? "revision:grid",
|
|
35613
|
+
author: getAttributeValue(tblGridChangeXml, "author") ?? "Unknown",
|
|
35614
|
+
date: Number.isFinite(parsedDate) ? parsedDate : 0,
|
|
35615
|
+
type: "grid",
|
|
35616
|
+
previous
|
|
35617
|
+
};
|
|
34871
35618
|
}
|
|
34872
35619
|
return table;
|
|
34873
35620
|
}
|
|
@@ -34972,8 +35719,7 @@ async function parseHeaderFooterXml(xmlContent, numberingMaps, zip, relsMap, ass
|
|
|
34972
35719
|
relsMap,
|
|
34973
35720
|
assets,
|
|
34974
35721
|
theme,
|
|
34975
|
-
parseNestedBlocks
|
|
34976
|
-
styles
|
|
35722
|
+
parseNestedBlocks
|
|
34977
35723
|
)
|
|
34978
35724
|
);
|
|
34979
35725
|
}
|
|
@@ -35041,8 +35787,7 @@ async function parseDocxNotesXml(kind, xmlContent, numberingMaps, zip, relsMap,
|
|
|
35041
35787
|
relsMap,
|
|
35042
35788
|
assets,
|
|
35043
35789
|
theme,
|
|
35044
|
-
parseNestedBlocks
|
|
35045
|
-
styles
|
|
35790
|
+
parseNestedBlocks
|
|
35046
35791
|
)
|
|
35047
35792
|
);
|
|
35048
35793
|
}
|
|
@@ -35083,8 +35828,7 @@ async function parseFootnotesXml(xmlContent, numberingMaps, zip, relsMap, assets
|
|
|
35083
35828
|
zip,
|
|
35084
35829
|
relsMap,
|
|
35085
35830
|
assets,
|
|
35086
|
-
theme
|
|
35087
|
-
styles
|
|
35831
|
+
theme
|
|
35088
35832
|
);
|
|
35089
35833
|
return {
|
|
35090
35834
|
byDocxId: parsed.byDocxId,
|
|
@@ -35101,8 +35845,7 @@ async function parseEndnotesXml(xmlContent, numberingMaps, zip, relsMap, assets,
|
|
|
35101
35845
|
zip,
|
|
35102
35846
|
relsMap,
|
|
35103
35847
|
assets,
|
|
35104
|
-
theme
|
|
35105
|
-
styles
|
|
35848
|
+
theme
|
|
35106
35849
|
);
|
|
35107
35850
|
return {
|
|
35108
35851
|
byDocxId: parsed.byDocxId,
|
|
@@ -35481,8 +36224,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35481
36224
|
relsMap,
|
|
35482
36225
|
assets,
|
|
35483
36226
|
theme,
|
|
35484
|
-
parseNestedBlocks
|
|
35485
|
-
importedStyles
|
|
36227
|
+
parseNestedBlocks
|
|
35486
36228
|
)
|
|
35487
36229
|
);
|
|
35488
36230
|
reportBodyProgress();
|
|
@@ -35550,8 +36292,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35550
36292
|
zip,
|
|
35551
36293
|
partRelsMap,
|
|
35552
36294
|
assets,
|
|
35553
|
-
theme
|
|
35554
|
-
importedStyles
|
|
36295
|
+
theme
|
|
35555
36296
|
);
|
|
35556
36297
|
applyDocGridLinePitch(
|
|
35557
36298
|
partBlocks,
|
|
@@ -35611,8 +36352,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35611
36352
|
zip,
|
|
35612
36353
|
footnotesPartRels,
|
|
35613
36354
|
assets,
|
|
35614
|
-
theme
|
|
35615
|
-
importedStyles
|
|
36355
|
+
theme
|
|
35616
36356
|
);
|
|
35617
36357
|
if (docSettings.footnoteSettings) {
|
|
35618
36358
|
parsedFootnotes.footnotes.settings = docSettings.footnoteSettings;
|
|
@@ -35627,8 +36367,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
35627
36367
|
zip,
|
|
35628
36368
|
endnotesPartRels,
|
|
35629
36369
|
assets,
|
|
35630
|
-
theme
|
|
35631
|
-
importedStyles
|
|
36370
|
+
theme
|
|
35632
36371
|
);
|
|
35633
36372
|
if (docSettings.endnoteSettings) {
|
|
35634
36373
|
parsedEndnotes.endnotes.settings = docSettings.endnoteSettings;
|
|
@@ -35841,7 +36580,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
35841
36580
|
const worker = new Worker(
|
|
35842
36581
|
new URL(
|
|
35843
36582
|
/* @vite-ignore */
|
|
35844
|
-
"" + new URL("assets/importDocxWorker-
|
|
36583
|
+
"" + new URL("assets/importDocxWorker-BN5o1geV.js", import.meta.url).href,
|
|
35845
36584
|
import.meta.url
|
|
35846
36585
|
),
|
|
35847
36586
|
{
|
|
@@ -40206,7 +40945,7 @@ export {
|
|
|
40206
40945
|
createRenderEffect as Z,
|
|
40207
40946
|
style as _,
|
|
40208
40947
|
assertNever as a,
|
|
40209
|
-
|
|
40948
|
+
loadFontAsset as a$,
|
|
40210
40949
|
setStyleProperty as a0,
|
|
40211
40950
|
memo as a1,
|
|
40212
40951
|
template as a2,
|
|
@@ -40226,24 +40965,24 @@ export {
|
|
|
40226
40965
|
getPresetPathSegments as aG,
|
|
40227
40966
|
projectBlocksLayout as aH,
|
|
40228
40967
|
buildListLabels as aI,
|
|
40229
|
-
|
|
40230
|
-
|
|
40231
|
-
|
|
40232
|
-
|
|
40233
|
-
|
|
40234
|
-
|
|
40235
|
-
|
|
40236
|
-
|
|
40237
|
-
|
|
40238
|
-
|
|
40239
|
-
|
|
40240
|
-
|
|
40241
|
-
|
|
40242
|
-
|
|
40243
|
-
|
|
40244
|
-
|
|
40245
|
-
|
|
40246
|
-
|
|
40968
|
+
getImageFloatingGeometry as aJ,
|
|
40969
|
+
textStyleToFontSizePt as aK,
|
|
40970
|
+
PX_PER_POINT as aL,
|
|
40971
|
+
DEFAULT_FONT_SIZE_PX as aM,
|
|
40972
|
+
isDoubleUnderlineStyle as aN,
|
|
40973
|
+
isWavyUnderlineStyle as aO,
|
|
40974
|
+
underlineStyleLineWidthPx as aP,
|
|
40975
|
+
underlineStyleDashArray as aQ,
|
|
40976
|
+
resolveListLabel as aR,
|
|
40977
|
+
getListLabelInset as aS,
|
|
40978
|
+
getAlignedListLabelInset as aT,
|
|
40979
|
+
getParagraphBorderInsets as aU,
|
|
40980
|
+
buildSegmentTable as aV,
|
|
40981
|
+
buildCanvasTableLayout as aW,
|
|
40982
|
+
resolveCanvasTableWidth as aX,
|
|
40983
|
+
resolveFloatingTableRect as aY,
|
|
40984
|
+
normalizeFamily as aZ,
|
|
40985
|
+
ROBOTO_FONT_FILES as a_,
|
|
40247
40986
|
className as aa,
|
|
40248
40987
|
For as ab,
|
|
40249
40988
|
UNDERLINE_STYLE_OPTIONS as ac,
|
|
@@ -40271,109 +41010,112 @@ export {
|
|
|
40271
41010
|
getRunFieldChar as ay,
|
|
40272
41011
|
getRunFieldInstruction as az,
|
|
40273
41012
|
createEditorStateFromDocument as b,
|
|
40274
|
-
|
|
40275
|
-
|
|
40276
|
-
|
|
40277
|
-
|
|
40278
|
-
|
|
40279
|
-
|
|
40280
|
-
|
|
40281
|
-
|
|
40282
|
-
|
|
40283
|
-
|
|
40284
|
-
|
|
40285
|
-
|
|
40286
|
-
|
|
40287
|
-
|
|
40288
|
-
|
|
40289
|
-
|
|
40290
|
-
|
|
40291
|
-
|
|
40292
|
-
|
|
40293
|
-
|
|
40294
|
-
|
|
40295
|
-
|
|
40296
|
-
|
|
40297
|
-
|
|
40298
|
-
|
|
40299
|
-
|
|
40300
|
-
|
|
40301
|
-
|
|
40302
|
-
|
|
40303
|
-
|
|
40304
|
-
|
|
40305
|
-
|
|
40306
|
-
|
|
40307
|
-
|
|
40308
|
-
|
|
40309
|
-
|
|
40310
|
-
|
|
40311
|
-
|
|
40312
|
-
|
|
40313
|
-
|
|
40314
|
-
|
|
40315
|
-
|
|
40316
|
-
|
|
40317
|
-
|
|
40318
|
-
|
|
40319
|
-
|
|
40320
|
-
|
|
40321
|
-
|
|
40322
|
-
|
|
40323
|
-
|
|
40324
|
-
|
|
40325
|
-
|
|
40326
|
-
|
|
40327
|
-
|
|
40328
|
-
|
|
40329
|
-
|
|
40330
|
-
|
|
40331
|
-
|
|
40332
|
-
|
|
40333
|
-
|
|
40334
|
-
|
|
40335
|
-
|
|
40336
|
-
|
|
40337
|
-
|
|
41013
|
+
EDITOR_SCROLL_PADDING_PX as b$,
|
|
41014
|
+
OFFICE_COMPAT_FONT_FAMILIES as b0,
|
|
41015
|
+
buildSfnt as b1,
|
|
41016
|
+
defaultFontDecoderRegistry as b2,
|
|
41017
|
+
SfntFontProgram as b3,
|
|
41018
|
+
collectPdfFontFamilies as b4,
|
|
41019
|
+
projectDocumentLayout as b5,
|
|
41020
|
+
getPageContentWidth as b6,
|
|
41021
|
+
getPageHeaderZoneTop as b7,
|
|
41022
|
+
getPageBodyTop as b8,
|
|
41023
|
+
getPageColumnRects as b9,
|
|
41024
|
+
getParagraphEntries as bA,
|
|
41025
|
+
getParagraphById as bB,
|
|
41026
|
+
createEditorFootnote as bC,
|
|
41027
|
+
createFootnoteReferenceRun as bD,
|
|
41028
|
+
renumberFootnotes as bE,
|
|
41029
|
+
getFootnoteDisplayMarker as bF,
|
|
41030
|
+
getHeadingLevel as bG,
|
|
41031
|
+
preciseFontModeVersion as bH,
|
|
41032
|
+
isPreciseFontModeEnabled as bI,
|
|
41033
|
+
resolveNamedTextStyle as bJ,
|
|
41034
|
+
togglePreciseFontMode as bK,
|
|
41035
|
+
nextFontSizePt as bL,
|
|
41036
|
+
previousFontSizePt as bM,
|
|
41037
|
+
fontSizePtToPx as bN,
|
|
41038
|
+
createDefaultToolbarPreset as bO,
|
|
41039
|
+
MenuRegistry as bP,
|
|
41040
|
+
createToolbarRegistry as bQ,
|
|
41041
|
+
Editor as bR,
|
|
41042
|
+
resolveCommandRef as bS,
|
|
41043
|
+
commandRefName as bT,
|
|
41044
|
+
createOasisEditorClient as bU,
|
|
41045
|
+
createEditorZoom as bV,
|
|
41046
|
+
startLongTaskObserver as bW,
|
|
41047
|
+
installGlobalReport as bX,
|
|
41048
|
+
applyStoredPreciseFontPreference as bY,
|
|
41049
|
+
getWelcomeSeen as bZ,
|
|
41050
|
+
isLocalFontAccessSupported as b_,
|
|
41051
|
+
findFootnoteReference as ba,
|
|
41052
|
+
FOOTNOTE_MARKER_GUTTER_PX as bb,
|
|
41053
|
+
resolveImporterForFile as bc,
|
|
41054
|
+
getDocumentSectionsCanonical as bd,
|
|
41055
|
+
getDocumentParagraphsCanonical as be,
|
|
41056
|
+
getDocumentParagraphs as bf,
|
|
41057
|
+
getDocumentPageSettings as bg,
|
|
41058
|
+
getTableCellContentWidthForParagraph as bh,
|
|
41059
|
+
on as bi,
|
|
41060
|
+
debounce as bj,
|
|
41061
|
+
unwrap as bk,
|
|
41062
|
+
perfTimer as bl,
|
|
41063
|
+
getRunTextBox as bm,
|
|
41064
|
+
createEditorDocument as bn,
|
|
41065
|
+
resolveResizedDimensions as bo,
|
|
41066
|
+
resolveTextBoxRenderHeight as bp,
|
|
41067
|
+
getToolbarStyleState as bq,
|
|
41068
|
+
getCachedCanvasImage as br,
|
|
41069
|
+
measureParagraphMinContentWidthPx as bs,
|
|
41070
|
+
getEditableBlocksForZone as bt,
|
|
41071
|
+
findParagraphLocation as bu,
|
|
41072
|
+
createSectionBoundaryParagraph as bv,
|
|
41073
|
+
normalizePageSettings as bw,
|
|
41074
|
+
DEFAULT_EDITOR_PAGE_SETTINGS as bx,
|
|
41075
|
+
markStart as by,
|
|
41076
|
+
markEnd as bz,
|
|
40338
41077
|
createSignal as c,
|
|
40339
|
-
|
|
40340
|
-
|
|
40341
|
-
|
|
40342
|
-
|
|
40343
|
-
|
|
40344
|
-
|
|
40345
|
-
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
|
|
40349
|
-
|
|
40350
|
-
|
|
40351
|
-
|
|
40352
|
-
|
|
40353
|
-
|
|
40354
|
-
|
|
40355
|
-
|
|
40356
|
-
|
|
40357
|
-
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40361
|
-
|
|
40362
|
-
|
|
40363
|
-
|
|
40364
|
-
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40368
|
-
|
|
40369
|
-
|
|
40370
|
-
|
|
40371
|
-
|
|
40372
|
-
|
|
40373
|
-
|
|
40374
|
-
|
|
40375
|
-
|
|
40376
|
-
|
|
41078
|
+
Toolbar as c0,
|
|
41079
|
+
OasisEditorLoading as c1,
|
|
41080
|
+
I18nProvider as c2,
|
|
41081
|
+
createTranslator as c3,
|
|
41082
|
+
createEditorLogger as c4,
|
|
41083
|
+
registerDomStatsSurface as c5,
|
|
41084
|
+
Button as c6,
|
|
41085
|
+
Checkbox as c7,
|
|
41086
|
+
ColorPicker as c8,
|
|
41087
|
+
CommandRegistry as c9,
|
|
41088
|
+
createEditorCommandBus as cA,
|
|
41089
|
+
createOasisEditor as cB,
|
|
41090
|
+
createOasisEditorContainer as cC,
|
|
41091
|
+
mount as cD,
|
|
41092
|
+
registerToolbarRenderer as cE,
|
|
41093
|
+
DEFAULT_PALETTE as ca,
|
|
41094
|
+
DialogFooter as cb,
|
|
41095
|
+
FloatingActionButton as cc,
|
|
41096
|
+
GridPicker as cd,
|
|
41097
|
+
IconButton as ce,
|
|
41098
|
+
Menu as cf,
|
|
41099
|
+
OASIS_BUILTIN_COMMANDS as cg,
|
|
41100
|
+
OASIS_MENU_ITEMS as ch,
|
|
41101
|
+
OASIS_TOOLBAR_ITEMS as ci,
|
|
41102
|
+
OasisEditorAppLazy as cj,
|
|
41103
|
+
OasisEditorContainer as ck,
|
|
41104
|
+
PluginCollection as cl,
|
|
41105
|
+
Popover as cm,
|
|
41106
|
+
RIBBON_TABS as cn,
|
|
41107
|
+
Select as co,
|
|
41108
|
+
SelectField as cp,
|
|
41109
|
+
Separator as cq,
|
|
41110
|
+
SidePanel as cr,
|
|
41111
|
+
SidePanelBody as cs,
|
|
41112
|
+
SidePanelFooter as ct,
|
|
41113
|
+
SidePanelHeader as cu,
|
|
41114
|
+
SplitButton as cv,
|
|
41115
|
+
StyleGallery as cw,
|
|
41116
|
+
TextField as cx,
|
|
41117
|
+
Button$1 as cy,
|
|
41118
|
+
buildRibbonTabDefinitions as cz,
|
|
40377
41119
|
createInitialEditorState as d,
|
|
40378
41120
|
createEditorParagraphFromRuns as e,
|
|
40379
41121
|
fontSizePxToPt as f,
|