@hufe921/canvas-editor 0.9.17 → 0.9.18
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/dist/canvas-editor.es.js +321 -173
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +18 -18
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +2 -2
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -2
- package/dist/src/editor/core/draw/Draw.d.ts +12 -1
- package/dist/src/editor/core/draw/particle/ImageParticle.d.ts +2 -0
- package/dist/src/editor/core/observer/ImageObserver.d.ts +7 -0
- package/dist/src/editor/core/observer/SelectionObserver.d.ts +2 -4
- package/dist/src/editor/core/position/Position.d.ts +2 -0
- package/dist/src/editor/interface/Draw.d.ts +2 -8
- package/dist/src/editor/interface/Position.d.ts +15 -0
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/dist/src/editor/utils/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -129,11 +129,11 @@ export declare class Command {
|
|
|
129
129
|
executeSearchNavigateNext(): void;
|
|
130
130
|
getSearchNavigateInfo(): null | INavigateInfo;
|
|
131
131
|
executeReplace(payload: string): void;
|
|
132
|
-
executePrint(): void
|
|
132
|
+
executePrint(): Promise<void>;
|
|
133
133
|
executeReplaceImageElement(payload: string): void;
|
|
134
134
|
executeSaveAsImageElement(): void;
|
|
135
135
|
executeChangeImageDisplay(element: IElement, display: ImageDisplay): void;
|
|
136
|
-
getImage(): string[]
|
|
136
|
+
getImage(): Promise<string[]>;
|
|
137
137
|
getValue(): IEditorResult;
|
|
138
138
|
getWordCount(): Promise<number>;
|
|
139
139
|
getRangeText(): string;
|
|
@@ -72,11 +72,11 @@ export declare class CommandAdapt {
|
|
|
72
72
|
searchNavigateNext(): void;
|
|
73
73
|
getSearchNavigateInfo(): null | INavigateInfo;
|
|
74
74
|
replace(payload: string): void;
|
|
75
|
-
print(): void
|
|
75
|
+
print(): Promise<void>;
|
|
76
76
|
replaceImageElement(payload: string): void;
|
|
77
77
|
saveAsImageElement(): void;
|
|
78
78
|
changeImageDisplay(element: IElement, display: ImageDisplay): void;
|
|
79
|
-
getImage(): string[]
|
|
79
|
+
getImage(): Promise<string[]>;
|
|
80
80
|
getValue(): IEditorResult;
|
|
81
81
|
getWordCount(): Promise<number>;
|
|
82
82
|
getRangeText(): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IDrawOption, IPainterOptions } from '../../interface/Draw';
|
|
2
2
|
import { IEditorOption, IEditorResult } from '../../interface/Editor';
|
|
3
3
|
import { IElement, IElementStyle } from '../../interface/Element';
|
|
4
|
+
import { IRow } from '../../interface/Row';
|
|
4
5
|
import { Cursor } from '../cursor/Cursor';
|
|
5
6
|
import { CanvasEvent } from '../event/CanvasEvent';
|
|
6
7
|
import { HistoryManager } from '../history/HistoryManager';
|
|
@@ -19,6 +20,7 @@ import { Previewer } from './particle/previewer/Previewer';
|
|
|
19
20
|
import { DateParticle } from './particle/date/DateParticle';
|
|
20
21
|
import { IMargin } from '../../interface/Margin';
|
|
21
22
|
import { I18n } from '../i18n/I18n';
|
|
23
|
+
import { ImageObserver } from '../observer/ImageObserver';
|
|
22
24
|
export declare class Draw {
|
|
23
25
|
private container;
|
|
24
26
|
private pageContainer;
|
|
@@ -63,11 +65,14 @@ export declare class Draw {
|
|
|
63
65
|
private workerManager;
|
|
64
66
|
private scrollObserver;
|
|
65
67
|
private selectionObserver;
|
|
68
|
+
private imageObserver;
|
|
66
69
|
private rowList;
|
|
70
|
+
private pageRowList;
|
|
67
71
|
private painterStyle;
|
|
68
72
|
private painterOptions;
|
|
69
73
|
private visiblePageNoList;
|
|
70
74
|
private intersectionPageNo;
|
|
75
|
+
private lazyRenderIntersectionObserver;
|
|
71
76
|
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, elementList: IElement[], listener: Listener);
|
|
72
77
|
getMode(): EditorMode;
|
|
73
78
|
setMode(payload: EditorMode): void;
|
|
@@ -96,6 +101,8 @@ export declare class Draw {
|
|
|
96
101
|
setPageNo(payload: number): void;
|
|
97
102
|
getPage(): HTMLCanvasElement;
|
|
98
103
|
getPageList(): HTMLCanvasElement[];
|
|
104
|
+
getRowList(): IRow[];
|
|
105
|
+
getPageRowList(): IRow[][];
|
|
99
106
|
getCtx(): CanvasRenderingContext2D;
|
|
100
107
|
getOptions(): DeepRequired<IEditorOption>;
|
|
101
108
|
getSearch(): Search;
|
|
@@ -115,9 +122,10 @@ export declare class Draw {
|
|
|
115
122
|
getDateParticle(): DateParticle;
|
|
116
123
|
getControl(): Control;
|
|
117
124
|
getWorkerManager(): WorkerManager;
|
|
125
|
+
getImageObserver(): ImageObserver;
|
|
118
126
|
getI18n(): I18n;
|
|
119
127
|
getRowCount(): number;
|
|
120
|
-
getDataURL(): string[]
|
|
128
|
+
getDataURL(): Promise<string[]>;
|
|
121
129
|
getPainterStyle(): IElementStyle | null;
|
|
122
130
|
getPainterOptions(): IPainterOptions | null;
|
|
123
131
|
setPainterStyle(payload: IElementStyle | null, options?: IPainterOptions): void;
|
|
@@ -134,10 +142,13 @@ export declare class Draw {
|
|
|
134
142
|
private _createPage;
|
|
135
143
|
private _getFont;
|
|
136
144
|
private _computeRowList;
|
|
145
|
+
private _computePageList;
|
|
137
146
|
private _drawRichText;
|
|
138
147
|
private _drawRow;
|
|
139
148
|
private _clearPage;
|
|
140
149
|
private _drawPage;
|
|
150
|
+
private _lazyRender;
|
|
151
|
+
private _immediateRender;
|
|
141
152
|
render(payload?: IDrawOption): void;
|
|
142
153
|
destroy(): void;
|
|
143
154
|
}
|
|
@@ -2,8 +2,10 @@ import { IEditorOption } from '../../../interface/Editor';
|
|
|
2
2
|
import { IElement } from '../../../interface/Element';
|
|
3
3
|
import { Draw } from '../Draw';
|
|
4
4
|
export declare class ImageParticle {
|
|
5
|
+
private draw;
|
|
5
6
|
protected options: Required<IEditorOption>;
|
|
6
7
|
protected imageCache: Map<string, HTMLImageElement>;
|
|
7
8
|
constructor(draw: Draw);
|
|
9
|
+
protected addImageObserver(promise: Promise<unknown>): void;
|
|
8
10
|
render(ctx: CanvasRenderingContext2D, element: IElement, x: number, y: number): void;
|
|
9
11
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export declare class SelectionObserver {
|
|
2
|
-
private
|
|
2
|
+
private readonly step;
|
|
3
|
+
private readonly thresholdPoints;
|
|
3
4
|
private requestAnimationFrameId;
|
|
4
|
-
private tippingPoints;
|
|
5
5
|
private isMousedown;
|
|
6
6
|
private isMoving;
|
|
7
|
-
private clientWidth;
|
|
8
|
-
private clientHeight;
|
|
9
7
|
constructor();
|
|
10
8
|
private _addEvent;
|
|
11
9
|
removeEvent(): void;
|
|
@@ -11,6 +11,8 @@ export declare class Position {
|
|
|
11
11
|
getOriginalPositionList(): IElementPosition[];
|
|
12
12
|
getPositionList(): IElementPosition[];
|
|
13
13
|
setPositionList(payload: IElementPosition[]): void;
|
|
14
|
+
private computePageRowPosition;
|
|
15
|
+
computePositionList(): void;
|
|
14
16
|
setCursorPosition(position: IElementPosition | null): void;
|
|
15
17
|
getCursorPosition(): IElementPosition | null;
|
|
16
18
|
getPositionContext(): IPositionContext;
|
|
@@ -4,7 +4,8 @@ export interface IDrawOption {
|
|
|
4
4
|
curIndex?: number;
|
|
5
5
|
isSetCursor?: boolean;
|
|
6
6
|
isSubmitHistory?: boolean;
|
|
7
|
-
|
|
7
|
+
isCompute?: boolean;
|
|
8
|
+
isLazy?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export interface IDrawImagePayload {
|
|
10
11
|
width: number;
|
|
@@ -16,15 +17,8 @@ export interface IDrawRowPayload {
|
|
|
16
17
|
rowList: IRow[];
|
|
17
18
|
pageNo: number;
|
|
18
19
|
startIndex: number;
|
|
19
|
-
startX: number;
|
|
20
|
-
startY: number;
|
|
21
20
|
innerWidth: number;
|
|
22
21
|
}
|
|
23
|
-
export interface IDrawRowResult {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
index: number;
|
|
27
|
-
}
|
|
28
22
|
export interface IPainterOptions {
|
|
29
23
|
isDblclick: boolean;
|
|
30
24
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IElement } from '..';
|
|
2
2
|
import { IElementPosition } from './Element';
|
|
3
|
+
import { IRow } from './Row';
|
|
3
4
|
import { ITd } from './table/Td';
|
|
4
5
|
export interface ICurrentPosition {
|
|
5
6
|
index: number;
|
|
@@ -35,3 +36,17 @@ export interface IPositionContext {
|
|
|
35
36
|
trId?: string;
|
|
36
37
|
tableId?: string;
|
|
37
38
|
}
|
|
39
|
+
export interface IComputePageRowPositionPayload {
|
|
40
|
+
positionList: IElementPosition[];
|
|
41
|
+
rowList: IRow[];
|
|
42
|
+
pageNo: number;
|
|
43
|
+
startIndex: number;
|
|
44
|
+
startX: number;
|
|
45
|
+
startY: number;
|
|
46
|
+
innerWidth: number;
|
|
47
|
+
}
|
|
48
|
+
export interface IComputePageRowPositionResult {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
index: number;
|
|
52
|
+
}
|
|
@@ -9,3 +9,4 @@ export declare function threeClick(dom: HTMLElement, fn: (evt: MouseEvent) => an
|
|
|
9
9
|
export declare function isObject(type: unknown): type is Record<string, unknown>;
|
|
10
10
|
export declare function isArray(type: unknown): type is Array<unknown>;
|
|
11
11
|
export declare function mergeObject<T>(source: T, target: T): T;
|
|
12
|
+
export declare function nextTick(fn: Function): void;
|