@hufe921/canvas-editor 0.9.10 → 0.9.12
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/README.md +8 -6
- package/dist/canvas-editor.es.js +856 -501
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +16 -16
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/event/CanvasEvent.d.ts +18 -14
- package/dist/src/editor/core/event/GlobalEvent.d.ts +1 -1
- package/dist/src/editor/core/event/handlers/click.d.ts +8 -0
- package/dist/src/editor/core/event/handlers/composition.d.ts +8 -0
- package/dist/src/editor/core/event/handlers/copy.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/cut.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/drag.d.ts +6 -0
- package/dist/src/editor/core/event/handlers/drop.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/input.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/keydown.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mousedown.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mouseleave.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mousemove.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mouseup.d.ts +2 -0
- package/dist/src/editor/core/position/Position.d.ts +1 -0
- package/dist/src/editor/core/range/RangeManager.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -1
- package/package.json +8 -3
|
@@ -1,29 +1,32 @@
|
|
|
1
|
+
import { IElement, IElementPosition } from '../../interface/Element';
|
|
2
|
+
import { ICurrentPosition } from '../../interface/Position';
|
|
1
3
|
import { Draw } from '../draw/Draw';
|
|
4
|
+
import { IRange } from '../../interface/Range';
|
|
2
5
|
export declare class CanvasEvent {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
isAllowSelection: boolean;
|
|
7
|
+
isCompositing: boolean;
|
|
8
|
+
isAllowDrag: boolean;
|
|
9
|
+
isAllowDrop: boolean;
|
|
10
|
+
cacheRange: IRange | null;
|
|
11
|
+
cacheElementList: IElement[] | null;
|
|
12
|
+
cachePositionList: IElementPosition[] | null;
|
|
13
|
+
mouseDownStartPosition: ICurrentPosition | null;
|
|
6
14
|
private draw;
|
|
7
|
-
private options;
|
|
8
15
|
private pageContainer;
|
|
9
16
|
private pageList;
|
|
10
|
-
private position;
|
|
11
17
|
private range;
|
|
12
|
-
private
|
|
13
|
-
private historyManager;
|
|
14
|
-
private previewer;
|
|
15
|
-
private tableTool;
|
|
16
|
-
private hyperlinkParticle;
|
|
17
|
-
private dateParticle;
|
|
18
|
-
private listener;
|
|
19
|
-
private control;
|
|
18
|
+
private position;
|
|
20
19
|
constructor(draw: Draw);
|
|
20
|
+
getDraw(): Draw;
|
|
21
21
|
register(): void;
|
|
22
|
+
setIsAllowSelection(payload: boolean): void;
|
|
22
23
|
setIsAllowDrag(payload: boolean): void;
|
|
23
24
|
clearPainterStyle(): void;
|
|
24
25
|
applyPainterStyle(): void;
|
|
26
|
+
selectAll(): void;
|
|
25
27
|
mousemove(evt: MouseEvent): void;
|
|
26
28
|
mousedown(evt: MouseEvent): void;
|
|
29
|
+
mouseup(evt: MouseEvent): void;
|
|
27
30
|
mouseleave(evt: MouseEvent): void;
|
|
28
31
|
keydown(evt: KeyboardEvent): void;
|
|
29
32
|
dblclick(): void;
|
|
@@ -31,7 +34,8 @@ export declare class CanvasEvent {
|
|
|
31
34
|
input(data: string): void;
|
|
32
35
|
cut(): void;
|
|
33
36
|
copy(): void;
|
|
34
|
-
selectAll(): void;
|
|
35
37
|
compositionstart(): void;
|
|
36
38
|
compositionend(): void;
|
|
39
|
+
drop(evt: DragEvent): void;
|
|
40
|
+
dragover(evt: DragEvent | MouseEvent): void;
|
|
37
41
|
}
|
|
@@ -17,7 +17,7 @@ export declare class GlobalEvent {
|
|
|
17
17
|
private addEvent;
|
|
18
18
|
removeEvent(): void;
|
|
19
19
|
recoverEffect: (evt: Event) => void;
|
|
20
|
-
|
|
20
|
+
setCanvasEventAbility: () => void;
|
|
21
21
|
setRangeStyle: () => void;
|
|
22
22
|
setPageScale: (evt: WheelEvent) => void;
|
|
23
23
|
private _handleVisibilityChange;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CanvasEvent } from '../CanvasEvent';
|
|
2
|
+
declare function dblclick(host: CanvasEvent): void;
|
|
3
|
+
declare function threeClick(host: CanvasEvent): void;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
dblclick: typeof dblclick;
|
|
6
|
+
threeClick: typeof threeClick;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CanvasEvent } from '../CanvasEvent';
|
|
2
|
+
declare function compositionstart(host: CanvasEvent): void;
|
|
3
|
+
declare function compositionend(host: CanvasEvent): void;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
compositionstart: typeof compositionstart;
|
|
6
|
+
compositionend: typeof compositionend;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -16,4 +16,5 @@ export declare class Position {
|
|
|
16
16
|
getPositionContext(): IPositionContext;
|
|
17
17
|
setPositionContext(payload: IPositionContext): void;
|
|
18
18
|
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
19
|
+
adjustPositionContext(payload: Pick<IGetPositionByXYPayload, 'x' | 'y'>): ICurrentPosition;
|
|
19
20
|
}
|
|
@@ -12,6 +12,7 @@ export declare class RangeManager {
|
|
|
12
12
|
getRange(): IRange;
|
|
13
13
|
getSelection(): IElement[] | null;
|
|
14
14
|
getRangeRow(): RangeRowMap | null;
|
|
15
|
+
getIsPointInRange(x: number, y: number): boolean;
|
|
15
16
|
setRange(startIndex: number, endIndex: number, tableId?: string, startTdIndex?: number, endTdIndex?: number, startTrIndex?: number, endTrIndex?: number): void;
|
|
16
17
|
setRangeStyle(): void;
|
|
17
18
|
recoveryRangeStyle(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElementType } from '../enum/Element';
|
|
2
2
|
import { IElement } from '../../interface/Element';
|
|
3
|
-
export declare const EDITOR_ELEMENT_STYLE_ATTR:
|
|
3
|
+
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[];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@hufe921/canvas-editor",
|
|
3
3
|
"author": "Hufe",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.12",
|
|
6
6
|
"description": "rich text editor by canvas/svg",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -39,7 +39,10 @@
|
|
|
39
39
|
"lint": "eslint .",
|
|
40
40
|
"cypress:open": "cypress open",
|
|
41
41
|
"cypress:run": "cypress run",
|
|
42
|
-
"type:check": "tsc --noEmit"
|
|
42
|
+
"type:check": "tsc --noEmit",
|
|
43
|
+
"docs:dev": "vitepress dev docs",
|
|
44
|
+
"docs:build": "vitepress build docs",
|
|
45
|
+
"docs:preview": "vitepress preview docs"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
48
|
"@rollup/plugin-typescript": "^10.0.1",
|
|
@@ -52,7 +55,9 @@
|
|
|
52
55
|
"eslint": "7.32.0",
|
|
53
56
|
"typescript": "^4.3.2",
|
|
54
57
|
"vite": "^2.4.2",
|
|
55
|
-
"vite-plugin-css-injected-by-js": "^2.1.1"
|
|
58
|
+
"vite-plugin-css-injected-by-js": "^2.1.1",
|
|
59
|
+
"vitepress": "^1.0.0-alpha.33",
|
|
60
|
+
"vue": "^3.2.45"
|
|
56
61
|
},
|
|
57
62
|
"dependencies": {
|
|
58
63
|
"prismjs": "^1.27.0"
|