oasis-editor 0.0.88 → 0.0.89
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-cKm4OFIF.js} +1325 -171
- package/dist/assets/{importDocxWorker-BcELKms0.js → importDocxWorker-DVDyiqYf.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 +17 -0
- package/dist/core/model/types/styles.d.ts +43 -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/draw/drawFragment.d.ts +13 -1
- package/dist/export/pdf/draw/drawTextBoxShape.d.ts +1 -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-BICQTKCZ.js} +1401 -850
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as
|
|
4
|
+
import { v as visitRun, a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, w as isSelectionCollapsed, x as parseFontSizePtToPx, y as formatFontSizePt, z as createEditorParagraph, A as getBlockParagraphs, B as findParagraphTableLocation, C as buildTableCellLayout, P as PT_PER_PX, D as createEditorTableCell, E as createEditorTableRow, F as createEditorTable, G as underlineStyleToCssDecorationStyle, H as resolveImageSrc, I as listKindForTag, J as isParagraphTag, K as collectInlineRuns, L as parseParagraphStyle, M as getRunImage, N as InlineShell, O as BalloonShell, Q as DocumentShell, R as createMemo, T as buildCanvasLayoutSnapshot, U as getCaretRectFromSnapshot, V as getParagraphRectFromSnapshot, W as createComponent, X as CaretOverlay, Y as Show, Z as createRenderEffect, _ as style, $ as setAttribute, a0 as setStyleProperty, a1 as memo, a2 as template, a3 as useI18n, a4 as createEffect, a5 as insert, a6 as use, a7 as addEventListener, a8 as Dialog, a9 as delegateEvents, aa as className, ab as For, ac as UNDERLINE_STYLE_OPTIONS, ad as Tabs, ae as onMount, af as onCleanup, ag as PluginUiHost, ah as OasisEditorEditor, ai as OasisBrandMark, aj as setPreciseFontPreference, ak as setWelcomeSeen, al as enablePreciseFontMode, am as TWIPS_PER_POINT, an as PX_PER_INCH, ao as TWIPS_PER_INCH, ap as resolveEffectiveParagraphStyle, aq as resolveEffectiveTextStyleForParagraph, ar as EMU_PER_PX, as as EMU_PER_PT, at as getRunFootnoteReference, au as getRunEndnoteReference, av as iterateFootnoteReferenceRuns, aw as iterateEndnoteReferenceRuns, ax as imageContentTypeDefaults, ay as getRunFieldChar, az as getRunFieldInstruction, aA as createEditorRun, aB as JSZip, aC as imageExtensionFromMime, aD as pxToPt$1, aE as resolveFloatingObjectRect, aF as getTextBoxFloatingGeometry, aG as getPresetPathSegments, aH as projectBlocksLayout, aI as buildListLabels, aJ as getImageFloatingGeometry, aK as textStyleToFontSizePt, aL as PX_PER_POINT, aM as DEFAULT_FONT_SIZE_PX, aN as isDoubleUnderlineStyle, aO as isWavyUnderlineStyle, aP as underlineStyleLineWidthPx, aQ as underlineStyleDashArray, aR as resolveListLabel, aS as getListLabelInset, aT as getAlignedListLabelInset, aU as getParagraphBorderInsets, aV as buildSegmentTable, aW as buildCanvasTableLayout, aX as resolveCanvasTableWidth, aY as resolveFloatingTableRect, aZ as normalizeFamily, a_ as ROBOTO_FONT_FILES, a$ as loadFontAsset, b0 as OFFICE_COMPAT_FONT_FAMILIES, b1 as buildSfnt, b2 as defaultFontDecoderRegistry, b3 as SfntFontProgram, b4 as collectPdfFontFamilies, b5 as projectDocumentLayout, b6 as getPageContentWidth, b7 as getPageHeaderZoneTop, b8 as getPageBodyTop, b9 as getPageColumnRects, ba as findFootnoteReference, bb as FOOTNOTE_MARKER_GUTTER_PX, bc as resolveImporterForFile, bd as getDocumentSectionsCanonical, be as getDocumentParagraphsCanonical, bf as getDocumentParagraphs, bg as getDocumentPageSettings, bh as getTableCellContentWidthForParagraph, bi as on, bj as debounce, bk as unwrap, bl as perfTimer, bm as getRunTextBox, bn as createEditorDocument, bo as resolveResizedDimensions, bp as resolveTextBoxRenderHeight, bq as getToolbarStyleState, br as getCachedCanvasImage, bs as measureParagraphMinContentWidthPx, bt as getEditableBlocksForZone, bu as findParagraphLocation, bv as createSectionBoundaryParagraph, bw as normalizePageSettings, bx as DEFAULT_EDITOR_PAGE_SETTINGS, by as markStart, bz as markEnd, bA as getParagraphEntries, bB as getParagraphById, bC as createEditorFootnote, bD as createFootnoteReferenceRun, bE as renumberFootnotes, bF as getFootnoteDisplayMarker, bG as getHeadingLevel, bH as preciseFontModeVersion, bI as isPreciseFontModeEnabled, bJ as resolveNamedTextStyle, bK as togglePreciseFontMode, bL as nextFontSizePt, bM as previousFontSizePt, bN as fontSizePtToPx, bO as createDefaultToolbarPreset, bP as MenuRegistry, bQ as createToolbarRegistry, bR as Editor, bS as resolveCommandRef, bT as commandRefName, bU as createOasisEditorClient, bV as createEditorZoom, bW as startLongTaskObserver, bX as installGlobalReport, bY as applyStoredPreciseFontPreference, bZ as getWelcomeSeen, b_ as isLocalFontAccessSupported, b$ as EDITOR_SCROLL_PADDING_PX, c0 as Toolbar, c1 as OasisEditorLoading, c2 as I18nProvider, c3 as createTranslator, c4 as createEditorLogger, c5 as registerDomStatsSurface } from "./index-BICQTKCZ.js";
|
|
5
5
|
function cloneStyle(style2) {
|
|
6
6
|
return style2 ? { ...style2 } : void 0;
|
|
7
7
|
}
|
|
@@ -113,20 +113,49 @@ function cloneBlocks(blocks) {
|
|
|
113
113
|
...block.style,
|
|
114
114
|
defaultCellMargins: block.style.defaultCellMargins ? { ...block.style.defaultCellMargins } : void 0,
|
|
115
115
|
floating: block.style.floating ? { ...block.style.floating } : void 0,
|
|
116
|
-
|
|
116
|
+
revision: block.style.revision ? {
|
|
117
|
+
...block.style.revision,
|
|
118
|
+
previous: { ...block.style.revision.previous }
|
|
119
|
+
} : void 0
|
|
120
|
+
} : void 0,
|
|
121
|
+
gridRevision: block.gridRevision ? {
|
|
122
|
+
...block.gridRevision,
|
|
123
|
+
previous: [...block.gridRevision.previous]
|
|
117
124
|
} : void 0,
|
|
118
|
-
tblGridChangeXml: block.tblGridChangeXml,
|
|
119
125
|
rows: block.rows.map((row) => ({
|
|
120
126
|
...row,
|
|
127
|
+
conditionalStyle: row.conditionalStyle ? { ...row.conditionalStyle } : void 0,
|
|
121
128
|
style: row.style ? {
|
|
122
129
|
...row.style,
|
|
123
|
-
|
|
130
|
+
revision: row.style.revision ? { ...row.style.revision } : void 0,
|
|
131
|
+
propertyRevision: row.style.propertyRevision ? {
|
|
132
|
+
...row.style.propertyRevision,
|
|
133
|
+
previous: { ...row.style.propertyRevision.previous }
|
|
134
|
+
} : void 0
|
|
124
135
|
} : void 0,
|
|
125
136
|
cells: row.cells.map((cell) => ({
|
|
126
137
|
...cell,
|
|
138
|
+
conditionalStyle: cell.conditionalStyle ? { ...cell.conditionalStyle } : void 0,
|
|
139
|
+
mergeRevisionState: cell.mergeRevisionState ? {
|
|
140
|
+
...cell.mergeRevisionState,
|
|
141
|
+
previousCells: cell.mergeRevisionState.previousCells.map(
|
|
142
|
+
(previousCell) => ({
|
|
143
|
+
...previousCell,
|
|
144
|
+
mergeRevisionState: void 0,
|
|
145
|
+
style: previousCell.style ? { ...previousCell.style } : void 0,
|
|
146
|
+
blocks: cloneParagraphs(previousCell.blocks)
|
|
147
|
+
})
|
|
148
|
+
)
|
|
149
|
+
} : void 0,
|
|
127
150
|
style: cell.style ? {
|
|
128
151
|
...cell.style,
|
|
129
|
-
|
|
152
|
+
revision: cell.style.revision ? { ...cell.style.revision } : void 0,
|
|
153
|
+
propertyRevision: cell.style.propertyRevision ? {
|
|
154
|
+
...cell.style.propertyRevision,
|
|
155
|
+
previous: {
|
|
156
|
+
...cell.style.propertyRevision.previous
|
|
157
|
+
}
|
|
158
|
+
} : void 0
|
|
130
159
|
} : void 0,
|
|
131
160
|
blocks: cloneParagraphs(cell.blocks)
|
|
132
161
|
}))
|
|
@@ -153,23 +182,54 @@ function cloneBlock(block) {
|
|
|
153
182
|
...block.style,
|
|
154
183
|
defaultCellMargins: block.style.defaultCellMargins ? { ...block.style.defaultCellMargins } : void 0,
|
|
155
184
|
floating: block.style.floating ? { ...block.style.floating } : void 0,
|
|
156
|
-
|
|
185
|
+
revision: block.style.revision ? {
|
|
186
|
+
...block.style.revision,
|
|
187
|
+
previous: { ...block.style.revision.previous }
|
|
188
|
+
} : void 0
|
|
189
|
+
} : void 0,
|
|
190
|
+
gridRevision: block.gridRevision ? {
|
|
191
|
+
...block.gridRevision,
|
|
192
|
+
previous: [...block.gridRevision.previous]
|
|
157
193
|
} : void 0,
|
|
158
|
-
tblGridChangeXml: block.tblGridChangeXml,
|
|
159
194
|
rows: block.rows.map((row) => ({
|
|
160
195
|
...row,
|
|
196
|
+
conditionalStyle: row.conditionalStyle ? { ...row.conditionalStyle } : void 0,
|
|
161
197
|
style: row.style ? {
|
|
162
198
|
...row.style,
|
|
163
|
-
|
|
199
|
+
revision: row.style.revision ? { ...row.style.revision } : void 0,
|
|
200
|
+
propertyRevision: row.style.propertyRevision ? {
|
|
201
|
+
...row.style.propertyRevision,
|
|
202
|
+
previous: { ...row.style.propertyRevision.previous }
|
|
203
|
+
} : void 0
|
|
164
204
|
} : void 0,
|
|
165
205
|
cells: row.cells.map((cell) => ({
|
|
166
206
|
...cell,
|
|
207
|
+
conditionalStyle: cell.conditionalStyle ? { ...cell.conditionalStyle } : void 0,
|
|
208
|
+
mergeRevisionState: cell.mergeRevisionState ? {
|
|
209
|
+
...cell.mergeRevisionState,
|
|
210
|
+
previousCells: cell.mergeRevisionState.previousCells.map(
|
|
211
|
+
(previousCell) => ({
|
|
212
|
+
...previousCell,
|
|
213
|
+
mergeRevisionState: void 0,
|
|
214
|
+
style: previousCell.style ? { ...previousCell.style } : void 0,
|
|
215
|
+
blocks: previousCell.blocks.map(
|
|
216
|
+
(paragraph) => cloneBlock(paragraph)
|
|
217
|
+
)
|
|
218
|
+
})
|
|
219
|
+
)
|
|
220
|
+
} : void 0,
|
|
167
221
|
colSpan: cell.colSpan ?? void 0,
|
|
168
222
|
rowSpan: cell.rowSpan ?? void 0,
|
|
169
223
|
vMerge: cell.vMerge ?? void 0,
|
|
170
224
|
style: cell.style ? {
|
|
171
225
|
...cell.style,
|
|
172
|
-
|
|
226
|
+
revision: cell.style.revision ? { ...cell.style.revision } : void 0,
|
|
227
|
+
propertyRevision: cell.style.propertyRevision ? {
|
|
228
|
+
...cell.style.propertyRevision,
|
|
229
|
+
previous: {
|
|
230
|
+
...cell.style.propertyRevision.previous
|
|
231
|
+
}
|
|
232
|
+
} : void 0
|
|
173
233
|
} : void 0,
|
|
174
234
|
blocks: cell.blocks.map((paragraph) => ({
|
|
175
235
|
...paragraph,
|
|
@@ -26566,6 +26626,17 @@ function createEditorDialogs() {
|
|
|
26566
26626
|
tableIndentLeft: "",
|
|
26567
26627
|
tableWrapping: "none",
|
|
26568
26628
|
floatingSummary: "",
|
|
26629
|
+
floatingHorizontalAnchor: "margin",
|
|
26630
|
+
floatingVerticalAnchor: "text",
|
|
26631
|
+
floatingX: "0",
|
|
26632
|
+
floatingY: "0",
|
|
26633
|
+
floatingXAlign: "",
|
|
26634
|
+
floatingYAlign: "",
|
|
26635
|
+
floatingDistanceTop: "0",
|
|
26636
|
+
floatingDistanceRight: "0",
|
|
26637
|
+
floatingDistanceBottom: "0",
|
|
26638
|
+
floatingDistanceLeft: "0",
|
|
26639
|
+
floatingOverlap: "overlap",
|
|
26569
26640
|
rowHeight: "",
|
|
26570
26641
|
rowHeightRule: "",
|
|
26571
26642
|
repeatHeader: false,
|
|
@@ -26589,6 +26660,10 @@ function createEditorDialogs() {
|
|
|
26589
26660
|
borderRight: false,
|
|
26590
26661
|
borderBottom: false,
|
|
26591
26662
|
borderLeft: false,
|
|
26663
|
+
borderStart: false,
|
|
26664
|
+
borderEnd: false,
|
|
26665
|
+
borderTopLeftToBottomRight: false,
|
|
26666
|
+
borderTopRightToBottomLeft: false,
|
|
26592
26667
|
shading: "",
|
|
26593
26668
|
altTitle: "",
|
|
26594
26669
|
altDescription: ""
|
|
@@ -28546,6 +28621,13 @@ function createParagraphDialogBridge(deps) {
|
|
|
28546
28621
|
applyParagraphDialogValues
|
|
28547
28622
|
};
|
|
28548
28623
|
}
|
|
28624
|
+
function createTableRevisionMetadata() {
|
|
28625
|
+
return {
|
|
28626
|
+
id: `rev:${Math.random().toString(36).slice(2, 9)}`,
|
|
28627
|
+
author: "User",
|
|
28628
|
+
date: Date.now()
|
|
28629
|
+
};
|
|
28630
|
+
}
|
|
28549
28631
|
function patchStyleValue(style2, key, value) {
|
|
28550
28632
|
const nextStyle = { ...style2 ?? {} };
|
|
28551
28633
|
if (value === null) {
|
|
@@ -28720,10 +28802,20 @@ function setTableCellStyleValue(state, key, value) {
|
|
|
28720
28802
|
selectedParagraphIds.add(id);
|
|
28721
28803
|
}
|
|
28722
28804
|
}
|
|
28723
|
-
const updateCell = (cell) =>
|
|
28724
|
-
|
|
28725
|
-
|
|
28726
|
-
|
|
28805
|
+
const updateCell = (cell) => {
|
|
28806
|
+
let style2 = cell.style;
|
|
28807
|
+
if (state.trackChangesEnabled && key !== "revision" && key !== "propertyRevision" && !(style2 == null ? void 0 : style2.propertyRevision)) {
|
|
28808
|
+
style2 = {
|
|
28809
|
+
...style2 ?? {},
|
|
28810
|
+
propertyRevision: {
|
|
28811
|
+
...createTableRevisionMetadata(),
|
|
28812
|
+
type: "property",
|
|
28813
|
+
previous: { ...style2 ?? {} }
|
|
28814
|
+
}
|
|
28815
|
+
};
|
|
28816
|
+
}
|
|
28817
|
+
return { ...cell, style: patchStyleValue(style2, key, value) };
|
|
28818
|
+
};
|
|
28727
28819
|
const nextSections = getDocumentSections(state.document).map((section) => ({
|
|
28728
28820
|
...section,
|
|
28729
28821
|
blocks: updateTableCellsInBlocks(
|
|
@@ -28771,10 +28863,20 @@ function collectLinearSelectedParagraphIds(state) {
|
|
|
28771
28863
|
}
|
|
28772
28864
|
function setTableStyleValue(state, key, value) {
|
|
28773
28865
|
const selectedParagraphIds = collectLinearSelectedParagraphIds(state);
|
|
28774
|
-
const updateTable = (table) =>
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28866
|
+
const updateTable = (table) => {
|
|
28867
|
+
let style2 = table.style;
|
|
28868
|
+
if (state.trackChangesEnabled && key !== "revision" && !(style2 == null ? void 0 : style2.revision)) {
|
|
28869
|
+
style2 = {
|
|
28870
|
+
...style2 ?? {},
|
|
28871
|
+
revision: {
|
|
28872
|
+
...createTableRevisionMetadata(),
|
|
28873
|
+
type: "property",
|
|
28874
|
+
previous: { ...style2 ?? {} }
|
|
28875
|
+
}
|
|
28876
|
+
};
|
|
28877
|
+
}
|
|
28878
|
+
return { ...table, style: patchStyleValue(style2, key, value) };
|
|
28879
|
+
};
|
|
28778
28880
|
const updateBlocks = (blocks) => {
|
|
28779
28881
|
return blocks.map((block) => {
|
|
28780
28882
|
if (block.type === "paragraph") return block;
|
|
@@ -28798,9 +28900,20 @@ function setTableStyleValue(state, key, value) {
|
|
|
28798
28900
|
function setActiveTableStyleValue(state, tableId, key, value) {
|
|
28799
28901
|
const updateTable = (table) => {
|
|
28800
28902
|
if (table.id !== tableId) return table;
|
|
28903
|
+
let style2 = table.style;
|
|
28904
|
+
if (state.trackChangesEnabled && key !== "revision" && !(style2 == null ? void 0 : style2.revision)) {
|
|
28905
|
+
style2 = {
|
|
28906
|
+
...style2 ?? {},
|
|
28907
|
+
revision: {
|
|
28908
|
+
...createTableRevisionMetadata(),
|
|
28909
|
+
type: "property",
|
|
28910
|
+
previous: { ...style2 ?? {} }
|
|
28911
|
+
}
|
|
28912
|
+
};
|
|
28913
|
+
}
|
|
28801
28914
|
return {
|
|
28802
28915
|
...table,
|
|
28803
|
-
style: patchStyleValue(
|
|
28916
|
+
style: patchStyleValue(style2, key, value)
|
|
28804
28917
|
};
|
|
28805
28918
|
};
|
|
28806
28919
|
return updateStateSections(
|
|
@@ -28813,7 +28926,20 @@ function setSelectedTableRowStyleValue(state, key, value) {
|
|
|
28813
28926
|
if (!target) return state;
|
|
28814
28927
|
const updateTable = (table) => {
|
|
28815
28928
|
const nextRows = table.rows.map(
|
|
28816
|
-
(row, rowIndex) => rowIndex === target.loc.rowIndex ?
|
|
28929
|
+
(row, rowIndex) => rowIndex === target.loc.rowIndex ? (() => {
|
|
28930
|
+
let style2 = row.style;
|
|
28931
|
+
if (state.trackChangesEnabled && key !== "revision" && key !== "propertyRevision" && !(style2 == null ? void 0 : style2.propertyRevision)) {
|
|
28932
|
+
style2 = {
|
|
28933
|
+
...style2 ?? {},
|
|
28934
|
+
propertyRevision: {
|
|
28935
|
+
...createTableRevisionMetadata(),
|
|
28936
|
+
type: "property",
|
|
28937
|
+
previous: { ...style2 ?? {} }
|
|
28938
|
+
}
|
|
28939
|
+
};
|
|
28940
|
+
}
|
|
28941
|
+
return { ...row, style: patchStyleValue(style2, key, value) };
|
|
28942
|
+
})() : row
|
|
28817
28943
|
);
|
|
28818
28944
|
return { ...table, rows: nextRows };
|
|
28819
28945
|
};
|
|
@@ -28824,9 +28950,26 @@ function setSelectedTableRowHeader(state, value) {
|
|
|
28824
28950
|
if (!target) return state;
|
|
28825
28951
|
const updateTable = (table) => ({
|
|
28826
28952
|
...table,
|
|
28827
|
-
rows: table.rows.map(
|
|
28828
|
-
(
|
|
28829
|
-
|
|
28953
|
+
rows: table.rows.map((row, rowIndex) => {
|
|
28954
|
+
if (rowIndex !== target.loc.rowIndex) return row;
|
|
28955
|
+
let style2 = row.style;
|
|
28956
|
+
if (state.trackChangesEnabled && !(style2 == null ? void 0 : style2.propertyRevision)) {
|
|
28957
|
+
style2 = {
|
|
28958
|
+
...style2 ?? {},
|
|
28959
|
+
propertyRevision: {
|
|
28960
|
+
...createTableRevisionMetadata(),
|
|
28961
|
+
type: "property",
|
|
28962
|
+
previous: { ...style2 ?? {}, isHeader: row.isHeader }
|
|
28963
|
+
}
|
|
28964
|
+
};
|
|
28965
|
+
}
|
|
28966
|
+
const isHeader = value === null ? void 0 : value;
|
|
28967
|
+
return {
|
|
28968
|
+
...row,
|
|
28969
|
+
isHeader,
|
|
28970
|
+
style: patchStyleValue(style2, "isHeader", isHeader ?? null)
|
|
28971
|
+
};
|
|
28972
|
+
})
|
|
28830
28973
|
});
|
|
28831
28974
|
return updateActiveTableBlocks(state, updateTable);
|
|
28832
28975
|
}
|
|
@@ -28836,9 +28979,20 @@ function setTableRowHeight(state, tableId, rowIndex, height) {
|
|
|
28836
28979
|
const nextRows = [...table.rows];
|
|
28837
28980
|
const row = nextRows[rowIndex];
|
|
28838
28981
|
if (row) {
|
|
28982
|
+
let style2 = row.style;
|
|
28983
|
+
if (state.trackChangesEnabled && !(style2 == null ? void 0 : style2.propertyRevision)) {
|
|
28984
|
+
style2 = {
|
|
28985
|
+
...style2 ?? {},
|
|
28986
|
+
propertyRevision: {
|
|
28987
|
+
...createTableRevisionMetadata(),
|
|
28988
|
+
type: "property",
|
|
28989
|
+
previous: { ...style2 ?? {} }
|
|
28990
|
+
}
|
|
28991
|
+
};
|
|
28992
|
+
}
|
|
28839
28993
|
nextRows[rowIndex] = {
|
|
28840
28994
|
...row,
|
|
28841
|
-
style: patchStyleValue(
|
|
28995
|
+
style: patchStyleValue(style2, "height", height)
|
|
28842
28996
|
};
|
|
28843
28997
|
}
|
|
28844
28998
|
return { ...table, rows: nextRows };
|
|
@@ -28904,6 +29058,7 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
28904
29058
|
}
|
|
28905
29059
|
const nextRows = table.rows.map((row, rowIndex) => {
|
|
28906
29060
|
const nextCells = row.cells.map((cell, cellIndex) => {
|
|
29061
|
+
var _a2, _b;
|
|
28907
29062
|
const entry = tableLayout.find(
|
|
28908
29063
|
(item) => item.rowIndex === rowIndex && item.cellIndex === cellIndex
|
|
28909
29064
|
);
|
|
@@ -28911,11 +29066,17 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
28911
29066
|
const rightVisualColumnIndex = entry.visualColumnIndex + entry.colSpan - 1;
|
|
28912
29067
|
const newWidth = columnWidths[rightVisualColumnIndex];
|
|
28913
29068
|
if (newWidth !== void 0 && entry.colSpan === 1) {
|
|
29069
|
+
const propertyRevision = state.trackChangesEnabled && !((_a2 = cell.style) == null ? void 0 : _a2.propertyRevision) ? {
|
|
29070
|
+
...createTableRevisionMetadata(),
|
|
29071
|
+
type: "property",
|
|
29072
|
+
previous: { ...cell.style ?? {} }
|
|
29073
|
+
} : (_b = cell.style) == null ? void 0 : _b.propertyRevision;
|
|
28914
29074
|
return {
|
|
28915
29075
|
...cell,
|
|
28916
29076
|
style: {
|
|
28917
29077
|
...cell.style ?? {},
|
|
28918
|
-
width: typeof newWidth === "number" ? newWidth : newWidth
|
|
29078
|
+
width: typeof newWidth === "number" ? newWidth : newWidth,
|
|
29079
|
+
...propertyRevision ? { propertyRevision } : {}
|
|
28919
29080
|
}
|
|
28920
29081
|
};
|
|
28921
29082
|
}
|
|
@@ -28924,6 +29085,13 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
28924
29085
|
return { ...row, cells: nextCells };
|
|
28925
29086
|
});
|
|
28926
29087
|
const nextStyle = { ...table.style ?? {} };
|
|
29088
|
+
if (state.trackChangesEnabled && !nextStyle.revision && (tableWidth !== void 0 || tableIndentLeft !== void 0)) {
|
|
29089
|
+
nextStyle.revision = {
|
|
29090
|
+
...createTableRevisionMetadata(),
|
|
29091
|
+
type: "property",
|
|
29092
|
+
previous: { ...table.style ?? {} }
|
|
29093
|
+
};
|
|
29094
|
+
}
|
|
28927
29095
|
if (tableWidth !== void 0) {
|
|
28928
29096
|
nextStyle.width = tableWidth;
|
|
28929
29097
|
}
|
|
@@ -28934,6 +29102,11 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
28934
29102
|
...table,
|
|
28935
29103
|
rows: nextRows,
|
|
28936
29104
|
gridCols: hasGridOverride && canResolveGrid ? nextGridCols : table.gridCols,
|
|
29105
|
+
gridRevision: state.trackChangesEnabled && hasGridOverride && canResolveGrid && !table.gridRevision ? {
|
|
29106
|
+
...createTableRevisionMetadata(),
|
|
29107
|
+
type: "grid",
|
|
29108
|
+
previous: [...table.gridCols ?? []]
|
|
29109
|
+
} : table.gridRevision,
|
|
28937
29110
|
style: Object.keys(nextStyle).length > 0 ? nextStyle : void 0
|
|
28938
29111
|
};
|
|
28939
29112
|
};
|
|
@@ -28944,6 +29117,7 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
28944
29117
|
}
|
|
28945
29118
|
function insertTableAtSelection(state, rows, cols) {
|
|
28946
29119
|
const initialCellWidth = `${100 / Math.max(1, cols)}%`;
|
|
29120
|
+
const insertionRevision = state.trackChangesEnabled ? createTableRevisionMetadata() : void 0;
|
|
28947
29121
|
const tableRows = [];
|
|
28948
29122
|
for (let rowIndex = 0; rowIndex < rows; rowIndex += 1) {
|
|
28949
29123
|
const cells = [];
|
|
@@ -28955,7 +29129,13 @@ function insertTableAtSelection(state, rows, cols) {
|
|
|
28955
29129
|
}
|
|
28956
29130
|
});
|
|
28957
29131
|
}
|
|
28958
|
-
|
|
29132
|
+
const row = createEditorTableRow(cells);
|
|
29133
|
+
if (insertionRevision) {
|
|
29134
|
+
row.style = {
|
|
29135
|
+
revision: { ...insertionRevision, type: "insert" }
|
|
29136
|
+
};
|
|
29137
|
+
}
|
|
29138
|
+
tableRows.push(row);
|
|
28959
29139
|
}
|
|
28960
29140
|
const table = {
|
|
28961
29141
|
...createEditorTable(tableRows),
|
|
@@ -29026,6 +29206,17 @@ const EMPTY_INITIAL = {
|
|
|
29026
29206
|
tableIndentLeft: "",
|
|
29027
29207
|
tableWrapping: "none",
|
|
29028
29208
|
floatingSummary: "",
|
|
29209
|
+
floatingHorizontalAnchor: "margin",
|
|
29210
|
+
floatingVerticalAnchor: "text",
|
|
29211
|
+
floatingX: "0",
|
|
29212
|
+
floatingY: "0",
|
|
29213
|
+
floatingXAlign: "",
|
|
29214
|
+
floatingYAlign: "",
|
|
29215
|
+
floatingDistanceTop: "0",
|
|
29216
|
+
floatingDistanceRight: "0",
|
|
29217
|
+
floatingDistanceBottom: "0",
|
|
29218
|
+
floatingDistanceLeft: "0",
|
|
29219
|
+
floatingOverlap: "overlap",
|
|
29029
29220
|
rowHeight: "",
|
|
29030
29221
|
rowHeightRule: "",
|
|
29031
29222
|
repeatHeader: false,
|
|
@@ -29049,6 +29240,10 @@ const EMPTY_INITIAL = {
|
|
|
29049
29240
|
borderRight: false,
|
|
29050
29241
|
borderBottom: false,
|
|
29051
29242
|
borderLeft: false,
|
|
29243
|
+
borderStart: false,
|
|
29244
|
+
borderEnd: false,
|
|
29245
|
+
borderTopLeftToBottomRight: false,
|
|
29246
|
+
borderTopRightToBottomLeft: false,
|
|
29052
29247
|
shading: "",
|
|
29053
29248
|
altTitle: "",
|
|
29054
29249
|
altDescription: ""
|
|
@@ -29105,7 +29300,7 @@ function buildFloatingSummary(table) {
|
|
|
29105
29300
|
return Object.entries(floating).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
29106
29301
|
}
|
|
29107
29302
|
function buildInitialValues(ctx, activeTab = "table") {
|
|
29108
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
29303
|
+
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, _A, _B, _C, _D, _E, _F;
|
|
29109
29304
|
const tableWidth = serializeWidth((_a = ctx.table.style) == null ? void 0 : _a.width);
|
|
29110
29305
|
const row = ctx.table.rows[ctx.rowIndex];
|
|
29111
29306
|
const cell = row == null ? void 0 : row.cells[ctx.cellIndex];
|
|
@@ -29118,7 +29313,11 @@ function buildInitialValues(ctx, activeTab = "table") {
|
|
|
29118
29313
|
style2.borderTop,
|
|
29119
29314
|
style2.borderRight,
|
|
29120
29315
|
style2.borderBottom,
|
|
29121
|
-
style2.borderLeft
|
|
29316
|
+
style2.borderLeft,
|
|
29317
|
+
style2.borderStart,
|
|
29318
|
+
style2.borderEnd,
|
|
29319
|
+
style2.borderTopLeftToBottomRight,
|
|
29320
|
+
style2.borderTopRightToBottomLeft
|
|
29122
29321
|
].filter(isVisibleBorder);
|
|
29123
29322
|
const sharedBorder = candidateBorders[0];
|
|
29124
29323
|
const floatingSummary = buildFloatingSummary(ctx.table);
|
|
@@ -29131,11 +29330,26 @@ function buildInitialValues(ctx, activeTab = "table") {
|
|
|
29131
29330
|
tableIndentLeft: serializeWidth((_f = ctx.table.style) == null ? void 0 : _f.indentLeft).value,
|
|
29132
29331
|
tableWrapping: floatingSummary ? "around" : "none",
|
|
29133
29332
|
floatingSummary,
|
|
29333
|
+
floatingHorizontalAnchor: ((_h = (_g = ctx.table.style) == null ? void 0 : _g.floating) == null ? void 0 : _h.horizontalAnchor) ?? "margin",
|
|
29334
|
+
floatingVerticalAnchor: ((_j = (_i = ctx.table.style) == null ? void 0 : _i.floating) == null ? void 0 : _j.verticalAnchor) ?? "text",
|
|
29335
|
+
floatingX: ((_l = (_k = ctx.table.style) == null ? void 0 : _k.floating) == null ? void 0 : _l.x) != null ? String(ctx.table.style.floating.x) : "0",
|
|
29336
|
+
floatingY: ((_n = (_m = ctx.table.style) == null ? void 0 : _m.floating) == null ? void 0 : _n.y) != null ? String(ctx.table.style.floating.y) : "0",
|
|
29337
|
+
floatingXAlign: ((_p = (_o = ctx.table.style) == null ? void 0 : _o.floating) == null ? void 0 : _p.xAlign) ?? "",
|
|
29338
|
+
floatingYAlign: ((_r = (_q = ctx.table.style) == null ? void 0 : _q.floating) == null ? void 0 : _r.yAlign) ?? "",
|
|
29339
|
+
floatingDistanceTop: String(((_t = (_s = ctx.table.style) == null ? void 0 : _s.floating) == null ? void 0 : _t.distanceTop) ?? 0),
|
|
29340
|
+
floatingDistanceRight: String(
|
|
29341
|
+
((_v = (_u = ctx.table.style) == null ? void 0 : _u.floating) == null ? void 0 : _v.distanceRight) ?? 0
|
|
29342
|
+
),
|
|
29343
|
+
floatingDistanceBottom: String(
|
|
29344
|
+
((_x = (_w = ctx.table.style) == null ? void 0 : _w.floating) == null ? void 0 : _x.distanceBottom) ?? 0
|
|
29345
|
+
),
|
|
29346
|
+
floatingDistanceLeft: String(((_z = (_y = ctx.table.style) == null ? void 0 : _y.floating) == null ? void 0 : _z.distanceLeft) ?? 0),
|
|
29347
|
+
floatingOverlap: ((_A = ctx.table.style) == null ? void 0 : _A.tblOverlap) ?? "overlap",
|
|
29134
29348
|
rowHeight: rowHeight.value,
|
|
29135
|
-
rowHeightRule: ((
|
|
29349
|
+
rowHeightRule: ((_B = row == null ? void 0 : row.style) == null ? void 0 : _B.heightRule) ?? "",
|
|
29136
29350
|
repeatHeader: Boolean(row == null ? void 0 : row.isHeader),
|
|
29137
|
-
allowBreakAcrossPages: ((
|
|
29138
|
-
hiddenRow: ((
|
|
29351
|
+
allowBreakAcrossPages: ((_C = row == null ? void 0 : row.style) == null ? void 0 : _C.cantSplit) !== true,
|
|
29352
|
+
hiddenRow: ((_D = row == null ? void 0 : row.style) == null ? void 0 : _D.hidden) === true,
|
|
29139
29353
|
columnWidth: columnWidth.value,
|
|
29140
29354
|
cellWidth: cellWidth.value,
|
|
29141
29355
|
cellVerticalAlign: style2.verticalAlign ?? "",
|
|
@@ -29154,9 +29368,17 @@ function buildInitialValues(ctx, activeTab = "table") {
|
|
|
29154
29368
|
borderRight: isVisibleBorder(style2.borderRight),
|
|
29155
29369
|
borderBottom: isVisibleBorder(style2.borderBottom),
|
|
29156
29370
|
borderLeft: isVisibleBorder(style2.borderLeft),
|
|
29371
|
+
borderStart: isVisibleBorder(style2.borderStart),
|
|
29372
|
+
borderEnd: isVisibleBorder(style2.borderEnd),
|
|
29373
|
+
borderTopLeftToBottomRight: isVisibleBorder(
|
|
29374
|
+
style2.borderTopLeftToBottomRight
|
|
29375
|
+
),
|
|
29376
|
+
borderTopRightToBottomLeft: isVisibleBorder(
|
|
29377
|
+
style2.borderTopRightToBottomLeft
|
|
29378
|
+
),
|
|
29157
29379
|
shading: style2.shading ?? "",
|
|
29158
|
-
altTitle: ((
|
|
29159
|
-
altDescription: ((
|
|
29380
|
+
altTitle: ((_E = ctx.table.style) == null ? void 0 : _E.altTitle) ?? "",
|
|
29381
|
+
altDescription: ((_F = ctx.table.style) == null ? void 0 : _F.altDescription) ?? ""
|
|
29160
29382
|
};
|
|
29161
29383
|
}
|
|
29162
29384
|
function setCellStyle(state, key, value) {
|
|
@@ -29174,14 +29396,36 @@ function applyTableProperties(state, values) {
|
|
|
29174
29396
|
const ctx = resolveActiveTableContext(state);
|
|
29175
29397
|
if (!ctx) return state;
|
|
29176
29398
|
let next = state;
|
|
29177
|
-
next = setActiveTableStyleValue(
|
|
29178
|
-
|
|
29399
|
+
next = setActiveTableStyleValue(
|
|
29400
|
+
next,
|
|
29401
|
+
ctx.tableId,
|
|
29402
|
+
"width",
|
|
29403
|
+
values.tableWidth
|
|
29404
|
+
);
|
|
29405
|
+
next = setActiveTableStyleValue(
|
|
29406
|
+
next,
|
|
29407
|
+
ctx.tableId,
|
|
29408
|
+
"align",
|
|
29409
|
+
values.tableAlign
|
|
29410
|
+
);
|
|
29179
29411
|
next = setActiveTableStyleValue(
|
|
29180
29412
|
next,
|
|
29181
29413
|
ctx.tableId,
|
|
29182
29414
|
"indentLeft",
|
|
29183
29415
|
values.tableIndentLeft
|
|
29184
29416
|
);
|
|
29417
|
+
next = setActiveTableStyleValue(
|
|
29418
|
+
next,
|
|
29419
|
+
ctx.tableId,
|
|
29420
|
+
"floating",
|
|
29421
|
+
values.tableFloating
|
|
29422
|
+
);
|
|
29423
|
+
next = setActiveTableStyleValue(
|
|
29424
|
+
next,
|
|
29425
|
+
ctx.tableId,
|
|
29426
|
+
"tblOverlap",
|
|
29427
|
+
values.tableOverlap
|
|
29428
|
+
);
|
|
29185
29429
|
next = setActiveTableStyleValue(
|
|
29186
29430
|
next,
|
|
29187
29431
|
ctx.tableId,
|
|
@@ -29222,6 +29466,18 @@ function applyTableProperties(state, values) {
|
|
|
29222
29466
|
next = setCellStyle(next, "borderRight", values.borders.right);
|
|
29223
29467
|
next = setCellStyle(next, "borderBottom", values.borders.bottom);
|
|
29224
29468
|
next = setCellStyle(next, "borderLeft", values.borders.left);
|
|
29469
|
+
next = setCellStyle(next, "borderStart", values.borders.start);
|
|
29470
|
+
next = setCellStyle(next, "borderEnd", values.borders.end);
|
|
29471
|
+
next = setCellStyle(
|
|
29472
|
+
next,
|
|
29473
|
+
"borderTopLeftToBottomRight",
|
|
29474
|
+
values.borders.topLeftToBottomRight
|
|
29475
|
+
);
|
|
29476
|
+
next = setCellStyle(
|
|
29477
|
+
next,
|
|
29478
|
+
"borderTopRightToBottomLeft",
|
|
29479
|
+
values.borders.topRightToBottomLeft
|
|
29480
|
+
);
|
|
29225
29481
|
next = setCellStyle(next, "shading", values.shading);
|
|
29226
29482
|
return next;
|
|
29227
29483
|
}
|
|
@@ -31619,7 +31875,7 @@ function ParagraphDialog(props) {
|
|
|
31619
31875
|
});
|
|
31620
31876
|
}
|
|
31621
31877
|
delegateEvents(["input", "click"]);
|
|
31622
|
-
var _tmpl$$5 = /* @__PURE__ */ template(`<div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input
|
|
31878
|
+
var _tmpl$$5 = /* @__PURE__ */ template(`<div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><input type=number class=oasis-editor-dialog-input step=1>`), _tmpl$2$1 = /* @__PURE__ */ template(`<label class=oasis-editor-dialog-style-toggle><input type=checkbox>`), _tmpl$3$1 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-secondary"data-testid=editor-table-properties-cancel>`), _tmpl$4$1 = /* @__PURE__ */ template(`<button class="oasis-editor-dialog-button oasis-editor-dialog-button-primary"data-testid=editor-table-properties-apply>`), _tmpl$5$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-row><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-h-anchor><option value=margin></option><option value=page></option><option value=text></option></select></label><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-v-anchor><option value=margin></option><option value=page></option><option value=text>`), _tmpl$6$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-row><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-x-align><option value></option></select></label><label class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><span class=oasis-editor-dialog-label></span><select class=oasis-editor-dialog-input data-testid=editor-table-properties-floating-y-align><option value>`), _tmpl$7 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-row>`), _tmpl$8 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-row><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-table-properties-table-width-unit><option value=points></option><option value=percent></option></select></div></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-style-row></div><div class=oasis-editor-dialog-row></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-style-row>`), _tmpl$9 = /* @__PURE__ */ template(`<label class=oasis-editor-dialog-style-toggle><input type=radio name=table-align>`), _tmpl$0 = /* @__PURE__ */ template(`<option>`), _tmpl$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-table-properties-row-height-rule><option value></option><option value=atLeast></option><option value=exact></option></select></div></div><div class=oasis-editor-dialog-style-row>`), _tmpl$10 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><div class=oasis-editor-dialog-row>`), _tmpl$11 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-table-properties-cell-valign><option value></option><option value=top></option><option value=middle></option><option value=bottom></option></select></div><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-table-properties-cell-direction><option value></option><option value=lrTb>lrTb</option><option value=tbRl>tbRl</option><option value=btLr>btLr</option><option value=lrTbV>lrTbV</option><option value=tbRlV>tbRlV</option></select></div></div><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-style-row></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-row></div></fieldset><fieldset class=oasis-editor-font-dialog-fieldset><legend></legend><div class=oasis-editor-dialog-row><div class="oasis-editor-dialog-input-group oasis-editor-dialog-input-group-grow"><label class=oasis-editor-dialog-label></label><select class=oasis-editor-dialog-input data-testid=editor-table-properties-border-style><option value=none></option><option value=solid></option><option value=dashed></option><option value=dotted></option></select></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-table-properties-border-color></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input type=color class=oasis-editor-dialog-input data-testid=editor-table-properties-shading></div></div><div class=oasis-editor-dialog-style-row></div><div class=oasis-editor-table-properties-cell-preview data-testid=editor-table-properties-cell-preview>`), _tmpl$12 = /* @__PURE__ */ template(`<div class=oasis-editor-table-properties-panel><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><input class=oasis-editor-dialog-input data-testid=editor-table-properties-alt-title></div><div class=oasis-editor-dialog-input-group><label class=oasis-editor-dialog-label></label><textarea class="oasis-editor-dialog-input oasis-editor-table-properties-textarea"data-testid=editor-table-properties-alt-description>`);
|
|
31623
31879
|
const DEFAULT_BORDER_WIDTH_PT = 0.5;
|
|
31624
31880
|
const DEFAULT_BORDER_COLOR = "#000000";
|
|
31625
31881
|
function parseNumber(value) {
|
|
@@ -31649,6 +31905,17 @@ function TablePropertiesDialog(props) {
|
|
|
31649
31905
|
const [tableAlign, setTableAlign] = createSignal("");
|
|
31650
31906
|
const [tableIndentLeft, setTableIndentLeft] = createSignal("");
|
|
31651
31907
|
const [tableWrapping, setTableWrapping] = createSignal("none");
|
|
31908
|
+
const [floatingHorizontalAnchor, setFloatingHorizontalAnchor] = createSignal("margin");
|
|
31909
|
+
const [floatingVerticalAnchor, setFloatingVerticalAnchor] = createSignal("text");
|
|
31910
|
+
const [floatingX, setFloatingX] = createSignal("");
|
|
31911
|
+
const [floatingY, setFloatingY] = createSignal("");
|
|
31912
|
+
const [floatingXAlign, setFloatingXAlign] = createSignal("");
|
|
31913
|
+
const [floatingYAlign, setFloatingYAlign] = createSignal("");
|
|
31914
|
+
const [floatingDistanceTop, setFloatingDistanceTop] = createSignal("");
|
|
31915
|
+
const [floatingDistanceRight, setFloatingDistanceRight] = createSignal("");
|
|
31916
|
+
const [floatingDistanceBottom, setFloatingDistanceBottom] = createSignal("");
|
|
31917
|
+
const [floatingDistanceLeft, setFloatingDistanceLeft] = createSignal("");
|
|
31918
|
+
const [floatingOverlap, setFloatingOverlap] = createSignal("overlap");
|
|
31652
31919
|
const [rowHeight, setRowHeight] = createSignal("");
|
|
31653
31920
|
const [rowHeightRule, setRowHeightRule] = createSignal("");
|
|
31654
31921
|
const [repeatHeader, setRepeatHeader] = createSignal(false);
|
|
@@ -31672,6 +31939,10 @@ function TablePropertiesDialog(props) {
|
|
|
31672
31939
|
const [borderRight, setBorderRight] = createSignal(false);
|
|
31673
31940
|
const [borderBottom, setBorderBottom] = createSignal(false);
|
|
31674
31941
|
const [borderLeft, setBorderLeft] = createSignal(false);
|
|
31942
|
+
const [borderStart, setBorderStart] = createSignal(false);
|
|
31943
|
+
const [borderEnd, setBorderEnd] = createSignal(false);
|
|
31944
|
+
const [borderTlBr, setBorderTlBr] = createSignal(false);
|
|
31945
|
+
const [borderTrBl, setBorderTrBl] = createSignal(false);
|
|
31675
31946
|
const [shading, setShading] = createSignal("");
|
|
31676
31947
|
const [altTitle, setAltTitle] = createSignal("");
|
|
31677
31948
|
const [altDescription, setAltDescription] = createSignal("");
|
|
@@ -31683,6 +31954,17 @@ function TablePropertiesDialog(props) {
|
|
|
31683
31954
|
setTableAlign(props.initial.tableAlign);
|
|
31684
31955
|
setTableIndentLeft(props.initial.tableIndentLeft);
|
|
31685
31956
|
setTableWrapping(props.initial.tableWrapping);
|
|
31957
|
+
setFloatingHorizontalAnchor(props.initial.floatingHorizontalAnchor);
|
|
31958
|
+
setFloatingVerticalAnchor(props.initial.floatingVerticalAnchor);
|
|
31959
|
+
setFloatingX(props.initial.floatingX);
|
|
31960
|
+
setFloatingY(props.initial.floatingY);
|
|
31961
|
+
setFloatingXAlign(props.initial.floatingXAlign);
|
|
31962
|
+
setFloatingYAlign(props.initial.floatingYAlign);
|
|
31963
|
+
setFloatingDistanceTop(props.initial.floatingDistanceTop);
|
|
31964
|
+
setFloatingDistanceRight(props.initial.floatingDistanceRight);
|
|
31965
|
+
setFloatingDistanceBottom(props.initial.floatingDistanceBottom);
|
|
31966
|
+
setFloatingDistanceLeft(props.initial.floatingDistanceLeft);
|
|
31967
|
+
setFloatingOverlap(props.initial.floatingOverlap);
|
|
31686
31968
|
setRowHeight(props.initial.rowHeight);
|
|
31687
31969
|
setRowHeightRule(props.initial.rowHeightRule);
|
|
31688
31970
|
setRepeatHeader(props.initial.repeatHeader);
|
|
@@ -31706,6 +31988,10 @@ function TablePropertiesDialog(props) {
|
|
|
31706
31988
|
setBorderRight(props.initial.borderRight);
|
|
31707
31989
|
setBorderBottom(props.initial.borderBottom);
|
|
31708
31990
|
setBorderLeft(props.initial.borderLeft);
|
|
31991
|
+
setBorderStart(props.initial.borderStart);
|
|
31992
|
+
setBorderEnd(props.initial.borderEnd);
|
|
31993
|
+
setBorderTlBr(props.initial.borderTopLeftToBottomRight);
|
|
31994
|
+
setBorderTrBl(props.initial.borderTopRightToBottomLeft);
|
|
31709
31995
|
setShading(props.initial.shading);
|
|
31710
31996
|
setAltTitle(props.initial.altTitle);
|
|
31711
31997
|
setAltDescription(props.initial.altDescription);
|
|
@@ -31727,6 +32013,25 @@ function TablePropertiesDialog(props) {
|
|
|
31727
32013
|
tableWidth: parseWidth(tableWidth(), tableWidthUnit()),
|
|
31728
32014
|
tableAlign: tableAlign() || null,
|
|
31729
32015
|
tableIndentLeft: parseWidth(tableIndentLeft(), "points"),
|
|
32016
|
+
tableFloating: tableWrapping() === "around" ? {
|
|
32017
|
+
horizontalAnchor: floatingHorizontalAnchor(),
|
|
32018
|
+
verticalAnchor: floatingVerticalAnchor(),
|
|
32019
|
+
...floatingXAlign() ? {
|
|
32020
|
+
xAlign: floatingXAlign()
|
|
32021
|
+
} : {
|
|
32022
|
+
x: parseNumber(floatingX()) ?? 0
|
|
32023
|
+
},
|
|
32024
|
+
...floatingYAlign() ? {
|
|
32025
|
+
yAlign: floatingYAlign()
|
|
32026
|
+
} : {
|
|
32027
|
+
y: parseNumber(floatingY()) ?? 0
|
|
32028
|
+
},
|
|
32029
|
+
distanceTop: parseNumber(floatingDistanceTop()) ?? 0,
|
|
32030
|
+
distanceRight: parseNumber(floatingDistanceRight()) ?? 0,
|
|
32031
|
+
distanceBottom: parseNumber(floatingDistanceBottom()) ?? 0,
|
|
32032
|
+
distanceLeft: parseNumber(floatingDistanceLeft()) ?? 0
|
|
32033
|
+
} : null,
|
|
32034
|
+
tableOverlap: tableWrapping() === "around" ? floatingOverlap() : null,
|
|
31730
32035
|
rowHeight: parseWidth(rowHeight(), "points"),
|
|
31731
32036
|
rowHeightRule: rowHeightRule() || null,
|
|
31732
32037
|
repeatHeader: repeatHeader(),
|
|
@@ -31749,7 +32054,11 @@ function TablePropertiesDialog(props) {
|
|
|
31749
32054
|
top: borderTop() ? border : null,
|
|
31750
32055
|
right: borderRight() ? border : null,
|
|
31751
32056
|
bottom: borderBottom() ? border : null,
|
|
31752
|
-
left: borderLeft() ? border : null
|
|
32057
|
+
left: borderLeft() ? border : null,
|
|
32058
|
+
start: borderStart() ? border : null,
|
|
32059
|
+
end: borderEnd() ? border : null,
|
|
32060
|
+
topLeftToBottomRight: borderTlBr() ? border : null,
|
|
32061
|
+
topRightToBottomLeft: borderTrBl() ? border : null
|
|
31753
32062
|
},
|
|
31754
32063
|
shading: shading().trim() || null,
|
|
31755
32064
|
altTitle: altTitle().trim() || null,
|
|
@@ -31757,10 +32066,11 @@ function TablePropertiesDialog(props) {
|
|
|
31757
32066
|
}, props.initial);
|
|
31758
32067
|
props.onClose();
|
|
31759
32068
|
};
|
|
31760
|
-
const numericInput = (label, value, setter, testId, disabled = false) => (() => {
|
|
32069
|
+
const numericInput = (label, value, setter, testId, disabled = false, allowNegative = false) => (() => {
|
|
31761
32070
|
var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
31762
32071
|
insert(_el$2, label);
|
|
31763
32072
|
_el$3.$$input = (e) => setter(e.currentTarget.value);
|
|
32073
|
+
setAttribute(_el$3, "min", allowNegative ? void 0 : "0");
|
|
31764
32074
|
_el$3.disabled = disabled;
|
|
31765
32075
|
setAttribute(_el$3, "data-testid", testId);
|
|
31766
32076
|
createRenderEffect(() => _el$3.value = value());
|
|
@@ -31817,7 +32127,7 @@ function TablePropertiesDialog(props) {
|
|
|
31817
32127
|
label: t("table.tabTable"),
|
|
31818
32128
|
testId: "editor-table-properties-tab-table",
|
|
31819
32129
|
panel: (() => {
|
|
31820
|
-
var _el$8 = _tmpl$
|
|
32130
|
+
var _el$8 = _tmpl$8(), _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$0.nextSibling, _el$10 = _el$1.firstChild, _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling, _el$13 = _el$12.firstChild, _el$14 = _el$13.nextSibling, _el$15 = _el$9.nextSibling, _el$16 = _el$15.firstChild, _el$17 = _el$16.nextSibling, _el$18 = _el$17.nextSibling, _el$19 = _el$15.nextSibling, _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling;
|
|
31821
32131
|
insert(_el$0, () => t("table.sizeSection"));
|
|
31822
32132
|
insert(_el$1, () => numericInput(t("table.preferredWidth"), tableWidth, setTableWidth, "editor-table-properties-table-width"), _el$10);
|
|
31823
32133
|
insert(_el$11, () => t("table.measureIn"));
|
|
@@ -31826,19 +32136,72 @@ function TablePropertiesDialog(props) {
|
|
|
31826
32136
|
insert(_el$14, () => t("table.percent"));
|
|
31827
32137
|
insert(_el$16, () => t("table.alignmentSection"));
|
|
31828
32138
|
insert(_el$17, () => ["left", "center", "right"].map((align) => (() => {
|
|
31829
|
-
var _el$
|
|
31830
|
-
_el$
|
|
31831
|
-
setAttribute(_el$
|
|
31832
|
-
insert(_el$
|
|
31833
|
-
createRenderEffect(() => _el$
|
|
31834
|
-
return _el$
|
|
32139
|
+
var _el$45 = _tmpl$9(), _el$46 = _el$45.firstChild;
|
|
32140
|
+
_el$46.addEventListener("change", () => setTableAlign(align));
|
|
32141
|
+
setAttribute(_el$46, "data-testid", `editor-table-properties-align-${align}`);
|
|
32142
|
+
insert(_el$45, () => t(`table.align${align[0].toUpperCase()}${align.slice(1)}`), null);
|
|
32143
|
+
createRenderEffect(() => _el$46.checked = tableAlign() === align);
|
|
32144
|
+
return _el$45;
|
|
31835
32145
|
})()));
|
|
31836
32146
|
insert(_el$18, () => numericInput(t("table.indentFromLeft"), tableIndentLeft, setTableIndentLeft, "editor-table-properties-indent-left"));
|
|
31837
32147
|
insert(_el$20, () => t("table.textWrappingSection"));
|
|
31838
|
-
insert(_el$21, () => checkbox(t("table.wrapNone"), () => tableWrapping() === "none", () => setTableWrapping("none"), "editor-table-properties-wrap-none"),
|
|
31839
|
-
insert(_el$21, () => checkbox(t("table.wrapAround"), () => tableWrapping() === "around", () => setTableWrapping("around"), "editor-table-properties-wrap-around"
|
|
31840
|
-
insert(_el$
|
|
31841
|
-
|
|
32148
|
+
insert(_el$21, () => checkbox(t("table.wrapNone"), () => tableWrapping() === "none", () => setTableWrapping("none"), "editor-table-properties-wrap-none"), null);
|
|
32149
|
+
insert(_el$21, () => checkbox(t("table.wrapAround"), () => tableWrapping() === "around", () => setTableWrapping("around"), "editor-table-properties-wrap-around"), null);
|
|
32150
|
+
insert(_el$19, createComponent(Show, {
|
|
32151
|
+
get when() {
|
|
32152
|
+
return tableWrapping() === "around";
|
|
32153
|
+
},
|
|
32154
|
+
get children() {
|
|
32155
|
+
return [(() => {
|
|
32156
|
+
var _el$22 = _tmpl$5$1(), _el$23 = _el$22.firstChild, _el$24 = _el$23.firstChild, _el$25 = _el$24.nextSibling, _el$26 = _el$25.firstChild, _el$27 = _el$26.nextSibling, _el$28 = _el$27.nextSibling, _el$29 = _el$23.nextSibling, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$31.firstChild, _el$33 = _el$32.nextSibling, _el$34 = _el$33.nextSibling;
|
|
32157
|
+
insert(_el$24, () => t("table.horizontalAnchor"));
|
|
32158
|
+
_el$25.addEventListener("change", (e) => setFloatingHorizontalAnchor(e.currentTarget.value));
|
|
32159
|
+
insert(_el$26, () => t("table.anchorMargin"));
|
|
32160
|
+
insert(_el$27, () => t("table.anchorPage"));
|
|
32161
|
+
insert(_el$28, () => t("table.anchorText"));
|
|
32162
|
+
insert(_el$30, () => t("table.verticalAnchor"));
|
|
32163
|
+
_el$31.addEventListener("change", (e) => setFloatingVerticalAnchor(e.currentTarget.value));
|
|
32164
|
+
insert(_el$32, () => t("table.anchorMargin"));
|
|
32165
|
+
insert(_el$33, () => t("table.anchorPage"));
|
|
32166
|
+
insert(_el$34, () => t("table.anchorText"));
|
|
32167
|
+
createRenderEffect(() => _el$25.value = floatingHorizontalAnchor());
|
|
32168
|
+
createRenderEffect(() => _el$31.value = floatingVerticalAnchor());
|
|
32169
|
+
return _el$22;
|
|
32170
|
+
})(), (() => {
|
|
32171
|
+
var _el$35 = _tmpl$6$1(), _el$36 = _el$35.firstChild, _el$37 = _el$36.firstChild, _el$38 = _el$37.nextSibling, _el$39 = _el$38.firstChild, _el$40 = _el$36.nextSibling, _el$41 = _el$40.firstChild, _el$42 = _el$41.nextSibling, _el$43 = _el$42.firstChild;
|
|
32172
|
+
insert(_el$35, () => numericInput(t("table.positionX"), floatingX, setFloatingX, "editor-table-properties-floating-x", Boolean(floatingXAlign()), true), _el$36);
|
|
32173
|
+
insert(_el$35, () => numericInput(t("table.positionY"), floatingY, setFloatingY, "editor-table-properties-floating-y", Boolean(floatingYAlign()), true), _el$36);
|
|
32174
|
+
insert(_el$37, () => t("table.horizontalAlignment"));
|
|
32175
|
+
_el$38.addEventListener("change", (e) => setFloatingXAlign(e.currentTarget.value));
|
|
32176
|
+
insert(_el$39, () => t("table.explicitOffset"));
|
|
32177
|
+
insert(_el$38, () => ["left", "center", "right", "inside", "outside"].map((value) => (() => {
|
|
32178
|
+
var _el$47 = _tmpl$0();
|
|
32179
|
+
_el$47.value = value;
|
|
32180
|
+
insert(_el$47, value);
|
|
32181
|
+
return _el$47;
|
|
32182
|
+
})()), null);
|
|
32183
|
+
insert(_el$41, () => t("table.verticalAlignment"));
|
|
32184
|
+
_el$42.addEventListener("change", (e) => setFloatingYAlign(e.currentTarget.value));
|
|
32185
|
+
insert(_el$43, () => t("table.explicitOffset"));
|
|
32186
|
+
insert(_el$42, () => ["top", "center", "bottom", "inside", "outside"].map((value) => (() => {
|
|
32187
|
+
var _el$48 = _tmpl$0();
|
|
32188
|
+
_el$48.value = value;
|
|
32189
|
+
insert(_el$48, value);
|
|
32190
|
+
return _el$48;
|
|
32191
|
+
})()), null);
|
|
32192
|
+
createRenderEffect(() => _el$38.value = floatingXAlign());
|
|
32193
|
+
createRenderEffect(() => _el$42.value = floatingYAlign());
|
|
32194
|
+
return _el$35;
|
|
32195
|
+
})(), (() => {
|
|
32196
|
+
var _el$44 = _tmpl$7();
|
|
32197
|
+
insert(_el$44, () => numericInput(t("table.distanceTop"), floatingDistanceTop, setFloatingDistanceTop, "editor-table-properties-floating-distance-top"), null);
|
|
32198
|
+
insert(_el$44, () => numericInput(t("table.distanceRight"), floatingDistanceRight, setFloatingDistanceRight, "editor-table-properties-floating-distance-right"), null);
|
|
32199
|
+
insert(_el$44, () => numericInput(t("table.distanceBottom"), floatingDistanceBottom, setFloatingDistanceBottom, "editor-table-properties-floating-distance-bottom"), null);
|
|
32200
|
+
insert(_el$44, () => numericInput(t("table.distanceLeft"), floatingDistanceLeft, setFloatingDistanceLeft, "editor-table-properties-floating-distance-left"), null);
|
|
32201
|
+
return _el$44;
|
|
32202
|
+
})(), memo(() => checkbox(t("table.allowOverlap"), () => floatingOverlap() === "overlap", (value) => setFloatingOverlap(value ? "overlap" : "never"), "editor-table-properties-floating-overlap"))];
|
|
32203
|
+
}
|
|
32204
|
+
}), null);
|
|
31842
32205
|
createRenderEffect(() => _el$12.value = tableWidthUnit());
|
|
31843
32206
|
return _el$8;
|
|
31844
32207
|
})()
|
|
@@ -31847,56 +32210,56 @@ function TablePropertiesDialog(props) {
|
|
|
31847
32210
|
label: t("table.tabRow"),
|
|
31848
32211
|
testId: "editor-table-properties-tab-row",
|
|
31849
32212
|
panel: (() => {
|
|
31850
|
-
var _el$
|
|
31851
|
-
insert(_el$
|
|
31852
|
-
insert(_el$
|
|
31853
|
-
_el$
|
|
31854
|
-
insert(_el$
|
|
31855
|
-
insert(_el$
|
|
31856
|
-
insert(_el$
|
|
31857
|
-
insert(_el$
|
|
31858
|
-
insert(_el$
|
|
31859
|
-
insert(_el$
|
|
31860
|
-
createRenderEffect(() => _el$
|
|
31861
|
-
return _el$
|
|
32213
|
+
var _el$49 = _tmpl$1(), _el$50 = _el$49.firstChild, _el$51 = _el$50.firstChild, _el$52 = _el$51.firstChild, _el$53 = _el$52.nextSibling, _el$54 = _el$53.firstChild, _el$55 = _el$54.nextSibling, _el$56 = _el$55.nextSibling, _el$57 = _el$50.nextSibling;
|
|
32214
|
+
insert(_el$50, () => numericInput(t("table.rowHeight"), rowHeight, setRowHeight, "editor-table-properties-row-height"), _el$51);
|
|
32215
|
+
insert(_el$52, () => t("table.rowHeightRule"));
|
|
32216
|
+
_el$53.addEventListener("change", (e) => setRowHeightRule(e.currentTarget.value));
|
|
32217
|
+
insert(_el$54, () => t("table.rowAuto"));
|
|
32218
|
+
insert(_el$55, () => t("table.rowAtLeast"));
|
|
32219
|
+
insert(_el$56, () => t("table.rowExactly"));
|
|
32220
|
+
insert(_el$57, () => checkbox(t("table.repeatHeader"), repeatHeader, setRepeatHeader, "editor-table-properties-repeat-header"), null);
|
|
32221
|
+
insert(_el$57, () => checkbox(t("table.allowBreakAcrossPages"), allowBreakAcrossPages, setAllowBreakAcrossPages, "editor-table-properties-allow-break"), null);
|
|
32222
|
+
insert(_el$57, () => checkbox(t("table.hiddenRow"), hiddenRow, setHiddenRow, "editor-table-properties-hidden-row"), null);
|
|
32223
|
+
createRenderEffect(() => _el$53.value = rowHeightRule());
|
|
32224
|
+
return _el$49;
|
|
31862
32225
|
})()
|
|
31863
32226
|
}, {
|
|
31864
32227
|
id: "column",
|
|
31865
32228
|
label: t("table.tabColumn"),
|
|
31866
32229
|
testId: "editor-table-properties-tab-column",
|
|
31867
32230
|
panel: (() => {
|
|
31868
|
-
var _el$
|
|
31869
|
-
insert(_el$
|
|
31870
|
-
return _el$
|
|
32231
|
+
var _el$58 = _tmpl$10(), _el$59 = _el$58.firstChild;
|
|
32232
|
+
insert(_el$59, () => numericInput(t("table.columnWidth"), columnWidth, setColumnWidth, "editor-table-properties-column-width"));
|
|
32233
|
+
return _el$58;
|
|
31871
32234
|
})()
|
|
31872
32235
|
}, {
|
|
31873
32236
|
id: "cell",
|
|
31874
32237
|
label: t("table.tabCell"),
|
|
31875
32238
|
testId: "editor-table-properties-tab-cell",
|
|
31876
32239
|
panel: (() => {
|
|
31877
|
-
var _el$
|
|
31878
|
-
insert(_el$
|
|
31879
|
-
insert(_el$
|
|
31880
|
-
_el$
|
|
31881
|
-
insert(_el$
|
|
31882
|
-
insert(_el$
|
|
31883
|
-
insert(_el$
|
|
31884
|
-
insert(_el$
|
|
31885
|
-
insert(_el$
|
|
31886
|
-
_el$
|
|
31887
|
-
insert(_el$
|
|
31888
|
-
insert(_el$
|
|
31889
|
-
insert(_el$
|
|
31890
|
-
insert(_el$
|
|
31891
|
-
insert(_el$
|
|
31892
|
-
insert(_el$
|
|
31893
|
-
insert(_el$
|
|
31894
|
-
insert(_el$
|
|
31895
|
-
insert(_el$
|
|
31896
|
-
insert(_el$
|
|
31897
|
-
insert(_el$
|
|
31898
|
-
insert(_el$
|
|
31899
|
-
_el$
|
|
32240
|
+
var _el$60 = _tmpl$11(), _el$61 = _el$60.firstChild, _el$62 = _el$61.firstChild, _el$63 = _el$62.firstChild, _el$64 = _el$63.nextSibling, _el$65 = _el$64.firstChild, _el$66 = _el$65.nextSibling, _el$67 = _el$66.nextSibling, _el$68 = _el$67.nextSibling, _el$69 = _el$62.nextSibling, _el$70 = _el$69.firstChild, _el$71 = _el$70.nextSibling, _el$72 = _el$71.firstChild, _el$73 = _el$61.nextSibling, _el$74 = _el$73.firstChild, _el$75 = _el$74.nextSibling, _el$76 = _el$73.nextSibling, _el$77 = _el$76.firstChild, _el$78 = _el$77.nextSibling, _el$79 = _el$76.nextSibling, _el$80 = _el$79.firstChild, _el$81 = _el$80.nextSibling, _el$82 = _el$81.firstChild, _el$83 = _el$82.firstChild, _el$84 = _el$83.nextSibling, _el$85 = _el$84.firstChild, _el$86 = _el$85.nextSibling, _el$87 = _el$86.nextSibling, _el$88 = _el$87.nextSibling, _el$89 = _el$82.nextSibling, _el$90 = _el$89.firstChild, _el$91 = _el$90.nextSibling, _el$92 = _el$89.nextSibling, _el$93 = _el$92.firstChild, _el$94 = _el$93.nextSibling, _el$95 = _el$81.nextSibling, _el$96 = _el$95.nextSibling;
|
|
32241
|
+
insert(_el$61, () => numericInput(t("table.cellWidth"), cellWidth, setCellWidth, "editor-table-properties-cell-width"), _el$62);
|
|
32242
|
+
insert(_el$63, () => t("table.verticalAlignment"));
|
|
32243
|
+
_el$64.addEventListener("change", (e) => setCellVerticalAlign(e.currentTarget.value));
|
|
32244
|
+
insert(_el$65, () => t("table.inherit"));
|
|
32245
|
+
insert(_el$66, () => t("table.valignTop"));
|
|
32246
|
+
insert(_el$67, () => t("table.valignMiddle"));
|
|
32247
|
+
insert(_el$68, () => t("table.valignBottom"));
|
|
32248
|
+
insert(_el$70, () => t("table.textDirection"));
|
|
32249
|
+
_el$71.addEventListener("change", (e) => setCellTextDirection(e.currentTarget.value));
|
|
32250
|
+
insert(_el$72, () => t("table.inherit"));
|
|
32251
|
+
insert(_el$74, () => t("table.options"));
|
|
32252
|
+
insert(_el$75, () => checkbox(t("table.noWrap"), cellNoWrap, setCellNoWrap, "editor-table-properties-cell-nowrap"), null);
|
|
32253
|
+
insert(_el$75, () => checkbox(t("table.fitText"), cellFitText, setCellFitText, "editor-table-properties-cell-fit-text"), null);
|
|
32254
|
+
insert(_el$75, () => checkbox(t("table.hideMark"), cellHideMark, setCellHideMark, "editor-table-properties-cell-hide-mark"), null);
|
|
32255
|
+
insert(_el$77, () => t("table.cellMargins"));
|
|
32256
|
+
insert(_el$78, () => numericInput(t("paragraph.borderSideTop"), marginTop, setMarginTop, "editor-table-properties-margin-top"), null);
|
|
32257
|
+
insert(_el$78, () => numericInput(t("paragraph.borderSideRight"), marginRight, setMarginRight, "editor-table-properties-margin-right"), null);
|
|
32258
|
+
insert(_el$78, () => numericInput(t("paragraph.borderSideBottom"), marginBottom, setMarginBottom, "editor-table-properties-margin-bottom"), null);
|
|
32259
|
+
insert(_el$78, () => numericInput(t("paragraph.borderSideLeft"), marginLeft, setMarginLeft, "editor-table-properties-margin-left"), null);
|
|
32260
|
+
insert(_el$80, () => t("paragraph.bordersSection"));
|
|
32261
|
+
insert(_el$83, () => t("paragraph.borderStyleLabel"));
|
|
32262
|
+
_el$84.addEventListener("change", (e) => {
|
|
31900
32263
|
const next = e.currentTarget.value;
|
|
31901
32264
|
setBorderStyle(next);
|
|
31902
32265
|
if (next === "none") {
|
|
@@ -31904,6 +32267,10 @@ function TablePropertiesDialog(props) {
|
|
|
31904
32267
|
setBorderRight(false);
|
|
31905
32268
|
setBorderBottom(false);
|
|
31906
32269
|
setBorderLeft(false);
|
|
32270
|
+
setBorderStart(false);
|
|
32271
|
+
setBorderEnd(false);
|
|
32272
|
+
setBorderTlBr(false);
|
|
32273
|
+
setBorderTrBl(false);
|
|
31907
32274
|
} else if (!borderTop() && !borderRight() && !borderBottom() && !borderLeft()) {
|
|
31908
32275
|
setBorderTop(true);
|
|
31909
32276
|
setBorderRight(true);
|
|
@@ -31911,48 +32278,52 @@ function TablePropertiesDialog(props) {
|
|
|
31911
32278
|
setBorderLeft(true);
|
|
31912
32279
|
}
|
|
31913
32280
|
});
|
|
31914
|
-
insert(_el$
|
|
31915
|
-
insert(_el$
|
|
31916
|
-
insert(_el$
|
|
31917
|
-
insert(_el$
|
|
31918
|
-
insert(_el$
|
|
31919
|
-
insert(_el$
|
|
31920
|
-
_el$
|
|
31921
|
-
insert(_el$
|
|
31922
|
-
_el$
|
|
31923
|
-
insert(_el$
|
|
31924
|
-
insert(_el$
|
|
31925
|
-
insert(_el$
|
|
31926
|
-
insert(_el$
|
|
32281
|
+
insert(_el$85, () => t("paragraph.borderNone"));
|
|
32282
|
+
insert(_el$86, () => t("paragraph.borderSolid"));
|
|
32283
|
+
insert(_el$87, () => t("paragraph.borderDashed"));
|
|
32284
|
+
insert(_el$88, () => t("paragraph.borderDotted"));
|
|
32285
|
+
insert(_el$81, () => numericInput(t("paragraph.borderWidthLabel"), borderWidth, setBorderWidth, "editor-table-properties-border-width", borderStyle() === "none"), _el$89);
|
|
32286
|
+
insert(_el$90, () => t("paragraph.borderColorLabel"));
|
|
32287
|
+
_el$91.$$input = (e) => setBorderColor(e.currentTarget.value);
|
|
32288
|
+
insert(_el$93, () => t("paragraph.shadingLabel"));
|
|
32289
|
+
_el$94.$$input = (e) => setShading(e.currentTarget.value);
|
|
32290
|
+
insert(_el$95, () => checkbox(t("paragraph.borderSideTop"), borderTop, setBorderTop, "editor-table-properties-border-top", borderStyle() === "none"), null);
|
|
32291
|
+
insert(_el$95, () => checkbox(t("paragraph.borderSideRight"), borderRight, setBorderRight, "editor-table-properties-border-right", borderStyle() === "none"), null);
|
|
32292
|
+
insert(_el$95, () => checkbox(t("paragraph.borderSideBottom"), borderBottom, setBorderBottom, "editor-table-properties-border-bottom", borderStyle() === "none"), null);
|
|
32293
|
+
insert(_el$95, () => checkbox(t("paragraph.borderSideLeft"), borderLeft, setBorderLeft, "editor-table-properties-border-left", borderStyle() === "none"), null);
|
|
32294
|
+
insert(_el$95, () => checkbox(t("table.borderStart"), borderStart, setBorderStart, "editor-table-properties-border-start", borderStyle() === "none"), null);
|
|
32295
|
+
insert(_el$95, () => checkbox(t("table.borderEnd"), borderEnd, setBorderEnd, "editor-table-properties-border-end", borderStyle() === "none"), null);
|
|
32296
|
+
insert(_el$95, () => checkbox(t("table.borderTlBr"), borderTlBr, setBorderTlBr, "editor-table-properties-border-tlbr", borderStyle() === "none"), null);
|
|
32297
|
+
insert(_el$95, () => checkbox(t("table.borderTrBl"), borderTrBl, setBorderTrBl, "editor-table-properties-border-trbl", borderStyle() === "none"), null);
|
|
31927
32298
|
createRenderEffect((_p$) => {
|
|
31928
32299
|
var _v$ = borderStyle() === "none", _v$2 = borderPreview();
|
|
31929
|
-
_v$ !== _p$.e && (_el$
|
|
31930
|
-
_p$.t = style(_el$
|
|
32300
|
+
_v$ !== _p$.e && (_el$91.disabled = _p$.e = _v$);
|
|
32301
|
+
_p$.t = style(_el$96, _v$2, _p$.t);
|
|
31931
32302
|
return _p$;
|
|
31932
32303
|
}, {
|
|
31933
32304
|
e: void 0,
|
|
31934
32305
|
t: void 0
|
|
31935
32306
|
});
|
|
31936
|
-
createRenderEffect(() => _el$
|
|
31937
|
-
createRenderEffect(() => _el$
|
|
31938
|
-
createRenderEffect(() => _el$
|
|
31939
|
-
createRenderEffect(() => _el$
|
|
31940
|
-
createRenderEffect(() => _el$
|
|
31941
|
-
return _el$
|
|
32307
|
+
createRenderEffect(() => _el$64.value = cellVerticalAlign());
|
|
32308
|
+
createRenderEffect(() => _el$71.value = cellTextDirection());
|
|
32309
|
+
createRenderEffect(() => _el$84.value = borderStyle());
|
|
32310
|
+
createRenderEffect(() => _el$91.value = borderColor() || DEFAULT_BORDER_COLOR);
|
|
32311
|
+
createRenderEffect(() => _el$94.value = shading() || "#ffffff");
|
|
32312
|
+
return _el$60;
|
|
31942
32313
|
})()
|
|
31943
32314
|
}, {
|
|
31944
32315
|
id: "altText",
|
|
31945
32316
|
label: t("table.tabAltText"),
|
|
31946
32317
|
testId: "editor-table-properties-tab-alt-text",
|
|
31947
32318
|
panel: (() => {
|
|
31948
|
-
var _el$
|
|
31949
|
-
insert(_el$
|
|
31950
|
-
_el$
|
|
31951
|
-
insert(_el$
|
|
31952
|
-
_el$
|
|
31953
|
-
createRenderEffect(() => _el$
|
|
31954
|
-
createRenderEffect(() => _el$
|
|
31955
|
-
return _el$
|
|
32319
|
+
var _el$97 = _tmpl$12(), _el$98 = _el$97.firstChild, _el$99 = _el$98.firstChild, _el$100 = _el$99.nextSibling, _el$101 = _el$98.nextSibling, _el$102 = _el$101.firstChild, _el$103 = _el$102.nextSibling;
|
|
32320
|
+
insert(_el$99, () => t("table.altTitle"));
|
|
32321
|
+
_el$100.$$input = (e) => setAltTitle(e.currentTarget.value);
|
|
32322
|
+
insert(_el$102, () => t("table.altDescription"));
|
|
32323
|
+
_el$103.$$input = (e) => setAltDescription(e.currentTarget.value);
|
|
32324
|
+
createRenderEffect(() => _el$100.value = altTitle());
|
|
32325
|
+
createRenderEffect(() => _el$103.value = altDescription());
|
|
32326
|
+
return _el$97;
|
|
31956
32327
|
})()
|
|
31957
32328
|
}];
|
|
31958
32329
|
}
|
|
@@ -32810,6 +33181,35 @@ function serializeParagraphBorders(style2) {
|
|
|
32810
33181
|
const DEFAULT_TABLE_BORDER_COLOR = "6F6F6F";
|
|
32811
33182
|
const DEFAULT_TABLE_BORDER_WIDTH_PT = 0.75;
|
|
32812
33183
|
const DEFAULT_CELL_PADDING_LEFT_RIGHT_PT = 5.4;
|
|
33184
|
+
function serializeRevisionAttrs(revision) {
|
|
33185
|
+
const numericId = /^\d+$/.test(revision.id) ? revision.id : String(
|
|
33186
|
+
Array.from(revision.id).reduce(
|
|
33187
|
+
(hash, character) => hash * 31 + character.charCodeAt(0) >>> 0,
|
|
33188
|
+
0
|
|
33189
|
+
)
|
|
33190
|
+
);
|
|
33191
|
+
const date = Number.isFinite(revision.date) ? new Date(revision.date).toISOString() : (/* @__PURE__ */ new Date(0)).toISOString();
|
|
33192
|
+
return `w:id="${numericId}" w:author="${escapeXml(revision.author)}" w:date="${date}"`;
|
|
33193
|
+
}
|
|
33194
|
+
function serializeConditionalFlags(flags) {
|
|
33195
|
+
if (!flags || Object.keys(flags).length === 0) return "";
|
|
33196
|
+
const attributes = [
|
|
33197
|
+
["firstRow", "firstRow"],
|
|
33198
|
+
["lastRow", "lastRow"],
|
|
33199
|
+
["firstColumn", "firstCol"],
|
|
33200
|
+
["lastColumn", "lastCol"],
|
|
33201
|
+
["oddVBand", "band1Vert"],
|
|
33202
|
+
["evenVBand", "band2Vert"],
|
|
33203
|
+
["oddHBand", "band1Horz"],
|
|
33204
|
+
["evenHBand", "band2Horz"],
|
|
33205
|
+
["firstRowFirstColumn", "nwCell"],
|
|
33206
|
+
["firstRowLastColumn", "neCell"],
|
|
33207
|
+
["lastRowFirstColumn", "swCell"],
|
|
33208
|
+
["lastRowLastColumn", "seCell"]
|
|
33209
|
+
];
|
|
33210
|
+
const xml = attributes.filter(([, key]) => flags[key] !== void 0).map(([name, key]) => `w:${name}="${flags[key] ? "1" : "0"}"`).join(" ");
|
|
33211
|
+
return xml ? `<w:cnfStyle ${xml}/>` : "";
|
|
33212
|
+
}
|
|
32813
33213
|
function serializeOnOffElement(tag, value) {
|
|
32814
33214
|
if (value === void 0) {
|
|
32815
33215
|
return "";
|
|
@@ -32900,7 +33300,9 @@ function serializeTableDefaultCellMargins(margins) {
|
|
|
32900
33300
|
const parts = [];
|
|
32901
33301
|
const edge = (name, value) => {
|
|
32902
33302
|
if (value !== void 0 && Number.isFinite(value)) {
|
|
32903
|
-
parts.push(
|
|
33303
|
+
parts.push(
|
|
33304
|
+
`<w:${name} w:w="${pointsToTwips(value) ?? 0}" w:type="dxa"/>`
|
|
33305
|
+
);
|
|
32904
33306
|
}
|
|
32905
33307
|
};
|
|
32906
33308
|
edge("top", margins.top);
|
|
@@ -32912,9 +33314,11 @@ function serializeTableDefaultCellMargins(margins) {
|
|
|
32912
33314
|
return parts.length > 0 ? `<w:tblCellMar>${parts.join("")}</w:tblCellMar>` : "";
|
|
32913
33315
|
}
|
|
32914
33316
|
function serializeTableCellProperties(cell, fallbackWidthPt) {
|
|
32915
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
33317
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
32916
33318
|
const colSpan = Math.max(1, Math.floor(cell.colSpan ?? 1));
|
|
32917
33319
|
const parts = [];
|
|
33320
|
+
const conditional = serializeConditionalFlags(cell.conditionalStyle);
|
|
33321
|
+
if (conditional) parts.push(conditional);
|
|
32918
33322
|
const widthXml = serializeCellWidth(((_a = cell.style) == null ? void 0 : _a.width) ?? fallbackWidthPt);
|
|
32919
33323
|
if (widthXml) {
|
|
32920
33324
|
parts.push(widthXml);
|
|
@@ -32956,11 +33360,33 @@ function serializeTableCellProperties(cell, fallbackWidthPt) {
|
|
|
32956
33360
|
if (hideMark) {
|
|
32957
33361
|
parts.push(hideMark);
|
|
32958
33362
|
}
|
|
32959
|
-
if ((
|
|
32960
|
-
|
|
33363
|
+
if ((_i = cell.style) == null ? void 0 : _i.propertyRevision) {
|
|
33364
|
+
const revision = cell.style.propertyRevision;
|
|
33365
|
+
const previous = serializeTableCellProperties({
|
|
33366
|
+
...cell,
|
|
33367
|
+
style: revision.previous
|
|
33368
|
+
});
|
|
33369
|
+
parts.push(
|
|
33370
|
+
`<w:tcPrChange ${serializeRevisionAttrs(revision)}>${previous}</w:tcPrChange>`
|
|
33371
|
+
);
|
|
33372
|
+
}
|
|
33373
|
+
if ((_j = cell.style) == null ? void 0 : _j.revision) {
|
|
33374
|
+
const revision = cell.style.revision;
|
|
33375
|
+
const element = revision.type === "insert" ? "cellIns" : revision.type === "delete" ? "cellDel" : "cellMerge";
|
|
33376
|
+
const mergeAttrs = revision.type === "merge" ? `${((_k = revision.previous) == null ? void 0 : _k.vMerge) ? ` w:vMergeOrig="${revision.previous.vMerge === "restart" ? "rest" : "cont"}"` : ""}${cell.vMerge ? ` w:vMerge="${cell.vMerge === "restart" ? "rest" : "cont"}"` : ""}` : "";
|
|
33377
|
+
parts.push(
|
|
33378
|
+
`<w:${element} ${serializeRevisionAttrs(revision)}${mergeAttrs}/>`
|
|
33379
|
+
);
|
|
32961
33380
|
}
|
|
32962
33381
|
return parts.length > 0 ? `<w:tcPr>${parts.join("")}</w:tcPr>` : "";
|
|
32963
33382
|
}
|
|
33383
|
+
function serializeTableCellStyleXml(style2) {
|
|
33384
|
+
return serializeTableCellProperties({
|
|
33385
|
+
id: "table-style-cell",
|
|
33386
|
+
blocks: [],
|
|
33387
|
+
style: style2
|
|
33388
|
+
});
|
|
33389
|
+
}
|
|
32964
33390
|
function serializeGridSkip(tag, value) {
|
|
32965
33391
|
if (value === void 0 || !Number.isFinite(value)) {
|
|
32966
33392
|
return "";
|
|
@@ -32983,10 +33409,12 @@ function serializeTableRowHeightFromStyle(heightValue, heightRule) {
|
|
|
32983
33409
|
}
|
|
32984
33410
|
function serializeTableRowHeight(row) {
|
|
32985
33411
|
var _a, _b;
|
|
32986
|
-
return serializeTableRowHeightFromStyle(
|
|
33412
|
+
return serializeTableRowHeightFromStyle(
|
|
33413
|
+
(_a = row.style) == null ? void 0 : _a.height,
|
|
33414
|
+
(_b = row.style) == null ? void 0 : _b.heightRule
|
|
33415
|
+
);
|
|
32987
33416
|
}
|
|
32988
33417
|
function serializeTableRowStyleXml(style2) {
|
|
32989
|
-
var _a;
|
|
32990
33418
|
if (!style2) return "";
|
|
32991
33419
|
const parts = [];
|
|
32992
33420
|
const gridBefore = serializeGridSkip("gridBefore", style2.gridBefore);
|
|
@@ -32997,49 +33425,104 @@ function serializeTableRowStyleXml(style2) {
|
|
|
32997
33425
|
if (widthBefore) parts.push(widthBefore);
|
|
32998
33426
|
const widthAfter = serializeDocxWidthElement("wAfter", style2.widthAfter);
|
|
32999
33427
|
if (widthAfter) parts.push(widthAfter);
|
|
33000
|
-
const cellSpacingXml = serializeDocxWidthElement(
|
|
33428
|
+
const cellSpacingXml = serializeDocxWidthElement(
|
|
33429
|
+
"tblCellSpacing",
|
|
33430
|
+
style2.cellSpacing
|
|
33431
|
+
);
|
|
33001
33432
|
if (cellSpacingXml) parts.push(cellSpacingXml);
|
|
33002
|
-
const heightXml = serializeTableRowHeightFromStyle(
|
|
33433
|
+
const heightXml = serializeTableRowHeightFromStyle(
|
|
33434
|
+
style2.height,
|
|
33435
|
+
style2.heightRule
|
|
33436
|
+
);
|
|
33003
33437
|
if (heightXml) parts.push(heightXml);
|
|
33004
33438
|
const cantSplit = serializeOnOffElement("cantSplit", style2.cantSplit);
|
|
33005
33439
|
if (cantSplit) parts.push(cantSplit);
|
|
33006
33440
|
const hidden = serializeOnOffElement("hidden", style2.hidden);
|
|
33007
33441
|
if (hidden) parts.push(hidden);
|
|
33008
|
-
|
|
33442
|
+
const header = serializeOnOffElement("tblHeader", style2.isHeader);
|
|
33443
|
+
if (header) parts.push(header);
|
|
33009
33444
|
return parts.length > 0 ? `<w:trPr>${parts.join("")}</w:trPr>` : "";
|
|
33010
33445
|
}
|
|
33011
33446
|
function serializeTableRowProperties(row) {
|
|
33012
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
33447
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
33013
33448
|
const parts = [];
|
|
33449
|
+
const conditional = serializeConditionalFlags(row.conditionalStyle);
|
|
33450
|
+
if (conditional) parts.push(conditional);
|
|
33014
33451
|
const gridBefore = serializeGridSkip("gridBefore", (_a = row.style) == null ? void 0 : _a.gridBefore);
|
|
33015
33452
|
if (gridBefore) parts.push(gridBefore);
|
|
33016
33453
|
const gridAfter = serializeGridSkip("gridAfter", (_b = row.style) == null ? void 0 : _b.gridAfter);
|
|
33017
33454
|
if (gridAfter) parts.push(gridAfter);
|
|
33018
|
-
const widthBefore = serializeDocxWidthElement(
|
|
33455
|
+
const widthBefore = serializeDocxWidthElement(
|
|
33456
|
+
"wBefore",
|
|
33457
|
+
(_c = row.style) == null ? void 0 : _c.widthBefore
|
|
33458
|
+
);
|
|
33019
33459
|
if (widthBefore) parts.push(widthBefore);
|
|
33020
33460
|
const widthAfter = serializeDocxWidthElement("wAfter", (_d = row.style) == null ? void 0 : _d.widthAfter);
|
|
33021
33461
|
if (widthAfter) parts.push(widthAfter);
|
|
33022
|
-
const cellSpacingXml = serializeDocxWidthElement(
|
|
33462
|
+
const cellSpacingXml = serializeDocxWidthElement(
|
|
33463
|
+
"tblCellSpacing",
|
|
33464
|
+
(_e = row.style) == null ? void 0 : _e.cellSpacing
|
|
33465
|
+
);
|
|
33023
33466
|
if (cellSpacingXml) parts.push(cellSpacingXml);
|
|
33024
33467
|
const height = serializeTableRowHeight(row);
|
|
33025
33468
|
if (height) parts.push(height);
|
|
33026
33469
|
const cantSplit = serializeOnOffElement("cantSplit", (_f = row.style) == null ? void 0 : _f.cantSplit);
|
|
33027
33470
|
if (cantSplit) parts.push(cantSplit);
|
|
33028
|
-
if (row.isHeader) parts.push("<w:tblHeader/>");
|
|
33029
|
-
const hidden = serializeOnOffElement("hidden", (
|
|
33471
|
+
if (((_g = row.style) == null ? void 0 : _g.isHeader) ?? row.isHeader) parts.push("<w:tblHeader/>");
|
|
33472
|
+
const hidden = serializeOnOffElement("hidden", (_h = row.style) == null ? void 0 : _h.hidden);
|
|
33030
33473
|
if (hidden) parts.push(hidden);
|
|
33031
|
-
if ((_i =
|
|
33474
|
+
if ((_i = row.style) == null ? void 0 : _i.propertyRevision) {
|
|
33475
|
+
const revision = row.style.propertyRevision;
|
|
33476
|
+
parts.push(
|
|
33477
|
+
`<w:trPrChange ${serializeRevisionAttrs(revision)}>${serializeTableRowStyleXml(revision.previous)}</w:trPrChange>`
|
|
33478
|
+
);
|
|
33479
|
+
}
|
|
33480
|
+
if (((_j = row.style) == null ? void 0 : _j.revision) && row.style.revision.type !== "merge") {
|
|
33481
|
+
const revision = row.style.revision;
|
|
33482
|
+
const element = revision.type === "insert" ? "ins" : "del";
|
|
33483
|
+
parts.push(`<w:${element} ${serializeRevisionAttrs(revision)}/>`);
|
|
33484
|
+
}
|
|
33032
33485
|
return parts.length > 0 ? `<w:trPr>${parts.join("")}</w:trPr>` : "";
|
|
33033
33486
|
}
|
|
33034
33487
|
function serializeFloatingTableProperties(floating) {
|
|
33035
33488
|
if (!floating || Object.keys(floating).length === 0) {
|
|
33036
33489
|
return "";
|
|
33037
33490
|
}
|
|
33038
|
-
const
|
|
33491
|
+
const twips = (value) => {
|
|
33492
|
+
const converted = pointsToTwips(value);
|
|
33493
|
+
return converted === null ? void 0 : String(converted);
|
|
33494
|
+
};
|
|
33495
|
+
const values = {
|
|
33496
|
+
horzAnchor: floating.horizontalAnchor,
|
|
33497
|
+
vertAnchor: floating.verticalAnchor,
|
|
33498
|
+
tblpX: twips(floating.x),
|
|
33499
|
+
tblpY: twips(floating.y),
|
|
33500
|
+
tblpXSpec: floating.xAlign,
|
|
33501
|
+
tblpYSpec: floating.yAlign,
|
|
33502
|
+
topFromText: twips(floating.distanceTop),
|
|
33503
|
+
rightFromText: twips(floating.distanceRight),
|
|
33504
|
+
bottomFromText: twips(floating.distanceBottom),
|
|
33505
|
+
leftFromText: twips(floating.distanceLeft)
|
|
33506
|
+
};
|
|
33507
|
+
const attrs = Object.entries(values).filter((entry) => entry[1] !== void 0).map(([key, value]) => `w:${key}="${escapeXml(value)}"`).join(" ");
|
|
33039
33508
|
return `<w:tblpPr ${attrs}/>`;
|
|
33040
33509
|
}
|
|
33510
|
+
function serializeTableBorders(style2) {
|
|
33511
|
+
const borders = style2 == null ? void 0 : style2.borders;
|
|
33512
|
+
if (!borders) return "";
|
|
33513
|
+
const edges = [
|
|
33514
|
+
["top", borders.borderTop],
|
|
33515
|
+
["left", borders.borderLeft],
|
|
33516
|
+
["bottom", borders.borderBottom],
|
|
33517
|
+
["right", borders.borderRight],
|
|
33518
|
+
["insideH", borders.borderInsideH],
|
|
33519
|
+
["insideV", borders.borderInsideV]
|
|
33520
|
+
];
|
|
33521
|
+
const xml = edges.filter((entry) => !!entry[1]).map(([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`).join("");
|
|
33522
|
+
return xml ? `<w:tblBorders>${xml}</w:tblBorders>` : "";
|
|
33523
|
+
}
|
|
33041
33524
|
function serializeTableProperties(table) {
|
|
33042
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n
|
|
33525
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
33043
33526
|
const parts = [];
|
|
33044
33527
|
if ((_a = table.style) == null ? void 0 : _a.styleId) {
|
|
33045
33528
|
parts.push(`<w:tblStyle w:val="${escapeXml(table.style.styleId)}"/>`);
|
|
@@ -33080,6 +33563,8 @@ function serializeTableProperties(table) {
|
|
|
33080
33563
|
if (defaultMarginsXml) {
|
|
33081
33564
|
parts.push(defaultMarginsXml);
|
|
33082
33565
|
}
|
|
33566
|
+
const tableBorders = serializeTableBorders(table.style);
|
|
33567
|
+
if (tableBorders) parts.push(tableBorders);
|
|
33083
33568
|
const indentXml = serializeDocxWidthElement(
|
|
33084
33569
|
"tblInd",
|
|
33085
33570
|
(_j = table.style) == null ? void 0 : _j.indentLeft
|
|
@@ -33088,15 +33573,25 @@ function serializeTableProperties(table) {
|
|
|
33088
33573
|
parts.push(indentXml);
|
|
33089
33574
|
}
|
|
33090
33575
|
parts.push(`<w:tblLayout w:type="${((_k = table.style) == null ? void 0 : _k.layout) ?? "fixed"}"/>`);
|
|
33091
|
-
const bidiVisual = serializeOnOffElement(
|
|
33576
|
+
const bidiVisual = serializeOnOffElement(
|
|
33577
|
+
"bidiVisual",
|
|
33578
|
+
(_l = table.style) == null ? void 0 : _l.bidiVisual
|
|
33579
|
+
);
|
|
33092
33580
|
if (bidiVisual) {
|
|
33093
33581
|
parts.push(bidiVisual);
|
|
33094
33582
|
}
|
|
33095
33583
|
if ((_m = table.style) == null ? void 0 : _m.tblOverlap) {
|
|
33096
33584
|
parts.push(`<w:tblOverlap w:val="${escapeXml(table.style.tblOverlap)}"/>`);
|
|
33097
33585
|
}
|
|
33098
|
-
if ((
|
|
33099
|
-
|
|
33586
|
+
if ((_n = table.style) == null ? void 0 : _n.revision) {
|
|
33587
|
+
const revision = table.style.revision;
|
|
33588
|
+
const previous = serializeTableProperties({
|
|
33589
|
+
...table,
|
|
33590
|
+
style: revision.previous
|
|
33591
|
+
});
|
|
33592
|
+
parts.push(
|
|
33593
|
+
`<w:tblPrChange ${serializeRevisionAttrs(revision)}>${previous}</w:tblPrChange>`
|
|
33594
|
+
);
|
|
33100
33595
|
}
|
|
33101
33596
|
return `<w:tblPr>${parts.join("")}</w:tblPr>`;
|
|
33102
33597
|
}
|
|
@@ -33127,7 +33622,7 @@ function serializeTableXml(table, serializeParagraphXml2) {
|
|
|
33127
33622
|
}).join("");
|
|
33128
33623
|
return `<w:tr>${row.tblPrExXml ?? ""}${serializeTableRowProperties(row)}${cellsXml}</w:tr>`;
|
|
33129
33624
|
}).join("");
|
|
33130
|
-
const gridXml = table.gridCols ? `<w:tblGrid>${table.gridCols.map((width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`).join("")}${table.
|
|
33625
|
+
const gridXml = table.gridCols ? `<w:tblGrid>${table.gridCols.map((width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`).join("")}${table.gridRevision ? `<w:tblGridChange ${serializeRevisionAttrs(table.gridRevision)}><w:tblGrid>${table.gridRevision.previous.map((width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
|
|
33131
33626
|
return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
|
|
33132
33627
|
}
|
|
33133
33628
|
function materializeParagraphStyle(paragraph, styles) {
|
|
@@ -34282,6 +34777,9 @@ const CONDITIONAL_TYPE_ORDER = [
|
|
|
34282
34777
|
"seCell"
|
|
34283
34778
|
];
|
|
34284
34779
|
function serializeConditionalTcPr(cond) {
|
|
34780
|
+
if (cond.cellStyle) {
|
|
34781
|
+
return serializeTableCellStyleXml(cond.cellStyle);
|
|
34782
|
+
}
|
|
34285
34783
|
const parts = [];
|
|
34286
34784
|
if (cond.borders) {
|
|
34287
34785
|
const b = cond.borders;
|
|
@@ -34305,12 +34803,63 @@ function serializeConditionalTcPr(cond) {
|
|
|
34305
34803
|
}
|
|
34306
34804
|
return parts.length > 0 ? `<w:tcPr>${parts.join("")}</w:tcPr>` : "";
|
|
34307
34805
|
}
|
|
34806
|
+
function serializeWidthElement(name, value) {
|
|
34807
|
+
if (typeof value === "number") {
|
|
34808
|
+
return `<w:${name} w:w="${pointsToTwips(value) ?? 0}" w:type="dxa"/>`;
|
|
34809
|
+
}
|
|
34810
|
+
if (typeof value === "string" && value.endsWith("%")) {
|
|
34811
|
+
const percent = Number.parseFloat(value);
|
|
34812
|
+
return Number.isFinite(percent) ? `<w:${name} w:w="${Math.round(percent * 50)}" w:type="pct"/>` : "";
|
|
34813
|
+
}
|
|
34814
|
+
return value === "auto" ? `<w:${name} w:w="0" w:type="auto"/>` : "";
|
|
34815
|
+
}
|
|
34816
|
+
function serializeTableStyleProperties(style2) {
|
|
34817
|
+
if (!style2) return "";
|
|
34818
|
+
const parts = [];
|
|
34819
|
+
if (style2.rowBandSize !== void 0)
|
|
34820
|
+
parts.push(`<w:tblStyleRowBandSize w:val="${style2.rowBandSize}"/>`);
|
|
34821
|
+
if (style2.colBandSize !== void 0)
|
|
34822
|
+
parts.push(`<w:tblStyleColBandSize w:val="${style2.colBandSize}"/>`);
|
|
34823
|
+
const width = serializeWidthElement("tblW", style2.width);
|
|
34824
|
+
if (width) parts.push(width);
|
|
34825
|
+
const indent = serializeWidthElement("tblInd", style2.indentLeft);
|
|
34826
|
+
if (indent) parts.push(indent);
|
|
34827
|
+
const spacing = serializeWidthElement("tblCellSpacing", style2.cellSpacing);
|
|
34828
|
+
if (spacing) parts.push(spacing);
|
|
34829
|
+
if (style2.align) parts.push(`<w:jc w:val="${style2.align}"/>`);
|
|
34830
|
+
if (style2.layout) parts.push(`<w:tblLayout w:type="${style2.layout}"/>`);
|
|
34831
|
+
if (style2.bidiVisual !== void 0)
|
|
34832
|
+
parts.push(`<w:bidiVisual w:val="${style2.bidiVisual ? "1" : "0"}"/>`);
|
|
34833
|
+
if (style2.defaultCellMargins) {
|
|
34834
|
+
const margins = Object.entries(style2.defaultCellMargins).map(
|
|
34835
|
+
([name, value]) => `<w:${name} w:w="${pointsToTwips(value) ?? 0}" w:type="dxa"/>`
|
|
34836
|
+
).join("");
|
|
34837
|
+
if (margins) parts.push(`<w:tblCellMar>${margins}</w:tblCellMar>`);
|
|
34838
|
+
}
|
|
34839
|
+
if (style2.borders) {
|
|
34840
|
+
const edges = [
|
|
34841
|
+
["top", style2.borders.borderTop],
|
|
34842
|
+
["left", style2.borders.borderLeft],
|
|
34843
|
+
["bottom", style2.borders.borderBottom],
|
|
34844
|
+
["right", style2.borders.borderRight],
|
|
34845
|
+
["insideH", style2.borders.borderInsideH],
|
|
34846
|
+
["insideV", style2.borders.borderInsideV]
|
|
34847
|
+
];
|
|
34848
|
+
const borders = edges.filter(
|
|
34849
|
+
(entry) => !!entry[1]
|
|
34850
|
+
).map(([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`).join("");
|
|
34851
|
+
if (borders) parts.push(`<w:tblBorders>${borders}</w:tblBorders>`);
|
|
34852
|
+
}
|
|
34853
|
+
return parts.length > 0 ? `<w:tblPr>${parts.join("")}</w:tblPr>` : "";
|
|
34854
|
+
}
|
|
34308
34855
|
function serializeConditionalBlock(type, cond) {
|
|
34309
34856
|
const parts = [];
|
|
34310
34857
|
const pPr = cond.paragraphStyle ? serializeParagraphStyleXml(cond.paragraphStyle) : "";
|
|
34311
34858
|
if (pPr) parts.push(pPr);
|
|
34312
34859
|
const rPr = cond.textStyle ? serializeRunProperties(cond.textStyle) : "";
|
|
34313
34860
|
if (rPr) parts.push(rPr);
|
|
34861
|
+
const tblPr = serializeTableStyleProperties(cond.tableStyle);
|
|
34862
|
+
if (tblPr) parts.push(tblPr);
|
|
34314
34863
|
const trPr = cond.rowStyle ? serializeTableRowStyleXml(cond.rowStyle) : "";
|
|
34315
34864
|
if (trPr) parts.push(trPr);
|
|
34316
34865
|
const tcPr = serializeConditionalTcPr(cond);
|
|
@@ -34355,22 +34904,8 @@ function serializeNamedStyle(style2) {
|
|
|
34355
34904
|
}
|
|
34356
34905
|
if (style2.type === "table" && style2.tableStyle) {
|
|
34357
34906
|
const ts = style2.tableStyle;
|
|
34358
|
-
const
|
|
34359
|
-
if (
|
|
34360
|
-
tblPrParts.push(`<w:tblStyleRowBandSize w:val="${ts.rowBandSize}"/>`);
|
|
34361
|
-
}
|
|
34362
|
-
if (ts.colBandSize !== void 0) {
|
|
34363
|
-
tblPrParts.push(`<w:tblStyleColBandSize w:val="${ts.colBandSize}"/>`);
|
|
34364
|
-
}
|
|
34365
|
-
if (ts.indentLeft !== void 0) {
|
|
34366
|
-
const val = typeof ts.indentLeft === "number" ? pointsToTwips(ts.indentLeft) : null;
|
|
34367
|
-
if (val !== null) {
|
|
34368
|
-
tblPrParts.push(`<w:tblInd w:w="${val}" w:type="dxa"/>`);
|
|
34369
|
-
}
|
|
34370
|
-
}
|
|
34371
|
-
if (tblPrParts.length > 0) {
|
|
34372
|
-
parts.push(`<w:tblPr>${tblPrParts.join("")}</w:tblPr>`);
|
|
34373
|
-
}
|
|
34907
|
+
const tblPr = serializeTableStyleProperties(ts);
|
|
34908
|
+
if (tblPr) parts.push(tblPr);
|
|
34374
34909
|
if (ts.conditionalFormats) {
|
|
34375
34910
|
const orderedKeys = [
|
|
34376
34911
|
...CONDITIONAL_TYPE_ORDER.filter((k) => k in ts.conditionalFormats),
|
|
@@ -34388,7 +34923,7 @@ function serializeNamedStyle(style2) {
|
|
|
34388
34923
|
}
|
|
34389
34924
|
}
|
|
34390
34925
|
const typeAttr = style2.type === "character" ? "character" : style2.type === "table" ? "table" : "paragraph";
|
|
34391
|
-
return `<w:style w:type="${typeAttr}" w:styleId="${escapeXml(style2.id)}">${parts.join("")}</w:style>`;
|
|
34926
|
+
return `<w:style w:type="${typeAttr}" w:styleId="${escapeXml(style2.id)}"${style2.isDefault ? ' w:default="1"' : ""}>${parts.join("")}</w:style>`;
|
|
34392
34927
|
}
|
|
34393
34928
|
function buildStylesXml(styles) {
|
|
34394
34929
|
const styleElements = Object.values(styles).map(serializeNamedStyle).join("");
|
|
@@ -35326,6 +35861,10 @@ async function drawFloatingTextBoxesForParagraph(options) {
|
|
|
35326
35861
|
if (!(textBox == null ? void 0 : textBox.floating)) {
|
|
35327
35862
|
continue;
|
|
35328
35863
|
}
|
|
35864
|
+
const isBehind = Boolean(textBox.floating.behindDoc);
|
|
35865
|
+
if (options.layer && options.layer === "behind" !== isBehind) {
|
|
35866
|
+
continue;
|
|
35867
|
+
}
|
|
35329
35868
|
const slot = slotByOffset.get(fragment.startOffset);
|
|
35330
35869
|
const anchorLeft = contentLeft + ((slot == null ? void 0 : slot.left) ?? 0);
|
|
35331
35870
|
const lineTop = paragraphTop + line.top;
|
|
@@ -35515,6 +36054,42 @@ function resolveFragmentBounds(line, fragment, fontSizePx) {
|
|
|
35515
36054
|
right: (nextSlot == null ? void 0 : nextSlot.left) ?? last.left + fontSizePx * 0.55
|
|
35516
36055
|
};
|
|
35517
36056
|
}
|
|
36057
|
+
async function drawFloatingImagesForParagraph(options) {
|
|
36058
|
+
for (const line of options.lines) {
|
|
36059
|
+
const slots = new Map(line.slots.map((slot) => [slot.offset, slot]));
|
|
36060
|
+
for (const fragment of line.fragments) {
|
|
36061
|
+
const image = fragment.image;
|
|
36062
|
+
if (!(image == null ? void 0 : image.floating)) continue;
|
|
36063
|
+
const isBehind = Boolean(image.floating.behindDoc);
|
|
36064
|
+
if (options.layer === "behind" !== isBehind) continue;
|
|
36065
|
+
const slot = slots.get(fragment.startOffset);
|
|
36066
|
+
const rect = resolveFloatingObjectRect({
|
|
36067
|
+
object: getImageFloatingGeometry(image),
|
|
36068
|
+
pageSettings: options.pageSettings,
|
|
36069
|
+
contentLeft: options.contentLeft,
|
|
36070
|
+
contentTop: options.contentTop,
|
|
36071
|
+
contentWidth: options.contentWidth,
|
|
36072
|
+
paragraphTop: options.paragraphTop,
|
|
36073
|
+
lineTop: options.paragraphTop + line.top,
|
|
36074
|
+
anchorLeft: options.contentLeft + ((slot == null ? void 0 : slot.left) ?? 0)
|
|
36075
|
+
});
|
|
36076
|
+
const resourceName = await registerPdfImageRun(
|
|
36077
|
+
options.writer,
|
|
36078
|
+
options.document,
|
|
36079
|
+
image
|
|
36080
|
+
);
|
|
36081
|
+
if (!resourceName) continue;
|
|
36082
|
+
options.writer.drawImage(options.pageIndex, {
|
|
36083
|
+
resourceName,
|
|
36084
|
+
x: pxToPt$1(rect.x),
|
|
36085
|
+
y: pxToPt$1(rect.y),
|
|
36086
|
+
width: pxToPt$1(rect.width),
|
|
36087
|
+
height: pxToPt$1(rect.height),
|
|
36088
|
+
rotation: image.rotation
|
|
36089
|
+
});
|
|
36090
|
+
}
|
|
36091
|
+
}
|
|
36092
|
+
}
|
|
35518
36093
|
function drawFragmentHighlight(writer, pageIndex, line, fragment, originX, originY, styles) {
|
|
35519
36094
|
if (!styles.highlight) {
|
|
35520
36095
|
return;
|
|
@@ -35754,6 +36329,9 @@ async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, docu
|
|
|
35754
36329
|
async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
|
|
35755
36330
|
var _a;
|
|
35756
36331
|
if (fragment.image) {
|
|
36332
|
+
if (fragment.image.floating) {
|
|
36333
|
+
return;
|
|
36334
|
+
}
|
|
35757
36335
|
const slot = line.slots.find(
|
|
35758
36336
|
(candidate) => candidate.offset === fragment.startOffset
|
|
35759
36337
|
) ?? line.slots.find((candidate) => candidate.offset >= fragment.startOffset);
|
|
@@ -36082,6 +36660,28 @@ function drawCellBorders(writer, pageIndex, cell, originX, originY) {
|
|
|
36082
36660
|
bottom
|
|
36083
36661
|
);
|
|
36084
36662
|
drawCellEdge(writer, pageIndex, cell.borders.left, left, top, left, bottom);
|
|
36663
|
+
if (cell.borders.topLeftToBottomRight) {
|
|
36664
|
+
drawCellEdge(
|
|
36665
|
+
writer,
|
|
36666
|
+
pageIndex,
|
|
36667
|
+
cell.borders.topLeftToBottomRight,
|
|
36668
|
+
left,
|
|
36669
|
+
top,
|
|
36670
|
+
right,
|
|
36671
|
+
bottom
|
|
36672
|
+
);
|
|
36673
|
+
}
|
|
36674
|
+
if (cell.borders.topRightToBottomLeft) {
|
|
36675
|
+
drawCellEdge(
|
|
36676
|
+
writer,
|
|
36677
|
+
pageIndex,
|
|
36678
|
+
cell.borders.topRightToBottomLeft,
|
|
36679
|
+
right,
|
|
36680
|
+
top,
|
|
36681
|
+
left,
|
|
36682
|
+
bottom
|
|
36683
|
+
);
|
|
36684
|
+
}
|
|
36085
36685
|
}
|
|
36086
36686
|
async function drawTableBlock(writer, pageIndex, block, document2, originX, originY, contentWidth, fontRegistry, listOrdinals, drawers) {
|
|
36087
36687
|
if (block.sourceBlock.type !== "table") {
|
|
@@ -36114,6 +36714,17 @@ async function drawTableBlock(writer, pageIndex, block, document2, originX, orig
|
|
|
36114
36714
|
}
|
|
36115
36715
|
for (const cell of tableLayout.cells) {
|
|
36116
36716
|
drawCellBorders(writer, pageIndex, cell, originX, originY);
|
|
36717
|
+
if (cell.revision) {
|
|
36718
|
+
const color = cell.revision.type === "insert" ? "#059669" : cell.revision.type === "delete" ? "#dc2626" : "#d97706";
|
|
36719
|
+
writer.drawRect(pageIndex, {
|
|
36720
|
+
x: pxToPt$1(originX + cell.left + 1),
|
|
36721
|
+
y: pxToPt$1(originY + cell.top + 1),
|
|
36722
|
+
width: pxToPt$1(Math.max(0, cell.width - 2)),
|
|
36723
|
+
height: pxToPt$1(Math.max(0, cell.height - 2)),
|
|
36724
|
+
stroke: color,
|
|
36725
|
+
lineWidth: pxToPt$1(2)
|
|
36726
|
+
});
|
|
36727
|
+
}
|
|
36117
36728
|
}
|
|
36118
36729
|
for (const cell of tableLayout.cells) {
|
|
36119
36730
|
for (const paragraphLayout of cell.paragraphs) {
|
|
@@ -36134,6 +36745,7 @@ async function drawTableBlock(writer, pageIndex, block, document2, originX, orig
|
|
|
36134
36745
|
}
|
|
36135
36746
|
const blockDrawers = { drawParagraph, drawTableBlock };
|
|
36136
36747
|
async function drawBlockList(writer, pageIndex, blocks, document2, originX, originY, contentWidth, fontRegistry, listOrdinals, pageSettings) {
|
|
36748
|
+
var _a;
|
|
36137
36749
|
if (!blocks || blocks.length === 0) {
|
|
36138
36750
|
return;
|
|
36139
36751
|
}
|
|
@@ -36161,6 +36773,34 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
36161
36773
|
boxTop,
|
|
36162
36774
|
contentWidth
|
|
36163
36775
|
);
|
|
36776
|
+
if (pageSettings) {
|
|
36777
|
+
await drawFloatingImagesForParagraph({
|
|
36778
|
+
writer,
|
|
36779
|
+
pageIndex,
|
|
36780
|
+
lines: block.layout.lines,
|
|
36781
|
+
document: document2,
|
|
36782
|
+
pageSettings,
|
|
36783
|
+
contentLeft: originX,
|
|
36784
|
+
contentTop,
|
|
36785
|
+
contentWidth,
|
|
36786
|
+
paragraphTop: textTop,
|
|
36787
|
+
layer: "behind"
|
|
36788
|
+
});
|
|
36789
|
+
await drawFloatingTextBoxesForParagraph({
|
|
36790
|
+
writer,
|
|
36791
|
+
document: document2,
|
|
36792
|
+
fontRegistry,
|
|
36793
|
+
pageIndex,
|
|
36794
|
+
lines: block.layout.lines,
|
|
36795
|
+
pageSettings,
|
|
36796
|
+
contentLeft: originX,
|
|
36797
|
+
contentTop,
|
|
36798
|
+
contentWidth,
|
|
36799
|
+
paragraphTop: boxTop,
|
|
36800
|
+
drawers: blockDrawers,
|
|
36801
|
+
layer: "behind"
|
|
36802
|
+
});
|
|
36803
|
+
}
|
|
36164
36804
|
await drawParagraph(
|
|
36165
36805
|
writer,
|
|
36166
36806
|
pageIndex,
|
|
@@ -36174,6 +36814,18 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
36174
36814
|
blockDrawers
|
|
36175
36815
|
);
|
|
36176
36816
|
if (pageSettings) {
|
|
36817
|
+
await drawFloatingImagesForParagraph({
|
|
36818
|
+
writer,
|
|
36819
|
+
pageIndex,
|
|
36820
|
+
lines: block.layout.lines,
|
|
36821
|
+
document: document2,
|
|
36822
|
+
pageSettings,
|
|
36823
|
+
contentLeft: originX,
|
|
36824
|
+
contentTop,
|
|
36825
|
+
contentWidth,
|
|
36826
|
+
paragraphTop: textTop,
|
|
36827
|
+
layer: "front"
|
|
36828
|
+
});
|
|
36177
36829
|
await drawFloatingTextBoxesForParagraph({
|
|
36178
36830
|
writer,
|
|
36179
36831
|
document: document2,
|
|
@@ -36185,12 +36837,44 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
36185
36837
|
contentTop,
|
|
36186
36838
|
contentWidth,
|
|
36187
36839
|
paragraphTop: boxTop,
|
|
36188
|
-
drawers: blockDrawers
|
|
36840
|
+
drawers: blockDrawers,
|
|
36841
|
+
layer: "front"
|
|
36189
36842
|
});
|
|
36190
36843
|
}
|
|
36191
36844
|
break;
|
|
36192
36845
|
}
|
|
36193
36846
|
case "table":
|
|
36847
|
+
if (((_a = block.sourceBlock.style) == null ? void 0 : _a.floating) && pageSettings) {
|
|
36848
|
+
const width = resolveCanvasTableWidth(
|
|
36849
|
+
block.sourceBlock,
|
|
36850
|
+
contentWidth
|
|
36851
|
+
);
|
|
36852
|
+
const rect = resolveFloatingTableRect({
|
|
36853
|
+
floating: block.sourceBlock.style.floating,
|
|
36854
|
+
pageSettings,
|
|
36855
|
+
contentLeft: originX,
|
|
36856
|
+
contentTop,
|
|
36857
|
+
contentWidth,
|
|
36858
|
+
anchorTop: cursorY,
|
|
36859
|
+
width,
|
|
36860
|
+
height: block.floatingTableHeight ?? 1,
|
|
36861
|
+
pageIndex
|
|
36862
|
+
});
|
|
36863
|
+
rect.y += block.floatingTableOffsetY ?? 0;
|
|
36864
|
+
await drawTableBlock(
|
|
36865
|
+
writer,
|
|
36866
|
+
pageIndex,
|
|
36867
|
+
{ ...block, estimatedHeight: rect.height },
|
|
36868
|
+
document2,
|
|
36869
|
+
rect.x,
|
|
36870
|
+
rect.y,
|
|
36871
|
+
contentWidth,
|
|
36872
|
+
fontRegistry,
|
|
36873
|
+
listOrdinals,
|
|
36874
|
+
blockDrawers
|
|
36875
|
+
);
|
|
36876
|
+
break;
|
|
36877
|
+
}
|
|
36194
36878
|
await drawTableBlock(
|
|
36195
36879
|
writer,
|
|
36196
36880
|
pageIndex,
|
|
@@ -40043,6 +40727,15 @@ function createTableSelectionResolvers(deps) {
|
|
|
40043
40727
|
};
|
|
40044
40728
|
}
|
|
40045
40729
|
function createTableCellSpanOperations(deps) {
|
|
40730
|
+
const cloneCellSnapshot = (cell) => ({
|
|
40731
|
+
...cell,
|
|
40732
|
+
style: cell.style ? { ...cell.style } : void 0,
|
|
40733
|
+
conditionalStyle: cell.conditionalStyle ? { ...cell.conditionalStyle } : void 0,
|
|
40734
|
+
mergeRevisionState: void 0,
|
|
40735
|
+
blocks: cell.blocks.map(
|
|
40736
|
+
(block) => cloneBlock(block)
|
|
40737
|
+
)
|
|
40738
|
+
});
|
|
40046
40739
|
const mergeSelectedTableCells = (current) => {
|
|
40047
40740
|
const range = deps.resolveHorizontalTableCellRange(current);
|
|
40048
40741
|
if (!range) {
|
|
@@ -40064,6 +40757,7 @@ function createTableCellSpanOperations(deps) {
|
|
|
40064
40757
|
if (selectedCells.length < 2) {
|
|
40065
40758
|
return current;
|
|
40066
40759
|
}
|
|
40760
|
+
const revision = current.trackChangesEnabled ? createTableRevisionMetadata() : void 0;
|
|
40067
40761
|
const mergedCell = {
|
|
40068
40762
|
...selectedCells[0],
|
|
40069
40763
|
colSpan: selectedCells.reduce(
|
|
@@ -40072,7 +40766,27 @@ function createTableCellSpanOperations(deps) {
|
|
|
40072
40766
|
),
|
|
40073
40767
|
blocks: selectedCells.flatMap(
|
|
40074
40768
|
(cell) => cell.blocks.map((paragraph) => cloneBlock(paragraph))
|
|
40075
|
-
)
|
|
40769
|
+
),
|
|
40770
|
+
...revision ? {
|
|
40771
|
+
style: {
|
|
40772
|
+
...selectedCells[0].style ?? {},
|
|
40773
|
+
revision: {
|
|
40774
|
+
...revision,
|
|
40775
|
+
type: "merge",
|
|
40776
|
+
previous: {
|
|
40777
|
+
colSpan: selectedCells[0].colSpan,
|
|
40778
|
+
rowSpan: selectedCells[0].rowSpan,
|
|
40779
|
+
vMerge: selectedCells[0].vMerge
|
|
40780
|
+
}
|
|
40781
|
+
}
|
|
40782
|
+
},
|
|
40783
|
+
mergeRevisionState: {
|
|
40784
|
+
revisionId: revision.id,
|
|
40785
|
+
orientation: "horizontal",
|
|
40786
|
+
currentCellCount: 1,
|
|
40787
|
+
previousCells: selectedCells.map(cloneCellSnapshot)
|
|
40788
|
+
}
|
|
40789
|
+
} : {}
|
|
40076
40790
|
};
|
|
40077
40791
|
row.cells.splice(range.startCellIndex, selectedCells.length, mergedCell);
|
|
40078
40792
|
const nextParagraph = mergedCell.blocks[0];
|
|
@@ -40120,13 +40834,34 @@ function createTableCellSpanOperations(deps) {
|
|
|
40120
40834
|
)) {
|
|
40121
40835
|
return current;
|
|
40122
40836
|
}
|
|
40837
|
+
const revision = current.trackChangesEnabled ? createTableRevisionMetadata() : void 0;
|
|
40123
40838
|
const mergedCell = {
|
|
40124
40839
|
...selectedCells[0],
|
|
40125
40840
|
rowSpan: selectedCells.length,
|
|
40126
40841
|
vMerge: "restart",
|
|
40127
40842
|
blocks: selectedCells.flatMap(
|
|
40128
40843
|
(cell) => cell.blocks.map((paragraph) => cloneBlock(paragraph))
|
|
40129
|
-
)
|
|
40844
|
+
),
|
|
40845
|
+
...revision ? {
|
|
40846
|
+
style: {
|
|
40847
|
+
...selectedCells[0].style ?? {},
|
|
40848
|
+
revision: {
|
|
40849
|
+
...revision,
|
|
40850
|
+
type: "merge",
|
|
40851
|
+
previous: {
|
|
40852
|
+
colSpan: selectedCells[0].colSpan,
|
|
40853
|
+
rowSpan: selectedCells[0].rowSpan,
|
|
40854
|
+
vMerge: selectedCells[0].vMerge
|
|
40855
|
+
}
|
|
40856
|
+
}
|
|
40857
|
+
},
|
|
40858
|
+
mergeRevisionState: {
|
|
40859
|
+
revisionId: revision.id,
|
|
40860
|
+
orientation: "vertical",
|
|
40861
|
+
currentCellCount: 1,
|
|
40862
|
+
previousCells: selectedCells.map(cloneCellSnapshot)
|
|
40863
|
+
}
|
|
40864
|
+
} : {}
|
|
40130
40865
|
};
|
|
40131
40866
|
tableBlock.rows[range.startRowIndex].cells[range.cellIndex] = mergedCell;
|
|
40132
40867
|
for (let rowIndex = range.startRowIndex + 1; rowIndex <= range.endRowIndex; rowIndex += 1) {
|
|
@@ -40184,9 +40919,38 @@ function createTableCellSpanOperations(deps) {
|
|
|
40184
40919
|
if (!cell || span <= 1 || cell.vMerge !== "restart") {
|
|
40185
40920
|
return current;
|
|
40186
40921
|
}
|
|
40922
|
+
const previousCell = cloneCellSnapshot(cell);
|
|
40923
|
+
const revision = current.trackChangesEnabled ? createTableRevisionMetadata() : void 0;
|
|
40924
|
+
const preservedColSpan = Math.max(1, cell.colSpan ?? 1);
|
|
40187
40925
|
cell.rowSpan = void 0;
|
|
40188
40926
|
cell.vMerge = void 0;
|
|
40189
|
-
|
|
40927
|
+
if (revision) {
|
|
40928
|
+
cell.style = {
|
|
40929
|
+
...cell.style ?? {},
|
|
40930
|
+
revision: {
|
|
40931
|
+
...revision,
|
|
40932
|
+
type: "merge",
|
|
40933
|
+
previous: {
|
|
40934
|
+
colSpan: previousCell.colSpan,
|
|
40935
|
+
rowSpan: previousCell.rowSpan,
|
|
40936
|
+
vMerge: previousCell.vMerge
|
|
40937
|
+
}
|
|
40938
|
+
}
|
|
40939
|
+
};
|
|
40940
|
+
cell.mergeRevisionState = {
|
|
40941
|
+
revisionId: revision.id,
|
|
40942
|
+
orientation: "vertical",
|
|
40943
|
+
currentCellCount: 1,
|
|
40944
|
+
previousCells: [
|
|
40945
|
+
previousCell,
|
|
40946
|
+
...Array.from({ length: span - 1 }, (_, offset) => {
|
|
40947
|
+
var _a2;
|
|
40948
|
+
const prior = (_a2 = tableBlock.rows[location.rowIndex + offset + 1]) == null ? void 0 : _a2.cells[location.cellIndex];
|
|
40949
|
+
return prior ? cloneCellSnapshot(prior) : createEditorTableCell([], preservedColSpan);
|
|
40950
|
+
})
|
|
40951
|
+
]
|
|
40952
|
+
};
|
|
40953
|
+
}
|
|
40190
40954
|
for (let offset = 1; offset < span; offset += 1) {
|
|
40191
40955
|
const row = tableBlock.rows[location.rowIndex + offset];
|
|
40192
40956
|
if (!row) {
|
|
@@ -40236,13 +41000,35 @@ function createTableCellSpanOperations(deps) {
|
|
|
40236
41000
|
if (!row || !cell || span <= 1) {
|
|
40237
41001
|
return current;
|
|
40238
41002
|
}
|
|
41003
|
+
const previousCell = cloneCellSnapshot(cell);
|
|
41004
|
+
const revision = current.trackChangesEnabled ? createTableRevisionMetadata() : void 0;
|
|
40239
41005
|
const nextCells = [
|
|
40240
41006
|
{
|
|
40241
41007
|
...cell,
|
|
40242
41008
|
colSpan: 1,
|
|
40243
41009
|
blocks: cell.blocks.map(
|
|
40244
41010
|
(paragraph) => cloneBlock(paragraph)
|
|
40245
|
-
)
|
|
41011
|
+
),
|
|
41012
|
+
...revision ? {
|
|
41013
|
+
style: {
|
|
41014
|
+
...cell.style ?? {},
|
|
41015
|
+
revision: {
|
|
41016
|
+
...revision,
|
|
41017
|
+
type: "merge",
|
|
41018
|
+
previous: {
|
|
41019
|
+
colSpan: previousCell.colSpan,
|
|
41020
|
+
rowSpan: previousCell.rowSpan,
|
|
41021
|
+
vMerge: previousCell.vMerge
|
|
41022
|
+
}
|
|
41023
|
+
}
|
|
41024
|
+
},
|
|
41025
|
+
mergeRevisionState: {
|
|
41026
|
+
revisionId: revision.id,
|
|
41027
|
+
orientation: "horizontal",
|
|
41028
|
+
currentCellCount: span,
|
|
41029
|
+
previousCells: [previousCell]
|
|
41030
|
+
}
|
|
41031
|
+
} : {}
|
|
40246
41032
|
},
|
|
40247
41033
|
...Array.from(
|
|
40248
41034
|
{ length: span - 1 },
|
|
@@ -40351,6 +41137,15 @@ function createTableRowColumnOperations(deps) {
|
|
|
40351
41137
|
);
|
|
40352
41138
|
})
|
|
40353
41139
|
);
|
|
41140
|
+
if (current.trackChangesEnabled) {
|
|
41141
|
+
blankRow.style = {
|
|
41142
|
+
...blankRow.style ?? {},
|
|
41143
|
+
revision: {
|
|
41144
|
+
...createTableRevisionMetadata(),
|
|
41145
|
+
type: "insert"
|
|
41146
|
+
}
|
|
41147
|
+
};
|
|
41148
|
+
}
|
|
40354
41149
|
tableBlock.rows.splice(insertIndex, 0, blankRow);
|
|
40355
41150
|
const targetVisualColumn = (selectedEntry == null ? void 0 : selectedEntry.visualColumnIndex) ?? location.cellIndex;
|
|
40356
41151
|
const targetCell2 = findCellAtVisualColumn(blankRow, targetVisualColumn);
|
|
@@ -40385,6 +41180,15 @@ function createTableRowColumnOperations(deps) {
|
|
|
40385
41180
|
)
|
|
40386
41181
|
)
|
|
40387
41182
|
);
|
|
41183
|
+
if (current.trackChangesEnabled) {
|
|
41184
|
+
blankRow.style = {
|
|
41185
|
+
...blankRow.style ?? {},
|
|
41186
|
+
revision: {
|
|
41187
|
+
...createTableRevisionMetadata(),
|
|
41188
|
+
type: "insert"
|
|
41189
|
+
}
|
|
41190
|
+
};
|
|
41191
|
+
}
|
|
40388
41192
|
tableBlock.rows.splice(insertIndex, 0, blankRow);
|
|
40389
41193
|
const targetCell = blankRow.cells[Math.min(location.cellIndex, blankRow.cells.length - 1)];
|
|
40390
41194
|
const nextParagraph = (targetCell == null ? void 0 : targetCell.blocks[0]) ?? ((_b = blankRow.cells.find(
|
|
@@ -40420,13 +41224,23 @@ function createTableRowColumnOperations(deps) {
|
|
|
40420
41224
|
if (!tableBlock || tableBlock.type !== "table") {
|
|
40421
41225
|
return current;
|
|
40422
41226
|
}
|
|
40423
|
-
if (tableBlock.rows.length <= 1) {
|
|
41227
|
+
if (tableBlock.rows.length <= 1 && !current.trackChangesEnabled) {
|
|
40424
41228
|
return current;
|
|
40425
41229
|
}
|
|
40426
41230
|
const rowToDelete = tableBlock.rows[location.rowIndex];
|
|
40427
41231
|
if (!rowToDelete) {
|
|
40428
41232
|
return current;
|
|
40429
41233
|
}
|
|
41234
|
+
if (current.trackChangesEnabled) {
|
|
41235
|
+
rowToDelete.style = {
|
|
41236
|
+
...rowToDelete.style ?? {},
|
|
41237
|
+
revision: {
|
|
41238
|
+
...createTableRevisionMetadata(),
|
|
41239
|
+
type: "delete"
|
|
41240
|
+
}
|
|
41241
|
+
};
|
|
41242
|
+
return updateBlocksInCurrentSection(current, targetBlocks, location.zone);
|
|
41243
|
+
}
|
|
40430
41244
|
const blockedByRestartCell = rowToDelete.cells.some(
|
|
40431
41245
|
(cell) => cell.vMerge !== "continue" && Math.max(1, cell.rowSpan ?? 1) > 1
|
|
40432
41246
|
);
|
|
@@ -40512,13 +41326,34 @@ function createTableRowColumnOperations(deps) {
|
|
|
40512
41326
|
for (const cell of row.cells) {
|
|
40513
41327
|
const span = Math.max(1, cell.colSpan ?? 1);
|
|
40514
41328
|
if (!inserted && insertVisualColumn <= visualCursor) {
|
|
40515
|
-
|
|
41329
|
+
const insertedCell = createEditorTableCell([
|
|
41330
|
+
createEditorParagraph("")
|
|
41331
|
+
]);
|
|
41332
|
+
if (current.trackChangesEnabled) {
|
|
41333
|
+
insertedCell.style = {
|
|
41334
|
+
revision: {
|
|
41335
|
+
...createTableRevisionMetadata(),
|
|
41336
|
+
type: "insert"
|
|
41337
|
+
}
|
|
41338
|
+
};
|
|
41339
|
+
}
|
|
41340
|
+
nextCells.push(insertedCell);
|
|
40516
41341
|
inserted = true;
|
|
40517
41342
|
}
|
|
40518
41343
|
if (!inserted && visualCursor < insertVisualColumn && insertVisualColumn < visualCursor + span) {
|
|
40519
41344
|
nextCells.push({
|
|
40520
41345
|
...cell,
|
|
40521
|
-
colSpan: span + 1
|
|
41346
|
+
colSpan: span + 1,
|
|
41347
|
+
...current.trackChangesEnabled ? {
|
|
41348
|
+
style: {
|
|
41349
|
+
...cell.style ?? {},
|
|
41350
|
+
revision: {
|
|
41351
|
+
...createTableRevisionMetadata(),
|
|
41352
|
+
type: "merge",
|
|
41353
|
+
previous: { colSpan: cell.colSpan }
|
|
41354
|
+
}
|
|
41355
|
+
}
|
|
41356
|
+
} : {}
|
|
40522
41357
|
});
|
|
40523
41358
|
inserted = true;
|
|
40524
41359
|
} else {
|
|
@@ -40527,7 +41362,18 @@ function createTableRowColumnOperations(deps) {
|
|
|
40527
41362
|
visualCursor += span;
|
|
40528
41363
|
}
|
|
40529
41364
|
if (!inserted) {
|
|
40530
|
-
|
|
41365
|
+
const insertedCell = createEditorTableCell([
|
|
41366
|
+
createEditorParagraph("")
|
|
41367
|
+
]);
|
|
41368
|
+
if (current.trackChangesEnabled) {
|
|
41369
|
+
insertedCell.style = {
|
|
41370
|
+
revision: {
|
|
41371
|
+
...createTableRevisionMetadata(),
|
|
41372
|
+
type: "insert"
|
|
41373
|
+
}
|
|
41374
|
+
};
|
|
41375
|
+
}
|
|
41376
|
+
nextCells.push(insertedCell);
|
|
40531
41377
|
}
|
|
40532
41378
|
row.cells = nextCells;
|
|
40533
41379
|
}
|
|
@@ -40562,11 +41408,16 @@ function createTableRowColumnOperations(deps) {
|
|
|
40562
41408
|
)
|
|
40563
41409
|
);
|
|
40564
41410
|
for (const row of tableBlock.rows) {
|
|
40565
|
-
|
|
40566
|
-
|
|
40567
|
-
|
|
40568
|
-
|
|
40569
|
-
|
|
41411
|
+
const insertedCell = createEditorTableCell([createEditorParagraph("")]);
|
|
41412
|
+
if (current.trackChangesEnabled) {
|
|
41413
|
+
insertedCell.style = {
|
|
41414
|
+
revision: {
|
|
41415
|
+
...createTableRevisionMetadata(),
|
|
41416
|
+
type: "insert"
|
|
41417
|
+
}
|
|
41418
|
+
};
|
|
41419
|
+
}
|
|
41420
|
+
row.cells.splice(insertIndex, 0, insertedCell);
|
|
40570
41421
|
}
|
|
40571
41422
|
const targetRow = tableBlock.rows[location.rowIndex];
|
|
40572
41423
|
const targetCell = targetRow == null ? void 0 : targetRow.cells[insertIndex];
|
|
@@ -40605,6 +41456,26 @@ function createTableRowColumnOperations(deps) {
|
|
|
40605
41456
|
if (getTableVisualWidth(tableBlock) <= 1) {
|
|
40606
41457
|
return current;
|
|
40607
41458
|
}
|
|
41459
|
+
if (current.trackChangesEnabled) {
|
|
41460
|
+
const layout = buildTableCellLayout(tableBlock);
|
|
41461
|
+
const selected = layout.find(
|
|
41462
|
+
(entry) => entry.rowIndex === location.rowIndex && entry.cellIndex === location.cellIndex
|
|
41463
|
+
);
|
|
41464
|
+
const visualColumn = (selected == null ? void 0 : selected.visualColumnIndex) ?? location.cellIndex;
|
|
41465
|
+
for (const row of tableBlock.rows) {
|
|
41466
|
+
const cell = findCellAtVisualColumn(row, visualColumn);
|
|
41467
|
+
if (cell) {
|
|
41468
|
+
cell.style = {
|
|
41469
|
+
...cell.style ?? {},
|
|
41470
|
+
revision: {
|
|
41471
|
+
...createTableRevisionMetadata(),
|
|
41472
|
+
type: "delete"
|
|
41473
|
+
}
|
|
41474
|
+
};
|
|
41475
|
+
}
|
|
41476
|
+
}
|
|
41477
|
+
return updateBlocksInCurrentSection(current, targetBlocks, location.zone);
|
|
41478
|
+
}
|
|
40608
41479
|
const hasHorizontalSpansInTable = tableBlock.rows.some(
|
|
40609
41480
|
(row) => row.cells.some((cell) => Math.max(1, cell.colSpan ?? 1) > 1)
|
|
40610
41481
|
);
|
|
@@ -43040,6 +43911,7 @@ function createEditorTableDrag(deps) {
|
|
|
43040
43911
|
null
|
|
43041
43912
|
);
|
|
43042
43913
|
const [startClientY, setStartClientY] = createSignal(0);
|
|
43914
|
+
const [startClientX, setStartClientX] = createSignal(0);
|
|
43043
43915
|
const [mousePos, setMousePos] = createSignal({ x: 0, y: 0 });
|
|
43044
43916
|
const stopDrag = () => {
|
|
43045
43917
|
setDragging(false);
|
|
@@ -43093,9 +43965,32 @@ function createEditorTableDrag(deps) {
|
|
|
43093
43965
|
event.clientY
|
|
43094
43966
|
);
|
|
43095
43967
|
const tableId = info == null ? void 0 : info.tableId;
|
|
43096
|
-
if (
|
|
43968
|
+
if (tableId) {
|
|
43097
43969
|
deps.applyTransactionalState((current) => {
|
|
43098
|
-
|
|
43970
|
+
var _a;
|
|
43971
|
+
const findTable = () => {
|
|
43972
|
+
for (const zone of ["main", "header", "footer"]) {
|
|
43973
|
+
const blocks = getEditableBlocksForZone(current, zone);
|
|
43974
|
+
const table2 = blocks.find(
|
|
43975
|
+
(block) => block.type === "table" && block.id === tableId
|
|
43976
|
+
);
|
|
43977
|
+
if (table2) return table2;
|
|
43978
|
+
}
|
|
43979
|
+
return void 0;
|
|
43980
|
+
};
|
|
43981
|
+
const table = findTable();
|
|
43982
|
+
if ((table == null ? void 0 : table.type) === "table" && ((_a = table.style) == null ? void 0 : _a.floating)) {
|
|
43983
|
+
const floating = table.style.floating;
|
|
43984
|
+
const pointsPerPixel = 72 / 96;
|
|
43985
|
+
return setActiveTableStyleValue(current, tableId, "floating", {
|
|
43986
|
+
...floating,
|
|
43987
|
+
x: (floating.x ?? 0) + (event.clientX - startClientX()) * pointsPerPixel,
|
|
43988
|
+
y: (floating.y ?? 0) + (event.clientY - startClientY()) * pointsPerPixel,
|
|
43989
|
+
xAlign: void 0,
|
|
43990
|
+
yAlign: void 0
|
|
43991
|
+
});
|
|
43992
|
+
}
|
|
43993
|
+
return pos ? moveBlockToPosition(current, tableId, pos) : current;
|
|
43099
43994
|
});
|
|
43100
43995
|
}
|
|
43101
43996
|
}
|
|
@@ -43116,6 +44011,7 @@ function createEditorTableDrag(deps) {
|
|
|
43116
44011
|
offsetY: event.clientY - handleRect.top
|
|
43117
44012
|
});
|
|
43118
44013
|
setStartClientY(event.clientY);
|
|
44014
|
+
setStartClientX(event.clientX);
|
|
43119
44015
|
setMousePos({ x: event.clientX, y: event.clientY });
|
|
43120
44016
|
setDragging(false);
|
|
43121
44017
|
setDropTargetPos(null);
|
|
@@ -44192,6 +45088,51 @@ function createEditorRevisionController(deps) {
|
|
|
44192
45088
|
}
|
|
44193
45089
|
if (foundRevision) break;
|
|
44194
45090
|
}
|
|
45091
|
+
const findInBlocks = (blocks) => {
|
|
45092
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
45093
|
+
for (const block of blocks) {
|
|
45094
|
+
if (block.type === "paragraph") continue;
|
|
45095
|
+
if (((_b2 = (_a2 = block.style) == null ? void 0 : _a2.revision) == null ? void 0 : _b2.id) === revisionId) {
|
|
45096
|
+
return block.style.revision;
|
|
45097
|
+
}
|
|
45098
|
+
if (((_c2 = block.gridRevision) == null ? void 0 : _c2.id) === revisionId) return block.gridRevision;
|
|
45099
|
+
for (const row of block.rows) {
|
|
45100
|
+
if (((_e = (_d = row.style) == null ? void 0 : _d.revision) == null ? void 0 : _e.id) === revisionId) return row.style.revision;
|
|
45101
|
+
if (((_g = (_f = row.style) == null ? void 0 : _f.propertyRevision) == null ? void 0 : _g.id) === revisionId) {
|
|
45102
|
+
return row.style.propertyRevision;
|
|
45103
|
+
}
|
|
45104
|
+
for (const cell of row.cells) {
|
|
45105
|
+
if (((_i = (_h = cell.style) == null ? void 0 : _h.revision) == null ? void 0 : _i.id) === revisionId) {
|
|
45106
|
+
return cell.style.revision;
|
|
45107
|
+
}
|
|
45108
|
+
if (((_k = (_j = cell.style) == null ? void 0 : _j.propertyRevision) == null ? void 0 : _k.id) === revisionId) {
|
|
45109
|
+
return cell.style.propertyRevision;
|
|
45110
|
+
}
|
|
45111
|
+
const nested = findInBlocks(cell.blocks);
|
|
45112
|
+
if (nested) return nested;
|
|
45113
|
+
}
|
|
45114
|
+
}
|
|
45115
|
+
}
|
|
45116
|
+
return void 0;
|
|
45117
|
+
};
|
|
45118
|
+
if (!foundRevision) {
|
|
45119
|
+
for (const section of getDocumentSections(deps.state().document)) {
|
|
45120
|
+
for (const blocks of [
|
|
45121
|
+
section.blocks,
|
|
45122
|
+
section.header,
|
|
45123
|
+
section.firstPageHeader,
|
|
45124
|
+
section.evenPageHeader,
|
|
45125
|
+
section.footer,
|
|
45126
|
+
section.firstPageFooter,
|
|
45127
|
+
section.evenPageFooter
|
|
45128
|
+
]) {
|
|
45129
|
+
if (!blocks) continue;
|
|
45130
|
+
foundRevision = findInBlocks(blocks);
|
|
45131
|
+
if (foundRevision) break;
|
|
45132
|
+
}
|
|
45133
|
+
if (foundRevision) break;
|
|
45134
|
+
}
|
|
45135
|
+
}
|
|
44195
45136
|
if (!foundRevision) return;
|
|
44196
45137
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
44197
45138
|
const surfaceRect = (_b = deps.surfaceRef()) == null ? void 0 : _b.getBoundingClientRect();
|
|
@@ -44545,6 +45486,148 @@ function toggleTrackChanges(state) {
|
|
|
44545
45486
|
trackChangesEnabled: !state.trackChangesEnabled
|
|
44546
45487
|
};
|
|
44547
45488
|
}
|
|
45489
|
+
function transformTableRevisionBlocks(blocks, revisionId, accept) {
|
|
45490
|
+
return blocks.flatMap((block) => {
|
|
45491
|
+
var _a;
|
|
45492
|
+
if (block.type === "paragraph") return [block];
|
|
45493
|
+
let style2 = block.style;
|
|
45494
|
+
if (((_a = style2 == null ? void 0 : style2.revision) == null ? void 0 : _a.id) === revisionId) {
|
|
45495
|
+
if (accept) {
|
|
45496
|
+
const { revision: _revision, ...current } = style2;
|
|
45497
|
+
style2 = current;
|
|
45498
|
+
} else {
|
|
45499
|
+
style2 = { ...style2.revision.previous };
|
|
45500
|
+
}
|
|
45501
|
+
}
|
|
45502
|
+
let gridCols = block.gridCols;
|
|
45503
|
+
let gridRevision = block.gridRevision;
|
|
45504
|
+
if ((gridRevision == null ? void 0 : gridRevision.id) === revisionId) {
|
|
45505
|
+
gridCols = accept ? gridCols : [...gridRevision.previous];
|
|
45506
|
+
gridRevision = void 0;
|
|
45507
|
+
}
|
|
45508
|
+
const sourceRows = block.rows.map((row) => ({
|
|
45509
|
+
...row,
|
|
45510
|
+
cells: [...row.cells]
|
|
45511
|
+
}));
|
|
45512
|
+
for (let rowIndex = 0; rowIndex < sourceRows.length; rowIndex += 1) {
|
|
45513
|
+
const row = sourceRows[rowIndex];
|
|
45514
|
+
for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
|
|
45515
|
+
const cell = row.cells[cellIndex];
|
|
45516
|
+
const mergeState = cell.mergeRevisionState;
|
|
45517
|
+
if (!mergeState || mergeState.revisionId !== revisionId) continue;
|
|
45518
|
+
if (accept) {
|
|
45519
|
+
const { mergeRevisionState: _state, ...acceptedCell } = cell;
|
|
45520
|
+
row.cells[cellIndex] = acceptedCell;
|
|
45521
|
+
continue;
|
|
45522
|
+
}
|
|
45523
|
+
if (mergeState.orientation === "horizontal") {
|
|
45524
|
+
row.cells.splice(
|
|
45525
|
+
cellIndex,
|
|
45526
|
+
mergeState.currentCellCount,
|
|
45527
|
+
...mergeState.previousCells
|
|
45528
|
+
);
|
|
45529
|
+
} else {
|
|
45530
|
+
mergeState.previousCells.forEach((previousCell, offset) => {
|
|
45531
|
+
const targetRow = sourceRows[rowIndex + offset];
|
|
45532
|
+
if (targetRow) targetRow.cells[cellIndex] = previousCell;
|
|
45533
|
+
});
|
|
45534
|
+
}
|
|
45535
|
+
}
|
|
45536
|
+
}
|
|
45537
|
+
const rows = sourceRows.flatMap((row) => {
|
|
45538
|
+
var _a2, _b, _c, _d;
|
|
45539
|
+
if (((_b = (_a2 = row.style) == null ? void 0 : _a2.revision) == null ? void 0 : _b.id) === revisionId) {
|
|
45540
|
+
const remove = accept && row.style.revision.type === "delete" || !accept && row.style.revision.type === "insert";
|
|
45541
|
+
if (remove) return [];
|
|
45542
|
+
}
|
|
45543
|
+
let rowStyle = row.style;
|
|
45544
|
+
if (((_c = rowStyle == null ? void 0 : rowStyle.propertyRevision) == null ? void 0 : _c.id) === revisionId) {
|
|
45545
|
+
if (accept) {
|
|
45546
|
+
const { propertyRevision: _revision, ...current } = rowStyle;
|
|
45547
|
+
rowStyle = current;
|
|
45548
|
+
} else {
|
|
45549
|
+
rowStyle = {
|
|
45550
|
+
...rowStyle.propertyRevision.previous,
|
|
45551
|
+
revision: rowStyle.revision
|
|
45552
|
+
};
|
|
45553
|
+
}
|
|
45554
|
+
}
|
|
45555
|
+
if (((_d = rowStyle == null ? void 0 : rowStyle.revision) == null ? void 0 : _d.id) === revisionId) {
|
|
45556
|
+
const { revision: _revision, ...current } = rowStyle;
|
|
45557
|
+
rowStyle = current;
|
|
45558
|
+
}
|
|
45559
|
+
const cells = row.cells.flatMap((cell) => {
|
|
45560
|
+
var _a3, _b2, _c2, _d2, _e;
|
|
45561
|
+
if (((_b2 = (_a3 = cell.style) == null ? void 0 : _a3.revision) == null ? void 0 : _b2.id) === revisionId) {
|
|
45562
|
+
const remove = accept && cell.style.revision.type === "delete" || !accept && cell.style.revision.type === "insert";
|
|
45563
|
+
if (remove) return [];
|
|
45564
|
+
}
|
|
45565
|
+
let cellStyle = cell.style;
|
|
45566
|
+
if (((_c2 = cellStyle == null ? void 0 : cellStyle.propertyRevision) == null ? void 0 : _c2.id) === revisionId) {
|
|
45567
|
+
if (accept) {
|
|
45568
|
+
const { propertyRevision: _revision, ...current } = cellStyle;
|
|
45569
|
+
cellStyle = current;
|
|
45570
|
+
} else {
|
|
45571
|
+
cellStyle = {
|
|
45572
|
+
...cellStyle.propertyRevision.previous,
|
|
45573
|
+
revision: cellStyle.revision
|
|
45574
|
+
};
|
|
45575
|
+
}
|
|
45576
|
+
}
|
|
45577
|
+
let nextCell = {
|
|
45578
|
+
...cell,
|
|
45579
|
+
style: cellStyle,
|
|
45580
|
+
blocks: transformTableRevisionBlocks(
|
|
45581
|
+
cell.blocks,
|
|
45582
|
+
revisionId,
|
|
45583
|
+
accept
|
|
45584
|
+
)
|
|
45585
|
+
};
|
|
45586
|
+
if (((_d2 = cellStyle == null ? void 0 : cellStyle.revision) == null ? void 0 : _d2.id) === revisionId && ((_e = cell.mergeRevisionState) == null ? void 0 : _e.revisionId) !== revisionId) {
|
|
45587
|
+
const revision = cellStyle.revision;
|
|
45588
|
+
const { revision: _revision, ...current } = cellStyle;
|
|
45589
|
+
nextCell = {
|
|
45590
|
+
...nextCell,
|
|
45591
|
+
...accept || revision.type !== "merge" ? {} : revision.previous,
|
|
45592
|
+
style: current
|
|
45593
|
+
};
|
|
45594
|
+
}
|
|
45595
|
+
return [nextCell];
|
|
45596
|
+
});
|
|
45597
|
+
return [
|
|
45598
|
+
{
|
|
45599
|
+
...row,
|
|
45600
|
+
isHeader: rowStyle && "isHeader" in rowStyle ? rowStyle.isHeader : row.isHeader,
|
|
45601
|
+
style: rowStyle,
|
|
45602
|
+
cells
|
|
45603
|
+
}
|
|
45604
|
+
];
|
|
45605
|
+
});
|
|
45606
|
+
if (rows.length === 0) return [];
|
|
45607
|
+
return [{ ...block, style: style2, gridCols, gridRevision, rows }];
|
|
45608
|
+
});
|
|
45609
|
+
}
|
|
45610
|
+
function transformTableRevision(state, revisionId, accept) {
|
|
45611
|
+
const sections = getDocumentSections(state.document).map((section) => ({
|
|
45612
|
+
...section,
|
|
45613
|
+
blocks: transformTableRevisionBlocks(section.blocks, revisionId, accept),
|
|
45614
|
+
header: section.header ? transformTableRevisionBlocks(section.header, revisionId, accept) : void 0,
|
|
45615
|
+
firstPageHeader: section.firstPageHeader ? transformTableRevisionBlocks(
|
|
45616
|
+
section.firstPageHeader,
|
|
45617
|
+
revisionId,
|
|
45618
|
+
accept
|
|
45619
|
+
) : void 0,
|
|
45620
|
+
evenPageHeader: section.evenPageHeader ? transformTableRevisionBlocks(section.evenPageHeader, revisionId, accept) : void 0,
|
|
45621
|
+
footer: section.footer ? transformTableRevisionBlocks(section.footer, revisionId, accept) : void 0,
|
|
45622
|
+
firstPageFooter: section.firstPageFooter ? transformTableRevisionBlocks(
|
|
45623
|
+
section.firstPageFooter,
|
|
45624
|
+
revisionId,
|
|
45625
|
+
accept
|
|
45626
|
+
) : void 0,
|
|
45627
|
+
evenPageFooter: section.evenPageFooter ? transformTableRevisionBlocks(section.evenPageFooter, revisionId, accept) : void 0
|
|
45628
|
+
}));
|
|
45629
|
+
return { ...state, document: { ...state.document, sections } };
|
|
45630
|
+
}
|
|
44548
45631
|
function acceptRevision(state, revisionId) {
|
|
44549
45632
|
const paragraphs = getParagraphs(state);
|
|
44550
45633
|
const nextParagraphs = paragraphs.map((paragraph) => {
|
|
@@ -44567,7 +45650,7 @@ function acceptRevision(state, revisionId) {
|
|
|
44567
45650
|
}
|
|
44568
45651
|
return buildParagraphFromRuns(paragraph, nextRuns);
|
|
44569
45652
|
});
|
|
44570
|
-
|
|
45653
|
+
const textState = cloneStateWithParagraphs(
|
|
44571
45654
|
state,
|
|
44572
45655
|
nextParagraphs,
|
|
44573
45656
|
preserveSelectionByParagraphOffsets(
|
|
@@ -44575,6 +45658,7 @@ function acceptRevision(state, revisionId) {
|
|
|
44575
45658
|
normalizeSelection(state)
|
|
44576
45659
|
)
|
|
44577
45660
|
);
|
|
45661
|
+
return transformTableRevision(textState, revisionId, true);
|
|
44578
45662
|
}
|
|
44579
45663
|
function rejectRevision(state, revisionId) {
|
|
44580
45664
|
const paragraphs = getParagraphs(state);
|
|
@@ -44598,7 +45682,7 @@ function rejectRevision(state, revisionId) {
|
|
|
44598
45682
|
}
|
|
44599
45683
|
return buildParagraphFromRuns(paragraph, nextRuns);
|
|
44600
45684
|
});
|
|
44601
|
-
|
|
45685
|
+
const textState = cloneStateWithParagraphs(
|
|
44602
45686
|
state,
|
|
44603
45687
|
nextParagraphs,
|
|
44604
45688
|
preserveSelectionByParagraphOffsets(
|
|
@@ -44606,6 +45690,40 @@ function rejectRevision(state, revisionId) {
|
|
|
44606
45690
|
normalizeSelection(state)
|
|
44607
45691
|
)
|
|
44608
45692
|
);
|
|
45693
|
+
return transformTableRevision(textState, revisionId, false);
|
|
45694
|
+
}
|
|
45695
|
+
function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
|
|
45696
|
+
var _a, _b, _c, _d, _e;
|
|
45697
|
+
for (const block of blocks) {
|
|
45698
|
+
if (block.type === "paragraph") continue;
|
|
45699
|
+
const tableSelected = block.rows.some(
|
|
45700
|
+
(row) => row.cells.some(
|
|
45701
|
+
(cell) => cell.blocks.some((paragraph) => selectedParagraphIds.has(paragraph.id))
|
|
45702
|
+
)
|
|
45703
|
+
);
|
|
45704
|
+
if (tableSelected) {
|
|
45705
|
+
if ((_a = block.style) == null ? void 0 : _a.revision) revisionIds.add(block.style.revision.id);
|
|
45706
|
+
if (block.gridRevision) revisionIds.add(block.gridRevision.id);
|
|
45707
|
+
}
|
|
45708
|
+
for (const row of block.rows) {
|
|
45709
|
+
const selectedCells = row.cells.filter(
|
|
45710
|
+
(cell) => cell.blocks.some((paragraph) => selectedParagraphIds.has(paragraph.id))
|
|
45711
|
+
);
|
|
45712
|
+
if (selectedCells.length > 0) {
|
|
45713
|
+
if ((_b = row.style) == null ? void 0 : _b.revision) revisionIds.add(row.style.revision.id);
|
|
45714
|
+
if ((_c = row.style) == null ? void 0 : _c.propertyRevision) {
|
|
45715
|
+
revisionIds.add(row.style.propertyRevision.id);
|
|
45716
|
+
}
|
|
45717
|
+
}
|
|
45718
|
+
for (const cell of selectedCells) {
|
|
45719
|
+
if ((_d = cell.style) == null ? void 0 : _d.revision) revisionIds.add(cell.style.revision.id);
|
|
45720
|
+
if ((_e = cell.style) == null ? void 0 : _e.propertyRevision) {
|
|
45721
|
+
revisionIds.add(cell.style.propertyRevision.id);
|
|
45722
|
+
}
|
|
45723
|
+
collectTableRevisionIds(cell.blocks, selectedParagraphIds, revisionIds);
|
|
45724
|
+
}
|
|
45725
|
+
}
|
|
45726
|
+
}
|
|
44609
45727
|
}
|
|
44610
45728
|
function acceptRevisionsInSelection(state) {
|
|
44611
45729
|
var _a;
|
|
@@ -44623,6 +45741,24 @@ function acceptRevisionsInSelection(state) {
|
|
|
44623
45741
|
}
|
|
44624
45742
|
}
|
|
44625
45743
|
}
|
|
45744
|
+
const selectedParagraphIds = new Set(
|
|
45745
|
+
paragraphs.slice(normalized.startIndex, normalized.endIndex + 1).map((paragraph) => paragraph.id)
|
|
45746
|
+
);
|
|
45747
|
+
for (const section of getDocumentSections(state.document)) {
|
|
45748
|
+
for (const blocks of [
|
|
45749
|
+
section.blocks,
|
|
45750
|
+
section.header,
|
|
45751
|
+
section.firstPageHeader,
|
|
45752
|
+
section.evenPageHeader,
|
|
45753
|
+
section.footer,
|
|
45754
|
+
section.firstPageFooter,
|
|
45755
|
+
section.evenPageFooter
|
|
45756
|
+
]) {
|
|
45757
|
+
if (blocks) {
|
|
45758
|
+
collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds);
|
|
45759
|
+
}
|
|
45760
|
+
}
|
|
45761
|
+
}
|
|
44626
45762
|
let nextState = state;
|
|
44627
45763
|
for (const revisionId of revisionIds) {
|
|
44628
45764
|
nextState = acceptRevision(nextState, revisionId);
|
|
@@ -44645,6 +45781,24 @@ function rejectRevisionsInSelection(state) {
|
|
|
44645
45781
|
}
|
|
44646
45782
|
}
|
|
44647
45783
|
}
|
|
45784
|
+
const selectedParagraphIds = new Set(
|
|
45785
|
+
paragraphs.slice(normalized.startIndex, normalized.endIndex + 1).map((paragraph) => paragraph.id)
|
|
45786
|
+
);
|
|
45787
|
+
for (const section of getDocumentSections(state.document)) {
|
|
45788
|
+
for (const blocks of [
|
|
45789
|
+
section.blocks,
|
|
45790
|
+
section.header,
|
|
45791
|
+
section.firstPageHeader,
|
|
45792
|
+
section.evenPageHeader,
|
|
45793
|
+
section.footer,
|
|
45794
|
+
section.firstPageFooter,
|
|
45795
|
+
section.evenPageFooter
|
|
45796
|
+
]) {
|
|
45797
|
+
if (blocks) {
|
|
45798
|
+
collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds);
|
|
45799
|
+
}
|
|
45800
|
+
}
|
|
45801
|
+
}
|
|
44648
45802
|
let nextState = state;
|
|
44649
45803
|
for (const revisionId of revisionIds) {
|
|
44650
45804
|
nextState = rejectRevision(nextState, revisionId);
|