oasis-editor 0.0.102 → 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-DDtlPHus.js → OasisEditorApp-CLzJ9zyp.js} +1 -1
- package/dist/assets/{importDocxWorker-GkXQ7kFj.js → importDocxWorker-thqRCD9m.js} +1 -1
- 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-CNtAFUVS.js → index-DLL7O0m4.js} +27 -18
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -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")
|
|
@@ -36307,7 +36316,7 @@ async function parseParagraphNodes(paragraphNode, numberingMaps, zip, relsMap, a
|
|
|
36307
36316
|
parseNestedBlocks
|
|
36308
36317
|
);
|
|
36309
36318
|
const parsedStyle = withDocxImplicitSingleLineHeight(
|
|
36310
|
-
parseParagraphStyle$1(paragraphProperties)
|
|
36319
|
+
parseParagraphStyle$1(paragraphProperties, theme.colors)
|
|
36311
36320
|
);
|
|
36312
36321
|
const markRunStyle = parseRunStyle(
|
|
36313
36322
|
getFirstChildByTagNameNS(paragraphProperties, WORD_NS, "rPr"),
|
|
@@ -36464,7 +36473,7 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
36464
36473
|
continue;
|
|
36465
36474
|
}
|
|
36466
36475
|
const vMerge = getTableCellVMerge(cellProperties);
|
|
36467
|
-
const cellStyle = parseTableCellStyle(cellProperties);
|
|
36476
|
+
const cellStyle = parseTableCellStyle(cellProperties, void 0, theme.colors);
|
|
36468
36477
|
const cell = createEditorTableCell(
|
|
36469
36478
|
paragraphs.length > 0 ? paragraphs : [createEditorParagraphFromRuns([{ text: "" }])],
|
|
36470
36479
|
colSpan,
|
|
@@ -37634,7 +37643,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
37634
37643
|
const worker = new Worker(
|
|
37635
37644
|
new URL(
|
|
37636
37645
|
/* @vite-ignore */
|
|
37637
|
-
"" + new URL("assets/importDocxWorker-
|
|
37646
|
+
"" + new URL("assets/importDocxWorker-thqRCD9m.js", import.meta.url).href,
|
|
37638
37647
|
import.meta.url
|
|
37639
37648
|
),
|
|
37640
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,
|