oasis-editor 0.0.181 → 0.0.183
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-DiKa_1be.js → OasisEditorApp-5Ov72yrU.js} +55 -33
- package/dist/assets/{importDocxWorker-D1N33VdD.js → importDocxWorker-D5fxy-0f.js} +1 -1
- package/dist/core/document/bookmarkAnchors.d.ts +0 -5
- package/dist/core/document/commentAnchors.d.ts +3 -0
- package/dist/core/document/rangeAnchors.d.ts +23 -0
- package/dist/core/model/types/documentComments.d.ts +4 -2
- package/dist/import/docx/commentsXml.d.ts +2 -0
- package/dist/{index-DBFpDATA.js → index-vDrr-EGA.js} +38 -15
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { EditorBookmarks, EditorParagraphNode } from '../model.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Remap every bookmark anchor that lives in `oldParagraphs` to its new position
|
|
5
|
-
* in `newParagraphs`. Anchors whose paragraph is not part of this zone are left
|
|
6
|
-
* untouched. Returns the same registry instance when nothing changed.
|
|
7
|
-
*/
|
|
8
3
|
export declare function transformBookmarksAcrossParagraphEdit(bookmarks: EditorBookmarks, oldParagraphs: EditorParagraphNode[], newParagraphs: EditorParagraphNode[]): EditorBookmarks;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EditorParagraphNode } from '../model.js';
|
|
2
|
+
|
|
3
|
+
interface TextRangeAnchor {
|
|
4
|
+
paragraphId: string;
|
|
5
|
+
offset: number;
|
|
6
|
+
seq?: number;
|
|
7
|
+
}
|
|
8
|
+
interface TextRangeItem {
|
|
9
|
+
start?: TextRangeAnchor;
|
|
10
|
+
end?: TextRangeAnchor;
|
|
11
|
+
}
|
|
12
|
+
interface TextRangeRegistry {
|
|
13
|
+
items: Record<string, TextRangeItem>;
|
|
14
|
+
order: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Remap document-level text ranges across one paragraph edit. The edited zone
|
|
18
|
+
* is linearized with paragraph-break sentinels, so typing, deletion and
|
|
19
|
+
* split/merge operations share one exact mapping path. Registries/items that do
|
|
20
|
+
* not change retain identity for structural sharing.
|
|
21
|
+
*/
|
|
22
|
+
export declare function transformTextRangeRegistryAcrossParagraphEdit<Registry extends TextRangeRegistry>(registry: Registry, oldParagraphs: EditorParagraphNode[], newParagraphs: EditorParagraphNode[]): Registry;
|
|
23
|
+
export {};
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* `word/comments.xml` — modeled like footnotes/endnotes.
|
|
10
10
|
*
|
|
11
11
|
* This is the import/display/export representation: faithful round-trip plus a
|
|
12
|
-
* highlighted range and a hover/click popup.
|
|
13
|
-
*
|
|
12
|
+
* highlighted range and a hover/click popup. Range anchors stay live across
|
|
13
|
+
* paragraph edits; comment authoring commands remain a separate concern.
|
|
14
14
|
*/
|
|
15
15
|
export interface EditorCommentAnchor {
|
|
16
16
|
/** Id of the paragraph this anchor lives in (`EditorParagraphNode.id`). */
|
|
@@ -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). */
|
|
@@ -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
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-5Ov72yrU.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -41755,14 +41755,14 @@ function parseDate(value2) {
|
|
|
41755
41755
|
return Number.isNaN(ms) ? void 0 : ms;
|
|
41756
41756
|
}
|
|
41757
41757
|
function parseCommentsExtended(xml) {
|
|
41758
|
-
const
|
|
41758
|
+
const extended = /* @__PURE__ */ new Map();
|
|
41759
41759
|
if (!xml) {
|
|
41760
|
-
return
|
|
41760
|
+
return extended;
|
|
41761
41761
|
}
|
|
41762
41762
|
const doc = new DOMParser$1().parseFromString(xml, "application/xml");
|
|
41763
41763
|
const root = doc.documentElement;
|
|
41764
41764
|
if (!root) {
|
|
41765
|
-
return
|
|
41765
|
+
return extended;
|
|
41766
41766
|
}
|
|
41767
41767
|
for (const ex of getChildrenByTagNameNS(root, WORD15_NS$2, "commentEx")) {
|
|
41768
41768
|
const paraId = ex.getAttributeNS(WORD15_NS$2, "paraId");
|
|
@@ -41770,9 +41770,13 @@ function parseCommentsExtended(xml) {
|
|
|
41770
41770
|
continue;
|
|
41771
41771
|
}
|
|
41772
41772
|
const isDone = ex.getAttributeNS(WORD15_NS$2, "done");
|
|
41773
|
-
|
|
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
|
+
});
|
|
41774
41778
|
}
|
|
41775
|
-
return
|
|
41779
|
+
return extended;
|
|
41776
41780
|
}
|
|
41777
41781
|
function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
41778
41782
|
const byDocxId = /* @__PURE__ */ new Map();
|
|
@@ -41784,7 +41788,7 @@ function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
|
41784
41788
|
if (!root) {
|
|
41785
41789
|
return byDocxId;
|
|
41786
41790
|
}
|
|
41787
|
-
const
|
|
41791
|
+
const extendedByParaId = parseCommentsExtended(commentsExtendedXml);
|
|
41788
41792
|
for (const comment of getChildrenByTagNameNS(root, WORD_NS$3, "comment")) {
|
|
41789
41793
|
const docxId = getAttributeValue(comment, "id");
|
|
41790
41794
|
if (docxId === null) {
|
|
@@ -41797,15 +41801,16 @@ function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
|
41797
41801
|
const paragraphs = getChildrenByTagNameNS(comment, WORD_NS$3, "p");
|
|
41798
41802
|
const text2 = paragraphs.map((p) => flattenCommentText(p)).join("\n").trim();
|
|
41799
41803
|
const paraId = paragraphs.length > 0 ? getAttributeValue(paragraphs[0], "paraId") ?? void 0 : void 0;
|
|
41800
|
-
const
|
|
41804
|
+
const extended = paraId !== void 0 ? extendedByParaId.get(paraId) : void 0;
|
|
41801
41805
|
byDocxId.set(docxId, {
|
|
41802
41806
|
author,
|
|
41803
41807
|
...initials ? { initials } : {},
|
|
41804
41808
|
...date !== void 0 ? { date } : {},
|
|
41805
41809
|
...dateUtc !== void 0 ? { dateUtc } : {},
|
|
41806
41810
|
text: text2,
|
|
41807
|
-
...resolved ? { resolved } : {},
|
|
41808
|
-
...paraId ? { paraId } : {}
|
|
41811
|
+
...(extended == null ? void 0 : extended.resolved) ? { resolved: true } : {},
|
|
41812
|
+
...paraId ? { paraId } : {},
|
|
41813
|
+
...(extended == null ? void 0 : extended.parentParaId) ? { parentParaId: extended.parentParaId } : {}
|
|
41809
41814
|
});
|
|
41810
41815
|
}
|
|
41811
41816
|
return byDocxId;
|
|
@@ -42278,6 +42283,17 @@ function buildEditorComments(ranges, bodies) {
|
|
|
42278
42283
|
}
|
|
42279
42284
|
return na - nb;
|
|
42280
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
|
+
}
|
|
42281
42297
|
const items = {};
|
|
42282
42298
|
const order = [];
|
|
42283
42299
|
for (const docxId of sorted) {
|
|
@@ -42286,7 +42302,8 @@ function buildEditorComments(ranges, bodies) {
|
|
|
42286
42302
|
if (!range && !body) {
|
|
42287
42303
|
continue;
|
|
42288
42304
|
}
|
|
42289
|
-
const id =
|
|
42305
|
+
const id = localIdByDocxId.get(docxId);
|
|
42306
|
+
const parentId = (body == null ? void 0 : body.parentParaId) ? localIdByParaId.get(body.parentParaId) : void 0;
|
|
42290
42307
|
const docxIdNum = Number.parseInt(docxId, 10);
|
|
42291
42308
|
items[id] = {
|
|
42292
42309
|
id,
|
|
@@ -42295,6 +42312,7 @@ function buildEditorComments(ranges, bodies) {
|
|
|
42295
42312
|
...(body == null ? void 0 : body.date) !== void 0 ? { date: body.date } : {},
|
|
42296
42313
|
...(body == null ? void 0 : body.dateUtc) !== void 0 ? { dateUtc: body.dateUtc } : {},
|
|
42297
42314
|
...(body == null ? void 0 : body.resolved) ? { resolved: body.resolved } : {},
|
|
42315
|
+
...parentId ? { parentId } : {},
|
|
42298
42316
|
text: (body == null ? void 0 : body.text) ?? "",
|
|
42299
42317
|
...(range == null ? void 0 : range.start) ? { start: range.start } : {},
|
|
42300
42318
|
...(range == null ? void 0 : range.end) ? { end: range.end } : {},
|
|
@@ -42735,9 +42753,14 @@ function buildCommentsPartXml(plan) {
|
|
|
42735
42753
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${COMMENTS_XMLNS}>${body}</w:comments>`;
|
|
42736
42754
|
}
|
|
42737
42755
|
function buildCommentsExtendedPartXml(plan) {
|
|
42738
|
-
const
|
|
42739
|
-
({ comment, paraId }) =>
|
|
42740
|
-
)
|
|
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("");
|
|
42741
42764
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${COMMENTS_XMLNS}>${body}</w15:commentsEx>`;
|
|
42742
42765
|
}
|
|
42743
42766
|
function isUsableNoteDocxId(value2) {
|
|
@@ -48037,7 +48060,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
48037
48060
|
const worker = new Worker(
|
|
48038
48061
|
new URL(
|
|
48039
48062
|
/* @vite-ignore */
|
|
48040
|
-
"" + new URL("assets/importDocxWorker-
|
|
48063
|
+
"" + new URL("assets/importDocxWorker-D5fxy-0f.js", import.meta.url).href,
|
|
48041
48064
|
import.meta.url
|
|
48042
48065
|
),
|
|
48043
48066
|
{
|
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-vDrr-EGA.js";
|
|
2
2
|
export {
|
|
3
3
|
dN as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|