@hufe921/canvas-editor 0.9.64 → 0.9.66
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/canvas-editor.es.js +426 -97
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +36 -36
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +1 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -1
- package/dist/src/editor/core/draw/Draw.d.ts +2 -0
- package/dist/src/editor/core/draw/particle/ImageParticle.d.ts +6 -0
- package/dist/src/editor/core/draw/particle/previewer/Previewer.d.ts +3 -2
- package/dist/src/editor/core/event/handlers/mousedown.d.ts +1 -0
- package/dist/src/editor/core/position/Position.d.ts +4 -1
- package/dist/src/editor/dataset/constant/ContextMenu.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Common.d.ts +6 -0
- package/dist/src/editor/dataset/enum/Control.d.ts +0 -4
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/Draw.d.ts +5 -0
- package/dist/src/editor/interface/Element.d.ts +6 -1
- package/dist/src/editor/interface/Position.d.ts +21 -1
- package/dist/src/editor/interface/table/Td.d.ts +2 -2
- package/package.json +1 -1
|
@@ -95,6 +95,7 @@ export declare class Command {
|
|
|
95
95
|
getHTML: CommandAdapt['getHTML'];
|
|
96
96
|
getText: CommandAdapt['getText'];
|
|
97
97
|
getWordCount: CommandAdapt['getWordCount'];
|
|
98
|
+
getRange: CommandAdapt['getRange'];
|
|
98
99
|
getRangeText: CommandAdapt['getRangeText'];
|
|
99
100
|
getRangeContext: CommandAdapt['getRangeContext'];
|
|
100
101
|
getRangeRow: CommandAdapt['getRangeRow'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImageDisplay } from '../../dataset/enum/
|
|
1
|
+
import { ImageDisplay } from '../../dataset/enum/Common';
|
|
2
2
|
import { EditorMode, EditorZone, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
3
|
import { ListStyle, ListType } from '../../dataset/enum/List';
|
|
4
4
|
import { RowFlex } from '../../dataset/enum/Row';
|
|
@@ -103,6 +103,7 @@ export declare class CommandAdapt {
|
|
|
103
103
|
getHTML(): IEditorHTML;
|
|
104
104
|
getText(): IEditorText;
|
|
105
105
|
getWordCount(): Promise<number>;
|
|
106
|
+
getRange(): IRange;
|
|
106
107
|
getRangeText(): string;
|
|
107
108
|
getRangeContext(): RangeContext | null;
|
|
108
109
|
getRangeRow(): IElement[] | null;
|
|
@@ -199,6 +199,7 @@ export declare class Draw {
|
|
|
199
199
|
private _computePageList;
|
|
200
200
|
private _drawRichText;
|
|
201
201
|
drawRow(ctx: CanvasRenderingContext2D, payload: IDrawRowPayload): void;
|
|
202
|
+
private _drawFloat;
|
|
202
203
|
private _clearPage;
|
|
203
204
|
private _drawPage;
|
|
204
205
|
private _disconnectLazyRender;
|
|
@@ -206,4 +207,5 @@ export declare class Draw {
|
|
|
206
207
|
private _immediateRender;
|
|
207
208
|
render(payload?: IDrawOption): void;
|
|
208
209
|
destroy(): void;
|
|
210
|
+
clearSideEffect(): void;
|
|
209
211
|
}
|
|
@@ -5,7 +5,13 @@ export declare class ImageParticle {
|
|
|
5
5
|
private draw;
|
|
6
6
|
protected options: Required<IEditorOption>;
|
|
7
7
|
protected imageCache: Map<string, HTMLImageElement>;
|
|
8
|
+
private container;
|
|
9
|
+
private floatImageContainer;
|
|
10
|
+
private floatImage;
|
|
8
11
|
constructor(draw: Draw);
|
|
12
|
+
createFloatImage(element: IElement): void;
|
|
13
|
+
dragFloatImage(movementX: number, movementY: number): void;
|
|
14
|
+
destroyFloatImage(): void;
|
|
9
15
|
protected addImageObserver(promise: Promise<unknown>): void;
|
|
10
16
|
protected getFallbackImage(width: number, height: number): HTMLImageElement;
|
|
11
17
|
render(ctx: CanvasRenderingContext2D, element: IElement, x: number, y: number): void;
|
|
@@ -23,16 +23,17 @@ export declare class Previewer {
|
|
|
23
23
|
private previewerContainer;
|
|
24
24
|
private previewerImage;
|
|
25
25
|
constructor(draw: Draw);
|
|
26
|
+
private _getElementPosition;
|
|
26
27
|
private _createResizerDom;
|
|
27
28
|
private _keydown;
|
|
28
29
|
private _mousedown;
|
|
29
30
|
private _mousemove;
|
|
30
|
-
private _dblclick;
|
|
31
31
|
private _drawPreviewer;
|
|
32
32
|
_setPreviewerTransform(scale: number, rotate: number, x: number, y: number): void;
|
|
33
33
|
private _clearPreviewer;
|
|
34
34
|
_updateResizerRect(width: number, height: number): void;
|
|
35
35
|
_updateResizerSizeView(width: number, height: number): void;
|
|
36
|
-
|
|
36
|
+
render(): void;
|
|
37
|
+
drawResizer(element: IElement, position?: IElementPosition | null, options?: IPreviewerDrawOption): void;
|
|
37
38
|
clearResizer(): void;
|
|
38
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IComputePageRowPositionPayload, IComputePageRowPositionResult, IComputeRowPositionPayload } from '../../interface/Position';
|
|
1
|
+
import { IComputePageRowPositionPayload, IComputePageRowPositionResult, IComputeRowPositionPayload, IFloatPosition, IGetFloatPositionByXYPayload } from '../../interface/Position';
|
|
2
2
|
import { IElement, IElementPosition } from '../../interface/Element';
|
|
3
3
|
import { ICurrentPosition, IGetPositionByXYPayload, IPositionContext } from '../../interface/Position';
|
|
4
4
|
import { Draw } from '../draw/Draw';
|
|
@@ -6,9 +6,11 @@ export declare class Position {
|
|
|
6
6
|
private cursorPosition;
|
|
7
7
|
private positionContext;
|
|
8
8
|
private positionList;
|
|
9
|
+
private floatPositionList;
|
|
9
10
|
private draw;
|
|
10
11
|
private options;
|
|
11
12
|
constructor(draw: Draw);
|
|
13
|
+
getFloatPositionList(): IFloatPosition[];
|
|
12
14
|
getTablePositionList(sourceElementList: IElement[]): IElementPosition[];
|
|
13
15
|
getPositionList(): IElementPosition[];
|
|
14
16
|
getMainPositionList(): IElementPosition[];
|
|
@@ -24,5 +26,6 @@ export declare class Position {
|
|
|
24
26
|
getPositionContext(): IPositionContext;
|
|
25
27
|
setPositionContext(payload: IPositionContext): void;
|
|
26
28
|
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
29
|
+
getFloatPositionByXY(payload: IGetFloatPositionByXYPayload): ICurrentPosition | void;
|
|
27
30
|
adjustPositionContext(payload: IGetPositionByXYPayload): ICurrentPosition | null;
|
|
28
31
|
}
|
|
@@ -10,10 +10,6 @@ export declare enum ControlComponent {
|
|
|
10
10
|
VALUE = "value",
|
|
11
11
|
CHECKBOX = "checkbox"
|
|
12
12
|
}
|
|
13
|
-
export declare enum ImageDisplay {
|
|
14
|
-
INLINE = "inline",
|
|
15
|
-
BLOCK = "block"
|
|
16
|
-
}
|
|
17
13
|
export declare enum ControlIndentation {
|
|
18
14
|
ROW_START = "rowStart",
|
|
19
15
|
VALUE_START = "valueStart"
|
|
@@ -4,13 +4,14 @@ import { IElement } from './interface/Element';
|
|
|
4
4
|
import { Command } from './core/command/Command';
|
|
5
5
|
import { Listener } from './core/listener/Listener';
|
|
6
6
|
import { RowFlex } from './dataset/enum/Row';
|
|
7
|
+
import { ImageDisplay } from './dataset/enum/Common';
|
|
7
8
|
import { ElementType } from './dataset/enum/Element';
|
|
8
9
|
import { Register } from './core/register/Register';
|
|
9
10
|
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu';
|
|
10
11
|
import { EditorComponent, EditorZone, EditorMode, PageMode, PaperDirection, WordBreak } from './dataset/enum/Editor';
|
|
11
12
|
import { EDITOR_COMPONENT } from './dataset/constant/Editor';
|
|
12
13
|
import { IWatermark } from './interface/Watermark';
|
|
13
|
-
import { ControlIndentation, ControlType
|
|
14
|
+
import { ControlIndentation, ControlType } from './dataset/enum/Control';
|
|
14
15
|
import { INavigateInfo } from './core/draw/interactive/Search';
|
|
15
16
|
import { KeyMap } from './dataset/enum/KeyMap';
|
|
16
17
|
import { BlockType } from './dataset/enum/Block';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ImageDisplay } from '../dataset/enum/Common';
|
|
1
2
|
import { EditorMode, EditorZone } from '../dataset/enum/Editor';
|
|
2
3
|
import { IElement, IElementPosition } from './Element';
|
|
3
4
|
import { IRow } from './Row';
|
|
@@ -27,6 +28,10 @@ export interface IDrawRowPayload {
|
|
|
27
28
|
innerWidth: number;
|
|
28
29
|
zone?: EditorZone;
|
|
29
30
|
}
|
|
31
|
+
export interface IDrawFloatPayload {
|
|
32
|
+
pageNo: number;
|
|
33
|
+
imgDisplay: ImageDisplay;
|
|
34
|
+
}
|
|
30
35
|
export interface IDrawPagePayload {
|
|
31
36
|
elementList: IElement[];
|
|
32
37
|
positionList: IElementPosition[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImageDisplay } from '../dataset/enum/Common';
|
|
2
|
+
import { ControlComponent } from '../dataset/enum/Control';
|
|
2
3
|
import { ElementType } from '../dataset/enum/Element';
|
|
3
4
|
import { ListStyle, ListType } from '../dataset/enum/List';
|
|
4
5
|
import { RowFlex } from '../dataset/enum/Row';
|
|
@@ -84,6 +85,10 @@ export interface IDateElement {
|
|
|
84
85
|
}
|
|
85
86
|
export interface IImageElement {
|
|
86
87
|
imgDisplay?: ImageDisplay;
|
|
88
|
+
imgFloatPosition?: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
};
|
|
87
92
|
}
|
|
88
93
|
export interface IBlockElement {
|
|
89
94
|
block?: IBlock;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { IElement } from '..';
|
|
1
|
+
import { IElement, ImageDisplay } from '..';
|
|
2
2
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
3
3
|
import { IElementPosition } from './Element';
|
|
4
4
|
import { IRow } from './Row';
|
|
5
5
|
import { ITd } from './table/Td';
|
|
6
6
|
export interface ICurrentPosition {
|
|
7
7
|
index: number;
|
|
8
|
+
x?: number;
|
|
9
|
+
y?: number;
|
|
8
10
|
isCheckbox?: boolean;
|
|
9
11
|
isControl?: boolean;
|
|
10
12
|
isImage?: boolean;
|
|
@@ -29,6 +31,9 @@ export interface IGetPositionByXYPayload {
|
|
|
29
31
|
elementList?: IElement[];
|
|
30
32
|
positionList?: IElementPosition[];
|
|
31
33
|
}
|
|
34
|
+
export declare type IGetFloatPositionByXYPayload = IGetPositionByXYPayload & {
|
|
35
|
+
imgDisplay: ImageDisplay;
|
|
36
|
+
};
|
|
32
37
|
export interface IPositionContext {
|
|
33
38
|
isTable: boolean;
|
|
34
39
|
isCheckbox?: boolean;
|
|
@@ -53,9 +58,24 @@ export interface IComputePageRowPositionPayload {
|
|
|
53
58
|
startX: number;
|
|
54
59
|
startY: number;
|
|
55
60
|
innerWidth: number;
|
|
61
|
+
isTable?: boolean;
|
|
62
|
+
index?: number;
|
|
63
|
+
tdIndex?: number;
|
|
64
|
+
trIndex?: number;
|
|
65
|
+
tdValueIndex?: number;
|
|
56
66
|
}
|
|
57
67
|
export interface IComputePageRowPositionResult {
|
|
58
68
|
x: number;
|
|
59
69
|
y: number;
|
|
60
70
|
index: number;
|
|
61
71
|
}
|
|
72
|
+
export interface IFloatPosition {
|
|
73
|
+
pageNo: number;
|
|
74
|
+
element: IElement;
|
|
75
|
+
position: IElementPosition;
|
|
76
|
+
isTable?: boolean;
|
|
77
|
+
index?: number;
|
|
78
|
+
tdIndex?: number;
|
|
79
|
+
trIndex?: number;
|
|
80
|
+
tdValueIndex?: number;
|
|
81
|
+
}
|
|
@@ -20,8 +20,8 @@ export interface ITd {
|
|
|
20
20
|
positionList?: IElementPosition[];
|
|
21
21
|
verticalAlign?: VerticalAlign;
|
|
22
22
|
backgroundColor?: string;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
borderTypes?: TdBorder[];
|
|
24
|
+
slashTypes?: TdSlash[];
|
|
25
25
|
mainHeight?: number;
|
|
26
26
|
realHeight?: number;
|
|
27
27
|
realMinHeight?: number;
|