oasis-editor 0.0.168 → 0.0.170
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-CUrnWD1d.js → OasisEditorApp-Dit2WRPL.js} +1 -1
- package/dist/assets/{importDocxWorker-CJWh6Ie7.js → importDocxWorker-BPMw_A0Z.js} +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/nodes.d.ts +3 -1
- package/dist/core/model/types/primitives.d.ts +4 -0
- package/dist/import/docx/numbering.d.ts +2 -1
- package/dist/{index-Dq6Yxrd4.js → index-CcenIM2p.js} +45 -20
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* statements that pointed there continue to work via the barrel
|
|
7
7
|
* re-export in `src/core/model.ts`.
|
|
8
8
|
*/
|
|
9
|
-
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageCropShape, EditorImageCropFit, EditorImageFillMode, EditorLineDash, EditorImageBorder, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, EditorGradientStop, EditorTextFill, EditorTextOutline, EditorTextShadow, EditorGlow, EditorReflection, } from './types/primitives.js';
|
|
9
|
+
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageCropShape, EditorImageCropFit, EditorImageFillMode, EditorLineDash, EditorImageBorder, EditorImageFloatingPosition, EditorImageFloatingLayout, EditorImageRunData, EditorWrapPolygonPoint, EditorFieldData, EditorFieldChar, EditorFootnoteReferenceData, EditorEndnoteReferenceData, EditorRevision, EditorRevisionMetadata, EditorNumberingRevision, EditorStructuralRevision, EditorPropertyRevision, EditorAsset, EditorFootnoteNumberFormat, EditorFootnoteRestart, EditorDocxWidthValue, EditorTableLayout, EditorTableRowHeightRule, EditorGradientStop, EditorTextFill, EditorTextOutline, EditorTextShadow, EditorGlow, EditorReflection, } from './types/primitives.js';
|
|
10
10
|
export type { EditorTextStyle, EditorParagraphStyle, EditorTableStyle, EditorTableFloatingLayout, EditorTableConditionalFormat, EditorConditionalRowStyle, EditorTableConditionalType, EditorTableConditionalFlags, EditorTableCellStyle, EditorNamedStyle, } from './types/styles.js';
|
|
11
11
|
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorSdtPr, EditorSdtSubtype, EditorSdtListItem, EditorSdtDataBinding, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
12
12
|
export type { EditorMathNode, EditorMathText, EditorMathFraction, EditorMathRadical, EditorMathScript, EditorMathDelimiter, EditorMathAccent, EditorMathNary, EditorMathLimit, EditorMathMatrix, EditorMathBox, EditorMathGroup, EditorMathRaw, EditorMathStyle, EditorMathExpression, } from './types/math.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorDocxWidthValue, EditorEndnoteReferenceData, EditorFieldChar, EditorFieldData, EditorFootnoteReferenceData, EditorImageFloatingLayout, EditorImageRunData, EditorParagraphListStyle, EditorRevision, EditorPropertyRevision, EditorStructuralRevision, EditorTableRowHeightRule } from './primitives.js';
|
|
1
|
+
import { EditorDocxWidthValue, EditorEndnoteReferenceData, EditorFieldChar, EditorFieldData, EditorFootnoteReferenceData, EditorImageFloatingLayout, EditorImageRunData, EditorParagraphListStyle, EditorNumberingRevision, EditorRevision, EditorPropertyRevision, EditorStructuralRevision, EditorTableRowHeightRule } from './primitives.js';
|
|
2
2
|
import { EditorMathExpression } from './math.js';
|
|
3
3
|
import { EditorParagraphStyle, EditorTableCellStyle, EditorTableStyle, EditorTableConditionalFlags, EditorTextStyle } from './styles.js';
|
|
4
4
|
|
|
@@ -287,6 +287,8 @@ export interface EditorParagraphNode {
|
|
|
287
287
|
runs: EditorTextRun[];
|
|
288
288
|
style?: EditorParagraphStyle;
|
|
289
289
|
list?: EditorParagraphListStyle;
|
|
290
|
+
/** Tracked previous numbering metadata from `w:numPr/w:numberingChange`. */
|
|
291
|
+
numberingRevision?: EditorNumberingRevision;
|
|
290
292
|
/** Drop cap that body text in this paragraph wraps around, when present. */
|
|
291
293
|
dropCap?: EditorDropCap;
|
|
292
294
|
/** Enclosing block-level `w:sdt` content controls, preserved for round-trip. */
|
|
@@ -225,6 +225,10 @@ export interface EditorRevisionMetadata {
|
|
|
225
225
|
author: string;
|
|
226
226
|
date: number;
|
|
227
227
|
}
|
|
228
|
+
/** Previous paragraph numbering cache from `w:numberingChange`. */
|
|
229
|
+
export interface EditorNumberingRevision extends EditorRevisionMetadata {
|
|
230
|
+
original?: string;
|
|
231
|
+
}
|
|
228
232
|
export interface EditorStructuralRevision extends EditorRevisionMetadata {
|
|
229
233
|
type: "insert" | "delete" | "merge";
|
|
230
234
|
previous?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
-
import { EditorParagraphListStyle } from '../../core/model.js';
|
|
2
|
+
import { EditorNumberingRevision, EditorParagraphListStyle } from '../../core/model.js';
|
|
3
3
|
|
|
4
4
|
type ListFormat = NonNullable<EditorParagraphListStyle["format"]>;
|
|
5
5
|
interface NumberingLevel {
|
|
@@ -28,6 +28,7 @@ export interface NumberingMaps {
|
|
|
28
28
|
seenInstances: Set<string>;
|
|
29
29
|
}
|
|
30
30
|
export declare function parseNumbering(numberingXml: string | null): NumberingMaps;
|
|
31
|
+
export declare function parseParagraphNumberingRevision(paragraphProperties: XmlElement | null): EditorNumberingRevision | undefined;
|
|
31
32
|
export declare function parseParagraphList(paragraphProperties: XmlElement | null, numberingMaps: NumberingMaps): {
|
|
32
33
|
list: EditorParagraphListStyle;
|
|
33
34
|
indent?: NumberingLevel["indent"];
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-Dit2WRPL.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -36601,6 +36601,16 @@ function getEffectiveEditorListOoxmlFormat(list) {
|
|
|
36601
36601
|
}
|
|
36602
36602
|
return metadata.format;
|
|
36603
36603
|
}
|
|
36604
|
+
function parseRevisionMetadata$1(element) {
|
|
36605
|
+
if (!element) return void 0;
|
|
36606
|
+
const id = getAttributeValue(element, "id");
|
|
36607
|
+
const author = getAttributeValue(element, "author");
|
|
36608
|
+
const rawDate = getAttributeValue(element, "date");
|
|
36609
|
+
if (!id || !author || !rawDate) return void 0;
|
|
36610
|
+
const date = Date.parse(rawDate);
|
|
36611
|
+
if (!Number.isFinite(date)) return void 0;
|
|
36612
|
+
return { id, author, date };
|
|
36613
|
+
}
|
|
36604
36614
|
const FORMAT_MAP = {
|
|
36605
36615
|
decimal: "decimal",
|
|
36606
36616
|
lowerLetter: "lowerLetter",
|
|
@@ -36756,6 +36766,18 @@ function effectiveLevel(numberingMaps, numId, ilvl) {
|
|
|
36756
36766
|
const override = numberingMaps.numOverrideLevels.get(`${numId}:${ilvl}`);
|
|
36757
36767
|
return override ?? base ?? {};
|
|
36758
36768
|
}
|
|
36769
|
+
function parseParagraphNumberingRevision(paragraphProperties) {
|
|
36770
|
+
if (!paragraphProperties) return void 0;
|
|
36771
|
+
const numPr = getFirstChildByTagNameNS(paragraphProperties, WORD_NS$3, "numPr");
|
|
36772
|
+
const change = getFirstChildByTagNameNS(numPr, WORD_NS$3, "numberingChange");
|
|
36773
|
+
const metadata = parseRevisionMetadata$1(change);
|
|
36774
|
+
if (!metadata) return void 0;
|
|
36775
|
+
const original = getAttributeValue(change, "original") ?? void 0;
|
|
36776
|
+
return {
|
|
36777
|
+
...metadata,
|
|
36778
|
+
...original !== void 0 ? { original } : {}
|
|
36779
|
+
};
|
|
36780
|
+
}
|
|
36759
36781
|
function parseParagraphList(paragraphProperties, numberingMaps) {
|
|
36760
36782
|
if (!paragraphProperties) return void 0;
|
|
36761
36783
|
const numPr = getFirstChildByTagNameNS(paragraphProperties, WORD_NS$3, "numPr");
|
|
@@ -36897,16 +36919,6 @@ function parseShdFill(element, colors) {
|
|
|
36897
36919
|
if (colors) return resolveThemeColor(element, colors);
|
|
36898
36920
|
return void 0;
|
|
36899
36921
|
}
|
|
36900
|
-
function parseRevisionMetadata$1(element) {
|
|
36901
|
-
if (!element) return void 0;
|
|
36902
|
-
const id = getAttributeValue(element, "id");
|
|
36903
|
-
const author = getAttributeValue(element, "author");
|
|
36904
|
-
const rawDate = getAttributeValue(element, "date");
|
|
36905
|
-
if (!id || !author || !rawDate) return void 0;
|
|
36906
|
-
const date = Date.parse(rawDate);
|
|
36907
|
-
if (!Number.isFinite(date)) return void 0;
|
|
36908
|
-
return { id, author, date };
|
|
36909
|
-
}
|
|
36910
36922
|
function parseW14SolidFillColor(solidFillEl) {
|
|
36911
36923
|
const srgbClr = getFirstChildByTagNameNS(solidFillEl, WORD14_NS$1, "srgbClr");
|
|
36912
36924
|
if (!srgbClr) return null;
|
|
@@ -40465,7 +40477,8 @@ function createEditorParagraphSemanticSignature(paragraph) {
|
|
|
40465
40477
|
function createEditorParagraphPropertiesSignature(paragraph) {
|
|
40466
40478
|
return stableSemanticString({
|
|
40467
40479
|
style: paragraph.style,
|
|
40468
|
-
list: paragraph.list
|
|
40480
|
+
list: paragraph.list,
|
|
40481
|
+
numberingRevision: paragraph.numberingRevision
|
|
40469
40482
|
});
|
|
40470
40483
|
}
|
|
40471
40484
|
function setEditorParagraphOoxmlSource(paragraph, source) {
|
|
@@ -40765,7 +40778,7 @@ function importedRunToEditorRun(run) {
|
|
|
40765
40778
|
}
|
|
40766
40779
|
return withMarkers;
|
|
40767
40780
|
}
|
|
40768
|
-
function createImportedParagraph(runs, paragraphStyle, list, markRunStyle, source) {
|
|
40781
|
+
function createImportedParagraph(runs, paragraphStyle, list, numberingRevision, markRunStyle, source) {
|
|
40769
40782
|
var _a2, _b2;
|
|
40770
40783
|
const editorRuns = runs.length > 0 ? runs.map(importedRunToEditorRun) : [
|
|
40771
40784
|
{
|
|
@@ -40788,6 +40801,7 @@ function createImportedParagraph(runs, paragraphStyle, list, markRunStyle, sourc
|
|
|
40788
40801
|
);
|
|
40789
40802
|
}
|
|
40790
40803
|
paragraph.list = list ? { ...list } : void 0;
|
|
40804
|
+
paragraph.numberingRevision = numberingRevision ? { ...numberingRevision } : void 0;
|
|
40791
40805
|
if (((_b2 = source == null ? void 0 : source.runXml) == null ? void 0 : _b2.length) === paragraph.runs.length) {
|
|
40792
40806
|
for (let index = 0; index < paragraph.runs.length; index += 1) {
|
|
40793
40807
|
setEditorRunOoxmlSource(paragraph.runs[index], source.runXml[index]);
|
|
@@ -40856,6 +40870,7 @@ async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, a
|
|
|
40856
40870
|
);
|
|
40857
40871
|
const listResult = parseParagraphList(paragraphProperties, numberingMaps);
|
|
40858
40872
|
const list = listResult == null ? void 0 : listResult.list;
|
|
40873
|
+
const numberingRevision = parseParagraphNumberingRevision(paragraphProperties);
|
|
40859
40874
|
let styleWithListIndent = parsedStyle;
|
|
40860
40875
|
if (listResult == null ? void 0 : listResult.indent) {
|
|
40861
40876
|
const { left, hanging } = listResult.indent;
|
|
@@ -40886,6 +40901,7 @@ async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, a
|
|
|
40886
40901
|
runs,
|
|
40887
40902
|
paragraphStyle,
|
|
40888
40903
|
list,
|
|
40904
|
+
numberingRevision,
|
|
40889
40905
|
markRunStyle,
|
|
40890
40906
|
source
|
|
40891
40907
|
)
|
|
@@ -40905,7 +40921,13 @@ async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, a
|
|
|
40905
40921
|
}
|
|
40906
40922
|
const style2 = pendingPageBreakBefore ? { ...paragraphStyle ?? {}, pageBreakBefore: true } : paragraphStyle;
|
|
40907
40923
|
paragraphs.push(
|
|
40908
|
-
createImportedParagraph(
|
|
40924
|
+
createImportedParagraph(
|
|
40925
|
+
segment,
|
|
40926
|
+
style2,
|
|
40927
|
+
list,
|
|
40928
|
+
numberingRevision,
|
|
40929
|
+
markRunStyle
|
|
40930
|
+
)
|
|
40909
40931
|
);
|
|
40910
40932
|
pendingPageBreakBefore = false;
|
|
40911
40933
|
}
|
|
@@ -44489,10 +44511,12 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
|
|
|
44489
44511
|
}
|
|
44490
44512
|
parts.push(...serializeParagraphDecorations(style2));
|
|
44491
44513
|
const numbering = numberingInfo.get(paragraph.id);
|
|
44492
|
-
|
|
44493
|
-
|
|
44494
|
-
|
|
44495
|
-
|
|
44514
|
+
const numberingChange = paragraph.numberingRevision ? `<w:numberingChange ${serializeRevisionMetadataAttributes(
|
|
44515
|
+
paragraph.numberingRevision
|
|
44516
|
+
)}${paragraph.numberingRevision.original !== void 0 ? ` w:original="${escapeXml(paragraph.numberingRevision.original)}"` : ""}/>` : "";
|
|
44517
|
+
if (numbering || numberingChange) {
|
|
44518
|
+
const currentNumbering = numbering ? `<w:ilvl w:val="${numbering.level}"/><w:numId w:val="${numbering.numId}"/>` : "";
|
|
44519
|
+
parts.push(`<w:numPr>${currentNumbering}${numberingChange}</w:numPr>`);
|
|
44496
44520
|
}
|
|
44497
44521
|
if ((_c = paragraph.style) == null ? void 0 : _c.propertyRevision) {
|
|
44498
44522
|
parts.push(
|
|
@@ -47028,7 +47052,8 @@ function cloneParagraph(paragraph) {
|
|
|
47028
47052
|
...paragraph,
|
|
47029
47053
|
runs: paragraph.runs.map(cloneRun),
|
|
47030
47054
|
style: cloneParagraphStyle(paragraph.style),
|
|
47031
|
-
list: paragraph.list ? { ...paragraph.list } : void 0
|
|
47055
|
+
list: paragraph.list ? { ...paragraph.list } : void 0,
|
|
47056
|
+
numberingRevision: paragraph.numberingRevision ? { ...paragraph.numberingRevision } : void 0
|
|
47032
47057
|
};
|
|
47033
47058
|
}
|
|
47034
47059
|
function cloneParagraphList(list) {
|
|
@@ -47964,7 +47989,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
47964
47989
|
const worker = new Worker(
|
|
47965
47990
|
new URL(
|
|
47966
47991
|
/* @vite-ignore */
|
|
47967
|
-
"" + new URL("assets/importDocxWorker-
|
|
47992
|
+
"" + new URL("assets/importDocxWorker-BPMw_A0Z.js", import.meta.url).href,
|
|
47968
47993
|
import.meta.url
|
|
47969
47994
|
),
|
|
47970
47995
|
{
|
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-CcenIM2p.js";
|
|
2
2
|
export {
|
|
3
3
|
dK as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|