oasis-editor 0.0.163 → 0.0.165
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-DrmbnMAA.js → OasisEditorApp-B5U2tjAM.js} +1 -1
- package/dist/assets/{importDocxWorker-Dc9RJPVl.js → importDocxWorker-q9FwIHr4.js} +1 -1
- package/dist/core/model/types/runSdtAugmentation.d.ts +16 -0
- package/dist/export/docx/text/revisionXml.d.ts +5 -1
- package/dist/import/docx/runs/types.d.ts +3 -1
- package/dist/{index-ByH2Moxz.js → index-BGlDfVIA.js} +74 -4
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -8,6 +8,22 @@ declare module "./nodes.js" {
|
|
|
8
8
|
interface EditorRunBase {
|
|
9
9
|
/** Enclosing inline `w:sdt` content controls, outermost first. */
|
|
10
10
|
sdtWrappers?: EditorSdtBlockWrapper[];
|
|
11
|
+
/**
|
|
12
|
+
* Zero-length Word move-container boundary (`moveFrom/ToRangeStart/End`).
|
|
13
|
+
* Start markers carry CT_MoveBookmark metadata; end markers retain the
|
|
14
|
+
* matching id and optional custom-XML displacement hint.
|
|
15
|
+
*/
|
|
16
|
+
revisionRangeMarker?: {
|
|
17
|
+
move: "from" | "to";
|
|
18
|
+
edge: "start" | "end";
|
|
19
|
+
id: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
author?: string;
|
|
22
|
+
date?: number;
|
|
23
|
+
columnFirst?: number;
|
|
24
|
+
columnLast?: number;
|
|
25
|
+
displacedByCustomXml?: string;
|
|
26
|
+
};
|
|
11
27
|
}
|
|
12
28
|
interface EditorTableRowNode {
|
|
13
29
|
/** Enclosing row-level `w:sdt` content controls, outermost first. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorRevision } from '../../../core/model.js';
|
|
1
|
+
import { EditorRevision, EditorRunBase } from '../../../core/model.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Word stores visible text from deletion-like revisions in `w:delText` and
|
|
@@ -9,3 +9,7 @@ import { EditorRevision } from '../../../core/model.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function serializeDeletionRunContent(xml: string): string;
|
|
11
11
|
export declare function serializeRunRevisionWrapper(innerXml: string, revision: EditorRevision): string;
|
|
12
|
+
type MoveRangeMarker = NonNullable<EditorRunBase["revisionRangeMarker"]>;
|
|
13
|
+
/** Serializes a zero-length move source/destination container boundary. */
|
|
14
|
+
export declare function serializeMoveRangeMarker(marker: MoveRangeMarker): string;
|
|
15
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
-
import { EditorBlockNode, EditorTextStyle, EditorImageRunData, EditorTextBoxData, EditorMathExpression, EditorRevision, EditorSdtBlockWrapper } from '../../../core/model.js';
|
|
2
|
+
import { EditorBlockNode, EditorTextStyle, EditorImageRunData, EditorTextBoxData, EditorMathExpression, EditorRevision, EditorRunBase, EditorSdtBlockWrapper } from '../../../core/model.js';
|
|
3
3
|
|
|
4
4
|
export type ParseNestedBlocks = (container: XmlElement) => Promise<EditorBlockNode[]>;
|
|
5
5
|
/**
|
|
@@ -30,6 +30,8 @@ export interface ImportedRun {
|
|
|
30
30
|
styles?: EditorTextStyle;
|
|
31
31
|
/** Tracked insertion/deletion, optionally paired as a Word move. */
|
|
32
32
|
revision?: EditorRevision;
|
|
33
|
+
/** Zero-length move range start/end marker retained in inline order. */
|
|
34
|
+
revisionRangeMarker?: EditorRunBase["revisionRangeMarker"];
|
|
33
35
|
/** Enclosing inline `w:sdt` wrappers, outermost first. */
|
|
34
36
|
sdtWrappers?: EditorSdtBlockWrapper[];
|
|
35
37
|
field?: {
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-B5U2tjAM.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -39777,6 +39777,32 @@ function parseRevisionContainer(element) {
|
|
|
39777
39777
|
...kind === "moveFrom" ? { move: "from" } : kind === "moveTo" ? { move: "to" } : {}
|
|
39778
39778
|
};
|
|
39779
39779
|
}
|
|
39780
|
+
function parseMoveRangeMarker(element) {
|
|
39781
|
+
const match = /^move(From|To)Range(Start|End)$/.exec(element.localName ?? "");
|
|
39782
|
+
if (!match) return void 0;
|
|
39783
|
+
const move = match[1] === "From" ? "from" : "to";
|
|
39784
|
+
const edge = match[2] === "Start" ? "start" : "end";
|
|
39785
|
+
const rawDate = getAttributeValue(element, "date");
|
|
39786
|
+
const parsedDate = rawDate ? Date.parse(rawDate) : Number.NaN;
|
|
39787
|
+
const colFirstRaw = getAttributeValue(element, "colFirst");
|
|
39788
|
+
const colLastRaw = getAttributeValue(element, "colLast");
|
|
39789
|
+
const columnFirst = colFirstRaw !== null ? Number.parseInt(colFirstRaw, 10) : Number.NaN;
|
|
39790
|
+
const columnLast = colLastRaw !== null ? Number.parseInt(colLastRaw, 10) : Number.NaN;
|
|
39791
|
+
const name = getAttributeValue(element, "name") ?? void 0;
|
|
39792
|
+
const author = getAttributeValue(element, "author") ?? void 0;
|
|
39793
|
+
const displacedByCustomXml = getAttributeValue(element, "displacedByCustomXml") ?? void 0;
|
|
39794
|
+
return {
|
|
39795
|
+
move,
|
|
39796
|
+
edge,
|
|
39797
|
+
id: getAttributeValue(element, "id") ?? fallbackRevisionId(element),
|
|
39798
|
+
...name !== void 0 ? { name } : {},
|
|
39799
|
+
...author !== void 0 ? { author } : {},
|
|
39800
|
+
...Number.isFinite(parsedDate) ? { date: parsedDate } : {},
|
|
39801
|
+
...Number.isFinite(columnFirst) ? { columnFirst } : {},
|
|
39802
|
+
...Number.isFinite(columnLast) ? { columnLast } : {},
|
|
39803
|
+
...displacedByCustomXml !== void 0 ? { displacedByCustomXml } : {}
|
|
39804
|
+
};
|
|
39805
|
+
}
|
|
39780
39806
|
async function parseRunElement(runElement, zip, relsMap, assets, parseNestedBlocks) {
|
|
39781
39807
|
const textParts = [];
|
|
39782
39808
|
let image;
|
|
@@ -39984,6 +40010,11 @@ async function parseRunsContainer(container, numberingMaps, zip, relsMap, assets
|
|
|
39984
40010
|
runs.push({ text: "", comment: marker });
|
|
39985
40011
|
continue;
|
|
39986
40012
|
}
|
|
40013
|
+
const moveRangeMarker = parseMoveRangeMarker(element);
|
|
40014
|
+
if (moveRangeMarker) {
|
|
40015
|
+
runs.push({ text: "", revisionRangeMarker: moveRangeMarker });
|
|
40016
|
+
continue;
|
|
40017
|
+
}
|
|
39987
40018
|
const revision = parseRevisionContainer(element);
|
|
39988
40019
|
if (revision) {
|
|
39989
40020
|
const nestedRuns = await parseRunsContainer(
|
|
@@ -40585,6 +40616,9 @@ function importedRunToEditorRun(run) {
|
|
|
40585
40616
|
if (run.revision) {
|
|
40586
40617
|
base.revision = { ...run.revision };
|
|
40587
40618
|
}
|
|
40619
|
+
if (run.revisionRangeMarker) {
|
|
40620
|
+
base.revisionRangeMarker = { ...run.revisionRangeMarker };
|
|
40621
|
+
}
|
|
40588
40622
|
if ((_a2 = run.sdtWrappers) == null ? void 0 : _a2.length) {
|
|
40589
40623
|
base.sdtWrappers = [...run.sdtWrappers];
|
|
40590
40624
|
}
|
|
@@ -40667,7 +40701,7 @@ function splitRunsAtPageBreaks(runs) {
|
|
|
40667
40701
|
const segments = [[]];
|
|
40668
40702
|
let hasPageBreak = false;
|
|
40669
40703
|
const appendRun = (run, text2) => {
|
|
40670
|
-
if (text2.length === 0 && !run.image && !run.textBox && !run.field && !run.fieldChar && run.fieldInstruction === void 0 && !run.bookmark && !run.comment) {
|
|
40704
|
+
if (text2.length === 0 && !run.image && !run.textBox && !run.field && !run.fieldChar && run.fieldInstruction === void 0 && !run.bookmark && !run.comment && !run.revisionRangeMarker) {
|
|
40671
40705
|
return;
|
|
40672
40706
|
}
|
|
40673
40707
|
segments[segments.length - 1].push({
|
|
@@ -40693,7 +40727,7 @@ function splitRunsAtPageBreaks(runs) {
|
|
|
40693
40727
|
}
|
|
40694
40728
|
function paragraphHasVisibleContent(runs) {
|
|
40695
40729
|
return runs.some(
|
|
40696
|
-
(run) => run.image || run.textBox || run.field || run.fieldChar || run.fieldInstruction !== void 0 || run.bookmark || run.comment || run.text.replace(/\s/g, "").length > 0
|
|
40730
|
+
(run) => run.image || run.textBox || run.field || run.fieldChar || run.fieldInstruction !== void 0 || run.bookmark || run.comment || run.revisionRangeMarker || run.text.replace(/\s/g, "").length > 0
|
|
40697
40731
|
);
|
|
40698
40732
|
}
|
|
40699
40733
|
async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks, inheritedStyle) {
|
|
@@ -45290,7 +45324,39 @@ function serializeRunRevisionWrapper(innerXml, revision) {
|
|
|
45290
45324
|
const element = revisionElementName(revision);
|
|
45291
45325
|
return `<w:${element} ${attributes}>${innerXml}</w:${element}>`;
|
|
45292
45326
|
}
|
|
45327
|
+
function serializeMoveRangeMarker(marker) {
|
|
45328
|
+
const element = `move${marker.move === "from" ? "From" : "To"}Range${marker.edge === "start" ? "Start" : "End"}`;
|
|
45329
|
+
const attributes = [
|
|
45330
|
+
`w:id="${revisionNumericId(marker.id)}"`
|
|
45331
|
+
];
|
|
45332
|
+
if (marker.displacedByCustomXml !== void 0) {
|
|
45333
|
+
attributes.push(
|
|
45334
|
+
`w:displacedByCustomXml="${escapeXml(marker.displacedByCustomXml)}"`
|
|
45335
|
+
);
|
|
45336
|
+
}
|
|
45337
|
+
if (marker.edge === "start") {
|
|
45338
|
+
if (marker.name !== void 0) {
|
|
45339
|
+
attributes.push(`w:name="${escapeXml(marker.name)}"`);
|
|
45340
|
+
}
|
|
45341
|
+
if (marker.author !== void 0) {
|
|
45342
|
+
attributes.push(`w:author="${escapeXml(marker.author)}"`);
|
|
45343
|
+
}
|
|
45344
|
+
if (marker.date !== void 0 && Number.isFinite(marker.date)) {
|
|
45345
|
+
attributes.push(`w:date="${new Date(marker.date).toISOString()}"`);
|
|
45346
|
+
}
|
|
45347
|
+
if (marker.columnFirst !== void 0) {
|
|
45348
|
+
attributes.push(`w:colFirst="${Math.trunc(marker.columnFirst)}"`);
|
|
45349
|
+
}
|
|
45350
|
+
if (marker.columnLast !== void 0) {
|
|
45351
|
+
attributes.push(`w:colLast="${Math.trunc(marker.columnLast)}"`);
|
|
45352
|
+
}
|
|
45353
|
+
}
|
|
45354
|
+
return `<w:${element} ${attributes.join(" ")}/>`;
|
|
45355
|
+
}
|
|
45293
45356
|
function serializeRun(run, context2, paragraphStyleId, styles, serializeBlocksXml2) {
|
|
45357
|
+
if (run.revisionRangeMarker) {
|
|
45358
|
+
return serializeMoveRangeMarker(run.revisionRangeMarker);
|
|
45359
|
+
}
|
|
45294
45360
|
if (run.__isFootnoteRefMarker) {
|
|
45295
45361
|
return serializeFootnoteRefMarker();
|
|
45296
45362
|
}
|
|
@@ -45347,6 +45413,9 @@ function serializeRunWithRelationships(run, context2, paragraphStyleId, styles,
|
|
|
45347
45413
|
styles,
|
|
45348
45414
|
serializeBlocksXml2
|
|
45349
45415
|
);
|
|
45416
|
+
if (run.revisionRangeMarker) {
|
|
45417
|
+
return runXml;
|
|
45418
|
+
}
|
|
45350
45419
|
if (((_a2 = run.revision) == null ? void 0 : _a2.type) === "delete") {
|
|
45351
45420
|
runXml = serializeDeletionRunContent(runXml);
|
|
45352
45421
|
}
|
|
@@ -46736,6 +46805,7 @@ function cloneRun(run) {
|
|
|
46736
46805
|
text: run.text,
|
|
46737
46806
|
styles: cloneStyle(run.styles),
|
|
46738
46807
|
revision: run.revision ? { ...run.revision } : void 0,
|
|
46808
|
+
revisionRangeMarker: run.revisionRangeMarker ? { ...run.revisionRangeMarker } : void 0,
|
|
46739
46809
|
sdtWrappers: run.sdtWrappers ? [...run.sdtWrappers] : void 0
|
|
46740
46810
|
};
|
|
46741
46811
|
const cloned = visitRun(run, {
|
|
@@ -47717,7 +47787,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
47717
47787
|
const worker = new Worker(
|
|
47718
47788
|
new URL(
|
|
47719
47789
|
/* @vite-ignore */
|
|
47720
|
-
"" + new URL("assets/importDocxWorker-
|
|
47790
|
+
"" + new URL("assets/importDocxWorker-q9FwIHr4.js", import.meta.url).href,
|
|
47721
47791
|
import.meta.url
|
|
47722
47792
|
),
|
|
47723
47793
|
{
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-
|
|
1
|
+
import { dK, ah, aw, aM, aG, dL, dM, dN, aA, dO, ai, dP, dt, aN, dQ, dR, aL, aD, dS, dT, dU, ag, dV, dr, aP, dW, dX, dY, dZ, d_, dF, d$, e0, e1, aU, aT, e2, aE, e3, e4, e5, e6, e7, e8, aI, aF, e9, b3, aO, b2, aV, az, aK, dE, ea, dL as dL2, dS as dS2, dV as dV2, e2 as e22, e3 as e32, e8 as e82, eb, ec, dv, dq, ed, ee, ef, eg, eh, ei, ej, ds, ek, el, em, du, en } from "./index-BGlDfVIA.js";
|
|
2
2
|
export {
|
|
3
3
|
dK as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|