oasis-editor 0.0.180 → 0.0.182
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-h2nQFM-y.js → OasisEditorApp-BAPDCzny.js} +1 -1
- package/dist/assets/{importDocxWorker-CTxcTGME.js → importDocxWorker-D5fxy-0f.js} +1 -1
- package/dist/core/model/types/documentComments.d.ts +2 -0
- package/dist/core/model/types/nodes.d.ts +3 -1
- package/dist/import/docx/commentsXml.d.ts +2 -0
- package/dist/import/docx/tableProperties.d.ts +2 -1
- package/dist/{index-C0KjmCqU.js → index-BbOqOr2T.js} +77 -20
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +2 -2
- package/package.json +1 -1
|
@@ -41,6 +41,8 @@ export interface EditorComment {
|
|
|
41
41
|
dateUtc?: number;
|
|
42
42
|
/** Resolved/"done" state (`w15:commentEx/@w15:done`). */
|
|
43
43
|
resolved?: boolean;
|
|
44
|
+
/** Editor-local parent comment id for a threaded reply (`w15:paraIdParent`). */
|
|
45
|
+
parentId?: string;
|
|
44
46
|
/** Flattened comment body text (bodies in scope are single paragraphs). */
|
|
45
47
|
text: string;
|
|
46
48
|
/** Start anchor. May be absent for a malformed import (orphan end). */
|
|
@@ -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>;
|
|
@@ -8,6 +8,8 @@ export interface ParsedCommentBody {
|
|
|
8
8
|
resolved?: boolean;
|
|
9
9
|
/** `w14:paraId` of the comment's (first) paragraph — links to commentsEx. */
|
|
10
10
|
paraId?: string;
|
|
11
|
+
/** Parent comment paragraph id from `w15:commentEx/@w15:paraIdParent`. */
|
|
12
|
+
parentParaId?: string;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Parse `word/comments.xml` (+ optional `word/commentsExtended.xml`) into a map
|
|
@@ -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-BAPDCzny.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) {
|
|
@@ -41174,6 +41184,10 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
41174
41184
|
"tblPrExChange"
|
|
41175
41185
|
);
|
|
41176
41186
|
if (changeEl) {
|
|
41187
|
+
const revision = parseTablePropertyExceptionRevision(changeEl);
|
|
41188
|
+
if (revision) {
|
|
41189
|
+
row.propertyExceptionsRevision = revision;
|
|
41190
|
+
}
|
|
41177
41191
|
row.tblPrExChangeXml = new XMLSerializer().serializeToString(changeEl);
|
|
41178
41192
|
}
|
|
41179
41193
|
}
|
|
@@ -41741,14 +41755,14 @@ function parseDate(value2) {
|
|
|
41741
41755
|
return Number.isNaN(ms) ? void 0 : ms;
|
|
41742
41756
|
}
|
|
41743
41757
|
function parseCommentsExtended(xml) {
|
|
41744
|
-
const
|
|
41758
|
+
const extended = /* @__PURE__ */ new Map();
|
|
41745
41759
|
if (!xml) {
|
|
41746
|
-
return
|
|
41760
|
+
return extended;
|
|
41747
41761
|
}
|
|
41748
41762
|
const doc = new DOMParser$1().parseFromString(xml, "application/xml");
|
|
41749
41763
|
const root = doc.documentElement;
|
|
41750
41764
|
if (!root) {
|
|
41751
|
-
return
|
|
41765
|
+
return extended;
|
|
41752
41766
|
}
|
|
41753
41767
|
for (const ex of getChildrenByTagNameNS(root, WORD15_NS$2, "commentEx")) {
|
|
41754
41768
|
const paraId = ex.getAttributeNS(WORD15_NS$2, "paraId");
|
|
@@ -41756,9 +41770,13 @@ function parseCommentsExtended(xml) {
|
|
|
41756
41770
|
continue;
|
|
41757
41771
|
}
|
|
41758
41772
|
const isDone = ex.getAttributeNS(WORD15_NS$2, "done");
|
|
41759
|
-
|
|
41773
|
+
const parentParaId = ex.getAttributeNS(WORD15_NS$2, "paraIdParent") || void 0;
|
|
41774
|
+
extended.set(paraId, {
|
|
41775
|
+
resolved: isDone === "1" || isDone === "true",
|
|
41776
|
+
...parentParaId ? { parentParaId } : {}
|
|
41777
|
+
});
|
|
41760
41778
|
}
|
|
41761
|
-
return
|
|
41779
|
+
return extended;
|
|
41762
41780
|
}
|
|
41763
41781
|
function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
41764
41782
|
const byDocxId = /* @__PURE__ */ new Map();
|
|
@@ -41770,7 +41788,7 @@ function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
|
41770
41788
|
if (!root) {
|
|
41771
41789
|
return byDocxId;
|
|
41772
41790
|
}
|
|
41773
|
-
const
|
|
41791
|
+
const extendedByParaId = parseCommentsExtended(commentsExtendedXml);
|
|
41774
41792
|
for (const comment of getChildrenByTagNameNS(root, WORD_NS$3, "comment")) {
|
|
41775
41793
|
const docxId = getAttributeValue(comment, "id");
|
|
41776
41794
|
if (docxId === null) {
|
|
@@ -41783,15 +41801,16 @@ function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
|
41783
41801
|
const paragraphs = getChildrenByTagNameNS(comment, WORD_NS$3, "p");
|
|
41784
41802
|
const text2 = paragraphs.map((p) => flattenCommentText(p)).join("\n").trim();
|
|
41785
41803
|
const paraId = paragraphs.length > 0 ? getAttributeValue(paragraphs[0], "paraId") ?? void 0 : void 0;
|
|
41786
|
-
const
|
|
41804
|
+
const extended = paraId !== void 0 ? extendedByParaId.get(paraId) : void 0;
|
|
41787
41805
|
byDocxId.set(docxId, {
|
|
41788
41806
|
author,
|
|
41789
41807
|
...initials ? { initials } : {},
|
|
41790
41808
|
...date !== void 0 ? { date } : {},
|
|
41791
41809
|
...dateUtc !== void 0 ? { dateUtc } : {},
|
|
41792
41810
|
text: text2,
|
|
41793
|
-
...resolved ? { resolved } : {},
|
|
41794
|
-
...paraId ? { paraId } : {}
|
|
41811
|
+
...(extended == null ? void 0 : extended.resolved) ? { resolved: true } : {},
|
|
41812
|
+
...paraId ? { paraId } : {},
|
|
41813
|
+
...(extended == null ? void 0 : extended.parentParaId) ? { parentParaId: extended.parentParaId } : {}
|
|
41795
41814
|
});
|
|
41796
41815
|
}
|
|
41797
41816
|
return byDocxId;
|
|
@@ -42264,6 +42283,17 @@ function buildEditorComments(ranges, bodies) {
|
|
|
42264
42283
|
}
|
|
42265
42284
|
return na - nb;
|
|
42266
42285
|
});
|
|
42286
|
+
const localIdByDocxId = /* @__PURE__ */ new Map();
|
|
42287
|
+
for (const docxId of sorted) {
|
|
42288
|
+
localIdByDocxId.set(docxId, createEditorCommentId());
|
|
42289
|
+
}
|
|
42290
|
+
const localIdByParaId = /* @__PURE__ */ new Map();
|
|
42291
|
+
for (const [docxId, body] of bodies) {
|
|
42292
|
+
const localId = localIdByDocxId.get(docxId);
|
|
42293
|
+
if (localId && body.paraId) {
|
|
42294
|
+
localIdByParaId.set(body.paraId, localId);
|
|
42295
|
+
}
|
|
42296
|
+
}
|
|
42267
42297
|
const items = {};
|
|
42268
42298
|
const order = [];
|
|
42269
42299
|
for (const docxId of sorted) {
|
|
@@ -42272,7 +42302,8 @@ function buildEditorComments(ranges, bodies) {
|
|
|
42272
42302
|
if (!range && !body) {
|
|
42273
42303
|
continue;
|
|
42274
42304
|
}
|
|
42275
|
-
const id =
|
|
42305
|
+
const id = localIdByDocxId.get(docxId);
|
|
42306
|
+
const parentId = (body == null ? void 0 : body.parentParaId) ? localIdByParaId.get(body.parentParaId) : void 0;
|
|
42276
42307
|
const docxIdNum = Number.parseInt(docxId, 10);
|
|
42277
42308
|
items[id] = {
|
|
42278
42309
|
id,
|
|
@@ -42281,6 +42312,7 @@ function buildEditorComments(ranges, bodies) {
|
|
|
42281
42312
|
...(body == null ? void 0 : body.date) !== void 0 ? { date: body.date } : {},
|
|
42282
42313
|
...(body == null ? void 0 : body.dateUtc) !== void 0 ? { dateUtc: body.dateUtc } : {},
|
|
42283
42314
|
...(body == null ? void 0 : body.resolved) ? { resolved: body.resolved } : {},
|
|
42315
|
+
...parentId ? { parentId } : {},
|
|
42284
42316
|
text: (body == null ? void 0 : body.text) ?? "",
|
|
42285
42317
|
...(range == null ? void 0 : range.start) ? { start: range.start } : {},
|
|
42286
42318
|
...(range == null ? void 0 : range.end) ? { end: range.end } : {},
|
|
@@ -42721,9 +42753,14 @@ function buildCommentsPartXml(plan) {
|
|
|
42721
42753
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${COMMENTS_XMLNS}>${body}</w:comments>`;
|
|
42722
42754
|
}
|
|
42723
42755
|
function buildCommentsExtendedPartXml(plan) {
|
|
42724
|
-
const
|
|
42725
|
-
({ comment, paraId }) =>
|
|
42726
|
-
)
|
|
42756
|
+
const paraIdByCommentId = new Map(
|
|
42757
|
+
plan.comments.map(({ comment, paraId }) => [comment.id, paraId])
|
|
42758
|
+
);
|
|
42759
|
+
const body = plan.comments.map(({ comment, paraId }) => {
|
|
42760
|
+
const parentParaId = comment.parentId ? paraIdByCommentId.get(comment.parentId) : void 0;
|
|
42761
|
+
const parentAttr = parentParaId ? ` w15:paraIdParent="${parentParaId}"` : "";
|
|
42762
|
+
return `<w15:commentEx w15:paraId="${paraId}"${parentAttr} w15:done="${comment.resolved ? "1" : "0"}"/>`;
|
|
42763
|
+
}).join("");
|
|
42727
42764
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${COMMENTS_XMLNS}>${body}</w15:commentsEx>`;
|
|
42728
42765
|
}
|
|
42729
42766
|
function isUsableNoteDocxId(value2) {
|
|
@@ -43179,8 +43216,8 @@ function serializeTableProperties(table) {
|
|
|
43179
43216
|
}
|
|
43180
43217
|
return `<w:tblPr>${parts.join("")}</w:tblPr>`;
|
|
43181
43218
|
}
|
|
43182
|
-
function serializeTablePropertyExceptions(exceptions, tblPrExChangeXml) {
|
|
43183
|
-
if (!exceptions && !tblPrExChangeXml) {
|
|
43219
|
+
function serializeTablePropertyExceptions(exceptions, revision, tblPrExChangeXml) {
|
|
43220
|
+
if (!exceptions && !revision && !tblPrExChangeXml) {
|
|
43184
43221
|
return "";
|
|
43185
43222
|
}
|
|
43186
43223
|
const parts = [];
|
|
@@ -43216,6 +43253,11 @@ function serializeTablePropertyExceptions(exceptions, tblPrExChangeXml) {
|
|
|
43216
43253
|
}
|
|
43217
43254
|
if (tblPrExChangeXml) {
|
|
43218
43255
|
parts.push(tblPrExChangeXml);
|
|
43256
|
+
} else if (revision) {
|
|
43257
|
+
const previous = serializeTablePropertyExceptions(revision.previous) || "<w:tblPrEx/>";
|
|
43258
|
+
parts.push(
|
|
43259
|
+
`<w:tblPrExChange ${serializeRevisionAttrs(revision)}>${previous}</w:tblPrExChange>`
|
|
43260
|
+
);
|
|
43219
43261
|
}
|
|
43220
43262
|
return parts.length > 0 ? `<w:tblPrEx>${parts.join("")}</w:tblPrEx>` : "";
|
|
43221
43263
|
}
|
|
@@ -43244,7 +43286,11 @@ function serializeTableXml(table, serializeBlockXml) {
|
|
|
43244
43286
|
const contentXml = cell.vMerge === "continue" ? "<w:p/>" : blocksXml;
|
|
43245
43287
|
return `<w:tc${serializeExtAttributes(cell.extAttributes)}>${serializeTableCellProperties(cell, fallbackWidthPt)}${contentXml}</w:tc>`;
|
|
43246
43288
|
}).join("");
|
|
43247
|
-
return `<w:tr${serializeExtAttributes(row.extAttributes)}>${serializeTablePropertyExceptions(
|
|
43289
|
+
return `<w:tr${serializeExtAttributes(row.extAttributes)}>${serializeTablePropertyExceptions(
|
|
43290
|
+
row.propertyExceptions,
|
|
43291
|
+
row.propertyExceptionsRevision,
|
|
43292
|
+
row.tblPrExChangeXml
|
|
43293
|
+
)}${serializeTableRowProperties(row)}${cellsXml}</w:tr>`;
|
|
43248
43294
|
}).join("");
|
|
43249
43295
|
const gridXml = table.gridCols ? `<w:tblGrid>${table.gridCols.map(
|
|
43250
43296
|
(width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`
|
|
@@ -48014,7 +48060,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
48014
48060
|
const worker = new Worker(
|
|
48015
48061
|
new URL(
|
|
48016
48062
|
/* @vite-ignore */
|
|
48017
|
-
"" + new URL("assets/importDocxWorker-
|
|
48063
|
+
"" + new URL("assets/importDocxWorker-D5fxy-0f.js", import.meta.url).href,
|
|
48018
48064
|
import.meta.url
|
|
48019
48065
|
),
|
|
48020
48066
|
{
|
|
@@ -51955,6 +52001,8 @@ function cloneBlock(block) {
|
|
|
51955
52001
|
rows: block.rows.map((row) => ({
|
|
51956
52002
|
...row,
|
|
51957
52003
|
conditionalStyle: row.conditionalStyle ? { ...row.conditionalStyle } : void 0,
|
|
52004
|
+
propertyExceptions: row.propertyExceptions ? structuredClone(row.propertyExceptions) : void 0,
|
|
52005
|
+
propertyExceptionsRevision: row.propertyExceptionsRevision ? structuredClone(row.propertyExceptionsRevision) : void 0,
|
|
51958
52006
|
style: row.style ? {
|
|
51959
52007
|
...row.style,
|
|
51960
52008
|
revision: row.style.revision ? { ...row.style.revision } : void 0,
|
|
@@ -52400,7 +52448,16 @@ function transformRow(row, path, context2) {
|
|
|
52400
52448
|
let next = resolveRowStructuralRevision(row, path, context2);
|
|
52401
52449
|
const style2 = resolveRowPropertyStyle(next.style, `${path}.style`, context2);
|
|
52402
52450
|
if (style2 !== next.style) next = { ...next, style: style2 };
|
|
52403
|
-
|
|
52451
|
+
const propertyExceptionsRevision = next.propertyExceptionsRevision;
|
|
52452
|
+
if (propertyExceptionsRevision && matchesRevision(context2, propertyExceptionsRevision.id)) {
|
|
52453
|
+
markResolved(context2, propertyExceptionsRevision.id);
|
|
52454
|
+
next = {
|
|
52455
|
+
...next,
|
|
52456
|
+
propertyExceptions: context2.action === "accept" ? next.propertyExceptions : structuredClone(propertyExceptionsRevision.previous),
|
|
52457
|
+
propertyExceptionsRevision: void 0,
|
|
52458
|
+
tblPrExChangeXml: void 0
|
|
52459
|
+
};
|
|
52460
|
+
} else if (next.tblPrExChangeXml && !propertyExceptionsRevision) {
|
|
52404
52461
|
const revisionId = rawRevisionId(next.tblPrExChangeXml);
|
|
52405
52462
|
if (revisionId && matchesRevision(context2, revisionId)) {
|
|
52406
52463
|
markMatched(context2);
|
|
@@ -52412,7 +52469,7 @@ function transformRow(row, path, context2) {
|
|
|
52412
52469
|
kind: "table-property-exception-original-unavailable",
|
|
52413
52470
|
revisionId,
|
|
52414
52471
|
path: `${path}.tblPrExChangeXml`,
|
|
52415
|
-
message: "w:tblPrExChange
|
|
52472
|
+
message: "The imported w:tblPrExChange has no decodable previous w:tblPrEx snapshot."
|
|
52416
52473
|
});
|
|
52417
52474
|
}
|
|
52418
52475
|
}
|
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-BbOqOr2T.js";
|
|
2
2
|
export {
|
|
3
3
|
dN as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|