@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.
@@ -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
- private isAllowDrag;
4
- private isCompositing;
5
- private mouseDownStartPosition;
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 cursor;
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
- setDragState: () => void;
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;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function copy(host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function cut(host: CanvasEvent): void;
@@ -0,0 +1,6 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ declare function dragover(evt: DragEvent | MouseEvent, host: CanvasEvent): void;
3
+ declare const _default: {
4
+ dragover: typeof dragover;
5
+ };
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function drop(evt: DragEvent, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function input(data: string, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function keydown(evt: KeyboardEvent, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function mousedown(evt: MouseEvent, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function mouseleave(evt: MouseEvent, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function mousemove(evt: MouseEvent, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../CanvasEvent';
2
+ export declare function mouseup(evt: MouseEvent, host: CanvasEvent): void;
@@ -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: string[];
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.10",
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"