oasis-editor 0.0.179 → 0.0.181
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-Bf9zCPBd.js → OasisEditorApp-DiKa_1be.js} +1 -1
- package/dist/assets/{importDocxWorker-BPMw_A0Z.js → importDocxWorker-D1N33VdD.js} +1 -1
- package/dist/core/model/types/nodes.d.ts +3 -1
- package/dist/import/docx/tableProperties.d.ts +2 -1
- package/dist/{index-CSKfMgDC.js → index-DBFpDATA.js} +137 -22
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +2 -2
- package/package.json +1 -1
|
@@ -353,7 +353,9 @@ export interface EditorTableRowNode {
|
|
|
353
353
|
* resolution and re-serialized before `w:trPr` on export.
|
|
354
354
|
*/
|
|
355
355
|
propertyExceptions?: EditorTableStyle;
|
|
356
|
-
/**
|
|
356
|
+
/** Semantic previous row table-property exceptions from `w:tblPrExChange`. */
|
|
357
|
+
propertyExceptionsRevision?: EditorPropertyRevision<EditorTableStyle>;
|
|
358
|
+
/** Exact imported `<w:tblPrExChange ...>` retained as a preservation fallback. */
|
|
357
359
|
tblPrExChangeXml?: string;
|
|
358
360
|
/** Extension attributes (e.g. `w14:paraId`, `w15:*`) preserved for round-trip. */
|
|
359
361
|
extAttributes?: Record<string, string>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
-
import { EditorTableCellStyle, EditorTableRowNode, EditorTableRowStyle, EditorTableStyle, EditorTableConditionalFlags } from '../../core/model.js';
|
|
2
|
+
import { EditorTableCellStyle, EditorTableRowNode, EditorTableRowStyle, EditorTableStyle, EditorPropertyRevision, EditorTableConditionalFlags } from '../../core/model.js';
|
|
3
3
|
import { EditorTableBorders } from './borders.js';
|
|
4
4
|
import { ThemeColorMap } from './themeColors.js';
|
|
5
5
|
|
|
6
6
|
export declare function parseTableConditionalFlags(properties: XmlElement | null): EditorTableConditionalFlags | undefined;
|
|
7
|
+
export declare function parseTablePropertyExceptionRevision(change: XmlElement | null): EditorPropertyRevision<EditorTableStyle> | undefined;
|
|
7
8
|
export declare function parseTableStyle(tblPr: XmlElement | null, tableStyleId?: string): EditorTableStyle | undefined;
|
|
8
9
|
export declare function parseTableRowStyle(rowProperties: XmlElement | null): EditorTableRowStyle | undefined;
|
|
9
10
|
export declare function getTableCellColSpan(cellProperties: XmlElement | null): number;
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-DiKa_1be.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -37552,6 +37552,16 @@ function parseRevisionMetadata(element) {
|
|
|
37552
37552
|
date: Number.isFinite(parsedDate) ? parsedDate : 0
|
|
37553
37553
|
};
|
|
37554
37554
|
}
|
|
37555
|
+
function parseTablePropertyExceptionRevision(change) {
|
|
37556
|
+
if (!change) return void 0;
|
|
37557
|
+
const previous = getFirstChildByTagNameNS(change, WORD_NS$3, "tblPrEx");
|
|
37558
|
+
if (!previous) return void 0;
|
|
37559
|
+
return {
|
|
37560
|
+
...parseRevisionMetadata(change),
|
|
37561
|
+
type: "property",
|
|
37562
|
+
previous: parseTableStyle(previous) ?? {}
|
|
37563
|
+
};
|
|
37564
|
+
}
|
|
37555
37565
|
function parseFloatingTableProperties(tblPr) {
|
|
37556
37566
|
const tblpPr = getFirstChildByTagNameNS(tblPr, WORD_NS$3, "tblpPr");
|
|
37557
37567
|
if (!tblpPr || !tblpPr.attributes || tblpPr.attributes.length === 0) {
|
|
@@ -37826,6 +37836,11 @@ function getTableCellColSpan(cellProperties) {
|
|
|
37826
37836
|
const parsed = value2 ? Number(value2) : 1;
|
|
37827
37837
|
return Number.isFinite(parsed) && parsed > 1 ? Math.floor(parsed) : 1;
|
|
37828
37838
|
}
|
|
37839
|
+
function parseTrackedVerticalMergeValue(value2) {
|
|
37840
|
+
if (value2 === "rest" || value2 === "restart") return "restart";
|
|
37841
|
+
if (value2 === "cont" || value2 === "continue") return "continue";
|
|
37842
|
+
return void 0;
|
|
37843
|
+
}
|
|
37829
37844
|
function getTableCellVMerge(cellProperties) {
|
|
37830
37845
|
if (!cellProperties) {
|
|
37831
37846
|
return void 0;
|
|
@@ -37964,15 +37979,13 @@ function parseTableCellStyle(cellProperties, tableDefaultMargins, colors) {
|
|
|
37964
37979
|
const merged = getFirstChildByTagNameNS(cellProperties, WORD_NS$3, "cellMerge");
|
|
37965
37980
|
const structural = inserted ?? deleted ?? merged;
|
|
37966
37981
|
if (structural) {
|
|
37967
|
-
const originalMerge =
|
|
37982
|
+
const originalMerge = parseTrackedVerticalMergeValue(
|
|
37983
|
+
getAttributeValue(structural, "vMergeOrig")
|
|
37984
|
+
);
|
|
37968
37985
|
style2.revision = {
|
|
37969
37986
|
...parseRevisionMetadata(structural),
|
|
37970
37987
|
type: inserted ? "insert" : deleted ? "delete" : "merge",
|
|
37971
|
-
...merged && originalMerge ? {
|
|
37972
|
-
previous: {
|
|
37973
|
-
vMerge: originalMerge === "restart" ? "restart" : "continue"
|
|
37974
|
-
}
|
|
37975
|
-
} : {}
|
|
37988
|
+
...merged && originalMerge ? { previous: { vMerge: originalMerge } } : {}
|
|
37976
37989
|
};
|
|
37977
37990
|
}
|
|
37978
37991
|
for (const [key, border] of Object.entries(
|
|
@@ -41049,6 +41062,27 @@ function applyCellParagraphAutospacing(cellNode, blocks) {
|
|
|
41049
41062
|
)
|
|
41050
41063
|
);
|
|
41051
41064
|
}
|
|
41065
|
+
function captureTrackedCellMergeState(cell) {
|
|
41066
|
+
var _a2, _b2;
|
|
41067
|
+
const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
|
|
41068
|
+
const previousVMerge = (revision == null ? void 0 : revision.type) === "merge" ? (_b2 = revision.previous) == null ? void 0 : _b2.vMerge : void 0;
|
|
41069
|
+
if (!revision || revision.type !== "merge" || !previousVMerge) return;
|
|
41070
|
+
const previousStyle = cell.style ? { ...cell.style, revision: void 0 } : void 0;
|
|
41071
|
+
const previousCell = {
|
|
41072
|
+
...cell,
|
|
41073
|
+
blocks: previousVMerge === "continue" ? [] : cell.blocks,
|
|
41074
|
+
vMerge: previousVMerge,
|
|
41075
|
+
rowSpan: void 0,
|
|
41076
|
+
style: previousStyle,
|
|
41077
|
+
mergeRevisionState: void 0
|
|
41078
|
+
};
|
|
41079
|
+
cell.mergeRevisionState = {
|
|
41080
|
+
revisionId: revision.id,
|
|
41081
|
+
orientation: "vertical",
|
|
41082
|
+
currentCellCount: 1,
|
|
41083
|
+
previousCells: [previousCell]
|
|
41084
|
+
};
|
|
41085
|
+
}
|
|
41052
41086
|
async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, _styles) {
|
|
41053
41087
|
var _a2, _b2;
|
|
41054
41088
|
const gridCols = [];
|
|
@@ -41118,6 +41152,7 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
41118
41152
|
}
|
|
41119
41153
|
const cellExtAttrs = collectExtAttributes(cellNode);
|
|
41120
41154
|
if (cellExtAttrs) cell.extAttributes = cellExtAttrs;
|
|
41155
|
+
captureTrackedCellMergeState(cell);
|
|
41121
41156
|
if (vMerge === "continue") {
|
|
41122
41157
|
cell.blocks = [];
|
|
41123
41158
|
}
|
|
@@ -41149,6 +41184,10 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
41149
41184
|
"tblPrExChange"
|
|
41150
41185
|
);
|
|
41151
41186
|
if (changeEl) {
|
|
41187
|
+
const revision = parseTablePropertyExceptionRevision(changeEl);
|
|
41188
|
+
if (revision) {
|
|
41189
|
+
row.propertyExceptionsRevision = revision;
|
|
41190
|
+
}
|
|
41152
41191
|
row.tblPrExChangeXml = new XMLSerializer().serializeToString(changeEl);
|
|
41153
41192
|
}
|
|
41154
41193
|
}
|
|
@@ -43154,8 +43193,8 @@ function serializeTableProperties(table) {
|
|
|
43154
43193
|
}
|
|
43155
43194
|
return `<w:tblPr>${parts.join("")}</w:tblPr>`;
|
|
43156
43195
|
}
|
|
43157
|
-
function serializeTablePropertyExceptions(exceptions, tblPrExChangeXml) {
|
|
43158
|
-
if (!exceptions && !tblPrExChangeXml) {
|
|
43196
|
+
function serializeTablePropertyExceptions(exceptions, revision, tblPrExChangeXml) {
|
|
43197
|
+
if (!exceptions && !revision && !tblPrExChangeXml) {
|
|
43159
43198
|
return "";
|
|
43160
43199
|
}
|
|
43161
43200
|
const parts = [];
|
|
@@ -43191,6 +43230,11 @@ function serializeTablePropertyExceptions(exceptions, tblPrExChangeXml) {
|
|
|
43191
43230
|
}
|
|
43192
43231
|
if (tblPrExChangeXml) {
|
|
43193
43232
|
parts.push(tblPrExChangeXml);
|
|
43233
|
+
} else if (revision) {
|
|
43234
|
+
const previous = serializeTablePropertyExceptions(revision.previous) || "<w:tblPrEx/>";
|
|
43235
|
+
parts.push(
|
|
43236
|
+
`<w:tblPrExChange ${serializeRevisionAttrs(revision)}>${previous}</w:tblPrExChange>`
|
|
43237
|
+
);
|
|
43194
43238
|
}
|
|
43195
43239
|
return parts.length > 0 ? `<w:tblPrEx>${parts.join("")}</w:tblPrEx>` : "";
|
|
43196
43240
|
}
|
|
@@ -43219,7 +43263,11 @@ function serializeTableXml(table, serializeBlockXml) {
|
|
|
43219
43263
|
const contentXml = cell.vMerge === "continue" ? "<w:p/>" : blocksXml;
|
|
43220
43264
|
return `<w:tc${serializeExtAttributes(cell.extAttributes)}>${serializeTableCellProperties(cell, fallbackWidthPt)}${contentXml}</w:tc>`;
|
|
43221
43265
|
}).join("");
|
|
43222
|
-
return `<w:tr${serializeExtAttributes(row.extAttributes)}>${serializeTablePropertyExceptions(
|
|
43266
|
+
return `<w:tr${serializeExtAttributes(row.extAttributes)}>${serializeTablePropertyExceptions(
|
|
43267
|
+
row.propertyExceptions,
|
|
43268
|
+
row.propertyExceptionsRevision,
|
|
43269
|
+
row.tblPrExChangeXml
|
|
43270
|
+
)}${serializeTableRowProperties(row)}${cellsXml}</w:tr>`;
|
|
43223
43271
|
}).join("");
|
|
43224
43272
|
const gridXml = table.gridCols ? `<w:tblGrid>${table.gridCols.map(
|
|
43225
43273
|
(width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`
|
|
@@ -47989,7 +48037,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
47989
48037
|
const worker = new Worker(
|
|
47990
48038
|
new URL(
|
|
47991
48039
|
/* @vite-ignore */
|
|
47992
|
-
"" + new URL("assets/importDocxWorker-
|
|
48040
|
+
"" + new URL("assets/importDocxWorker-D1N33VdD.js", import.meta.url).href,
|
|
47993
48041
|
import.meta.url
|
|
47994
48042
|
),
|
|
47995
48043
|
{
|
|
@@ -51930,6 +51978,8 @@ function cloneBlock(block) {
|
|
|
51930
51978
|
rows: block.rows.map((row) => ({
|
|
51931
51979
|
...row,
|
|
51932
51980
|
conditionalStyle: row.conditionalStyle ? { ...row.conditionalStyle } : void 0,
|
|
51981
|
+
propertyExceptions: row.propertyExceptions ? structuredClone(row.propertyExceptions) : void 0,
|
|
51982
|
+
propertyExceptionsRevision: row.propertyExceptionsRevision ? structuredClone(row.propertyExceptionsRevision) : void 0,
|
|
51933
51983
|
style: row.style ? {
|
|
51934
51984
|
...row.style,
|
|
51935
51985
|
revision: row.style.revision ? { ...row.style.revision } : void 0,
|
|
@@ -52295,6 +52345,25 @@ function resolveRowStructuralRevision(row, path, context2) {
|
|
|
52295
52345
|
style: row.style ? { ...row.style, revision: void 0 } : row.style
|
|
52296
52346
|
};
|
|
52297
52347
|
}
|
|
52348
|
+
function restoreVerticalCellMerge(cell) {
|
|
52349
|
+
var _a2, _b2;
|
|
52350
|
+
const state = cell.mergeRevisionState;
|
|
52351
|
+
if ((state == null ? void 0 : state.orientation) === "vertical" && state.currentCellCount === 1 && state.previousCells.length === 1) {
|
|
52352
|
+
return structuredClone(state.previousCells[0]);
|
|
52353
|
+
}
|
|
52354
|
+
const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
|
|
52355
|
+
if ((revision == null ? void 0 : revision.type) === "merge" && ((_b2 = revision.previous) == null ? void 0 : _b2.vMerge) === "continue") {
|
|
52356
|
+
return {
|
|
52357
|
+
...cell,
|
|
52358
|
+
blocks: [],
|
|
52359
|
+
rowSpan: void 0,
|
|
52360
|
+
vMerge: "continue",
|
|
52361
|
+
style: cell.style ? { ...cell.style, revision: void 0 } : cell.style,
|
|
52362
|
+
mergeRevisionState: void 0
|
|
52363
|
+
};
|
|
52364
|
+
}
|
|
52365
|
+
return void 0;
|
|
52366
|
+
}
|
|
52298
52367
|
function resolveCellStructuralRevision(cell, path, context2) {
|
|
52299
52368
|
var _a2;
|
|
52300
52369
|
const revision = (_a2 = cell.style) == null ? void 0 : _a2.revision;
|
|
@@ -52302,13 +52371,18 @@ function resolveCellStructuralRevision(cell, path, context2) {
|
|
|
52302
52371
|
if (revision && matchesRevision(context2, revision.id)) {
|
|
52303
52372
|
markMatched(context2);
|
|
52304
52373
|
if (context2.action === "reject" && revision.type === "merge") {
|
|
52305
|
-
|
|
52306
|
-
|
|
52307
|
-
|
|
52308
|
-
|
|
52309
|
-
|
|
52310
|
-
|
|
52311
|
-
|
|
52374
|
+
const restored = restoreVerticalCellMerge(cell);
|
|
52375
|
+
if (!restored) {
|
|
52376
|
+
pushIssue(context2, {
|
|
52377
|
+
kind: "cell-merge-original-unavailable",
|
|
52378
|
+
revisionId: revision.id,
|
|
52379
|
+
path,
|
|
52380
|
+
message: "The previous merge topology lacks an exact semantic snapshot for safe restoration."
|
|
52381
|
+
});
|
|
52382
|
+
return cell;
|
|
52383
|
+
}
|
|
52384
|
+
markResolved(context2, revision.id);
|
|
52385
|
+
return restored;
|
|
52312
52386
|
}
|
|
52313
52387
|
markResolved(context2, revision.id);
|
|
52314
52388
|
return {
|
|
@@ -52324,11 +52398,16 @@ function resolveCellStructuralRevision(cell, path, context2) {
|
|
|
52324
52398
|
markResolved(context2, revisionId);
|
|
52325
52399
|
return { ...cell, mergeRevisionState: void 0 };
|
|
52326
52400
|
}
|
|
52401
|
+
const restored = restoreVerticalCellMerge(cell);
|
|
52402
|
+
if (restored) {
|
|
52403
|
+
markResolved(context2, revisionId);
|
|
52404
|
+
return restored;
|
|
52405
|
+
}
|
|
52327
52406
|
pushIssue(context2, {
|
|
52328
52407
|
kind: "cell-merge-original-unavailable",
|
|
52329
52408
|
revisionId,
|
|
52330
52409
|
path: `${path}.mergeRevisionState`,
|
|
52331
|
-
message: "The
|
|
52410
|
+
message: "The preserved merge snapshot is not a supported exact vertical-cell restoration."
|
|
52332
52411
|
});
|
|
52333
52412
|
}
|
|
52334
52413
|
return cell;
|
|
@@ -52346,7 +52425,16 @@ function transformRow(row, path, context2) {
|
|
|
52346
52425
|
let next = resolveRowStructuralRevision(row, path, context2);
|
|
52347
52426
|
const style2 = resolveRowPropertyStyle(next.style, `${path}.style`, context2);
|
|
52348
52427
|
if (style2 !== next.style) next = { ...next, style: style2 };
|
|
52349
|
-
|
|
52428
|
+
const propertyExceptionsRevision = next.propertyExceptionsRevision;
|
|
52429
|
+
if (propertyExceptionsRevision && matchesRevision(context2, propertyExceptionsRevision.id)) {
|
|
52430
|
+
markResolved(context2, propertyExceptionsRevision.id);
|
|
52431
|
+
next = {
|
|
52432
|
+
...next,
|
|
52433
|
+
propertyExceptions: context2.action === "accept" ? next.propertyExceptions : structuredClone(propertyExceptionsRevision.previous),
|
|
52434
|
+
propertyExceptionsRevision: void 0,
|
|
52435
|
+
tblPrExChangeXml: void 0
|
|
52436
|
+
};
|
|
52437
|
+
} else if (next.tblPrExChangeXml && !propertyExceptionsRevision) {
|
|
52350
52438
|
const revisionId = rawRevisionId(next.tblPrExChangeXml);
|
|
52351
52439
|
if (revisionId && matchesRevision(context2, revisionId)) {
|
|
52352
52440
|
markMatched(context2);
|
|
@@ -52358,7 +52446,7 @@ function transformRow(row, path, context2) {
|
|
|
52358
52446
|
kind: "table-property-exception-original-unavailable",
|
|
52359
52447
|
revisionId,
|
|
52360
52448
|
path: `${path}.tblPrExChangeXml`,
|
|
52361
|
-
message: "w:tblPrExChange
|
|
52449
|
+
message: "The imported w:tblPrExChange has no decodable previous w:tblPrEx snapshot."
|
|
52362
52450
|
});
|
|
52363
52451
|
}
|
|
52364
52452
|
}
|
|
@@ -52381,6 +52469,30 @@ function transformRow(row, path, context2) {
|
|
|
52381
52469
|
if (cellsChanged) next = { ...next, cells };
|
|
52382
52470
|
return next;
|
|
52383
52471
|
}
|
|
52472
|
+
function recomputeVerticalMergeRowSpans(table) {
|
|
52473
|
+
let changed = false;
|
|
52474
|
+
const rows = table.rows.map((row, rowIndex) => {
|
|
52475
|
+
let rowChanged = false;
|
|
52476
|
+
const cells = row.cells.map((cell, cellIndex) => {
|
|
52477
|
+
let rowSpan;
|
|
52478
|
+
if (cell.vMerge === "restart") {
|
|
52479
|
+
rowSpan = 1;
|
|
52480
|
+
for (let nextRowIndex = rowIndex + 1; nextRowIndex < table.rows.length; nextRowIndex += 1) {
|
|
52481
|
+
const nextCell = table.rows[nextRowIndex].cells[cellIndex];
|
|
52482
|
+
if (!nextCell || nextCell.vMerge !== "continue") break;
|
|
52483
|
+
rowSpan += 1;
|
|
52484
|
+
}
|
|
52485
|
+
}
|
|
52486
|
+
if (cell.rowSpan === rowSpan) return cell;
|
|
52487
|
+
rowChanged = true;
|
|
52488
|
+
return { ...cell, rowSpan };
|
|
52489
|
+
});
|
|
52490
|
+
if (!rowChanged) return row;
|
|
52491
|
+
changed = true;
|
|
52492
|
+
return { ...row, cells };
|
|
52493
|
+
});
|
|
52494
|
+
return changed ? { ...table, rows } : table;
|
|
52495
|
+
}
|
|
52384
52496
|
function transformTable(table, path, context2) {
|
|
52385
52497
|
var _a2;
|
|
52386
52498
|
let next = table;
|
|
@@ -52415,7 +52527,10 @@ function transformTable(table, path, context2) {
|
|
|
52415
52527
|
if (transformed !== row) rowsChanged = true;
|
|
52416
52528
|
}
|
|
52417
52529
|
if (rowsChanged) next = { ...next, rows };
|
|
52418
|
-
if (rowsChanged)
|
|
52530
|
+
if (rowsChanged) {
|
|
52531
|
+
next = recomputeVerticalMergeRowSpans(next);
|
|
52532
|
+
recordRemovedParagraphRelocations(table, next, context2);
|
|
52533
|
+
}
|
|
52419
52534
|
return next;
|
|
52420
52535
|
}
|
|
52421
52536
|
function transformBlocks(blocks, path, context2) {
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-
|
|
1
|
+
import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-DBFpDATA.js";
|
|
2
2
|
export {
|
|
3
3
|
dN as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|