oasis-editor 0.0.36 → 0.0.38
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-gZEDGfQL.js → OasisEditorApp-Bq6fZsEX.js} +128 -107
- package/dist/assets/{importDocxWorker-xRrspiYv.js → importDocxWorker-CMMv6C-7.js} +1 -1
- package/dist/export/pdf/draw/blockDrawers.d.ts +19 -0
- package/dist/export/pdf/draw/drawFragment.d.ts +2 -1
- package/dist/export/pdf/draw/drawParagraph.d.ts +2 -1
- package/dist/export/pdf/draw/drawTable.d.ts +2 -1
- package/dist/export/pdf/draw/drawTextBoxShape.d.ts +3 -1
- package/dist/import/docx/nestedBlocks.d.ts +8 -0
- package/dist/import/docx/paragraphs.d.ts +3 -2
- package/dist/import/docx/tables.d.ts +2 -1
- package/dist/{index-BrL9FzT-.js → index-lzzJKBU1.js} +284 -234
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EditorDocument, EditorLayoutBlock, EditorLayoutLine, EditorParagraphNode } from '../../../core/model.js';
|
|
2
|
+
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
3
|
+
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The block-level drawing functions a text box's inner content recurses into.
|
|
7
|
+
* Injected into the draw pipeline so `drawTextBoxShape` can render nested
|
|
8
|
+
* paragraphs/tables without importing `drawParagraph`/`drawTable` (which import
|
|
9
|
+
* back through the fragment painter), keeping the recursion acyclic. The
|
|
10
|
+
* concrete object is built by `createBlockDrawers` in `drawBlockList.ts`, the
|
|
11
|
+
* orchestrator that sits above this pipeline.
|
|
12
|
+
*
|
|
13
|
+
* Each function takes the `drawers` bundle as its final argument so deeper
|
|
14
|
+
* nesting (a text box inside a text box) keeps threading the same callbacks.
|
|
15
|
+
*/
|
|
16
|
+
export interface BlockDrawers {
|
|
17
|
+
drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
|
|
18
|
+
drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
|
|
19
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EditorDocument, EditorLayoutFragment, EditorLayoutLine, EditorParagraphNode, EditorTextStyle } from '../../../core/model.js';
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
|
+
import { BlockDrawers } from './blockDrawers.js';
|
|
3
4
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
5
|
|
|
5
6
|
export declare function drawFragmentHighlight(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
|
|
6
7
|
export declare function drawFragmentShading(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>): void;
|
|
7
8
|
export declare function drawFragmentDecoration(writer: OasisPdfWriter, pageIndex: number, line: EditorLayoutLine, fragment: EditorLayoutFragment, originX: number, originY: number, styles: Required<EditorTextStyle>, kind: "underline" | "strike" | "doubleStrike"): void;
|
|
8
|
-
export declare function drawFragmentText(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, fragment: EditorLayoutFragment, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry): Promise<void>;
|
|
9
|
+
export declare function drawFragmentText(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, fragment: EditorLayoutFragment, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, drawers: BlockDrawers): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorDocument, EditorLayoutLine, EditorParagraphNode, EditorParagraphStyle } from '../../../core/model.js';
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
|
+
import { BlockDrawers } from './blockDrawers.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Paints paragraph shading (`w:shd`) and borders (`w:pBdr`) for PDF export,
|
|
@@ -9,4 +10,4 @@ import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
|
9
10
|
* dotted edges use {@link borderDashArray} to match the canvas renderer.
|
|
10
11
|
*/
|
|
11
12
|
export declare function drawParagraphDecorations(writer: OasisPdfWriter, pageIndex: number, paragraphStyle: EditorParagraphStyle, lines: EditorLayoutLine[], originX: number, contentTop: number, contentWidth: number): void;
|
|
12
|
-
export declare function drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string
|
|
13
|
+
export declare function drawParagraph(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EditorDocument, EditorLayoutBlock } from '../../../core/model.js';
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
|
+
import { BlockDrawers } from './blockDrawers.js';
|
|
4
5
|
|
|
5
|
-
export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string
|
|
6
|
+
export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, drawers: BlockDrawers): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorDocument, EditorLayoutLine, EditorPageSettings, EditorTextBoxData } from '../../../core/model.js';
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
|
+
import { BlockDrawers } from './blockDrawers.js';
|
|
4
5
|
|
|
5
6
|
interface TextBoxPaintContext {
|
|
6
7
|
document: EditorDocument;
|
|
@@ -12,7 +13,7 @@ interface TextBoxPaintContext {
|
|
|
12
13
|
* honoring `textBox.rotation` by rotating about the box center — mirroring the
|
|
13
14
|
* canvas `paintTextBox`. Shared by inline and floating text box rendering.
|
|
14
15
|
*/
|
|
15
|
-
export declare function paintTextBox(writer: OasisPdfWriter, textBox: EditorTextBoxData, ctx: TextBoxPaintContext, xPx: number, yPx: number, widthPx: number, heightPx: number): Promise<void>;
|
|
16
|
+
export declare function paintTextBox(writer: OasisPdfWriter, textBox: EditorTextBoxData, ctx: TextBoxPaintContext, xPx: number, yPx: number, widthPx: number, heightPx: number, drawers: BlockDrawers): Promise<void>;
|
|
16
17
|
/**
|
|
17
18
|
* Paints the floating (anchored) text boxes / shapes of a single paragraph,
|
|
18
19
|
* mirroring the canvas `drawFloatingTextBoxesForParagraph`: positions are
|
|
@@ -30,5 +31,6 @@ export declare function drawFloatingTextBoxesForParagraph(options: {
|
|
|
30
31
|
contentTop: number;
|
|
31
32
|
contentWidth: number;
|
|
32
33
|
paragraphTop: number;
|
|
34
|
+
drawers: BlockDrawers;
|
|
33
35
|
}): Promise<void>;
|
|
34
36
|
export {};
|
|
@@ -4,7 +4,15 @@ import { EditorBlockNode } from '../../core/model.js';
|
|
|
4
4
|
import { AssetRegistry } from './assetRegistry.js';
|
|
5
5
|
import { DocxImportTheme } from './theme.js';
|
|
6
6
|
import { NumberingMaps } from './numbering.js';
|
|
7
|
+
import { ParseNestedBlocks } from './runs/types.js';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Build a `ParseNestedBlocks` callback bound to an import context. The paragraph
|
|
11
|
+
* and table parsers receive this so a text-box run can recurse into block-level
|
|
12
|
+
* content without importing this module (which imports them) — keeping the
|
|
13
|
+
* recursion acyclic with `nestedBlocks` as the orchestrator.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createNestedBlockParser(numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme): ParseNestedBlocks;
|
|
8
16
|
/**
|
|
9
17
|
* Parse the block-level content of a `w:txbxContent` (text box body) into the
|
|
10
18
|
* editor block model. Handles `w:p` (paragraphs) and `w:tbl` (tables), mirroring
|
|
@@ -4,10 +4,11 @@ import { EditorDropCap, EditorParagraphNode, EditorParagraphStyle } from '../../
|
|
|
4
4
|
import { AssetRegistry } from './assetRegistry.js';
|
|
5
5
|
import { DocxImportTheme } from './theme.js';
|
|
6
6
|
import { NumberingMaps } from './numbering.js';
|
|
7
|
+
import { ParseNestedBlocks } from './runs/types.js';
|
|
7
8
|
|
|
8
|
-
export declare function parseParagraphNodes(paragraphNode: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, inheritedStyle?: EditorParagraphStyle): Promise<{
|
|
9
|
+
export declare function parseParagraphNodes(paragraphNode: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, parseNestedBlocks: ParseNestedBlocks, inheritedStyle?: EditorParagraphStyle): Promise<{
|
|
9
10
|
paragraphs: EditorParagraphNode[];
|
|
10
11
|
pageBreakAfter: boolean;
|
|
11
12
|
dropCapFrame?: EditorDropCap;
|
|
12
13
|
}>;
|
|
13
|
-
export declare function parseParagraphNode(paragraphNode: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, inheritedStyle?: EditorParagraphStyle): Promise<EditorParagraphNode>;
|
|
14
|
+
export declare function parseParagraphNode(paragraphNode: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, parseNestedBlocks: ParseNestedBlocks, inheritedStyle?: EditorParagraphStyle): Promise<EditorParagraphNode>;
|
|
@@ -4,5 +4,6 @@ import { EditorNamedStyle, EditorTableNode } from '../../core/model.js';
|
|
|
4
4
|
import { AssetRegistry } from './assetRegistry.js';
|
|
5
5
|
import { DocxImportTheme } from './theme.js';
|
|
6
6
|
import { NumberingMaps } from './numbering.js';
|
|
7
|
+
import { ParseNestedBlocks } from './runs/types.js';
|
|
7
8
|
|
|
8
|
-
export declare function parseTableNode(tableNode: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, styles?: Record<string, EditorNamedStyle>): Promise<EditorTableNode>;
|
|
9
|
+
export declare function parseTableNode(tableNode: XmlElement, numberingMaps: NumberingMaps, zip: JSZip, relsMap: Map<string, string>, assets: AssetRegistry, theme: DocxImportTheme, parseNestedBlocks: ParseNestedBlocks, styles?: Record<string, EditorNamedStyle>): Promise<EditorTableNode>;
|