@hufe921/canvas-editor 0.9.135 → 0.9.137
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 +37 -0
- package/dist/assets/value-DeIsXod0.js.map +1 -0
- package/dist/canvas-editor.js +1761 -1503
- package/dist/canvas-editor.js.map +1 -1
- package/dist/canvas-editor.umd.cjs +33 -33
- package/dist/canvas-editor.umd.cjs.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +2 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +5 -1
- package/dist/src/editor/core/draw/Draw.d.ts +9 -1
- package/dist/src/editor/core/draw/column/ColumnManager.d.ts +14 -0
- package/dist/src/editor/core/draw/frame/Footer.d.ts +4 -3
- package/dist/src/editor/core/draw/frame/Header.d.ts +4 -3
- package/dist/src/editor/core/draw/interactive/Area.d.ts +2 -0
- package/dist/src/editor/core/position/Position.d.ts +6 -0
- package/dist/src/editor/core/zone/Zone.d.ts +1 -1
- package/dist/src/editor/dataset/constant/Column.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -0
- package/dist/src/editor/interface/Area.d.ts +6 -0
- package/dist/src/editor/interface/Column.d.ts +14 -0
- package/dist/src/editor/interface/Draw.d.ts +0 -1
- package/dist/src/editor/interface/Editor.d.ts +3 -0
- package/dist/src/editor/interface/Element.d.ts +4 -0
- package/dist/src/editor/interface/Footer.d.ts +1 -0
- package/dist/src/editor/interface/Header.d.ts +1 -0
- package/dist/src/editor/interface/Position.d.ts +10 -0
- package/dist/src/editor/interface/Print.d.ts +6 -0
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/dist/src/editor/utils/print.d.ts +2 -1
- package/package.json +1 -1
- package/dist/assets/value-By4_Dx3W.js.map +0 -1
|
@@ -72,6 +72,7 @@ export declare class Command {
|
|
|
72
72
|
executeSetImageCaption: CommandAdapt['setImageCaption'];
|
|
73
73
|
executeChangeImageDisplay: CommandAdapt['changeImageDisplay'];
|
|
74
74
|
executePageMode: CommandAdapt['pageMode'];
|
|
75
|
+
executeSetColumns: CommandAdapt['setColumns'];
|
|
75
76
|
executePageScale: CommandAdapt['pageScale'];
|
|
76
77
|
executePageScaleRecovery: CommandAdapt['pageScaleRecovery'];
|
|
77
78
|
executePageScaleMinus: CommandAdapt['pageScaleMinus'];
|
|
@@ -135,6 +136,7 @@ export declare class Command {
|
|
|
135
136
|
getKeywordRangeList: CommandAdapt['getKeywordRangeList'];
|
|
136
137
|
getKeywordContext: CommandAdapt['getKeywordContext'];
|
|
137
138
|
getPaperMargin: CommandAdapt['getPaperMargin'];
|
|
139
|
+
getColumns: CommandAdapt['getColumns'];
|
|
138
140
|
getSearchNavigateInfo: CommandAdapt['getSearchNavigateInfo'];
|
|
139
141
|
getLocale: CommandAdapt['getLocale'];
|
|
140
142
|
getGroupIds: CommandAdapt['getGroupIds'];
|
|
@@ -11,6 +11,7 @@ import { DeepRequired } from '../../interface/Common';
|
|
|
11
11
|
import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption, IRemoveControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
|
|
12
12
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
13
13
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
|
|
14
|
+
import { IColumnOption } from '../../interface/Column';
|
|
14
15
|
import { IDeleteElementByIdOption, IElement, IElementPosition, IGetElementByIdOption, IImageCaption, IImageCrop, IInsertElementListOption, IUpdateElementByIdOption } from '../../interface/Element';
|
|
15
16
|
import { ICopyOption, IPasteOption, IPositionContextByEventOption, IPositionContextByEventResult } from '../../interface/Event';
|
|
16
17
|
import { IMargin } from '../../interface/Margin';
|
|
@@ -24,6 +25,7 @@ import { INavigateInfo } from '../draw/interactive/Search';
|
|
|
24
25
|
import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, IDeleteAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../interface/Area';
|
|
25
26
|
import { IAreaBadge, IBadge } from '../../interface/Badge';
|
|
26
27
|
import { IRichtextOption } from '../../interface/Command';
|
|
28
|
+
import { IPrintOption } from '@/editor/interface/Print';
|
|
27
29
|
export declare class CommandAdapt {
|
|
28
30
|
private draw;
|
|
29
31
|
private range;
|
|
@@ -108,7 +110,7 @@ export declare class CommandAdapt {
|
|
|
108
110
|
searchNavigateNext(): void;
|
|
109
111
|
getSearchNavigateInfo(): null | INavigateInfo;
|
|
110
112
|
replace(payload: string, option?: IReplaceOption): void;
|
|
111
|
-
print(): Promise<void>;
|
|
113
|
+
print(option?: IPrintOption): Promise<void>;
|
|
112
114
|
replaceImageElement(payload: string): void;
|
|
113
115
|
saveAsImageElement(): void;
|
|
114
116
|
setImageCrop(crop: IImageCrop): void;
|
|
@@ -133,6 +135,8 @@ export declare class CommandAdapt {
|
|
|
133
135
|
getKeywordRangeList(payload: string): IRange[];
|
|
134
136
|
getKeywordContext(payload: string): ISearchResultContext[] | null;
|
|
135
137
|
pageMode(payload: PageMode): void;
|
|
138
|
+
setColumns(config: IColumnOption | null): void;
|
|
139
|
+
getColumns(): IColumnOption | null;
|
|
136
140
|
pageScale(scale: number): void;
|
|
137
141
|
pageScaleRecovery(): void;
|
|
138
142
|
pageScaleMinus(): void;
|
|
@@ -2,6 +2,8 @@ import { IAppendElementListOption, IComputeRowListPayload, IDrawOption, IDrawRow
|
|
|
2
2
|
import { IEditorData, IEditorOption, IEditorResult, ISetValueOption } from '../../interface/Editor';
|
|
3
3
|
import { IElement, IElementStyle, ISpliceElementListOption, IInsertElementListOption } from '../../interface/Element';
|
|
4
4
|
import { IRow } from '../../interface/Row';
|
|
5
|
+
import { IColumnLayout, IColumnOption } from '../../interface/Column';
|
|
6
|
+
import { ColumnManager } from './column/ColumnManager';
|
|
5
7
|
import { Cursor } from '../cursor/Cursor';
|
|
6
8
|
import { CanvasEvent } from '../event/CanvasEvent';
|
|
7
9
|
import { GlobalEvent } from '../event/GlobalEvent';
|
|
@@ -119,6 +121,8 @@ export declare class Draw {
|
|
|
119
121
|
private intersectionPageNo;
|
|
120
122
|
private lazyRenderIntersectionObserver;
|
|
121
123
|
private printModeData;
|
|
124
|
+
private controlMinWidthPlaceholderElementListSet;
|
|
125
|
+
private columnManager;
|
|
122
126
|
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap>, override: Override);
|
|
123
127
|
setPrintData(): void;
|
|
124
128
|
clearPrintData(): void;
|
|
@@ -129,16 +133,19 @@ export declare class Draw {
|
|
|
129
133
|
isDisabled(): boolean;
|
|
130
134
|
isDesignMode(): boolean;
|
|
131
135
|
isPrintMode(): boolean;
|
|
136
|
+
isAreaHideDisabled(): boolean;
|
|
132
137
|
isGraffitiMode(): boolean;
|
|
133
138
|
getOriginalWidth(): number;
|
|
134
139
|
getOriginalHeight(): number;
|
|
135
140
|
getWidth(): number;
|
|
136
141
|
getHeight(): number;
|
|
137
142
|
getMainHeight(): number;
|
|
138
|
-
getMainOuterHeight(): number;
|
|
143
|
+
getMainOuterHeight(pageNo?: number): number;
|
|
139
144
|
getCanvasWidth(pageNo?: number): number;
|
|
140
145
|
getCanvasHeight(pageNo?: number): number;
|
|
141
146
|
getInnerWidth(): number;
|
|
147
|
+
getColumnLayout(): IColumnLayout | null;
|
|
148
|
+
setColumnConfig(config: IColumnOption | null): void;
|
|
142
149
|
getOriginalInnerWidth(): number;
|
|
143
150
|
getContextInnerWidth(): number;
|
|
144
151
|
getMargins(): IMargin;
|
|
@@ -176,6 +183,7 @@ export declare class Draw {
|
|
|
176
183
|
getHistoryManager(): HistoryManager;
|
|
177
184
|
getPosition(): Position;
|
|
178
185
|
getZone(): Zone;
|
|
186
|
+
getColumnManager(): ColumnManager;
|
|
179
187
|
getRange(): RangeManager;
|
|
180
188
|
getLineBreakParticle(): LineBreakParticle;
|
|
181
189
|
getTextParticle(): TextParticle;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IColumnLayout, IColumnOption } from '../../../interface/Column';
|
|
2
|
+
import { Draw } from '../Draw';
|
|
3
|
+
export declare class ColumnManager {
|
|
4
|
+
private draw;
|
|
5
|
+
private options;
|
|
6
|
+
private layout;
|
|
7
|
+
constructor(draw: Draw);
|
|
8
|
+
computeLayout(innerWidth: number, config: IColumnOption | undefined): IColumnLayout | null;
|
|
9
|
+
compute(): void;
|
|
10
|
+
getLayout(): IColumnLayout | null;
|
|
11
|
+
setConfig(config: IColumnOption | null | undefined): void;
|
|
12
|
+
getOffset(columnIndex: number | undefined): number;
|
|
13
|
+
drawSeparator(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
14
|
+
}
|
|
@@ -18,10 +18,11 @@ export declare class Footer {
|
|
|
18
18
|
recovery(): void;
|
|
19
19
|
private _computeRowList;
|
|
20
20
|
private _computePositionList;
|
|
21
|
-
getFooterBottom(): number;
|
|
21
|
+
getFooterBottom(pageNo?: number): number;
|
|
22
22
|
getMaxHeight(): number;
|
|
23
|
-
getHeight(): number;
|
|
23
|
+
getHeight(pageNo?: number): number;
|
|
24
24
|
getRowHeight(): number;
|
|
25
|
-
getExtraHeight(): number;
|
|
25
|
+
getExtraHeight(pageNo?: number): number;
|
|
26
|
+
isDisabled(pageNo?: number): boolean;
|
|
26
27
|
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
27
28
|
}
|
|
@@ -18,10 +18,11 @@ export declare class Header {
|
|
|
18
18
|
recovery(): void;
|
|
19
19
|
private _computeRowList;
|
|
20
20
|
private _computePositionList;
|
|
21
|
-
getHeaderTop(): number;
|
|
21
|
+
getHeaderTop(pageNo?: number): number;
|
|
22
22
|
getMaxHeight(): number;
|
|
23
|
-
getHeight(): number;
|
|
23
|
+
getHeight(pageNo?: number): number;
|
|
24
24
|
getRowHeight(): number;
|
|
25
|
-
getExtraHeight(): number;
|
|
25
|
+
getExtraHeight(pageNo?: number): number;
|
|
26
|
+
isDisabled(pageNo?: number): boolean;
|
|
26
27
|
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
27
28
|
}
|
|
@@ -17,6 +17,8 @@ export declare class Area {
|
|
|
17
17
|
insertArea(payload: IInsertAreaOption): string | null;
|
|
18
18
|
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
19
19
|
compute(): void;
|
|
20
|
+
private computeAreaInfo;
|
|
21
|
+
private computeTableAreaInfo;
|
|
20
22
|
getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
|
|
21
23
|
getContextByAreaId(areaId: string, options?: ILocationAreaOption): {
|
|
22
24
|
range: IRange;
|
|
@@ -13,6 +13,11 @@ export declare class Position {
|
|
|
13
13
|
constructor(draw: Draw);
|
|
14
14
|
getFloatPositionList(): IFloatPosition[];
|
|
15
15
|
getTablePositionList(sourceElementList: IElement[]): IElementPosition[];
|
|
16
|
+
getTableTdByContext(sourceElementList: IElement[], context: IPositionContext): import("../../interface/table/Td").ITd | null;
|
|
17
|
+
buildTablePositionContext(context: IPositionContext, element: IElement, trIndex: number, tdIndex: number): IPositionContext;
|
|
18
|
+
getTableElementByContext(sourceElementList: IElement[], context: IPositionContext): IElement | null;
|
|
19
|
+
getTableElementPositionByContext(sourceElementList: IElement[], sourcePositionList: IElementPosition[], context: IPositionContext): IElementPosition | null;
|
|
20
|
+
private _getTablePathByContext;
|
|
16
21
|
getPositionList(): IElementPosition[];
|
|
17
22
|
getMainPositionList(): IElementPosition[];
|
|
18
23
|
getOriginalPositionList(): IElementPosition[];
|
|
@@ -32,6 +37,7 @@ export declare class Position {
|
|
|
32
37
|
getCursorPosition(): IElementPosition | null;
|
|
33
38
|
getPositionContext(): IPositionContext;
|
|
34
39
|
setPositionContext(payload: IPositionContext): void;
|
|
40
|
+
private _getColumnIndexByX;
|
|
35
41
|
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
36
42
|
getFloatPositionByXY(payload: IGetFloatPositionByXYPayload): ICurrentPosition | void;
|
|
37
43
|
adjustPositionContext(payload: IGetPositionByXYPayload): ICurrentPosition | null;
|
|
@@ -15,7 +15,7 @@ export declare class Zone {
|
|
|
15
15
|
isFooterActive(): boolean;
|
|
16
16
|
getZone(): EditorZone;
|
|
17
17
|
setZone(payload: EditorZone): void;
|
|
18
|
-
getZoneByY(y: number): EditorZone;
|
|
18
|
+
getZoneByY(y: number, pageNo?: number): EditorZone;
|
|
19
19
|
drawZoneIndicator(): void;
|
|
20
20
|
private _clearZoneIndicator;
|
|
21
21
|
}
|
|
@@ -4,6 +4,7 @@ import { ITd } from '../../interface/table/Td';
|
|
|
4
4
|
import { IControlStyle } from '../../interface/Control';
|
|
5
5
|
export declare const EDITOR_ELEMENT_STYLE_ATTR: Array<keyof IElement>;
|
|
6
6
|
export declare const EDITOR_ROW_ATTR: Array<keyof IElement>;
|
|
7
|
+
export declare const EDITOR_ELEMENT_PARAGRAPH_STYLE_ATTR: Array<keyof IElement>;
|
|
7
8
|
export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
|
|
8
9
|
export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
|
|
9
10
|
export declare const TABLE_TD_ZIP_ATTR: Array<keyof ITd>;
|
|
@@ -3,6 +3,7 @@ import { LocationPosition } from '../dataset/enum/Common';
|
|
|
3
3
|
import { IElement, IElementPosition } from './Element';
|
|
4
4
|
import { IPlaceholder } from './Placeholder';
|
|
5
5
|
import { IRange } from './Range';
|
|
6
|
+
import { ITd } from './table/Td';
|
|
6
7
|
export interface IAreaBasic {
|
|
7
8
|
extension?: unknown;
|
|
8
9
|
placeholder?: IPlaceholder;
|
|
@@ -48,6 +49,11 @@ export interface IAreaInfo {
|
|
|
48
49
|
area: IArea;
|
|
49
50
|
elementList: IElement[];
|
|
50
51
|
positionList: IElementPosition[];
|
|
52
|
+
sourceElementList: IElement[];
|
|
53
|
+
tableCell?: {
|
|
54
|
+
td: ITd;
|
|
55
|
+
tablePosition: IElementPosition;
|
|
56
|
+
};
|
|
51
57
|
}
|
|
52
58
|
export interface ILocationAreaOption {
|
|
53
59
|
position: LocationPosition;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IColumnOption {
|
|
2
|
+
count: number;
|
|
3
|
+
gap?: number;
|
|
4
|
+
separator?: boolean;
|
|
5
|
+
separatorColor?: string;
|
|
6
|
+
separatorWidth?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface IColumnLayout {
|
|
9
|
+
count: number;
|
|
10
|
+
width: number;
|
|
11
|
+
gap: number;
|
|
12
|
+
separator: boolean;
|
|
13
|
+
offsets: number[];
|
|
14
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorMode, PageMode, PaperDirection, RenderMode, WordBreak } from '../dataset/enum/Editor';
|
|
2
|
+
import { IColumnOption } from './Column';
|
|
2
3
|
import { IBackgroundOption } from './Background';
|
|
3
4
|
import { ICheckboxOption } from './Checkbox';
|
|
4
5
|
import { IRadioOption } from './Radio';
|
|
@@ -108,6 +109,7 @@ export interface IEditorOption {
|
|
|
108
109
|
list?: IListOption;
|
|
109
110
|
magnifier?: IMagnifierOption;
|
|
110
111
|
accessibility?: IAccessibilityOption;
|
|
112
|
+
column?: IColumnOption;
|
|
111
113
|
}
|
|
112
114
|
export interface IEditorResult {
|
|
113
115
|
version: string;
|
|
@@ -135,6 +137,7 @@ export interface IPrintModeRule {
|
|
|
135
137
|
backgroundDisabled?: boolean;
|
|
136
138
|
filterEmptyControl?: boolean;
|
|
137
139
|
filterHideElementRow?: boolean;
|
|
140
|
+
areaHideDisabled?: boolean;
|
|
138
141
|
}
|
|
139
142
|
export interface IReadonlyModeRule {
|
|
140
143
|
imagePreviewerDisabled?: boolean;
|
|
@@ -35,6 +35,8 @@ export interface IElementStyle {
|
|
|
35
35
|
strikeout?: boolean;
|
|
36
36
|
rowFlex?: RowFlex;
|
|
37
37
|
rowMargin?: number;
|
|
38
|
+
level?: TitleLevel;
|
|
39
|
+
title?: ITitle;
|
|
38
40
|
letterSpacing?: number;
|
|
39
41
|
textDecoration?: ITextDecoration;
|
|
40
42
|
}
|
|
@@ -94,6 +96,7 @@ export interface IControlElement {
|
|
|
94
96
|
control?: IControl;
|
|
95
97
|
controlId?: string;
|
|
96
98
|
controlComponent?: ControlComponent;
|
|
99
|
+
isControlMinWidthPlaceholder?: boolean;
|
|
97
100
|
}
|
|
98
101
|
export interface ICheckboxElement {
|
|
99
102
|
checkbox?: ICheckbox;
|
|
@@ -182,6 +185,7 @@ export interface IElementPosition {
|
|
|
182
185
|
metrics: IElementMetrics;
|
|
183
186
|
isFirstLetter: boolean;
|
|
184
187
|
isLastLetter: boolean;
|
|
188
|
+
columnIndex?: number;
|
|
185
189
|
coordinate: {
|
|
186
190
|
leftTop: number[];
|
|
187
191
|
leftBottom: number[];
|
|
@@ -21,6 +21,7 @@ export interface ICurrentPosition {
|
|
|
21
21
|
tdId?: string;
|
|
22
22
|
trId?: string;
|
|
23
23
|
tableId?: string;
|
|
24
|
+
tablePath?: ITablePositionContext[];
|
|
24
25
|
zone?: EditorZone;
|
|
25
26
|
hitLineStartIndex?: number;
|
|
26
27
|
}
|
|
@@ -51,6 +52,15 @@ export interface IPositionContext {
|
|
|
51
52
|
tdId?: string;
|
|
52
53
|
trId?: string;
|
|
53
54
|
tableId?: string;
|
|
55
|
+
tablePath?: ITablePositionContext[];
|
|
56
|
+
}
|
|
57
|
+
export interface ITablePositionContext {
|
|
58
|
+
index: number;
|
|
59
|
+
trIndex: number;
|
|
60
|
+
tdIndex: number;
|
|
61
|
+
tdId?: string;
|
|
62
|
+
trId?: string;
|
|
63
|
+
tableId?: string;
|
|
54
64
|
}
|
|
55
65
|
export interface IComputeRowPositionPayload {
|
|
56
66
|
row: IRow;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { PaperDirection } from '../dataset/enum/Editor';
|
|
2
2
|
import { IIframeInfo } from '../interface/Block';
|
|
3
|
-
|
|
3
|
+
interface IPrintOption {
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
6
6
|
direction?: PaperDirection;
|
|
7
7
|
iframeInfoList?: IIframeInfo[][];
|
|
8
8
|
}
|
|
9
9
|
export declare function print(base64List: string[], options: IPrintOption): Promise<void>;
|
|
10
|
+
export {};
|
package/package.json
CHANGED