@a3s-lab/office 0.46.0 → 0.47.0
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/README.md +11 -0
- package/dist/0~2133.js +748 -748
- package/dist/0~document-editor.js +3877 -3847
- package/dist/0~work-docx-export.js +2 -2
- package/dist/0~work-docx-import.js +41 -5
- package/dist/0~work-office-diagnostics.js +21 -6
- package/dist/4174.js +1817 -1565
- package/dist/internal/features/work/work-document-field-node.d.ts +2 -2
- package/dist/internal/features/work/work-document-fields.d.ts +36 -2
- package/dist/internal/features/work/work-docx-bookmark-import.d.ts +1 -1
- package/dist/internal/features/work/work-docx-field-import.d.ts +5 -1
- package/dist/internal/features/work/work-docx-import.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
|
-
import { type WorkDocumentFieldKind, type WorkDocumentFieldRefreshOptions } from './work-document-fields';
|
|
2
|
+
import { type WorkDocumentFieldInsertOptions, type WorkDocumentFieldKind, type WorkDocumentFieldRefreshOptions } from './work-document-fields';
|
|
3
3
|
import type { WorkDocumentContent } from './work-types';
|
|
4
4
|
declare module '@tiptap/core' {
|
|
5
5
|
interface Commands<ReturnType> {
|
|
6
6
|
documentField: {
|
|
7
|
-
insertDocumentField: (kind: WorkDocumentFieldKind) => ReturnType;
|
|
7
|
+
insertDocumentField: (kind: WorkDocumentFieldKind, options?: WorkDocumentFieldInsertOptions) => ReturnType;
|
|
8
8
|
refreshDocumentFields: (content: WorkDocumentContent, options?: WorkDocumentFieldRefreshOptions) => ReturnType;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
export type WorkDocumentFieldKind = 'page' | 'numPages' | 'section' | 'sectionPages' | 'date' | 'time';
|
|
1
|
+
export type WorkDocumentFieldKind = 'page' | 'numPages' | 'section' | 'sectionPages' | 'date' | 'time' | 'wordCount' | 'characterCount' | 'pageReference';
|
|
2
2
|
export interface WorkDocumentFieldContext {
|
|
3
3
|
pageNumber: number;
|
|
4
4
|
totalPages: number;
|
|
5
5
|
sectionNumber: number;
|
|
6
6
|
sectionPages: number;
|
|
7
|
+
/** Number of visible body words, excluding generated field results. */
|
|
8
|
+
wordCount?: number;
|
|
9
|
+
/** Number of visible body characters, including spaces. */
|
|
10
|
+
characterCount?: number;
|
|
11
|
+
/** Page number resolved for a PAGEREF target, when the target is present. */
|
|
12
|
+
referencePageNumber?: number | null;
|
|
13
|
+
/** Page numbers keyed by `id:<bookmark-id>` or `name:<bookmark-name>`. */
|
|
14
|
+
bookmarkPageNumbers?: ReadonlyMap<string, number>;
|
|
7
15
|
now?: Date;
|
|
8
16
|
}
|
|
9
17
|
export type WorkDocumentFieldContextResolver = (position: number) => WorkDocumentFieldContext | null;
|
|
@@ -13,10 +21,36 @@ export interface WorkDocumentFieldRefreshOptions {
|
|
|
13
21
|
addToHistory?: boolean;
|
|
14
22
|
updateClock?: boolean;
|
|
15
23
|
}
|
|
24
|
+
export interface WorkDocumentFieldInsertOptions {
|
|
25
|
+
/** Bookmark identity used to keep a page reference stable across renames. */
|
|
26
|
+
targetId?: string;
|
|
27
|
+
/** Bookmark name emitted in the native PAGEREF instruction. */
|
|
28
|
+
targetName?: string;
|
|
29
|
+
}
|
|
16
30
|
export declare function documentFieldKind(value: string | undefined): WorkDocumentFieldKind | null;
|
|
17
31
|
export declare function docxDocumentFieldKind(instruction: string): WorkDocumentFieldKind | null;
|
|
18
|
-
export declare function documentFieldInstruction(kind: WorkDocumentFieldKind): string;
|
|
32
|
+
export declare function documentFieldInstruction(kind: WorkDocumentFieldKind, options?: WorkDocumentFieldInsertOptions): string;
|
|
33
|
+
/** Builds a stable PAGEREF instruction while retaining the supported switches. */
|
|
34
|
+
export declare function documentPageReferenceInstruction(targetName: unknown, source?: string, defaultHyperlink?: boolean): string;
|
|
19
35
|
export declare function documentFieldLabel(kind: WorkDocumentFieldKind): string;
|
|
20
36
|
export declare function documentFieldDisplay(kind: WorkDocumentFieldKind, context: WorkDocumentFieldContext, instruction?: string, cachedValue?: string): string;
|
|
21
37
|
export declare function normalizeDocumentFieldsHtml(source: string): string;
|
|
22
38
|
export declare function resolveDocumentFieldsHtml(source: string, context: WorkDocumentFieldContext): string;
|
|
39
|
+
/** Returns the bookmark name used by a bounded PAGEREF instruction. */
|
|
40
|
+
export declare function docxDocumentFieldTarget(instruction: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* The editor intentionally accepts only switches whose result can be
|
|
43
|
+
* represented by one deterministic inline atom. Unknown switches remain
|
|
44
|
+
* cached text instead of being presented as an editable field with altered
|
|
45
|
+
* semantics.
|
|
46
|
+
*/
|
|
47
|
+
export declare function supportedDocxDocumentFieldInstruction(instruction: string): boolean;
|
|
48
|
+
export declare function documentFieldStatisticsFromText(source: string): {
|
|
49
|
+
wordCount: number;
|
|
50
|
+
characterCount: number;
|
|
51
|
+
};
|
|
52
|
+
/** Computes bounded body statistics while excluding generated field results. */
|
|
53
|
+
export declare function documentFieldStatisticsFromHtml(source: string): {
|
|
54
|
+
wordCount: number;
|
|
55
|
+
characterCount: number;
|
|
56
|
+
};
|
|
@@ -2,7 +2,7 @@ export interface ImportedDocxBookmarkMarkers {
|
|
|
2
2
|
bookmarks: ImportedDocxBookmarkMarker[];
|
|
3
3
|
references: ImportedDocxBookmarkReferenceMarker[];
|
|
4
4
|
}
|
|
5
|
-
interface ImportedDocxBookmarkMarker {
|
|
5
|
+
export interface ImportedDocxBookmarkMarker {
|
|
6
6
|
start: string;
|
|
7
7
|
end: string;
|
|
8
8
|
id: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type WorkDocumentFieldKind } from './work-document-fields';
|
|
2
|
+
import type { ImportedDocxBookmarkMarker } from './work-docx-bookmark-import';
|
|
2
3
|
export interface ImportedDocxFieldMarkers {
|
|
3
4
|
fields: ImportedDocxFieldMarker[];
|
|
4
5
|
}
|
|
@@ -9,8 +10,11 @@ interface ImportedDocxFieldMarker {
|
|
|
9
10
|
kind: WorkDocumentFieldKind;
|
|
10
11
|
instruction: string;
|
|
11
12
|
display: string;
|
|
13
|
+
targetId?: string;
|
|
14
|
+
targetName?: string;
|
|
15
|
+
orphaned?: boolean;
|
|
12
16
|
}
|
|
13
|
-
export declare function markDocxBodyFields(document: Document): ImportedDocxFieldMarkers;
|
|
17
|
+
export declare function markDocxBodyFields(document: Document, bookmarks?: readonly ImportedDocxBookmarkMarker[]): ImportedDocxFieldMarkers;
|
|
14
18
|
export declare function applyImportedDocxFieldMarkers(document: Document, markers: ImportedDocxFieldMarkers): void;
|
|
15
19
|
export declare function hasImportedDocxFieldMarkers(markers: ImportedDocxFieldMarkers): boolean;
|
|
16
20
|
export {};
|
|
@@ -6,7 +6,6 @@ import { type ImportedDocxCommentMarkers } from './work-docx-comment-import';
|
|
|
6
6
|
import { type ImportedDocxEquationMarkers } from './work-docx-equation-import';
|
|
7
7
|
import { type ImportedDocxFieldMarkers } from './work-docx-field-import';
|
|
8
8
|
import { type ImportedDocxImageLayoutMarkers } from './work-docx-image-layout-import';
|
|
9
|
-
import { type ImportedDocxTextBoxMarkers } from './work-docx-text-box-import';
|
|
10
9
|
import { type ImportedDocxIndexMarkers } from './work-docx-index-import';
|
|
11
10
|
import { type ImportedDocxListMarkers } from './work-docx-list-import';
|
|
12
11
|
import { type ImportedDocxNumberingChangeMarkers } from './work-docx-numbering-change-import';
|
|
@@ -25,6 +24,7 @@ import { type ImportedDocxTableCellMarkers } from './work-docx-table-cell-import
|
|
|
25
24
|
import { type ImportedDocxTableOfContentsMarkers } from './work-docx-table-of-contents-import';
|
|
26
25
|
import { type ImportedDocxTableRowMarkers } from './work-docx-table-row-import';
|
|
27
26
|
import { type ImportedDocxTableSizingMarkers } from './work-docx-table-sizing-import';
|
|
27
|
+
import { type ImportedDocxTextBoxMarkers } from './work-docx-text-box-import';
|
|
28
28
|
import { OoxmlPackage } from './work-ooxml-package';
|
|
29
29
|
import type { WorkDocumentContent, WorkDocumentSectionLayout } from './work-types';
|
|
30
30
|
type ImportedDocumentLayout = Omit<WorkDocumentContent, 'type' | 'html'>;
|