@hufe921/canvas-editor 0.9.136 → 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 +20 -0
- package/dist/assets/value-DeIsXod0.js.map +1 -0
- package/dist/canvas-editor.js +1345 -1208
- 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 +7 -0
- package/dist/src/editor/core/draw/column/ColumnManager.d.ts +14 -0
- package/dist/src/editor/core/draw/interactive/Area.d.ts +2 -0
- package/dist/src/editor/core/position/Position.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Column.d.ts +2 -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/Editor.d.ts +3 -0
- package/dist/src/editor/interface/Element.d.ts +1 -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';
|
|
@@ -120,6 +122,7 @@ export declare class Draw {
|
|
|
120
122
|
private lazyRenderIntersectionObserver;
|
|
121
123
|
private printModeData;
|
|
122
124
|
private controlMinWidthPlaceholderElementListSet;
|
|
125
|
+
private columnManager;
|
|
123
126
|
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap>, override: Override);
|
|
124
127
|
setPrintData(): void;
|
|
125
128
|
clearPrintData(): void;
|
|
@@ -130,6 +133,7 @@ export declare class Draw {
|
|
|
130
133
|
isDisabled(): boolean;
|
|
131
134
|
isDesignMode(): boolean;
|
|
132
135
|
isPrintMode(): boolean;
|
|
136
|
+
isAreaHideDisabled(): boolean;
|
|
133
137
|
isGraffitiMode(): boolean;
|
|
134
138
|
getOriginalWidth(): number;
|
|
135
139
|
getOriginalHeight(): number;
|
|
@@ -140,6 +144,8 @@ export declare class Draw {
|
|
|
140
144
|
getCanvasWidth(pageNo?: number): number;
|
|
141
145
|
getCanvasHeight(pageNo?: number): number;
|
|
142
146
|
getInnerWidth(): number;
|
|
147
|
+
getColumnLayout(): IColumnLayout | null;
|
|
148
|
+
setColumnConfig(config: IColumnOption | null): void;
|
|
143
149
|
getOriginalInnerWidth(): number;
|
|
144
150
|
getContextInnerWidth(): number;
|
|
145
151
|
getMargins(): IMargin;
|
|
@@ -177,6 +183,7 @@ export declare class Draw {
|
|
|
177
183
|
getHistoryManager(): HistoryManager;
|
|
178
184
|
getPosition(): Position;
|
|
179
185
|
getZone(): Zone;
|
|
186
|
+
getColumnManager(): ColumnManager;
|
|
180
187
|
getRange(): RangeManager;
|
|
181
188
|
getLineBreakParticle(): LineBreakParticle;
|
|
182
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
|
+
}
|
|
@@ -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;
|
|
@@ -37,6 +37,7 @@ export declare class Position {
|
|
|
37
37
|
getCursorPosition(): IElementPosition | null;
|
|
38
38
|
getPositionContext(): IPositionContext;
|
|
39
39
|
setPositionContext(payload: IPositionContext): void;
|
|
40
|
+
private _getColumnIndexByX;
|
|
40
41
|
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
41
42
|
getFloatPositionByXY(payload: IGetFloatPositionByXYPayload): ICurrentPosition | void;
|
|
42
43
|
adjustPositionContext(payload: IGetPositionByXYPayload): ICurrentPosition | null;
|
|
@@ -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;
|
|
@@ -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