oasis-editor 0.0.101 → 0.0.103
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-B421ezvO.js → OasisEditorApp-CLzJ9zyp.js} +46 -16
- package/dist/assets/{importDocxWorker-DkjxuxwM.js → importDocxWorker-thqRCD9m.js} +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/document.d.ts +27 -0
- package/dist/export/docx/docxPackageXml.d.ts +9 -3
- package/dist/import/docx/fontTable.d.ts +13 -0
- package/dist/import/docx/paragraphStyle.d.ts +2 -1
- package/dist/import/docx/styleUtils.d.ts +2 -1
- package/dist/import/docx/tableProperties.d.ts +2 -1
- package/dist/{index-BPpHyg6q.js → index-DLL7O0m4.js} +95 -26
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export type { EditorFootnote } from './types/documentFootnotes.js';
|
|
|
15
15
|
export type { EditorEndnote } from './types/documentEndnotes.js';
|
|
16
16
|
export type { EditorBookmark, EditorBookmarkAnchor, EditorBookmarks, } from './types/documentBookmarks.js';
|
|
17
17
|
export type { EditorComment, EditorCommentAnchor, EditorComments, } from './types/documentComments.js';
|
|
18
|
-
export type { EditorPageMargins, EditorPageSettings, EditorColumnsSettings, EditorSection, EditorFootnoteSettings, EditorFootnotes, EditorEndnoteSettings, EditorEndnotes, EditorDocument, } from './types/document.js';
|
|
18
|
+
export type { EditorPageMargins, EditorPageSettings, EditorColumnsSettings, EditorSection, EditorFontInfo, EditorFootnoteSettings, EditorFootnotes, EditorEndnoteSettings, EditorEndnotes, EditorDocument, } from './types/document.js';
|
|
19
19
|
export type { EditorPosition, EditorSelection, EditorEditingZone, } from './types/selection.js';
|
|
20
20
|
export type { EditorCaretSlot, EditorLayoutFragmentChar, EditorLayoutFragment, EditorLayoutLine, EditorLayoutParagraph, EditorLayoutBlock, TableCellBlockPosition, EditorLayoutPage, EditorLayoutDocument, } from './types/layout.js';
|
|
21
21
|
export type { EditorState } from './editorState.js';
|
|
@@ -53,6 +53,28 @@ export interface EditorSection {
|
|
|
53
53
|
evenPageFooter?: EditorBlockNode[];
|
|
54
54
|
breakType?: "nextPage" | "continuous";
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* One `w:font` entry from `word/fontTable.xml`: the document's declaration of a
|
|
58
|
+
* font it uses, with substitution metadata. Preserved for round-trip (and as the
|
|
59
|
+
* basis for future font-substitution decisions). Embedded font references
|
|
60
|
+
* (`w:embedRegular`/etc.) are intentionally not modeled.
|
|
61
|
+
*/
|
|
62
|
+
export interface EditorFontInfo {
|
|
63
|
+
/** `w:font/@w:name`: the font's primary name (e.g. "Calibri"). */
|
|
64
|
+
name: string;
|
|
65
|
+
/** `w:altName/@w:val`: fallback font name when `name` is unavailable. */
|
|
66
|
+
altName?: string;
|
|
67
|
+
/** `w:family/@w:val`: roman | swiss | modern | script | decorative | auto. */
|
|
68
|
+
family?: string;
|
|
69
|
+
/** `w:pitch/@w:val`: fixed | variable | default. */
|
|
70
|
+
pitch?: string;
|
|
71
|
+
/** `w:charset/@w:val`: character set (hex). */
|
|
72
|
+
charset?: string;
|
|
73
|
+
/** `w:panose1/@w:val`: PANOSE classification (10-byte hex). */
|
|
74
|
+
panose1?: string;
|
|
75
|
+
/** `w:sig` attributes (Unicode/codepage signature bits) preserved verbatim. */
|
|
76
|
+
sig?: Record<string, string>;
|
|
77
|
+
}
|
|
56
78
|
export interface EditorFootnoteSettings {
|
|
57
79
|
numberFormat?: EditorFootnoteNumberFormat;
|
|
58
80
|
restart?: EditorFootnoteRestart;
|
|
@@ -116,6 +138,11 @@ export interface EditorDocument {
|
|
|
116
138
|
* body shown in a hover/click popup.
|
|
117
139
|
*/
|
|
118
140
|
comments?: EditorComments;
|
|
141
|
+
/**
|
|
142
|
+
* `word/fontTable.xml` entries: the fonts the document declares, with
|
|
143
|
+
* substitution metadata. Preserved on import and re-emitted on export.
|
|
144
|
+
*/
|
|
145
|
+
fontTable?: EditorFontInfo[];
|
|
119
146
|
metadata?: {
|
|
120
147
|
title?: string;
|
|
121
148
|
[key: string]: unknown;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { EditorFootnoteSettings } from '../../core/model.js';
|
|
1
|
+
import { EditorFontInfo, EditorFootnoteSettings } from '../../core/model.js';
|
|
2
2
|
import { DocContext, PartDefinition } from './docxTypes.js';
|
|
3
3
|
|
|
4
|
-
export declare function buildContentTypesXml(hasNumbering: boolean, imageExtensions: Iterable<string>, hasSettings: boolean, parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean): string;
|
|
4
|
+
export declare function buildContentTypesXml(hasNumbering: boolean, imageExtensions: Iterable<string>, hasSettings: boolean, parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean, hasFontTable: boolean): string;
|
|
5
5
|
export declare function buildRootRelationshipsXml(): string;
|
|
6
|
-
export declare function buildDocumentRelationshipsXml(hasNumbering: boolean, hasSettings: boolean, images: DocContext["images"], hyperlinks: DocContext["hyperlinks"], parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean): string;
|
|
6
|
+
export declare function buildDocumentRelationshipsXml(hasNumbering: boolean, hasSettings: boolean, images: DocContext["images"], hyperlinks: DocContext["hyperlinks"], parts: PartDefinition[], hasFootnotes: boolean, hasEndnotes: boolean, hasStyles: boolean, hasComments: boolean, hasFontTable: boolean): string;
|
|
7
|
+
/**
|
|
8
|
+
* Serialize the document's font declarations to `word/fontTable.xml`. Mirrors the
|
|
9
|
+
* structured {@link EditorFontInfo} back to `<w:font>` entries (substitution
|
|
10
|
+
* metadata only; embedded font references are not emitted).
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildFontTableXml(fonts: EditorFontInfo[]): string;
|
|
7
13
|
export interface HyphenationSettingsXml {
|
|
8
14
|
autoHyphenation?: boolean;
|
|
9
15
|
consecutiveHyphenLimit?: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EditorFontInfo } from '../../core/model.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse `word/fontTable.xml` into the document's font declarations. Each
|
|
5
|
+
* `<w:font w:name="…">` carries substitution metadata (alternative name, family,
|
|
6
|
+
* pitch, charset, PANOSE, and the Unicode/codepage signature). Embedded font
|
|
7
|
+
* references (`w:embedRegular`/etc., which point at obfuscated `.odttf` parts)
|
|
8
|
+
* are intentionally not read.
|
|
9
|
+
*
|
|
10
|
+
* Returns `undefined` when there is no usable font table so the document field
|
|
11
|
+
* stays absent (and export skips the part).
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseFontTable(xml: string | null): EditorFontInfo[] | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
2
|
import { EditorParagraphStyle } from '../../core/model.js';
|
|
3
|
+
import { ThemeColorMap } from './themeColors.js';
|
|
3
4
|
|
|
4
5
|
export declare function normalizeImportedParagraphStyle(style: EditorParagraphStyle | undefined): EditorParagraphStyle | undefined;
|
|
5
6
|
export declare function withDocxImplicitSingleLineHeight(style: EditorParagraphStyle | undefined): EditorParagraphStyle;
|
|
@@ -15,4 +16,4 @@ export interface ParagraphAutospacingFlags {
|
|
|
15
16
|
* reproduce that collapsing; see `collapseCellAutospacing` in tables.ts.
|
|
16
17
|
*/
|
|
17
18
|
export declare function parseAutospacingFlags(paragraphProperties: XmlElement | null): ParagraphAutospacingFlags;
|
|
18
|
-
export declare function parseParagraphStyle(paragraphProperties: XmlElement | null): EditorParagraphStyle | undefined;
|
|
19
|
+
export declare function parseParagraphStyle(paragraphProperties: XmlElement | null, colors?: ThemeColorMap): EditorParagraphStyle | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
|
+
import { ThemeColorMap } from './themeColors.js';
|
|
2
3
|
|
|
3
4
|
export declare function stripUndefined<T extends object>(value: T): Partial<T> | undefined;
|
|
4
5
|
export declare function emptyOrUndefined<T extends object>(obj: T): T | undefined;
|
|
5
6
|
export declare function mergeStyles<T extends object>(base: T | undefined, local: T | undefined): T | undefined;
|
|
6
|
-
export declare function parseShdFill(element: XmlElement | null): string | undefined;
|
|
7
|
+
export declare function parseShdFill(element: XmlElement | null, colors?: ThemeColorMap): string | undefined;
|
|
@@ -2,6 +2,7 @@ import { Element as XmlElement } from '@xmldom/xmldom';
|
|
|
2
2
|
import { EditorParagraphNode, EditorTableCellStyle, EditorTableRowNode, EditorTableRowStyle, EditorTableStyle, EditorTableConditionalFlags } from '../../core/model.js';
|
|
3
3
|
import { EditorTableBorders } from './borders.js';
|
|
4
4
|
import { ParagraphAutospacingFlags } from './paragraphStyle.js';
|
|
5
|
+
import { ThemeColorMap } from './themeColors.js';
|
|
5
6
|
|
|
6
7
|
export declare function parseTableConditionalFlags(properties: XmlElement | null): EditorTableConditionalFlags | undefined;
|
|
7
8
|
export declare function parseTableStyle(tblPr: XmlElement | null, tableStyleId?: string): EditorTableStyle | undefined;
|
|
@@ -15,7 +16,7 @@ export declare function getTableCellVMerge(cellProperties: XmlElement | null): "
|
|
|
15
16
|
* anchor cell's colspan so both representations render identically.
|
|
16
17
|
*/
|
|
17
18
|
export declare function getTableCellHMerge(cellProperties: XmlElement | null): "restart" | "continue" | undefined;
|
|
18
|
-
export declare function parseTableCellStyle(cellProperties: XmlElement | null, tableDefaultMargins?: EditorTableStyle["defaultCellMargins"]): EditorTableCellStyle | undefined;
|
|
19
|
+
export declare function parseTableCellStyle(cellProperties: XmlElement | null, tableDefaultMargins?: EditorTableStyle["defaultCellMargins"], colors?: ThemeColorMap): EditorTableCellStyle | undefined;
|
|
19
20
|
export declare function isTableHeaderRow(rowNode: XmlElement): boolean;
|
|
20
21
|
/**
|
|
21
22
|
* Reproduces Word's HTML-style margin collapsing for paragraphs that use "auto
|
|
@@ -2519,7 +2519,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2519
2519
|
onCleanup(() => {
|
|
2520
2520
|
cancelled = true;
|
|
2521
2521
|
});
|
|
2522
|
-
import("./OasisEditorApp-
|
|
2522
|
+
import("./OasisEditorApp-CLzJ9zyp.js").then((m) => {
|
|
2523
2523
|
cancelled = true;
|
|
2524
2524
|
setProgress(1);
|
|
2525
2525
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -33413,8 +33413,11 @@ function emptyOrUndefined(obj) {
|
|
|
33413
33413
|
function mergeStyles(base, local) {
|
|
33414
33414
|
return emptyOrUndefined({ ...base ?? {}, ...local ?? {} });
|
|
33415
33415
|
}
|
|
33416
|
-
function parseShdFill(element) {
|
|
33417
|
-
|
|
33416
|
+
function parseShdFill(element, colors) {
|
|
33417
|
+
const fill = normalizeImportedHexColor(getAttributeValue(element, "fill"));
|
|
33418
|
+
if (fill) return fill;
|
|
33419
|
+
if (colors) return resolveThemeColor(element, colors);
|
|
33420
|
+
return void 0;
|
|
33418
33421
|
}
|
|
33419
33422
|
function parseW14SolidFillColor(solidFillEl) {
|
|
33420
33423
|
const srgbClr = getFirstChildByTagNameNS(solidFillEl, WORD14_NS, "srgbClr");
|
|
@@ -33933,7 +33936,7 @@ function parseRunStyle(runProperties, theme) {
|
|
|
33933
33936
|
styles.highlight = highlightValue;
|
|
33934
33937
|
}
|
|
33935
33938
|
const shd = getFirstChildByTagNameNS(runProperties, WORD_NS, "shd");
|
|
33936
|
-
const shdFill = parseShdFill(shd);
|
|
33939
|
+
const shdFill = parseShdFill(shd, theme.colors);
|
|
33937
33940
|
if (shdFill) {
|
|
33938
33941
|
styles.shading = shdFill;
|
|
33939
33942
|
}
|
|
@@ -34044,7 +34047,7 @@ function parseParagraphTabs(paragraphProperties) {
|
|
|
34044
34047
|
}
|
|
34045
34048
|
return tabs;
|
|
34046
34049
|
}
|
|
34047
|
-
function parseParagraphStyle$1(paragraphProperties) {
|
|
34050
|
+
function parseParagraphStyle$1(paragraphProperties, colors) {
|
|
34048
34051
|
if (!paragraphProperties) {
|
|
34049
34052
|
return void 0;
|
|
34050
34053
|
}
|
|
@@ -34151,7 +34154,7 @@ function parseParagraphStyle$1(paragraphProperties) {
|
|
|
34151
34154
|
if (borderLeft) style2.borderLeft = borderLeft;
|
|
34152
34155
|
}
|
|
34153
34156
|
const shading = getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "shd");
|
|
34154
|
-
const shadingFill = parseShdFill(shading);
|
|
34157
|
+
const shadingFill = parseShdFill(shading, colors);
|
|
34155
34158
|
if (shadingFill) {
|
|
34156
34159
|
style2.shading = shadingFill;
|
|
34157
34160
|
}
|
|
@@ -34560,7 +34563,7 @@ function parseTableCellBorders(cellProperties) {
|
|
|
34560
34563
|
getFirstChildByTagNameNS(cellProperties, WORD_NS, "tcBorders")
|
|
34561
34564
|
);
|
|
34562
34565
|
}
|
|
34563
|
-
function parseTableCellStyle(cellProperties, tableDefaultMargins) {
|
|
34566
|
+
function parseTableCellStyle(cellProperties, tableDefaultMargins, colors) {
|
|
34564
34567
|
if (!cellProperties) {
|
|
34565
34568
|
{
|
|
34566
34569
|
return void 0;
|
|
@@ -34575,7 +34578,7 @@ function parseTableCellStyle(cellProperties, tableDefaultMargins) {
|
|
|
34575
34578
|
...{}
|
|
34576
34579
|
};
|
|
34577
34580
|
const shading = getFirstChildByTagNameNS(cellProperties, WORD_NS, "shd");
|
|
34578
|
-
const fill = parseShdFill(shading);
|
|
34581
|
+
const fill = parseShdFill(shading, colors);
|
|
34579
34582
|
if (fill) {
|
|
34580
34583
|
style2.shading = fill;
|
|
34581
34584
|
}
|
|
@@ -34646,7 +34649,7 @@ function parseTableCellStyle(cellProperties, tableDefaultMargins) {
|
|
|
34646
34649
|
style2.propertyRevision = {
|
|
34647
34650
|
...parseRevisionMetadata(change),
|
|
34648
34651
|
type: "property",
|
|
34649
|
-
previous: parseTableCellStyle(previousProperties) ?? {}
|
|
34652
|
+
previous: parseTableCellStyle(previousProperties, void 0, colors) ?? {}
|
|
34650
34653
|
};
|
|
34651
34654
|
}
|
|
34652
34655
|
const inserted = getFirstChildByTagNameNS(cellProperties, WORD_NS, "cellIns");
|
|
@@ -34733,8 +34736,12 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
34733
34736
|
const defaultParagraphStyle = pPrDefault ? {
|
|
34734
34737
|
spacingBefore: 0,
|
|
34735
34738
|
spacingAfter: 0,
|
|
34736
|
-
...withDocxImplicitSingleLineHeight(
|
|
34737
|
-
|
|
34739
|
+
...withDocxImplicitSingleLineHeight(
|
|
34740
|
+
parseParagraphStyle$1(pPrDefault, theme.colors)
|
|
34741
|
+
)
|
|
34742
|
+
} : withDocxImplicitSingleLineHeight(
|
|
34743
|
+
parseParagraphStyle$1(pPrDefault, theme.colors)
|
|
34744
|
+
);
|
|
34738
34745
|
const defaultTextStyle = parseRunStyle(rPrDefault, theme);
|
|
34739
34746
|
const styles = {};
|
|
34740
34747
|
let defaultParagraphStyleId;
|
|
@@ -34767,7 +34774,8 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
34767
34774
|
const uiPriority = Number.isInteger(parsedUiPriority) && parsedUiPriority >= 0 ? parsedUiPriority : void 0;
|
|
34768
34775
|
const paragraphStyle = withDocxImplicitSingleLineHeight(
|
|
34769
34776
|
parseParagraphStyle$1(
|
|
34770
|
-
getFirstChildByTagNameNS(styleElement, WORD_NS, "pPr")
|
|
34777
|
+
getFirstChildByTagNameNS(styleElement, WORD_NS, "pPr"),
|
|
34778
|
+
theme.colors
|
|
34771
34779
|
)
|
|
34772
34780
|
);
|
|
34773
34781
|
const textStyle = parseRunStyle(
|
|
@@ -34796,12 +34804,12 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
34796
34804
|
const condType = getAttributeValue(tblStylePr, "type");
|
|
34797
34805
|
if (!condType) continue;
|
|
34798
34806
|
const tcPr = getFirstChildByTagNameNS(tblStylePr, WORD_NS, "tcPr");
|
|
34799
|
-
const conditionalCellStyle = parseTableCellStyle(tcPr);
|
|
34807
|
+
const conditionalCellStyle = parseTableCellStyle(tcPr, void 0, theme.colors);
|
|
34800
34808
|
const conditionalTableStyle = parseTableStyle(
|
|
34801
34809
|
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "tblPr")
|
|
34802
34810
|
);
|
|
34803
34811
|
const shd = getFirstChildByTagNameNS(tcPr, WORD_NS, "shd");
|
|
34804
|
-
const fill = parseShdFill(shd);
|
|
34812
|
+
const fill = parseShdFill(shd, theme.colors);
|
|
34805
34813
|
const condTextStyle = parseRunStyle(
|
|
34806
34814
|
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "rPr"),
|
|
34807
34815
|
theme
|
|
@@ -34812,7 +34820,8 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
34812
34820
|
)
|
|
34813
34821
|
);
|
|
34814
34822
|
const condParagraphStyle = parseParagraphStyle$1(
|
|
34815
|
-
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "pPr")
|
|
34823
|
+
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "pPr"),
|
|
34824
|
+
theme.colors
|
|
34816
34825
|
);
|
|
34817
34826
|
const condRowStyle = parseTableRowStyle(
|
|
34818
34827
|
getFirstChildByTagNameNS(tblStylePr, WORD_NS, "trPr")
|
|
@@ -34870,6 +34879,60 @@ function parseImportedStyles(stylesXml, theme) {
|
|
|
34870
34879
|
}
|
|
34871
34880
|
return emptyOrUndefined(styles);
|
|
34872
34881
|
}
|
|
34882
|
+
function parseFontTable(xml) {
|
|
34883
|
+
if (!xml) {
|
|
34884
|
+
return void 0;
|
|
34885
|
+
}
|
|
34886
|
+
const root = new DOMParser$1().parseFromString(xml, "application/xml");
|
|
34887
|
+
const fontsEl = root.getElementsByTagNameNS(WORD_NS, "fonts")[0];
|
|
34888
|
+
if (!fontsEl) {
|
|
34889
|
+
return void 0;
|
|
34890
|
+
}
|
|
34891
|
+
const fonts = [];
|
|
34892
|
+
for (const fontEl of getChildrenByTagNameNS(fontsEl, WORD_NS, "font")) {
|
|
34893
|
+
const name = getAttributeValue(fontEl, "name");
|
|
34894
|
+
if (!name) {
|
|
34895
|
+
continue;
|
|
34896
|
+
}
|
|
34897
|
+
const info = { name };
|
|
34898
|
+
const altName = getAttributeValue(
|
|
34899
|
+
getFirstChildByTagNameNS(fontEl, WORD_NS, "altName"),
|
|
34900
|
+
"val"
|
|
34901
|
+
);
|
|
34902
|
+
if (altName) info.altName = altName;
|
|
34903
|
+
const family = getAttributeValue(
|
|
34904
|
+
getFirstChildByTagNameNS(fontEl, WORD_NS, "family"),
|
|
34905
|
+
"val"
|
|
34906
|
+
);
|
|
34907
|
+
if (family) info.family = family;
|
|
34908
|
+
const pitch = getAttributeValue(
|
|
34909
|
+
getFirstChildByTagNameNS(fontEl, WORD_NS, "pitch"),
|
|
34910
|
+
"val"
|
|
34911
|
+
);
|
|
34912
|
+
if (pitch) info.pitch = pitch;
|
|
34913
|
+
const charset = getAttributeValue(
|
|
34914
|
+
getFirstChildByTagNameNS(fontEl, WORD_NS, "charset"),
|
|
34915
|
+
"val"
|
|
34916
|
+
);
|
|
34917
|
+
if (charset) info.charset = charset;
|
|
34918
|
+
const panose1 = getAttributeValue(
|
|
34919
|
+
getFirstChildByTagNameNS(fontEl, WORD_NS, "panose1"),
|
|
34920
|
+
"val"
|
|
34921
|
+
);
|
|
34922
|
+
if (panose1) info.panose1 = panose1;
|
|
34923
|
+
const sigEl = getFirstChildByTagNameNS(fontEl, WORD_NS, "sig");
|
|
34924
|
+
if (sigEl) {
|
|
34925
|
+
const sig = {};
|
|
34926
|
+
for (let i = 0; i < sigEl.attributes.length; i += 1) {
|
|
34927
|
+
const attr = sigEl.attributes[i];
|
|
34928
|
+
sig[attr.localName ?? attr.name] = attr.value;
|
|
34929
|
+
}
|
|
34930
|
+
if (Object.keys(sig).length > 0) info.sig = sig;
|
|
34931
|
+
}
|
|
34932
|
+
fonts.push(info);
|
|
34933
|
+
}
|
|
34934
|
+
return fonts.length > 0 ? fonts : void 0;
|
|
34935
|
+
}
|
|
34873
34936
|
function isXmlTrue(value) {
|
|
34874
34937
|
return value === "1" || value === "true" || value === "on";
|
|
34875
34938
|
}
|
|
@@ -36253,7 +36316,7 @@ async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, a
|
|
|
36253
36316
|
parseNestedBlocks
|
|
36254
36317
|
);
|
|
36255
36318
|
const parsedStyle = withDocxImplicitSingleLineHeight(
|
|
36256
|
-
parseParagraphStyle$1(paragraphProperties)
|
|
36319
|
+
parseParagraphStyle$1(paragraphProperties, theme.colors)
|
|
36257
36320
|
);
|
|
36258
36321
|
const markRunStyle = parseRunStyle(
|
|
36259
36322
|
getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "rPr"),
|
|
@@ -36410,7 +36473,7 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
36410
36473
|
continue;
|
|
36411
36474
|
}
|
|
36412
36475
|
const vMerge = getTableCellVMerge(cellProperties);
|
|
36413
|
-
const cellStyle = parseTableCellStyle(cellProperties);
|
|
36476
|
+
const cellStyle = parseTableCellStyle(cellProperties, void 0, theme.colors);
|
|
36414
36477
|
const cell = createEditorTableCell(
|
|
36415
36478
|
paragraphs.length > 0 ? paragraphs : [createEditorParagraphFromRuns([{ text: "" }])],
|
|
36416
36479
|
colSpan,
|
|
@@ -37059,7 +37122,7 @@ function parseCommentsXml(commentsXml, commentsExtendedXml) {
|
|
|
37059
37122
|
return byDocxId;
|
|
37060
37123
|
}
|
|
37061
37124
|
async function importDocxToEditorDocument(buffer, options = {}) {
|
|
37062
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
37125
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
37063
37126
|
(_a = options.onProgress) == null ? void 0 : _a.call(options, "opening-docx");
|
|
37064
37127
|
const zip = await JSZip.loadAsync(buffer);
|
|
37065
37128
|
const documentXml = await ((_b = zip.file("word/document.xml")) == null ? void 0 : _b.async("string"));
|
|
@@ -37073,10 +37136,13 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37073
37136
|
const settingsXml = await ((_e = zip.file("word/settings.xml")) == null ? void 0 : _e.async("string")) ?? null;
|
|
37074
37137
|
const docSettings = parseSettings(settingsXml);
|
|
37075
37138
|
const stylesXml = await ((_f = zip.file("word/styles.xml")) == null ? void 0 : _f.async("string")) ?? null;
|
|
37076
|
-
const
|
|
37139
|
+
const fontTable = parseFontTable(
|
|
37140
|
+
await ((_g = zip.file("word/fontTable.xml")) == null ? void 0 : _g.async("string")) ?? null
|
|
37141
|
+
);
|
|
37142
|
+
const themeXml = await ((_h = zip.file("word/theme/theme1.xml")) == null ? void 0 : _h.async("string")) ?? null;
|
|
37077
37143
|
const theme = parseDocxTheme(themeXml);
|
|
37078
37144
|
const importedStyles = parseImportedStyles(stylesXml, theme);
|
|
37079
|
-
(
|
|
37145
|
+
(_i = options.onProgress) == null ? void 0 : _i.call(options, "parsing-document");
|
|
37080
37146
|
const document2 = new DOMParser$1().parseFromString(
|
|
37081
37147
|
documentXml,
|
|
37082
37148
|
"application/xml"
|
|
@@ -37208,7 +37274,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37208
37274
|
}
|
|
37209
37275
|
);
|
|
37210
37276
|
}
|
|
37211
|
-
(
|
|
37277
|
+
(_j = options.onProgress) == null ? void 0 : _j.call(options, "parsing-headers-footers");
|
|
37212
37278
|
const sections = [];
|
|
37213
37279
|
const hasHeaderFooterReferences = (props) => Object.keys(props.headerRIds).length > 0 || Object.keys(props.footerRIds).length > 0;
|
|
37214
37280
|
const totalSectionsWithHeaders = sectionProps.filter(
|
|
@@ -37307,7 +37373,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37307
37373
|
evenPageFooter: evenPageFooter.length > 0 ? evenPageFooter : void 0
|
|
37308
37374
|
});
|
|
37309
37375
|
}
|
|
37310
|
-
const footnotesXml = await ((
|
|
37376
|
+
const footnotesXml = await ((_k = zip.file("word/footnotes.xml")) == null ? void 0 : _k.async("string")) ?? null;
|
|
37311
37377
|
const footnotesPartRels = footnotesXml ? await loadPartRelationships(zip, "word/footnotes.xml") : /* @__PURE__ */ new Map();
|
|
37312
37378
|
const parsedFootnotes = await parseFootnotesXml(
|
|
37313
37379
|
footnotesXml,
|
|
@@ -37322,7 +37388,7 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37322
37388
|
}
|
|
37323
37389
|
const editorFootnotes = Object.keys(parsedFootnotes.footnotes.items).length > 0 || parsedFootnotes.footnotes.separator || parsedFootnotes.footnotes.continuationSeparator || parsedFootnotes.footnotes.settings ? parsedFootnotes.footnotes : void 0;
|
|
37324
37390
|
remapImportedFootnoteRefsInSections(sections, parsedFootnotes.byDocxId);
|
|
37325
|
-
const endnotesXml = await ((
|
|
37391
|
+
const endnotesXml = await ((_l = zip.file("word/endnotes.xml")) == null ? void 0 : _l.async("string")) ?? null;
|
|
37326
37392
|
const endnotesPartRels = endnotesXml ? await loadPartRelationships(zip, "word/endnotes.xml") : /* @__PURE__ */ new Map();
|
|
37327
37393
|
const parsedEndnotes = await parseEndnotesXml(
|
|
37328
37394
|
endnotesXml,
|
|
@@ -37339,8 +37405,8 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37339
37405
|
remapImportedEndnoteRefsInSections(sections, parsedEndnotes.byDocxId);
|
|
37340
37406
|
const editorBookmarks = extractBookmarksFromSections(sections);
|
|
37341
37407
|
const commentRanges = extractCommentRangesFromSections(sections);
|
|
37342
|
-
const commentsXml = await ((
|
|
37343
|
-
const commentsExtendedXml = await ((
|
|
37408
|
+
const commentsXml = await ((_m = zip.file("word/comments.xml")) == null ? void 0 : _m.async("string")) ?? null;
|
|
37409
|
+
const commentsExtendedXml = await ((_n = zip.file("word/commentsExtended.xml")) == null ? void 0 : _n.async("string")) ?? null;
|
|
37344
37410
|
const commentBodies = parseCommentsXml(commentsXml, commentsExtendedXml);
|
|
37345
37411
|
const editorComments = buildEditorComments(commentRanges, commentBodies);
|
|
37346
37412
|
const shouldPreserveSections = sections.length > 1 || sections.some(
|
|
@@ -37387,6 +37453,9 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37387
37453
|
hyphenationZone: docSettings.hyphenationZone
|
|
37388
37454
|
};
|
|
37389
37455
|
}
|
|
37456
|
+
if (fontTable) {
|
|
37457
|
+
doc2.fontTable = fontTable;
|
|
37458
|
+
}
|
|
37390
37459
|
let result = doc2;
|
|
37391
37460
|
if (editorFootnotes) {
|
|
37392
37461
|
result.footnotes = editorFootnotes;
|
|
@@ -37574,7 +37643,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
37574
37643
|
const worker = new Worker(
|
|
37575
37644
|
new URL(
|
|
37576
37645
|
/* @vite-ignore */
|
|
37577
|
-
"" + new URL("assets/importDocxWorker-
|
|
37646
|
+
"" + new URL("assets/importDocxWorker-thqRCD9m.js", import.meta.url).href,
|
|
37578
37647
|
import.meta.url
|
|
37579
37648
|
),
|
|
37580
37649
|
{
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O, c8, c9, ca, cb, cc, a8, cd, Q, bT, ce, cf, cg, N, ch, bR, ci, cj, ck, cl, cm, c3, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, ad, cz, c2, cA, ca as ca2, cf as cf2, ch as ch2, cq as cq2, cs as cs2, cx as cx2, cB, bV, bQ, cC, cD, cE, bS, cF, cG, bU } from "./index-
|
|
1
|
+
import { O, c8, c9, ca, cb, cc, a8, cd, Q, bT, ce, cf, cg, N, ch, bR, ci, cj, ck, cl, cm, c3, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, ad, cz, c2, cA, ca as ca2, cf as cf2, ch as ch2, cq as cq2, cs as cs2, cx as cx2, cB, bV, bQ, cC, cD, cE, bS, cF, cG, bU } from "./index-DLL7O0m4.js";
|
|
2
2
|
export {
|
|
3
3
|
O as BalloonShell,
|
|
4
4
|
c8 as Button,
|