oasis-editor 0.0.29 → 0.0.31
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-D0fgzHt5.js → OasisEditorApp-CeDQ_a8-.js} +54 -132
- package/dist/assets/{importDocxWorker-DcrboJNQ.js → importDocxWorker-C8ErVbAl.js} +1 -1
- package/dist/core/model/index.d.ts +1 -0
- package/dist/core/model/listNumbering.d.ts +5 -0
- package/dist/core/model/types/primitives.d.ts +10 -0
- package/dist/export/docx/docxTypes.d.ts +10 -3
- package/dist/export/pdf/draw/drawBlockList.d.ts +1 -1
- package/dist/export/pdf/draw/drawParagraph.d.ts +1 -1
- package/dist/export/pdf/draw/drawTable.d.ts +1 -1
- package/dist/export/pdf/draw/lists.d.ts +2 -2
- package/dist/import/docx/numbering.d.ts +19 -28
- package/dist/{index-CMOt03WH.js → index-BYqaCJUC.js} +481 -415
- package/dist/oasis-editor.js +54 -54
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/canvas/listNumbering.d.ts +2 -1
- package/dist/ui/textMeasurement/indentation.d.ts +2 -0
- package/package.json +1 -1
|
@@ -29,4 +29,5 @@ export { getDocumentSections, getDocumentSectionsCanonical, } from './documentSe
|
|
|
29
29
|
export { DocumentIndexBuilder, getDocumentParagraphIndex, getDocumentParagraphs, getDocumentParagraphsCanonical, getParagraphById, findParagraphLocation, findParagraphTableLocation, WeakMapDocumentIndexCache, } from './documentIndex.js';
|
|
30
30
|
export type { EditorParagraphLocation, TableLocation, DocumentParagraphIndexEntry, DocumentIndexCache, } from './documentIndex.js';
|
|
31
31
|
export { getBlockParagraphs, collectSectionParagraphs, } from './paragraphWalker.js';
|
|
32
|
+
export { buildListLabels, resolveListLabel } from './listNumbering.js';
|
|
32
33
|
export { getActiveSectionIndex, getActiveZone, getEditableBlocksForZone, tryGetEditableBlocksForZone, getActiveSectionBlocks, getParagraphs, } from './editingZones.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EditorDocument } from './types/document.js';
|
|
2
|
+
import { EditorParagraphNode } from './types/nodes.js';
|
|
3
|
+
|
|
4
|
+
export declare function buildListLabels(document: EditorDocument): Map<string, string>;
|
|
5
|
+
export declare function resolveListLabel(paragraph: EditorParagraphNode, labels: Map<string, string>): string;
|
|
@@ -26,8 +26,18 @@ export interface EditorTabStop {
|
|
|
26
26
|
export interface EditorParagraphListStyle {
|
|
27
27
|
kind: "bullet" | "ordered";
|
|
28
28
|
level?: number;
|
|
29
|
+
/** Imported OOXML `w:numId`; paragraphs sharing it use the same counters. */
|
|
30
|
+
instanceId?: string;
|
|
29
31
|
format?: "decimal" | "lowerLetter" | "upperLetter" | "lowerRoman" | "upperRoman" | "bullet";
|
|
30
32
|
startAt?: number;
|
|
33
|
+
/** Effective `w:lvlText` pattern, for example `%1.%2.`. */
|
|
34
|
+
levelText?: string;
|
|
35
|
+
/** Effective formats for referenced levels in a multilevel label. */
|
|
36
|
+
levelFormats?: Array<"decimal" | "lowerLetter" | "upperLetter" | "lowerRoman" | "upperRoman" | "bullet">;
|
|
37
|
+
/** `w:lvlJc`: alignment of the label inside its hanging-indent area. */
|
|
38
|
+
alignment?: "left" | "center" | "right";
|
|
39
|
+
/** `w:isLgl`: render referenced ordered levels with decimal digits. */
|
|
40
|
+
legal?: boolean;
|
|
31
41
|
/**
|
|
32
42
|
* Separator between the list label and the paragraph text (`w:lvl/w:suff`).
|
|
33
43
|
* OOXML default is "tab"; Word renders the label, then advances to the next
|
|
@@ -2,16 +2,23 @@ import { EditorBlockNode, EditorImageCrop, EditorImageFillMode, EditorImageFloat
|
|
|
2
2
|
import { BookmarkEventsByParagraph } from './bookmarksXml.js';
|
|
3
3
|
import { CommentEventsByParagraph } from './commentsXml.js';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface NumberingLevelDefinition {
|
|
6
6
|
kind: EditorParagraphListStyle["kind"];
|
|
7
7
|
level: number;
|
|
8
|
-
abstractNumId: number;
|
|
9
|
-
numId: number;
|
|
10
8
|
format?: NonNullable<EditorParagraphListStyle["format"]>;
|
|
11
9
|
startAt?: number;
|
|
10
|
+
levelText?: string;
|
|
11
|
+
suffix?: EditorParagraphListStyle["suffix"];
|
|
12
|
+
alignment?: EditorParagraphListStyle["alignment"];
|
|
13
|
+
legal?: boolean;
|
|
12
14
|
bulletGlyph?: string;
|
|
13
15
|
bulletFont?: string;
|
|
14
16
|
}
|
|
17
|
+
export interface NumberingDefinition {
|
|
18
|
+
abstractNumId: number;
|
|
19
|
+
numId: number;
|
|
20
|
+
levels: NumberingLevelDefinition[];
|
|
21
|
+
}
|
|
15
22
|
export interface DocContext {
|
|
16
23
|
numberingInfo: Map<string, {
|
|
17
24
|
numId: number;
|
|
@@ -2,4 +2,4 @@ import { EditorDocument, EditorLayoutBlock, EditorPageSettings } from '../../../
|
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
4
|
|
|
5
|
-
export declare function drawBlockList(writer: OasisPdfWriter, pageIndex: number, blocks: EditorLayoutBlock[] | undefined, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string,
|
|
5
|
+
export declare function drawBlockList(writer: OasisPdfWriter, pageIndex: number, blocks: EditorLayoutBlock[] | undefined, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>, pageSettings?: EditorPageSettings): Promise<void>;
|
|
@@ -9,4 +9,4 @@ import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
|
9
9
|
* dotted edges use {@link borderDashArray} to match the canvas renderer.
|
|
10
10
|
*/
|
|
11
11
|
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,
|
|
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>): Promise<void>;
|
|
@@ -2,4 +2,4 @@ import { EditorDocument, EditorLayoutBlock } from '../../../core/model.js';
|
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
4
|
|
|
5
|
-
export declare function drawTableBlock(writer: OasisPdfWriter, pageIndex: number, block: EditorLayoutBlock, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string,
|
|
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>): Promise<void>;
|
|
@@ -2,5 +2,5 @@ import { EditorDocument, EditorLayoutLine, EditorParagraphNode } from '../../../
|
|
|
2
2
|
import { PdfFontRegistry } from '../fonts/PdfFontRegistry.js';
|
|
3
3
|
import { OasisPdfWriter } from '../OasisPdfWriter.js';
|
|
4
4
|
|
|
5
|
-
export declare function getListOrdinals(document: EditorDocument): Map<string,
|
|
6
|
-
export declare function drawListPrefix(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string,
|
|
5
|
+
export declare function getListOrdinals(document: EditorDocument): Map<string, string>;
|
|
6
|
+
export declare function drawListPrefix(writer: OasisPdfWriter, pageIndex: number, paragraph: EditorParagraphNode, line: EditorLayoutLine, document: EditorDocument, originX: number, originY: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, string>): void;
|
|
@@ -1,41 +1,32 @@
|
|
|
1
1
|
import { Element as XmlElement } from '@xmldom/xmldom';
|
|
2
2
|
import { EditorParagraphListStyle } from '../../core/model.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
type ListFormat = NonNullable<EditorParagraphListStyle["format"]>;
|
|
5
|
+
interface NumberingLevel {
|
|
6
|
+
kind?: EditorParagraphListStyle["kind"];
|
|
7
|
+
format?: ListFormat;
|
|
8
|
+
suffix?: EditorParagraphListStyle["suffix"];
|
|
9
|
+
startAt?: number;
|
|
10
|
+
levelText?: string;
|
|
11
|
+
alignment?: EditorParagraphListStyle["alignment"];
|
|
12
|
+
legal?: boolean;
|
|
13
|
+
bulletGlyph?: string;
|
|
14
|
+
bulletFont?: string;
|
|
15
|
+
indent?: {
|
|
9
16
|
left?: number;
|
|
10
17
|
hanging?: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** Starting number from `w:start`, keyed by "abstractNumId:ilvl". OOXML default is 1. */
|
|
17
|
-
abstractStarts: Map<string, number>;
|
|
18
|
-
/** Literal bullet glyph from `w:lvlText`, keyed by "abstractNumId:ilvl". */
|
|
19
|
-
abstractBulletGlyphs: Map<string, string>;
|
|
20
|
-
/** Font name from `w:lvl/w:rPr/w:rFonts`, keyed by "abstractNumId:ilvl". */
|
|
21
|
-
abstractBulletFonts: Map<string, string>;
|
|
22
|
-
/** `w:startOverride` values from `w:num/w:lvlOverride`, keyed by "numId:ilvl". */
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface NumberingMaps {
|
|
21
|
+
abstractLevels: Map<string, NumberingLevel>;
|
|
22
|
+
numOverrideLevels: Map<string, NumberingLevel>;
|
|
23
23
|
numStartOverrides: Map<string, number>;
|
|
24
|
-
/** numId → abstractNumId */
|
|
25
24
|
numToAbstractId: Map<string, string>;
|
|
26
|
-
/**
|
|
27
|
-
* Tracks which "numId:ilvl" pairs have been seen during paragraph parsing.
|
|
28
|
-
* The first paragraph for each pair carries the level's `startAt` value;
|
|
29
|
-
* subsequent paragraphs in the same list instance do not, so the counter
|
|
30
|
-
* continues from the previous ordinal instead of resetting.
|
|
31
|
-
*/
|
|
32
25
|
seenInstances: Set<string>;
|
|
33
26
|
}
|
|
34
27
|
export declare function parseNumbering(numberingXml: string | null): NumberingMaps;
|
|
35
28
|
export declare function parseParagraphList(paragraphProperties: XmlElement | null, numberingMaps: NumberingMaps): {
|
|
36
29
|
list: EditorParagraphListStyle;
|
|
37
|
-
indent?:
|
|
38
|
-
left?: number;
|
|
39
|
-
hanging?: number;
|
|
40
|
-
};
|
|
30
|
+
indent?: NumberingLevel["indent"];
|
|
41
31
|
} | undefined;
|
|
32
|
+
export {};
|