@hufe921/canvas-editor 0.9.27 → 0.9.29
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/CHANGELOG.md +46 -0
- package/README.md +1 -1
- package/dist/canvas-editor.es.js +393 -123
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +15 -15
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/draw/Draw.d.ts +6 -0
- package/dist/src/editor/core/draw/frame/Footer.d.ts +26 -0
- package/dist/src/editor/core/draw/frame/Header.d.ts +2 -0
- package/dist/src/editor/core/draw/particle/TextParticle.d.ts +1 -0
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +2 -0
- package/dist/src/editor/core/zone/Zone.d.ts +5 -3
- package/dist/src/editor/dataset/constant/Common.d.ts +3 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Footer.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Header.d.ts +0 -2
- package/dist/src/editor/dataset/enum/{Header.d.ts → Common.d.ts} +1 -1
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/Editor.d.ts +3 -1
- package/dist/src/editor/interface/Footer.d.ts +5 -0
- package/dist/src/editor/interface/Header.d.ts +2 -2
- package/dist/src/editor/interface/table/Td.d.ts +3 -0
- package/dist/src/editor/interface/table/Tr.d.ts +1 -0
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ import { IMargin } from '../../interface/Margin';
|
|
|
23
23
|
import { I18n } from '../i18n/I18n';
|
|
24
24
|
import { ImageObserver } from '../observer/ImageObserver';
|
|
25
25
|
import { Zone } from '../zone/Zone';
|
|
26
|
+
import { Footer } from './frame/Footer';
|
|
26
27
|
export declare class Draw {
|
|
27
28
|
private container;
|
|
28
29
|
private pageContainer;
|
|
@@ -58,6 +59,7 @@ export declare class Draw {
|
|
|
58
59
|
private pageNumber;
|
|
59
60
|
private waterMark;
|
|
60
61
|
private header;
|
|
62
|
+
private footer;
|
|
61
63
|
private hyperlinkParticle;
|
|
62
64
|
private dateParticle;
|
|
63
65
|
private separatorParticle;
|
|
@@ -87,6 +89,7 @@ export declare class Draw {
|
|
|
87
89
|
getWidth(): number;
|
|
88
90
|
getHeight(): number;
|
|
89
91
|
getMainHeight(): number;
|
|
92
|
+
getMainOuterHeight(): number;
|
|
90
93
|
getCanvasWidth(pageNo?: number): number;
|
|
91
94
|
getCanvasHeight(pageNo?: number): number;
|
|
92
95
|
getInnerWidth(): number;
|
|
@@ -108,6 +111,8 @@ export declare class Draw {
|
|
|
108
111
|
setPageNo(payload: number): void;
|
|
109
112
|
getPage(pageNo?: number): HTMLCanvasElement;
|
|
110
113
|
getPageList(): HTMLCanvasElement[];
|
|
114
|
+
getTableRowList(sourceElementList: IElement[]): IRow[];
|
|
115
|
+
getOriginalRowList(): IRow[];
|
|
111
116
|
getRowList(): IRow[];
|
|
112
117
|
getPageRowList(): IRow[][];
|
|
113
118
|
getCtx(): CanvasRenderingContext2D;
|
|
@@ -132,6 +137,7 @@ export declare class Draw {
|
|
|
132
137
|
getImageParticle(): ImageParticle;
|
|
133
138
|
getTableTool(): TableTool;
|
|
134
139
|
getHeader(): Header;
|
|
140
|
+
getFooter(): Footer;
|
|
135
141
|
getHyperlinkParticle(): HyperlinkParticle;
|
|
136
142
|
getDateParticle(): DateParticle;
|
|
137
143
|
getControl(): Control;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
2
|
+
import { IRow } from '../../../interface/Row';
|
|
3
|
+
import { Draw } from '../Draw';
|
|
4
|
+
export declare class Footer {
|
|
5
|
+
private draw;
|
|
6
|
+
private position;
|
|
7
|
+
private options;
|
|
8
|
+
private elementList;
|
|
9
|
+
private rowList;
|
|
10
|
+
private positionList;
|
|
11
|
+
constructor(draw: Draw);
|
|
12
|
+
getRowList(): IRow[];
|
|
13
|
+
setElementList(elementList: IElement[]): void;
|
|
14
|
+
getElementList(): IElement[];
|
|
15
|
+
getPositionList(): IElementPosition[];
|
|
16
|
+
compute(): void;
|
|
17
|
+
private _recovery;
|
|
18
|
+
private _computeRowList;
|
|
19
|
+
private _computePositionList;
|
|
20
|
+
getFooterBottom(): number;
|
|
21
|
+
getMaxHeight(): number;
|
|
22
|
+
getHeight(): number;
|
|
23
|
+
getRowHeight(): number;
|
|
24
|
+
getExtraHeight(): number;
|
|
25
|
+
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
26
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
2
|
+
import { IRow } from '../../../interface/Row';
|
|
2
3
|
import { Draw } from '../Draw';
|
|
3
4
|
export declare class Header {
|
|
4
5
|
private draw;
|
|
@@ -8,6 +9,7 @@ export declare class Header {
|
|
|
8
9
|
private rowList;
|
|
9
10
|
private positionList;
|
|
10
11
|
constructor(draw: Draw);
|
|
12
|
+
getRowList(): IRow[];
|
|
11
13
|
setElementList(elementList: IElement[]): void;
|
|
12
14
|
getElementList(): IElement[];
|
|
13
15
|
getPositionList(): IElementPosition[];
|
|
@@ -10,6 +10,7 @@ export declare class TextParticle {
|
|
|
10
10
|
private curColor?;
|
|
11
11
|
cacheMeasureText: Map<string, TextMetrics>;
|
|
12
12
|
constructor(draw: Draw);
|
|
13
|
+
measurePunctuationWidth(ctx: CanvasRenderingContext2D, element: IElement): number;
|
|
13
14
|
measureText(ctx: CanvasRenderingContext2D, element: IElement): TextMetrics;
|
|
14
15
|
complete(): void;
|
|
15
16
|
record(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { IElement } from '../../../..';
|
|
2
|
+
import { ITr } from '../../../../interface/table/Tr';
|
|
2
3
|
import { Draw } from '../../Draw';
|
|
3
4
|
export declare class TableParticle {
|
|
4
5
|
private range;
|
|
5
6
|
private options;
|
|
6
7
|
constructor(draw: Draw);
|
|
8
|
+
getTrListGroupByCol(payload: ITr[]): ITr[];
|
|
7
9
|
private _drawBorder;
|
|
8
10
|
computeRowColInfo(element: IElement): void;
|
|
9
11
|
drawRange(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { EditorZone } from '../../dataset/enum/Editor';
|
|
2
2
|
import { Draw } from '../draw/Draw';
|
|
3
3
|
export declare class Zone {
|
|
4
|
+
private readonly INDICATOR_PADDING;
|
|
4
5
|
private readonly INDICATOR_TITLE_TRANSLATE;
|
|
5
6
|
private draw;
|
|
6
7
|
private options;
|
|
7
8
|
private i18n;
|
|
8
9
|
private container;
|
|
9
10
|
private currentZone;
|
|
10
|
-
private
|
|
11
|
+
private indicatorContainer;
|
|
11
12
|
constructor(draw: Draw);
|
|
12
13
|
isHeaderActive(): boolean;
|
|
13
14
|
isMainActive(): boolean;
|
|
15
|
+
isFooterActive(): boolean;
|
|
14
16
|
getZone(): EditorZone;
|
|
15
17
|
setZone(payload: EditorZone): void;
|
|
16
|
-
|
|
17
|
-
private
|
|
18
|
+
drawZoneIndicator(): void;
|
|
19
|
+
private _clearZoneIndicator;
|
|
18
20
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { MaxHeightRatio } from '../enum/Common';
|
|
1
2
|
export declare const ZERO = "\u200B";
|
|
2
3
|
export declare const WRAP = "\n";
|
|
3
4
|
export declare const HORIZON_TAB = "\t";
|
|
4
5
|
export declare const NBSP = " ";
|
|
6
|
+
export declare const PUNCTUATION_LIST: string[];
|
|
7
|
+
export declare const maxHeightRadioMapping: Record<MaxHeightRatio, number>;
|
|
@@ -4,3 +4,4 @@ export declare const EDITOR_ELEMENT_STYLE_ATTR: Array<keyof IElement>;
|
|
|
4
4
|
export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
|
|
5
5
|
export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
|
|
6
6
|
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
7
|
+
export declare const INLINE_ELEMENT_TYPE: ElementType[];
|
|
@@ -18,6 +18,7 @@ import { IBlock } from './interface/Block';
|
|
|
18
18
|
import { ILang } from './interface/i18n/I18n';
|
|
19
19
|
import { VerticalAlign } from './dataset/enum/VerticalAlign';
|
|
20
20
|
import { TableBorder } from './dataset/enum/table/Table';
|
|
21
|
+
import { MaxHeightRatio } from './dataset/enum/Common';
|
|
21
22
|
export default class Editor {
|
|
22
23
|
command: Command;
|
|
23
24
|
listener: Listener;
|
|
@@ -25,5 +26,5 @@ export default class Editor {
|
|
|
25
26
|
destroy: Function;
|
|
26
27
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
27
28
|
}
|
|
28
|
-
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder };
|
|
29
|
+
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, MaxHeightRatio };
|
|
29
30
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang };
|
|
@@ -3,6 +3,7 @@ import { EditorMode, PageMode, PaperDirection } from '../dataset/enum/Editor';
|
|
|
3
3
|
import { ICheckboxOption } from './Checkbox';
|
|
4
4
|
import { IControlOption } from './Control';
|
|
5
5
|
import { ICursorOption } from './Cursor';
|
|
6
|
+
import { IFooter } from './Footer';
|
|
6
7
|
import { IHeader } from './Header';
|
|
7
8
|
import { IMargin } from './Margin';
|
|
8
9
|
import { IPageNumber } from './PageNumber';
|
|
@@ -42,11 +43,12 @@ export interface IEditorOption {
|
|
|
42
43
|
margins?: IMargin;
|
|
43
44
|
pageMode?: PageMode;
|
|
44
45
|
tdPadding?: number;
|
|
45
|
-
|
|
46
|
+
defaultTrMinHeight?: number;
|
|
46
47
|
defaultHyperlinkColor?: string;
|
|
47
48
|
paperDirection?: PaperDirection;
|
|
48
49
|
inactiveAlpha?: number;
|
|
49
50
|
header?: IHeader;
|
|
51
|
+
footer?: IFooter;
|
|
50
52
|
pageNumber?: IPageNumber;
|
|
51
53
|
watermark?: IWatermark;
|
|
52
54
|
control?: IControlOption;
|