oasis-editor 0.0.165 → 0.0.166
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-B5U2tjAM.js → OasisEditorApp-C1GkmD_B.js} +1 -1
- package/dist/assets/{importDocxWorker-q9FwIHr4.js → importDocxWorker-C5IkKe2t.js} +1 -1
- package/dist/core/model/types/styles.d.ts +4 -0
- package/dist/core/textStyle/textStyleMutations.d.ts +1 -0
- package/dist/export/docx/text/revisionXml.d.ts +2 -1
- package/dist/import/docx/revisionMetadata.d.ts +5 -0
- package/dist/{index-BGlDfVIA.js → index-BvpHK9s2.js} +246 -140
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -75,6 +75,8 @@ export interface EditorTextStyle {
|
|
|
75
75
|
shading?: string | null;
|
|
76
76
|
language?: EditorTextLanguage | null;
|
|
77
77
|
link?: string | null;
|
|
78
|
+
/** Previous direct run properties from `w:rPrChange`. */
|
|
79
|
+
propertyRevision?: EditorPropertyRevision<EditorTextStyle>;
|
|
78
80
|
}
|
|
79
81
|
export interface EditorParagraphStyle {
|
|
80
82
|
styleId?: string;
|
|
@@ -159,6 +161,8 @@ export interface EditorParagraphStyle {
|
|
|
159
161
|
* never silently dropped. Not rendered on any surface.
|
|
160
162
|
*/
|
|
161
163
|
framePrXml?: string | null;
|
|
164
|
+
/** Previous paragraph properties from `w:pPrChange`. */
|
|
165
|
+
propertyRevision?: EditorPropertyRevision<EditorParagraphStyle>;
|
|
162
166
|
}
|
|
163
167
|
/** Row properties from a conditional format's `w:trPr`. */
|
|
164
168
|
export interface EditorConditionalRowStyle {
|
|
@@ -2,6 +2,7 @@ import { EditorParagraphStyle, EditorTextStyle } from '../model.js';
|
|
|
2
2
|
import { ToggleableTextStyleKey, ValueParagraphStyleKey, ValueTextStyleKey } from './textStyleKeys.js';
|
|
3
3
|
|
|
4
4
|
export declare function cloneStyle(style?: EditorTextStyle): EditorTextStyle | undefined;
|
|
5
|
+
export declare function cloneParagraphStyle(style?: EditorParagraphStyle): EditorParagraphStyle | undefined;
|
|
5
6
|
export declare function stylesEqual(left?: EditorTextStyle, right?: EditorTextStyle): boolean;
|
|
6
7
|
export declare function setBooleanStyle(style: EditorTextStyle | undefined, key: ToggleableTextStyleKey, enabled: boolean): EditorTextStyle | undefined;
|
|
7
8
|
export declare function setValueStyle<K extends ValueTextStyleKey>(style: EditorTextStyle | undefined, key: K, value: EditorTextStyle[K] | null): EditorTextStyle | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorRevision, EditorRunBase } from '../../../core/model.js';
|
|
1
|
+
import { EditorRevision, EditorRevisionMetadata, EditorRunBase } from '../../../core/model.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Word stores visible text from deletion-like revisions in `w:delText` and
|
|
@@ -8,6 +8,7 @@ import { EditorRevision, EditorRunBase } from '../../../core/model.js';
|
|
|
8
8
|
* ordinary child is authoritative and the stale counterpart is removed first.
|
|
9
9
|
*/
|
|
10
10
|
export declare function serializeDeletionRunContent(xml: string): string;
|
|
11
|
+
export declare function serializeRevisionMetadataAttributes(revision: EditorRevisionMetadata): string;
|
|
11
12
|
export declare function serializeRunRevisionWrapper(innerXml: string, revision: EditorRevision): string;
|
|
12
13
|
type MoveRangeMarker = NonNullable<EditorRunBase["revisionRangeMarker"]>;
|
|
13
14
|
/** Serializes a zero-length move source/destination container boundary. */
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
+
import { EditorRevisionMetadata } from '../../core/model.js';
|
|
3
|
+
|
|
4
|
+
/** Parses the shared w:id/w:author/w:date payload used by OOXML property changes. */
|
|
5
|
+
export declare function parseRevisionMetadata(element: XmlElement | null | undefined): EditorRevisionMetadata | undefined;
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-C1GkmD_B.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -36897,6 +36897,16 @@ function parseShdFill(element, colors) {
|
|
|
36897
36897
|
if (colors) return resolveThemeColor(element, colors);
|
|
36898
36898
|
return void 0;
|
|
36899
36899
|
}
|
|
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
|
+
}
|
|
36900
36910
|
function parseW14SolidFillColor(solidFillEl) {
|
|
36901
36911
|
const srgbClr = getFirstChildByTagNameNS(solidFillEl, WORD14_NS$1, "srgbClr");
|
|
36902
36912
|
if (!srgbClr) return null;
|
|
@@ -37114,7 +37124,14 @@ function normalizeImportedRunStyle(style2, paragraphStyleId) {
|
|
|
37114
37124
|
highlight: dd(effective.highlight, defaultEffective.highlight),
|
|
37115
37125
|
shading: dd(effective.shading, defaultEffective.shading),
|
|
37116
37126
|
language: dd(effective.language, defaultEffective.language),
|
|
37117
|
-
link: dd(effective.link, defaultEffective.link)
|
|
37127
|
+
link: dd(effective.link, defaultEffective.link),
|
|
37128
|
+
propertyRevision: style2.propertyRevision ? {
|
|
37129
|
+
...style2.propertyRevision,
|
|
37130
|
+
previous: normalizeImportedRunStyle(
|
|
37131
|
+
style2.propertyRevision.previous,
|
|
37132
|
+
paragraphStyleId
|
|
37133
|
+
) ?? {}
|
|
37134
|
+
} : void 0
|
|
37118
37135
|
});
|
|
37119
37136
|
}
|
|
37120
37137
|
function parseRunStyle(runProperties, theme) {
|
|
@@ -37431,6 +37448,24 @@ function parseRunStyle(runProperties, theme) {
|
|
|
37431
37448
|
styles.language = parsedLanguage;
|
|
37432
37449
|
}
|
|
37433
37450
|
}
|
|
37451
|
+
const propertyChange = getFirstChildByTagNameNS(
|
|
37452
|
+
runProperties,
|
|
37453
|
+
WORD_NS$3,
|
|
37454
|
+
"rPrChange"
|
|
37455
|
+
);
|
|
37456
|
+
const revisionMetadata = parseRevisionMetadata$1(propertyChange);
|
|
37457
|
+
const previousProperties = getFirstChildByTagNameNS(
|
|
37458
|
+
propertyChange,
|
|
37459
|
+
WORD_NS$3,
|
|
37460
|
+
"rPr"
|
|
37461
|
+
);
|
|
37462
|
+
if (revisionMetadata && previousProperties) {
|
|
37463
|
+
styles.propertyRevision = {
|
|
37464
|
+
...revisionMetadata,
|
|
37465
|
+
type: "property",
|
|
37466
|
+
previous: parseRunStyle(previousProperties, theme) ?? {}
|
|
37467
|
+
};
|
|
37468
|
+
}
|
|
37434
37469
|
return emptyOrUndefined(styles);
|
|
37435
37470
|
}
|
|
37436
37471
|
const TABLE_CONDITIONAL_FLAG_ATTRIBUTES = [
|
|
@@ -37996,7 +38031,11 @@ function normalizeImportedParagraphStyle(style2) {
|
|
|
37996
38031
|
conditionalStyle: style2.conditionalStyle ?? void 0,
|
|
37997
38032
|
borderBetween: style2.borderBetween ?? void 0,
|
|
37998
38033
|
borderBar: style2.borderBar ?? void 0,
|
|
37999
|
-
framePrXml: style2.framePrXml ?? void 0
|
|
38034
|
+
framePrXml: style2.framePrXml ?? void 0,
|
|
38035
|
+
propertyRevision: style2.propertyRevision ? {
|
|
38036
|
+
...style2.propertyRevision,
|
|
38037
|
+
previous: normalizeImportedParagraphStyle(style2.propertyRevision.previous) ?? {}
|
|
38038
|
+
} : void 0
|
|
38000
38039
|
});
|
|
38001
38040
|
return normalized;
|
|
38002
38041
|
}
|
|
@@ -38296,6 +38335,24 @@ function parseParagraphStyle$1(paragraphProperties, colors) {
|
|
|
38296
38335
|
style2.framePrXml = new XMLSerializer().serializeToString(framePrEl);
|
|
38297
38336
|
}
|
|
38298
38337
|
}
|
|
38338
|
+
const propertyChange = getFirstChildByTagNameNS(
|
|
38339
|
+
paragraphProperties,
|
|
38340
|
+
WORD_NS$3,
|
|
38341
|
+
"pPrChange"
|
|
38342
|
+
);
|
|
38343
|
+
const revisionMetadata = parseRevisionMetadata$1(propertyChange);
|
|
38344
|
+
const previousProperties = getFirstChildByTagNameNS(
|
|
38345
|
+
propertyChange,
|
|
38346
|
+
WORD_NS$3,
|
|
38347
|
+
"pPr"
|
|
38348
|
+
);
|
|
38349
|
+
if (revisionMetadata && previousProperties) {
|
|
38350
|
+
style2.propertyRevision = {
|
|
38351
|
+
...revisionMetadata,
|
|
38352
|
+
type: "property",
|
|
38353
|
+
previous: parseParagraphStyle$1(previousProperties, colors) ?? {}
|
|
38354
|
+
};
|
|
38355
|
+
}
|
|
38299
38356
|
return emptyOrUndefined(style2);
|
|
38300
38357
|
}
|
|
38301
38358
|
function parseImportedStyles(stylesXml, theme) {
|
|
@@ -43928,6 +43985,7 @@ function serializeTableXmlPreservingSource(table, serializeParagraphXml2) {
|
|
|
43928
43985
|
return serialized.replace(`<w:tbl xmlns:w="${WORD_NS$1}"`, "<w:tbl");
|
|
43929
43986
|
}
|
|
43930
43987
|
function materializeParagraphStyle(paragraph, styles) {
|
|
43988
|
+
var _a2;
|
|
43931
43989
|
const effective = resolveEffectiveParagraphStyle(paragraph.style, styles);
|
|
43932
43990
|
return {
|
|
43933
43991
|
align: effective.align,
|
|
@@ -43969,11 +44027,12 @@ function materializeParagraphStyle(paragraph, styles) {
|
|
|
43969
44027
|
conditionalStyle: effective.conditionalStyle,
|
|
43970
44028
|
borderBetween: effective.borderBetween,
|
|
43971
44029
|
borderBar: effective.borderBar,
|
|
43972
|
-
framePrXml: effective.framePrXml
|
|
44030
|
+
framePrXml: effective.framePrXml,
|
|
44031
|
+
propertyRevision: (_a2 = paragraph.style) == null ? void 0 : _a2.propertyRevision
|
|
43973
44032
|
};
|
|
43974
44033
|
}
|
|
43975
44034
|
function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
43976
|
-
var _a2;
|
|
44035
|
+
var _a2, _b2;
|
|
43977
44036
|
const effective = resolveEffectiveTextStyleForParagraph(
|
|
43978
44037
|
run.styles,
|
|
43979
44038
|
paragraphStyleId,
|
|
@@ -44027,13 +44086,146 @@ function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
|
44027
44086
|
props3dXml: effective.props3dXml,
|
|
44028
44087
|
highlight: effective.highlight,
|
|
44029
44088
|
shading: effective.shading,
|
|
44030
|
-
language: effective.language
|
|
44089
|
+
language: effective.language,
|
|
44090
|
+
propertyRevision: (_a2 = run.styles) == null ? void 0 : _a2.propertyRevision
|
|
44031
44091
|
};
|
|
44032
|
-
if ((
|
|
44092
|
+
if ((_b2 = run.styles) == null ? void 0 : _b2.link) {
|
|
44033
44093
|
materialized.link = run.styles.link;
|
|
44034
44094
|
}
|
|
44035
44095
|
return materialized;
|
|
44036
44096
|
}
|
|
44097
|
+
const WRAPPER_XMLNS = `xmlns:oasis="urn:oasis:docx" xmlns:w="${WORD_NS$1}" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"`;
|
|
44098
|
+
function elementChildren(element) {
|
|
44099
|
+
const result = [];
|
|
44100
|
+
for (let index = 0; index < element.childNodes.length; index += 1) {
|
|
44101
|
+
const child2 = element.childNodes[index];
|
|
44102
|
+
if ((child2 == null ? void 0 : child2.nodeType) === child2.ELEMENT_NODE) {
|
|
44103
|
+
result.push(child2);
|
|
44104
|
+
}
|
|
44105
|
+
}
|
|
44106
|
+
return result;
|
|
44107
|
+
}
|
|
44108
|
+
function parseSingleRun(xml) {
|
|
44109
|
+
const wrapper = new DOMParser$1().parseFromString(
|
|
44110
|
+
`<oasis:root ${WRAPPER_XMLNS}>${xml}</oasis:root>`,
|
|
44111
|
+
"application/xml"
|
|
44112
|
+
).documentElement;
|
|
44113
|
+
if (!wrapper) return void 0;
|
|
44114
|
+
const children2 = elementChildren(wrapper);
|
|
44115
|
+
if (children2.length !== 1) return void 0;
|
|
44116
|
+
const run = children2[0];
|
|
44117
|
+
return run.namespaceURI === WORD_NS$1 && run.localName === "r" ? run : void 0;
|
|
44118
|
+
}
|
|
44119
|
+
function replaceWordChildName(parent, source, targetLocalName) {
|
|
44120
|
+
const ownerDocument = parent.ownerDocument;
|
|
44121
|
+
if (!ownerDocument) return;
|
|
44122
|
+
const replacement = ownerDocument.createElementNS(
|
|
44123
|
+
WORD_NS$1,
|
|
44124
|
+
`w:${targetLocalName}`
|
|
44125
|
+
);
|
|
44126
|
+
for (let index = 0; index < source.attributes.length; index += 1) {
|
|
44127
|
+
const attribute = source.attributes.item(index);
|
|
44128
|
+
if (!attribute) continue;
|
|
44129
|
+
if (attribute.namespaceURI) {
|
|
44130
|
+
replacement.setAttributeNS(
|
|
44131
|
+
attribute.namespaceURI,
|
|
44132
|
+
attribute.name,
|
|
44133
|
+
attribute.value
|
|
44134
|
+
);
|
|
44135
|
+
} else {
|
|
44136
|
+
replacement.setAttribute(attribute.name, attribute.value);
|
|
44137
|
+
}
|
|
44138
|
+
}
|
|
44139
|
+
while (source.firstChild) {
|
|
44140
|
+
replacement.appendChild(source.firstChild);
|
|
44141
|
+
}
|
|
44142
|
+
parent.replaceChild(replacement, source);
|
|
44143
|
+
}
|
|
44144
|
+
function serializeDeletionRunContent(xml) {
|
|
44145
|
+
const run = parseSingleRun(xml);
|
|
44146
|
+
if (!run) return xml;
|
|
44147
|
+
const children2 = elementChildren(run);
|
|
44148
|
+
const generatedText = children2.filter(
|
|
44149
|
+
(child2) => child2.namespaceURI === WORD_NS$1 && child2.localName === "t"
|
|
44150
|
+
);
|
|
44151
|
+
if (generatedText.length > 0) {
|
|
44152
|
+
for (const child2 of children2) {
|
|
44153
|
+
if (child2.namespaceURI === WORD_NS$1 && child2.localName === "delText") {
|
|
44154
|
+
run.removeChild(child2);
|
|
44155
|
+
}
|
|
44156
|
+
}
|
|
44157
|
+
for (const child2 of generatedText) {
|
|
44158
|
+
replaceWordChildName(run, child2, "delText");
|
|
44159
|
+
}
|
|
44160
|
+
}
|
|
44161
|
+
const refreshed = elementChildren(run);
|
|
44162
|
+
const generatedInstructions = refreshed.filter(
|
|
44163
|
+
(child2) => child2.namespaceURI === WORD_NS$1 && child2.localName === "instrText"
|
|
44164
|
+
);
|
|
44165
|
+
if (generatedInstructions.length > 0) {
|
|
44166
|
+
for (const child2 of refreshed) {
|
|
44167
|
+
if (child2.namespaceURI === WORD_NS$1 && child2.localName === "delInstrText") {
|
|
44168
|
+
run.removeChild(child2);
|
|
44169
|
+
}
|
|
44170
|
+
}
|
|
44171
|
+
for (const child2 of generatedInstructions) {
|
|
44172
|
+
replaceWordChildName(run, child2, "delInstrText");
|
|
44173
|
+
}
|
|
44174
|
+
}
|
|
44175
|
+
return new XMLSerializer().serializeToString(run);
|
|
44176
|
+
}
|
|
44177
|
+
function revisionNumericId(id) {
|
|
44178
|
+
if (/^\d+$/.test(id)) return id;
|
|
44179
|
+
return String(
|
|
44180
|
+
Array.from(id).reduce(
|
|
44181
|
+
(hash, character) => hash * 31 + character.charCodeAt(0) >>> 0,
|
|
44182
|
+
0
|
|
44183
|
+
)
|
|
44184
|
+
);
|
|
44185
|
+
}
|
|
44186
|
+
function serializeRevisionMetadataAttributes(revision) {
|
|
44187
|
+
const date = Number.isFinite(revision.date) ? new Date(revision.date).toISOString() : (/* @__PURE__ */ new Date(0)).toISOString();
|
|
44188
|
+
return `w:id="${revisionNumericId(revision.id)}" w:author="${escapeXml(revision.author)}" w:date="${date}"`;
|
|
44189
|
+
}
|
|
44190
|
+
function revisionElementName(revision) {
|
|
44191
|
+
if (revision.move === "from") return "moveFrom";
|
|
44192
|
+
if (revision.move === "to") return "moveTo";
|
|
44193
|
+
return revision.type === "delete" ? "del" : "ins";
|
|
44194
|
+
}
|
|
44195
|
+
function serializeRunRevisionWrapper(innerXml, revision) {
|
|
44196
|
+
const attributes = serializeRevisionMetadataAttributes(revision);
|
|
44197
|
+
const element = revisionElementName(revision);
|
|
44198
|
+
return `<w:${element} ${attributes}>${innerXml}</w:${element}>`;
|
|
44199
|
+
}
|
|
44200
|
+
function serializeMoveRangeMarker(marker) {
|
|
44201
|
+
const element = `move${marker.move === "from" ? "From" : "To"}Range${marker.edge === "start" ? "Start" : "End"}`;
|
|
44202
|
+
const attributes = [
|
|
44203
|
+
`w:id="${revisionNumericId(marker.id)}"`
|
|
44204
|
+
];
|
|
44205
|
+
if (marker.displacedByCustomXml !== void 0) {
|
|
44206
|
+
attributes.push(
|
|
44207
|
+
`w:displacedByCustomXml="${escapeXml(marker.displacedByCustomXml)}"`
|
|
44208
|
+
);
|
|
44209
|
+
}
|
|
44210
|
+
if (marker.edge === "start") {
|
|
44211
|
+
if (marker.name !== void 0) {
|
|
44212
|
+
attributes.push(`w:name="${escapeXml(marker.name)}"`);
|
|
44213
|
+
}
|
|
44214
|
+
if (marker.author !== void 0) {
|
|
44215
|
+
attributes.push(`w:author="${escapeXml(marker.author)}"`);
|
|
44216
|
+
}
|
|
44217
|
+
if (marker.date !== void 0 && Number.isFinite(marker.date)) {
|
|
44218
|
+
attributes.push(`w:date="${new Date(marker.date).toISOString()}"`);
|
|
44219
|
+
}
|
|
44220
|
+
if (marker.columnFirst !== void 0) {
|
|
44221
|
+
attributes.push(`w:colFirst="${Math.trunc(marker.columnFirst)}"`);
|
|
44222
|
+
}
|
|
44223
|
+
if (marker.columnLast !== void 0) {
|
|
44224
|
+
attributes.push(`w:colLast="${Math.trunc(marker.columnLast)}"`);
|
|
44225
|
+
}
|
|
44226
|
+
}
|
|
44227
|
+
return `<w:${element} ${attributes.join(" ")}/>`;
|
|
44228
|
+
}
|
|
44037
44229
|
function serializeParagraphTabs(tabs) {
|
|
44038
44230
|
if (!tabs || tabs.length === 0) {
|
|
44039
44231
|
return "";
|
|
@@ -44112,6 +44304,13 @@ function serializeParagraphDecorations(style2) {
|
|
|
44112
44304
|
}
|
|
44113
44305
|
return parts;
|
|
44114
44306
|
}
|
|
44307
|
+
function serializeParagraphPropertyRevision(revision) {
|
|
44308
|
+
const { propertyRevision: _nestedRevision, styleId, ...previous } = revision.previous;
|
|
44309
|
+
const serialized = serializeParagraphStyleXml(previous);
|
|
44310
|
+
const inner = serialized ? serialized.slice("<w:pPr>".length, -"</w:pPr>".length) : "";
|
|
44311
|
+
const styleXml = styleId ? `<w:pStyle w:val="${escapeXml(styleId)}"/>` : "";
|
|
44312
|
+
return `<w:pPrChange ${serializeRevisionMetadataAttributes(revision)}><w:pPr>${styleXml}${inner}</w:pPr></w:pPrChange>`;
|
|
44313
|
+
}
|
|
44115
44314
|
function serializeParagraphStyleXml(style2) {
|
|
44116
44315
|
const parts = [];
|
|
44117
44316
|
if (style2.align) {
|
|
@@ -44168,10 +44367,13 @@ function serializeParagraphStyleXml(style2) {
|
|
|
44168
44367
|
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
44169
44368
|
}
|
|
44170
44369
|
parts.push(...serializeParagraphDecorations(style2));
|
|
44370
|
+
if (style2.propertyRevision) {
|
|
44371
|
+
parts.push(serializeParagraphPropertyRevision(style2.propertyRevision));
|
|
44372
|
+
}
|
|
44171
44373
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
44172
44374
|
}
|
|
44173
44375
|
function serializeParagraphProperties(paragraph, numberingInfo, styles, overrides) {
|
|
44174
|
-
var _a2, _b2;
|
|
44376
|
+
var _a2, _b2, _c;
|
|
44175
44377
|
const parts = [];
|
|
44176
44378
|
const style2 = materializeParagraphStyle(paragraph, styles);
|
|
44177
44379
|
const align = ((_a2 = paragraph.style) == null ? void 0 : _a2.align) ?? (overrides == null ? void 0 : overrides.align) ?? style2.align;
|
|
@@ -44238,6 +44440,11 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
|
|
|
44238
44440
|
`<w:numPr><w:ilvl w:val="${numbering.level}"/><w:numId w:val="${numbering.numId}"/></w:numPr>`
|
|
44239
44441
|
);
|
|
44240
44442
|
}
|
|
44443
|
+
if ((_c = paragraph.style) == null ? void 0 : _c.propertyRevision) {
|
|
44444
|
+
parts.push(
|
|
44445
|
+
serializeParagraphPropertyRevision(paragraph.style.propertyRevision)
|
|
44446
|
+
);
|
|
44447
|
+
}
|
|
44241
44448
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
44242
44449
|
}
|
|
44243
44450
|
const DOCX_HIGHLIGHT_COLORS = {
|
|
@@ -44399,6 +44606,13 @@ function normalizeHighlightForDocx(highlight) {
|
|
|
44399
44606
|
}
|
|
44400
44607
|
return bestName;
|
|
44401
44608
|
}
|
|
44609
|
+
function serializeRunPropertyRevision(revision) {
|
|
44610
|
+
const { propertyRevision: _nestedRevision, styleId, ...previous } = revision.previous;
|
|
44611
|
+
const serialized = serializeRunProperties(previous);
|
|
44612
|
+
const inner = serialized ? serialized.slice("<w:rPr>".length, -"</w:rPr>".length) : "";
|
|
44613
|
+
const styleXml = styleId ? `<w:rStyle w:val="${escapeXml(styleId)}"/>` : "";
|
|
44614
|
+
return `<w:rPrChange ${serializeRevisionMetadataAttributes(revision)}><w:rPr>${styleXml}${inner}</w:rPr></w:rPrChange>`;
|
|
44615
|
+
}
|
|
44402
44616
|
function serializeRunProperties(styles) {
|
|
44403
44617
|
if (!styles) {
|
|
44404
44618
|
return "";
|
|
@@ -44542,6 +44756,9 @@ function serializeRunProperties(styles) {
|
|
|
44542
44756
|
parts.push(`<w:lang ${attrs.join(" ")}/>`);
|
|
44543
44757
|
}
|
|
44544
44758
|
}
|
|
44759
|
+
if (styles.propertyRevision) {
|
|
44760
|
+
parts.push(serializeRunPropertyRevision(styles.propertyRevision));
|
|
44761
|
+
}
|
|
44545
44762
|
return parts.length > 0 ? `<w:rPr>${parts.join("")}</w:rPr>` : "";
|
|
44546
44763
|
}
|
|
44547
44764
|
function needsPreserveSpace(text2) {
|
|
@@ -45224,135 +45441,6 @@ function mergeRunOoxmlSourceIntoGeneratedXml(run, generatedXml) {
|
|
|
45224
45441
|
mergeSourceRunChildren(sourceRun, generatedRun);
|
|
45225
45442
|
return new XMLSerializer().serializeToString(generatedRun);
|
|
45226
45443
|
}
|
|
45227
|
-
const WRAPPER_XMLNS = `xmlns:oasis="urn:oasis:docx" xmlns:w="${WORD_NS$1}" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"`;
|
|
45228
|
-
function elementChildren(element) {
|
|
45229
|
-
const result = [];
|
|
45230
|
-
for (let index = 0; index < element.childNodes.length; index += 1) {
|
|
45231
|
-
const child2 = element.childNodes[index];
|
|
45232
|
-
if ((child2 == null ? void 0 : child2.nodeType) === child2.ELEMENT_NODE) {
|
|
45233
|
-
result.push(child2);
|
|
45234
|
-
}
|
|
45235
|
-
}
|
|
45236
|
-
return result;
|
|
45237
|
-
}
|
|
45238
|
-
function parseSingleRun(xml) {
|
|
45239
|
-
const wrapper = new DOMParser$1().parseFromString(
|
|
45240
|
-
`<oasis:root ${WRAPPER_XMLNS}>${xml}</oasis:root>`,
|
|
45241
|
-
"application/xml"
|
|
45242
|
-
).documentElement;
|
|
45243
|
-
if (!wrapper) return void 0;
|
|
45244
|
-
const children2 = elementChildren(wrapper);
|
|
45245
|
-
if (children2.length !== 1) return void 0;
|
|
45246
|
-
const run = children2[0];
|
|
45247
|
-
return run.namespaceURI === WORD_NS$1 && run.localName === "r" ? run : void 0;
|
|
45248
|
-
}
|
|
45249
|
-
function replaceWordChildName(parent, source, targetLocalName) {
|
|
45250
|
-
const ownerDocument = parent.ownerDocument;
|
|
45251
|
-
if (!ownerDocument) return;
|
|
45252
|
-
const replacement = ownerDocument.createElementNS(
|
|
45253
|
-
WORD_NS$1,
|
|
45254
|
-
`w:${targetLocalName}`
|
|
45255
|
-
);
|
|
45256
|
-
for (let index = 0; index < source.attributes.length; index += 1) {
|
|
45257
|
-
const attribute = source.attributes.item(index);
|
|
45258
|
-
if (!attribute) continue;
|
|
45259
|
-
if (attribute.namespaceURI) {
|
|
45260
|
-
replacement.setAttributeNS(
|
|
45261
|
-
attribute.namespaceURI,
|
|
45262
|
-
attribute.name,
|
|
45263
|
-
attribute.value
|
|
45264
|
-
);
|
|
45265
|
-
} else {
|
|
45266
|
-
replacement.setAttribute(attribute.name, attribute.value);
|
|
45267
|
-
}
|
|
45268
|
-
}
|
|
45269
|
-
while (source.firstChild) {
|
|
45270
|
-
replacement.appendChild(source.firstChild);
|
|
45271
|
-
}
|
|
45272
|
-
parent.replaceChild(replacement, source);
|
|
45273
|
-
}
|
|
45274
|
-
function serializeDeletionRunContent(xml) {
|
|
45275
|
-
const run = parseSingleRun(xml);
|
|
45276
|
-
if (!run) return xml;
|
|
45277
|
-
const children2 = elementChildren(run);
|
|
45278
|
-
const generatedText = children2.filter(
|
|
45279
|
-
(child2) => child2.namespaceURI === WORD_NS$1 && child2.localName === "t"
|
|
45280
|
-
);
|
|
45281
|
-
if (generatedText.length > 0) {
|
|
45282
|
-
for (const child2 of children2) {
|
|
45283
|
-
if (child2.namespaceURI === WORD_NS$1 && child2.localName === "delText") {
|
|
45284
|
-
run.removeChild(child2);
|
|
45285
|
-
}
|
|
45286
|
-
}
|
|
45287
|
-
for (const child2 of generatedText) {
|
|
45288
|
-
replaceWordChildName(run, child2, "delText");
|
|
45289
|
-
}
|
|
45290
|
-
}
|
|
45291
|
-
const refreshed = elementChildren(run);
|
|
45292
|
-
const generatedInstructions = refreshed.filter(
|
|
45293
|
-
(child2) => child2.namespaceURI === WORD_NS$1 && child2.localName === "instrText"
|
|
45294
|
-
);
|
|
45295
|
-
if (generatedInstructions.length > 0) {
|
|
45296
|
-
for (const child2 of refreshed) {
|
|
45297
|
-
if (child2.namespaceURI === WORD_NS$1 && child2.localName === "delInstrText") {
|
|
45298
|
-
run.removeChild(child2);
|
|
45299
|
-
}
|
|
45300
|
-
}
|
|
45301
|
-
for (const child2 of generatedInstructions) {
|
|
45302
|
-
replaceWordChildName(run, child2, "delInstrText");
|
|
45303
|
-
}
|
|
45304
|
-
}
|
|
45305
|
-
return new XMLSerializer().serializeToString(run);
|
|
45306
|
-
}
|
|
45307
|
-
function revisionNumericId(id) {
|
|
45308
|
-
if (/^\d+$/.test(id)) return id;
|
|
45309
|
-
return String(
|
|
45310
|
-
Array.from(id).reduce(
|
|
45311
|
-
(hash, character) => hash * 31 + character.charCodeAt(0) >>> 0,
|
|
45312
|
-
0
|
|
45313
|
-
)
|
|
45314
|
-
);
|
|
45315
|
-
}
|
|
45316
|
-
function revisionElementName(revision) {
|
|
45317
|
-
if (revision.move === "from") return "moveFrom";
|
|
45318
|
-
if (revision.move === "to") return "moveTo";
|
|
45319
|
-
return revision.type === "delete" ? "del" : "ins";
|
|
45320
|
-
}
|
|
45321
|
-
function serializeRunRevisionWrapper(innerXml, revision) {
|
|
45322
|
-
const date = Number.isFinite(revision.date) ? new Date(revision.date).toISOString() : (/* @__PURE__ */ new Date(0)).toISOString();
|
|
45323
|
-
const attributes = `w:id="${revisionNumericId(revision.id)}" w:author="${escapeXml(revision.author)}" w:date="${date}"`;
|
|
45324
|
-
const element = revisionElementName(revision);
|
|
45325
|
-
return `<w:${element} ${attributes}>${innerXml}</w:${element}>`;
|
|
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
|
-
}
|
|
45356
45444
|
function serializeRun(run, context2, paragraphStyleId, styles, serializeBlocksXml2) {
|
|
45357
45445
|
if (run.revisionRangeMarker) {
|
|
45358
45446
|
return serializeMoveRangeMarker(run.revisionRangeMarker);
|
|
@@ -46742,7 +46830,25 @@ function buildHeaderFooterXml(kind, blocks, context2, styles, watermark) {
|
|
|
46742
46830
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:${tag} ${DOCUMENT_XMLNS}>${mark}${serializeBlocksXml(blocks, context2, styles)}</w:${tag}>`;
|
|
46743
46831
|
}
|
|
46744
46832
|
function cloneStyle(style2) {
|
|
46745
|
-
|
|
46833
|
+
if (!style2) return void 0;
|
|
46834
|
+
return {
|
|
46835
|
+
...style2,
|
|
46836
|
+
propertyRevision: style2.propertyRevision ? {
|
|
46837
|
+
...style2.propertyRevision,
|
|
46838
|
+
previous: cloneStyle(style2.propertyRevision.previous) ?? {}
|
|
46839
|
+
} : void 0
|
|
46840
|
+
};
|
|
46841
|
+
}
|
|
46842
|
+
function cloneParagraphStyle(style2) {
|
|
46843
|
+
if (!style2) return void 0;
|
|
46844
|
+
return {
|
|
46845
|
+
...style2,
|
|
46846
|
+
tabs: style2.tabs ? style2.tabs.map((tab) => ({ ...tab })) : style2.tabs,
|
|
46847
|
+
propertyRevision: style2.propertyRevision ? {
|
|
46848
|
+
...style2.propertyRevision,
|
|
46849
|
+
previous: cloneParagraphStyle(style2.propertyRevision.previous) ?? {}
|
|
46850
|
+
} : void 0
|
|
46851
|
+
};
|
|
46746
46852
|
}
|
|
46747
46853
|
function stylesEqual(left, right) {
|
|
46748
46854
|
return JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
|
|
@@ -46850,7 +46956,7 @@ function cloneParagraph(paragraph) {
|
|
|
46850
46956
|
return {
|
|
46851
46957
|
...paragraph,
|
|
46852
46958
|
runs: paragraph.runs.map(cloneRun),
|
|
46853
|
-
style: paragraph.style
|
|
46959
|
+
style: cloneParagraphStyle(paragraph.style),
|
|
46854
46960
|
list: paragraph.list ? { ...paragraph.list } : void 0
|
|
46855
46961
|
};
|
|
46856
46962
|
}
|
|
@@ -47787,7 +47893,7 @@ async function importDocxInWorker(buffer, options = {}) {
|
|
|
47787
47893
|
const worker = new Worker(
|
|
47788
47894
|
new URL(
|
|
47789
47895
|
/* @vite-ignore */
|
|
47790
|
-
"" + new URL("assets/importDocxWorker-
|
|
47896
|
+
"" + new URL("assets/importDocxWorker-C5IkKe2t.js", import.meta.url).href,
|
|
47791
47897
|
import.meta.url
|
|
47792
47898
|
),
|
|
47793
47899
|
{
|
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-BvpHK9s2.js";
|
|
2
2
|
export {
|
|
3
3
|
dK as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|