oasis-editor 0.0.100 → 0.0.101
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-CRjXmvyC.js → OasisEditorApp-B421ezvO.js} +270 -31
- package/dist/assets/{importDocxWorker-BulqJDJj.js → importDocxWorker-DkjxuxwM.js} +1 -1
- package/dist/core/editorState.d.ts +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/nodes.d.ts +19 -0
- package/dist/export/docx/text/blocksXml.d.ts +6 -0
- package/dist/export/pdf/OasisPdfWriter.d.ts +8 -1
- package/dist/export/pdf/writer/PdfContentStream.d.ts +19 -2
- package/dist/export/pdf/writer/PdfDocumentSerializer.d.ts +2 -1
- package/dist/export/pdf/writer/PdfShadingTable.d.ts +22 -0
- package/dist/export/pdf/writer/pdfPrimitives.d.ts +1 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +24 -0
- package/dist/import/docx/nestedBlocks.d.ts +14 -0
- package/dist/{index-BuxYvaSC.js → index-BPpHyg6q.js} +100 -26
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EditorAsset, EditorBlockNode, EditorDocument, EditorFootnote, EditorPageSettings, EditorParagraphNode, EditorSection, EditorState, EditorTableCellNode, EditorTableNode, EditorTableRowNode, EditorTextRun, EditorTextStyle, EditorTextBoxData, EditorImageRunData, EditorNamedStyle } from './model.js';
|
|
2
2
|
|
|
3
|
-
export type EditorNodeKind = "document" | "paragraph" | "run" | "table" | "table-row" | "table-cell" | "footnote" | "bookmark" | "comment";
|
|
3
|
+
export type EditorNodeKind = "document" | "paragraph" | "run" | "table" | "table-row" | "table-cell" | "footnote" | "bookmark" | "comment" | "sdt";
|
|
4
4
|
/**
|
|
5
5
|
* Single authority for editor node IDs. Stateless and globally unique, so two
|
|
6
6
|
* editors mounted on the same page never share a sequence. The `kind` prefix is
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type { EditorUnderlineStyle, EditorLigatures, EditorNumberSpacing, EditorNumberForm, EditorTextLanguage, EditorBorderStyle, EditorEmphasisMark, EditorTabStop, EditorParagraphListStyle, EditorImageCrop, EditorImageFillMode, 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';
|
|
10
10
|
export type { EditorTextStyle, EditorParagraphStyle, EditorTableStyle, EditorTableFloatingLayout, EditorTableConditionalFormat, EditorConditionalRowStyle, EditorTableConditionalType, EditorTableConditionalFlags, EditorTableCellStyle, EditorNamedStyle, } from './types/styles.js';
|
|
11
|
-
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
11
|
+
export type { EditorRunBase, EditorTextRun, EditorTextBoxShape, EditorTextBoxBody, EditorTextBoxData, EditorDropCap, EditorSdtBlockWrapper, EditorParagraphNode, EditorTableCellNode, EditorTableRowStyle, EditorTableRowNode, EditorTableNode, EditorBlockNode, } from './types/nodes.js';
|
|
12
12
|
export type { RunKind, RunOfKind, RunVisitor } from './runKind.js';
|
|
13
13
|
export { getRunKind, isInlineObjectRun, visitRun, getRunImage, getRunTextBox, getRunField, getRunFieldChar, getRunFieldInstruction, getRunFootnoteReference, getRunEndnoteReference, getRunSym, } from './runKind.js';
|
|
14
14
|
export type { EditorFootnote } from './types/documentFootnotes.js';
|
|
@@ -144,6 +144,21 @@ export interface EditorDropCap {
|
|
|
144
144
|
/** Cap run style: fontSize (`w:sz`), font, color, baselineShift (`w:position`). */
|
|
145
145
|
style?: EditorTextStyle;
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* A block-level structured document tag (`w:sdt`, a content control) enclosing
|
|
149
|
+
* one or more blocks, preserved for round-trip. Its content is unwrapped into the
|
|
150
|
+
* normal block flow (so it still renders and edits); this carries the wrapper's
|
|
151
|
+
* properties verbatim so export can re-wrap. `groupId` ties together the
|
|
152
|
+
* consecutive blocks that came from the same `w:sdt`; the array on a block lists
|
|
153
|
+
* its enclosing wrappers outermost-first (nested content controls).
|
|
154
|
+
*/
|
|
155
|
+
export interface EditorSdtBlockWrapper {
|
|
156
|
+
groupId: string;
|
|
157
|
+
/** Raw `<w:sdtPr>…</w:sdtPr>` XML, or empty when the tag had no properties. */
|
|
158
|
+
sdtPrXml: string;
|
|
159
|
+
/** Raw `<w:sdtEndPr>…</w:sdtEndPr>` XML, when present. */
|
|
160
|
+
sdtEndPrXml?: string;
|
|
161
|
+
}
|
|
147
162
|
export interface EditorParagraphNode {
|
|
148
163
|
id: string;
|
|
149
164
|
type: "paragraph";
|
|
@@ -152,6 +167,8 @@ export interface EditorParagraphNode {
|
|
|
152
167
|
list?: EditorParagraphListStyle;
|
|
153
168
|
/** Drop cap that body text in this paragraph wraps around, when present. */
|
|
154
169
|
dropCap?: EditorDropCap;
|
|
170
|
+
/** Enclosing block-level `w:sdt` content controls, preserved for round-trip. */
|
|
171
|
+
sdtWrappers?: EditorSdtBlockWrapper[];
|
|
155
172
|
}
|
|
156
173
|
export interface EditorTableCellNode {
|
|
157
174
|
id: string;
|
|
@@ -220,5 +237,7 @@ export interface EditorTableNode {
|
|
|
220
237
|
style?: EditorTableStyle;
|
|
221
238
|
/** Preservation-only `w:tblGridChange` XML. */
|
|
222
239
|
gridRevision?: EditorPropertyRevision<number[]>;
|
|
240
|
+
/** Enclosing block-level `w:sdt` content controls, preserved for round-trip. */
|
|
241
|
+
sdtWrappers?: EditorSdtBlockWrapper[];
|
|
223
242
|
}
|
|
224
243
|
export type EditorBlockNode = EditorParagraphNode | EditorTableNode;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { EditorBlockNode, EditorNamedStyle, EditorParagraphNode, EditorParagraphStyle } from '../../../core/model.js';
|
|
2
2
|
import { DocContext } from '../docxTypes.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Serialize a block run, re-wrapping any block-level `w:sdt` content controls
|
|
6
|
+
* preserved on import. Consecutive blocks sharing an outermost wrapper `groupId`
|
|
7
|
+
* are coalesced back into one `<w:sdt>` envelope; the wrapper is stripped before
|
|
8
|
+
* recursing so nested content controls re-wrap from the inside out.
|
|
9
|
+
*/
|
|
4
10
|
export declare function serializeBlocksXml(blocks: EditorBlockNode[], context: DocContext, styles: Record<string, EditorNamedStyle> | undefined): string;
|
|
5
11
|
export declare function serializeParagraphXml(paragraph: EditorParagraphNode, context: DocContext, styles: Record<string, EditorNamedStyle> | undefined, overrides?: {
|
|
6
12
|
align?: EditorParagraphStyle["align"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
|
|
1
|
+
import { OasisPdfAxialGradient, OasisPdfFontResource, OasisPdfImageOptions, OasisPdfImageResource, OasisPdfLineOptions, OasisPdfPageSize, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './writer/pdfTypes.js';
|
|
2
2
|
|
|
3
3
|
export type { OasisPdfPageSize, OasisPdfPage, OasisPdfRectOptions, OasisPdfLineOptions, OasisPdfPathSegment, OasisPdfPathOptions, OasisPdfTextOptions, OasisPdfImageResource, OasisPdfImageOptions, OasisPdfFontResource, OasisPdfBase14FontResource, OasisPdfUnicodeFontResource, } from './writer/pdfTypes.js';
|
|
4
4
|
export declare class OasisPdfWriter {
|
|
@@ -6,6 +6,7 @@ export declare class OasisPdfWriter {
|
|
|
6
6
|
private readonly streams;
|
|
7
7
|
private readonly fonts;
|
|
8
8
|
private readonly images;
|
|
9
|
+
private readonly shadings;
|
|
9
10
|
constructor(fontResources?: OasisPdfFontResource[]);
|
|
10
11
|
registerFontResource(resource: OasisPdfFontResource): void;
|
|
11
12
|
addPage(size: OasisPdfPageSize): number;
|
|
@@ -18,6 +19,12 @@ export declare class OasisPdfWriter {
|
|
|
18
19
|
rotateAbout(pageIndex: number, centerX: number, centerY: number, degrees: number): void;
|
|
19
20
|
clipRect(pageIndex: number, x: number, y: number, width: number, height: number): void;
|
|
20
21
|
drawText(pageIndex: number, options: OasisPdfTextOptions): void;
|
|
22
|
+
/**
|
|
23
|
+
* Registers an axial (linear) gradient on a page for use as a glyph fill, and
|
|
24
|
+
* returns its shading resource name to pass as `gradientShadingName` on a
|
|
25
|
+
* subsequent `drawText`. Coordinates are in the writer's top-left point space.
|
|
26
|
+
*/
|
|
27
|
+
registerAxialGradient(pageIndex: number, gradient: OasisPdfAxialGradient): string | null;
|
|
21
28
|
registerImageResource(resource: Omit<OasisPdfImageResource, "resourceName"> & {
|
|
22
29
|
resourceName?: string;
|
|
23
30
|
}): string;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { OasisPdfImageOptions, OasisPdfLineOptions, OasisPdfPage, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './pdfTypes.js';
|
|
1
|
+
import { OasisPdfAxialGradient, OasisPdfImageOptions, OasisPdfLineOptions, OasisPdfPage, OasisPdfPathOptions, OasisPdfRectOptions, OasisPdfTextOptions } from './pdfTypes.js';
|
|
2
2
|
import { PdfFontTable } from './PdfFontTable.js';
|
|
3
3
|
import { PdfImageTable } from './PdfImageTable.js';
|
|
4
|
+
import { PdfShadingTable } from './PdfShadingTable.js';
|
|
4
5
|
|
|
5
6
|
export declare class PdfContentStream {
|
|
6
7
|
readonly page: OasisPdfPage;
|
|
7
8
|
private readonly fonts;
|
|
8
9
|
private readonly images;
|
|
9
|
-
|
|
10
|
+
private readonly shadings;
|
|
11
|
+
constructor(page: OasisPdfPage, fonts: PdfFontTable, images: PdfImageTable, shadings: PdfShadingTable);
|
|
12
|
+
/**
|
|
13
|
+
* Registers an axial gradient for use as a glyph fill on this page. Coordinates
|
|
14
|
+
* come in the writer's top-left point space and are flipped to PDF bottom-left
|
|
15
|
+
* space here; the returned name is referenced via `OasisPdfTextOptions`.
|
|
16
|
+
*/
|
|
17
|
+
registerAxialGradient(gradient: OasisPdfAxialGradient): string;
|
|
10
18
|
drawRect(options: OasisPdfRectOptions): void;
|
|
11
19
|
drawLine(options: OasisPdfLineOptions): void;
|
|
12
20
|
drawPath(options: OasisPdfPathOptions): void;
|
|
@@ -15,6 +23,15 @@ export declare class PdfContentStream {
|
|
|
15
23
|
rotateAbout(centerX: number, centerY: number, degrees: number): void;
|
|
16
24
|
clipRect(x: number, y: number, width: number, height: number): void;
|
|
17
25
|
drawText(options: OasisPdfTextOptions): void;
|
|
26
|
+
private textSetupCommands;
|
|
18
27
|
private emitTextBlock;
|
|
28
|
+
/**
|
|
29
|
+
* Fills glyphs with an axial gradient: the text is drawn in clip render mode
|
|
30
|
+
* (`7 Tr`) so the glyph outlines become the clip path, then the shading is
|
|
31
|
+
* painted through them with `sh`. The whole sequence is isolated in a
|
|
32
|
+
* `q … Q` pair so the clip does not leak. Outline/stroke is not combined with
|
|
33
|
+
* gradient fill (the gradient supersedes it).
|
|
34
|
+
*/
|
|
35
|
+
private emitGradientTextBlock;
|
|
19
36
|
drawImage(options: OasisPdfImageOptions): void;
|
|
20
37
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OasisPdfPage } from './pdfTypes.js';
|
|
2
2
|
import { PdfFontTable } from './PdfFontTable.js';
|
|
3
3
|
import { PdfImageTable } from './PdfImageTable.js';
|
|
4
|
+
import { PdfShadingTable } from './PdfShadingTable.js';
|
|
4
5
|
|
|
5
|
-
export declare function serializePdfDocument(pages: OasisPdfPage[], fonts: PdfFontTable, images: PdfImageTable): Uint8Array;
|
|
6
|
+
export declare function serializePdfDocument(pages: OasisPdfPage[], fonts: PdfFontTable, images: PdfImageTable, shadings: PdfShadingTable): Uint8Array;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AddPdfObject } from './pdfTypes.js';
|
|
2
|
+
|
|
3
|
+
/** A gradient already resolved to PDF bottom-left-origin point coordinates. */
|
|
4
|
+
export interface PdfAxialShadingSpec {
|
|
5
|
+
x0: number;
|
|
6
|
+
y0: number;
|
|
7
|
+
x1: number;
|
|
8
|
+
y1: number;
|
|
9
|
+
/** Stops sorted by offset, each `{ offset: 0–1, color: hex }`. */
|
|
10
|
+
stops: Array<{
|
|
11
|
+
offset: number;
|
|
12
|
+
color: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare class PdfShadingTable {
|
|
16
|
+
private readonly shadings;
|
|
17
|
+
/** Registers a gradient (PDF space) and returns its `/Shading` resource name. */
|
|
18
|
+
register(spec: PdfAxialShadingSpec): string;
|
|
19
|
+
/** Emits each gradient's Function + Shading objects, keyed by resource name. */
|
|
20
|
+
buildShadingObjects(addObject: AddPdfObject): Map<string, number>;
|
|
21
|
+
private addShadingObject;
|
|
22
|
+
}
|
|
@@ -6,6 +6,7 @@ export declare function formatNumber(value: number): string;
|
|
|
6
6
|
export declare function byteLength(value: string): number;
|
|
7
7
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
8
8
|
export declare function toHex16(value: number): string;
|
|
9
|
+
export declare function colorToRgb(color: string | undefined, fallback: [number, number, number]): [number, number, number];
|
|
9
10
|
export declare function colorCommand(color: string | undefined, operator: "rg" | "RG", fallback: [number, number, number]): string;
|
|
10
11
|
export declare function resolveFontName(options: Pick<OasisPdfTextOptions, "bold" | "italic" | "fontResourceName">): string;
|
|
11
12
|
export declare function fontResourceObjectBody(resource: OasisPdfFontResource): string;
|
|
@@ -12,6 +12,24 @@ export interface OasisPdfPage {
|
|
|
12
12
|
height: number;
|
|
13
13
|
commands: string[];
|
|
14
14
|
imageResourceNames: Set<string>;
|
|
15
|
+
shadingResourceNames: Set<string>;
|
|
16
|
+
}
|
|
17
|
+
/** One color stop of an axial gradient. `offset` is 0–1; `color` is a hex string. */
|
|
18
|
+
export interface OasisPdfGradientStop {
|
|
19
|
+
offset: number;
|
|
20
|
+
color: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An axial (linear) gradient fill, in the writer's top-left-origin point space.
|
|
24
|
+
* `(x0,y0)→(x1,y1)` is the gradient axis; the content stream flips y to PDF space
|
|
25
|
+
* and the shading extends its end colors beyond the axis.
|
|
26
|
+
*/
|
|
27
|
+
export interface OasisPdfAxialGradient {
|
|
28
|
+
x0: number;
|
|
29
|
+
y0: number;
|
|
30
|
+
x1: number;
|
|
31
|
+
y1: number;
|
|
32
|
+
stops: OasisPdfGradientStop[];
|
|
15
33
|
}
|
|
16
34
|
export interface OasisPdfRectOptions {
|
|
17
35
|
x: number;
|
|
@@ -78,6 +96,12 @@ export interface OasisPdfTextOptions {
|
|
|
78
96
|
* Unicode font (e.g. `["liga", "onum", "ss01"]`). Ignored by base-14 fonts.
|
|
79
97
|
*/
|
|
80
98
|
fontFeatures?: readonly string[];
|
|
99
|
+
/**
|
|
100
|
+
* Resource name of an axial-gradient shading (from `registerAxialGradient`).
|
|
101
|
+
* When set, the glyphs are used as a clip path and the gradient is painted
|
|
102
|
+
* through them (`w14:textFill` gradient), so `color`/`renderMode` are ignored.
|
|
103
|
+
*/
|
|
104
|
+
gradientShadingName?: string;
|
|
81
105
|
}
|
|
82
106
|
export interface OasisPdfImageResource {
|
|
83
107
|
resourceName: string;
|
|
@@ -6,6 +6,20 @@ import { DocxImportTheme } from './theme.js';
|
|
|
6
6
|
import { NumberingMaps } from './numbering.js';
|
|
7
7
|
import { ParseNestedBlocks } from './runs/types.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Parse a single block-level child element (`w:p`, `w:tbl`, or a `w:sdt` content
|
|
11
|
+
* control) into editor blocks. Unknown elements yield no blocks. Shared by the
|
|
12
|
+
* text-box body walker, the document-body walker, and nested `w:sdtContent`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseBlockLevelChild(element: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, parseNestedBlocks: ParseNestedBlocks): Promise<EditorBlockNode[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Parse a block-level structured document tag (`w:sdt`) into its content blocks,
|
|
17
|
+
* preserving the `w:sdtPr`/`w:sdtEndPr` wrapper on each produced block so export
|
|
18
|
+
* can re-wrap it (see {@link EditorSdtBlockWrapper}). The content is unwrapped so
|
|
19
|
+
* it renders and edits like any other block; nested `w:sdt` recurses, prepending
|
|
20
|
+
* outer wrappers ahead of inner ones.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseSdtBlockNode(sdtElement: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, parseNestedBlocks: ParseNestedBlocks): Promise<EditorBlockNode[]>;
|
|
9
23
|
/**
|
|
10
24
|
* Build a `ParseNestedBlocks` callback bound to an import context. The paragraph
|
|
11
25
|
* and table parsers receive this so a text-box run can recurse into block-level
|
|
@@ -2519,7 +2519,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2519
2519
|
onCleanup(() => {
|
|
2520
2520
|
cancelled = true;
|
|
2521
2521
|
});
|
|
2522
|
-
import("./OasisEditorApp-
|
|
2522
|
+
import("./OasisEditorApp-B421ezvO.js").then((m) => {
|
|
2523
2523
|
cancelled = true;
|
|
2524
2524
|
setProgress(1);
|
|
2525
2525
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -36504,6 +36504,86 @@ async function parseTableNode(tableNode, numberingMaps, zip, relsMap, assets, th
|
|
|
36504
36504
|
}
|
|
36505
36505
|
return table;
|
|
36506
36506
|
}
|
|
36507
|
+
async function parseBlockLevelChild(element, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks) {
|
|
36508
|
+
if (element.namespaceURI !== WORD_NS) {
|
|
36509
|
+
return [];
|
|
36510
|
+
}
|
|
36511
|
+
if (element.localName === "p") {
|
|
36512
|
+
const parsed = await parseParagraphNodes(
|
|
36513
|
+
element,
|
|
36514
|
+
numberingMaps,
|
|
36515
|
+
zip,
|
|
36516
|
+
relsMap,
|
|
36517
|
+
assets,
|
|
36518
|
+
theme,
|
|
36519
|
+
parseNestedBlocks
|
|
36520
|
+
);
|
|
36521
|
+
return parsed.paragraphs;
|
|
36522
|
+
}
|
|
36523
|
+
if (element.localName === "tbl") {
|
|
36524
|
+
return [
|
|
36525
|
+
await parseTableNode(
|
|
36526
|
+
element,
|
|
36527
|
+
numberingMaps,
|
|
36528
|
+
zip,
|
|
36529
|
+
relsMap,
|
|
36530
|
+
assets,
|
|
36531
|
+
theme,
|
|
36532
|
+
parseNestedBlocks
|
|
36533
|
+
)
|
|
36534
|
+
];
|
|
36535
|
+
}
|
|
36536
|
+
if (element.localName === "sdt") {
|
|
36537
|
+
return parseSdtBlockNode(
|
|
36538
|
+
element,
|
|
36539
|
+
numberingMaps,
|
|
36540
|
+
zip,
|
|
36541
|
+
relsMap,
|
|
36542
|
+
assets,
|
|
36543
|
+
theme,
|
|
36544
|
+
parseNestedBlocks
|
|
36545
|
+
);
|
|
36546
|
+
}
|
|
36547
|
+
return [];
|
|
36548
|
+
}
|
|
36549
|
+
async function parseSdtBlockNode(sdtElement, numberingMaps, zip, relsMap, assets, theme, parseNestedBlocks) {
|
|
36550
|
+
const sdtPr = getFirstChildByTagNameNS(sdtElement, WORD_NS, "sdtPr");
|
|
36551
|
+
const sdtEndPr = getFirstChildByTagNameNS(sdtElement, WORD_NS, "sdtEndPr");
|
|
36552
|
+
const wrapper = {
|
|
36553
|
+
groupId: createEditorNodeId("sdt"),
|
|
36554
|
+
sdtPrXml: sdtPr ? new XMLSerializer().serializeToString(sdtPr) : "",
|
|
36555
|
+
...sdtEndPr ? { sdtEndPrXml: new XMLSerializer().serializeToString(sdtEndPr) } : {}
|
|
36556
|
+
};
|
|
36557
|
+
const sdtContent = getFirstChildByTagNameNS(
|
|
36558
|
+
sdtElement,
|
|
36559
|
+
WORD_NS,
|
|
36560
|
+
"sdtContent"
|
|
36561
|
+
);
|
|
36562
|
+
const blocks = [];
|
|
36563
|
+
if (sdtContent) {
|
|
36564
|
+
for (let index = 0; index < sdtContent.childNodes.length; index += 1) {
|
|
36565
|
+
const node = sdtContent.childNodes[index];
|
|
36566
|
+
if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
|
|
36567
|
+
continue;
|
|
36568
|
+
}
|
|
36569
|
+
blocks.push(
|
|
36570
|
+
...await parseBlockLevelChild(
|
|
36571
|
+
node,
|
|
36572
|
+
numberingMaps,
|
|
36573
|
+
zip,
|
|
36574
|
+
relsMap,
|
|
36575
|
+
assets,
|
|
36576
|
+
theme,
|
|
36577
|
+
parseNestedBlocks
|
|
36578
|
+
)
|
|
36579
|
+
);
|
|
36580
|
+
}
|
|
36581
|
+
}
|
|
36582
|
+
for (const block of blocks) {
|
|
36583
|
+
block.sdtWrappers = [wrapper, ...block.sdtWrappers ?? []];
|
|
36584
|
+
}
|
|
36585
|
+
return blocks;
|
|
36586
|
+
}
|
|
36507
36587
|
function createNestedBlockParser(numberingMaps, zip, relsMap, assets, theme) {
|
|
36508
36588
|
return (container) => parseTxbxContentBlocks(
|
|
36509
36589
|
container,
|
|
@@ -36528,36 +36608,17 @@ async function parseTxbxContentBlocks(container, numberingMaps, zip, relsMap, as
|
|
|
36528
36608
|
if ((node == null ? void 0 : node.nodeType) !== node.ELEMENT_NODE) {
|
|
36529
36609
|
continue;
|
|
36530
36610
|
}
|
|
36531
|
-
|
|
36532
|
-
|
|
36533
|
-
|
|
36534
|
-
}
|
|
36535
|
-
if (element.localName === "p") {
|
|
36536
|
-
const parsed = await parseParagraphNodes(
|
|
36537
|
-
element,
|
|
36611
|
+
blocks.push(
|
|
36612
|
+
...await parseBlockLevelChild(
|
|
36613
|
+
node,
|
|
36538
36614
|
numberingMaps,
|
|
36539
36615
|
zip,
|
|
36540
36616
|
relsMap,
|
|
36541
36617
|
assets,
|
|
36542
36618
|
theme,
|
|
36543
36619
|
parseNestedBlocks
|
|
36544
|
-
)
|
|
36545
|
-
|
|
36546
|
-
blocks.push(paragraph);
|
|
36547
|
-
}
|
|
36548
|
-
} else if (element.localName === "tbl") {
|
|
36549
|
-
blocks.push(
|
|
36550
|
-
await parseTableNode(
|
|
36551
|
-
element,
|
|
36552
|
-
numberingMaps,
|
|
36553
|
-
zip,
|
|
36554
|
-
relsMap,
|
|
36555
|
-
assets,
|
|
36556
|
-
theme,
|
|
36557
|
-
parseNestedBlocks
|
|
36558
|
-
)
|
|
36559
|
-
);
|
|
36560
|
-
}
|
|
36620
|
+
)
|
|
36621
|
+
);
|
|
36561
36622
|
}
|
|
36562
36623
|
return blocks;
|
|
36563
36624
|
}
|
|
@@ -37117,6 +37178,19 @@ async function importDocxToEditorDocument(buffer, options = {}) {
|
|
|
37117
37178
|
)
|
|
37118
37179
|
);
|
|
37119
37180
|
reportBodyProgress();
|
|
37181
|
+
} else if (element.localName === "sdt") {
|
|
37182
|
+
for (const block of await parseSdtBlockNode(
|
|
37183
|
+
element,
|
|
37184
|
+
numberingMaps,
|
|
37185
|
+
zip,
|
|
37186
|
+
relsMap,
|
|
37187
|
+
assets,
|
|
37188
|
+
theme,
|
|
37189
|
+
parseNestedBlocks
|
|
37190
|
+
)) {
|
|
37191
|
+
appendBodyBlock(block);
|
|
37192
|
+
}
|
|
37193
|
+
reportBodyProgress();
|
|
37120
37194
|
}
|
|
37121
37195
|
await yieldToEventLoop(50, completedBodyWorkItems);
|
|
37122
37196
|
}
|
|
@@ -37500,7 +37574,7 @@ function importDocxInWorker(buffer, options = {}) {
|
|
|
37500
37574
|
const worker = new Worker(
|
|
37501
37575
|
new URL(
|
|
37502
37576
|
/* @vite-ignore */
|
|
37503
|
-
"" + new URL("assets/importDocxWorker-
|
|
37577
|
+
"" + new URL("assets/importDocxWorker-DkjxuxwM.js", import.meta.url).href,
|
|
37504
37578
|
import.meta.url
|
|
37505
37579
|
),
|
|
37506
37580
|
{
|
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-BPpHyg6q.js";
|
|
2
2
|
export {
|
|
3
3
|
O as BalloonShell,
|
|
4
4
|
c8 as Button,
|