@ones-editor/editor 2.8.6 → 2.8.8
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/@ones-editor/to-docx/src/doc2other/core.d.ts +3 -1
- package/@ones-editor/to-docx/src/index.d.ts +2 -6
- package/@ones-editor/to-docx/src/to-docx.d.ts +3 -1
- package/@ones-editor/to-docx/src/types.d.ts +11 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +37 -8
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { DocBlock, DocObject } from '../../../../@ones-editor/core';
|
|
|
2
2
|
import { CalcCol } from './layout';
|
|
3
3
|
import { CalcCell } from './table';
|
|
4
4
|
import { BlockObject, CodeObject, ExportState, GetDocByBlockFunc, GetTextsByBoxFunc, MD5Func } from './types';
|
|
5
|
+
import { EditorToDocxOptions } from '../types';
|
|
5
6
|
/**
|
|
6
7
|
* 生成docx/html blocks的接口
|
|
7
8
|
* block的概念:
|
|
@@ -29,7 +30,8 @@ dbg: BlocksGenerator, // 生成器 html/docx
|
|
|
29
30
|
appId: string, docId: string, md5HexFunc: MD5Func, // 用来生成md5的函数,传入的原因是因为node和浏览器生成md5的方式不同
|
|
30
31
|
getDocByBlock: GetDocByBlockFunc | undefined, // 允许传入一个函数,将一个block处理后,生成一个新的doc
|
|
31
32
|
getTextsByBox: GetTextsByBoxFunc | undefined, // 允许传入一个函数,将box类型的数据,处理后返回新的text
|
|
32
|
-
maxWidth: number
|
|
33
|
+
maxWidth: number, // 限制本次处理的最大宽度
|
|
34
|
+
options?: EditorToDocxOptions): Promise<void>;
|
|
33
35
|
/**
|
|
34
36
|
* 生成一个新的导出状态,在导出docx/html过程中,需要维护的一个内存状态,主要是列表相关的状态
|
|
35
37
|
*/
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { IImageOptions } from 'docx';
|
|
2
1
|
import { OnesEditor } from '../../../@ones-editor/core';
|
|
3
2
|
import { ExportImageError } from './errors';
|
|
3
|
+
import { EditorToDocxOptions } from './types';
|
|
4
|
+
export * from './types';
|
|
4
5
|
export { ExportImageError };
|
|
5
|
-
export interface EditorToDocxOptions {
|
|
6
|
-
template?: Blob;
|
|
7
|
-
download?: boolean;
|
|
8
|
-
backgroundImageOptions?: IImageOptions;
|
|
9
|
-
}
|
|
10
6
|
export declare function editorToDocx(editor: OnesEditor, options?: EditorToDocxOptions): Promise<Blob>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IImageOptions } from 'docx';
|
|
2
2
|
import { DocObject } from '../../../@ones-editor/core';
|
|
3
3
|
import { FontSizeConfig, GetDocByBlockFunc, GetTextsByBoxFunc, MD5Func, ReadImageFunc } from './doc2other/types';
|
|
4
|
+
import { EditorToDocxOptions } from './types';
|
|
4
5
|
export declare class ToDocX {
|
|
5
6
|
private readonly templateData;
|
|
6
7
|
private readonly docData;
|
|
@@ -10,7 +11,8 @@ export declare class ToDocX {
|
|
|
10
11
|
private readonly getDocByBlock?;
|
|
11
12
|
private readonly getTextsByBox?;
|
|
12
13
|
private readonly backgroundImageOptions?;
|
|
13
|
-
|
|
14
|
+
private readonly options?;
|
|
15
|
+
constructor(templateData: Blob | undefined, docData: DocObject, md5HexFunc: MD5Func, readImage: ReadImageFunc, defaultFontSize?: FontSizeConfig | undefined, getDocByBlock?: GetDocByBlockFunc | undefined, getTextsByBox?: GetTextsByBoxFunc | undefined, backgroundImageOptions?: IImageOptions | undefined, options?: EditorToDocxOptions | undefined);
|
|
14
16
|
convert(appId: string, docId: string): Promise<Blob>;
|
|
15
17
|
private snapshot2docx;
|
|
16
18
|
private convertBlocks;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DocBlock } from '../../../@ones-editor/core';
|
|
2
|
+
import { IImageOptions } from 'docx';
|
|
3
|
+
export interface EditorToDocxOptions {
|
|
4
|
+
template?: Blob;
|
|
5
|
+
download?: boolean;
|
|
6
|
+
backgroundImageOptions?: IImageOptions;
|
|
7
|
+
buildLink?: (blockData: DocBlock, type: 'page-link' | 'block-link') => {
|
|
8
|
+
link: string;
|
|
9
|
+
title: string;
|
|
10
|
+
};
|
|
11
|
+
}
|