@hufe921/canvas-editor 0.9.131 → 0.9.133
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 +53 -0
- package/README.md +1 -1
- package/dist/assets/catalog-Cno2frQt.js.map +1 -0
- package/dist/assets/group-Bz5rW3In.js.map +1 -0
- package/dist/assets/value-CEZhhW6y.js.map +1 -0
- package/dist/assets/wordCount-C2BnvS6l.js.map +1 -0
- package/dist/canvas-editor.js +17218 -0
- package/dist/canvas-editor.js.map +1 -0
- package/dist/canvas-editor.umd.cjs +76 -0
- package/dist/canvas-editor.umd.cjs.map +1 -0
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/interactive/Magnifier.d.ts +19 -0
- package/dist/src/editor/core/event/GlobalEvent.d.ts +1 -0
- package/dist/src/editor/core/observer/SelectionObserver.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Editor.d.ts +1 -1
- package/dist/src/editor/dataset/constant/Magnifier.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Area.d.ts +2 -2
- package/dist/src/editor/dataset/enum/Control.d.ts +1 -1
- package/dist/src/editor/dataset/enum/Editor.d.ts +6 -6
- package/dist/src/editor/dataset/enum/KeyMap.d.ts +1 -0
- package/dist/src/editor/dataset/enum/List.d.ts +3 -3
- package/dist/src/editor/dataset/enum/table/Table.d.ts +1 -1
- package/dist/src/editor/interface/Editor.d.ts +2 -0
- package/dist/src/editor/interface/Magnifier.d.ts +6 -0
- package/dist/src/editor/utils/element.d.ts +1 -1
- package/package.json +33 -24
- package/dist/canvas-editor.es.js +0 -25199
- package/dist/canvas-editor.es.js.map +0 -1
- package/dist/canvas-editor.umd.js +0 -102
- package/dist/canvas-editor.umd.js.map +0 -1
|
@@ -41,6 +41,7 @@ import { TableOperate } from './particle/table/TableOperate';
|
|
|
41
41
|
import { Area } from './interactive/Area';
|
|
42
42
|
import { Badge } from './frame/Badge';
|
|
43
43
|
import { Graffiti } from './graffiti/Graffiti';
|
|
44
|
+
import { Magnifier } from './interactive/Magnifier';
|
|
44
45
|
export declare class Draw {
|
|
45
46
|
private container;
|
|
46
47
|
private pageContainer;
|
|
@@ -65,6 +66,7 @@ export declare class Draw {
|
|
|
65
66
|
private margin;
|
|
66
67
|
private background;
|
|
67
68
|
private badge;
|
|
69
|
+
private magnifier;
|
|
68
70
|
private search;
|
|
69
71
|
private group;
|
|
70
72
|
private area;
|
|
@@ -168,6 +170,7 @@ export declare class Draw {
|
|
|
168
170
|
getGroup(): Group;
|
|
169
171
|
getArea(): Area;
|
|
170
172
|
getBadge(): Badge;
|
|
173
|
+
getMagnifier(): Magnifier;
|
|
171
174
|
getHistoryManager(): HistoryManager;
|
|
172
175
|
getPosition(): Position;
|
|
173
176
|
getZone(): Zone;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Draw } from '../Draw';
|
|
2
|
+
export declare class Magnifier {
|
|
3
|
+
private draw;
|
|
4
|
+
private options;
|
|
5
|
+
private canvas;
|
|
6
|
+
private isActive;
|
|
7
|
+
private container;
|
|
8
|
+
constructor(draw: Draw);
|
|
9
|
+
private _createMagnifierCanvas;
|
|
10
|
+
private _addEvent;
|
|
11
|
+
private _removeEvent;
|
|
12
|
+
private _handleKeyDown;
|
|
13
|
+
private _handleKeyUp;
|
|
14
|
+
private _mousemove;
|
|
15
|
+
show(): void;
|
|
16
|
+
hide(): void;
|
|
17
|
+
private _update;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
@@ -2,5 +2,5 @@ import { DeepRequired } from '../../interface/Common';
|
|
|
2
2
|
import { IModeRule } from '../../interface/Editor';
|
|
3
3
|
export declare const EDITOR_COMPONENT = "editor-component";
|
|
4
4
|
export declare const EDITOR_PREFIX = "ce";
|
|
5
|
-
export declare const EDITOR_CLIPBOARD
|
|
5
|
+
export declare const EDITOR_CLIPBOARD = "ce-clipboard";
|
|
6
6
|
export declare const defaultModeRuleOption: Readonly<DeepRequired<IModeRule>>;
|
|
@@ -13,12 +13,12 @@ export declare enum EditorContext {
|
|
|
13
13
|
TABLE = "table"
|
|
14
14
|
}
|
|
15
15
|
export declare enum EditorMode {
|
|
16
|
-
EDIT = "edit"
|
|
17
|
-
CLEAN = "clean"
|
|
18
|
-
READONLY = "readonly"
|
|
19
|
-
FORM = "form"
|
|
20
|
-
PRINT = "print"
|
|
21
|
-
DESIGN = "design"
|
|
16
|
+
EDIT = "edit",// 编辑模式(文档可编辑、辅助元素均存在)
|
|
17
|
+
CLEAN = "clean",// 清洁模式(隐藏辅助元素)
|
|
18
|
+
READONLY = "readonly",// 只读模式(文档不可编辑)
|
|
19
|
+
FORM = "form",// 表单模式(仅控件内可编辑)
|
|
20
|
+
PRINT = "print",// 打印模式(文档不可编辑、隐藏辅助元素、选区、未书写控件及边框)
|
|
21
|
+
DESIGN = "design",// 设计模式(不可删除、只读等配置不控制)
|
|
22
22
|
GRAFFITI = "graffiti"
|
|
23
23
|
}
|
|
24
24
|
export declare enum EditorZone {
|
|
@@ -3,9 +3,9 @@ export declare enum ListType {
|
|
|
3
3
|
OL = "ol"
|
|
4
4
|
}
|
|
5
5
|
export declare enum UlStyle {
|
|
6
|
-
DISC = "disc"
|
|
7
|
-
CIRCLE = "circle"
|
|
8
|
-
SQUARE = "square"
|
|
6
|
+
DISC = "disc",// 实心圆点
|
|
7
|
+
CIRCLE = "circle",// 空心圆点
|
|
8
|
+
SQUARE = "square",// 实心方块
|
|
9
9
|
CHECKBOX = "checkbox"
|
|
10
10
|
}
|
|
11
11
|
export declare enum OlStyle {
|
|
@@ -27,6 +27,7 @@ import { LocationPosition } from '../dataset/enum/Common';
|
|
|
27
27
|
import { IRange } from './Range';
|
|
28
28
|
import { IGraffitiData, IGraffitiOption } from './Graffiti';
|
|
29
29
|
import { IWhiteSpaceOption } from './WhiteSpace';
|
|
30
|
+
import { IMagnifierOption } from './Magnifier';
|
|
30
31
|
export interface IEditorData {
|
|
31
32
|
header?: IElement[];
|
|
32
33
|
main: IElement[];
|
|
@@ -104,6 +105,7 @@ export interface IEditorOption {
|
|
|
104
105
|
label?: ILabelOption;
|
|
105
106
|
imgCaption?: IImgCaptionOption;
|
|
106
107
|
list?: IListOption;
|
|
108
|
+
magnifier?: IMagnifierOption;
|
|
107
109
|
}
|
|
108
110
|
export interface IEditorResult {
|
|
109
111
|
version: string;
|
|
@@ -22,7 +22,7 @@ interface IZipElementListOption {
|
|
|
22
22
|
}
|
|
23
23
|
export declare function zipElementList(payload: IElement[], options?: IZipElementListOption): IElement[];
|
|
24
24
|
export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
|
|
25
|
-
export declare function convertRowFlexToTextAlign(rowFlex: RowFlex): RowFlex.LEFT | RowFlex.CENTER | RowFlex.RIGHT | RowFlex.JUSTIFY
|
|
25
|
+
export declare function convertRowFlexToTextAlign(rowFlex: RowFlex): "justify" | RowFlex.LEFT | RowFlex.CENTER | RowFlex.RIGHT | RowFlex.JUSTIFY;
|
|
26
26
|
export declare function convertRowFlexToJustifyContent(rowFlex: RowFlex): "center" | "flex-start" | "flex-end" | "space-between";
|
|
27
27
|
export declare function isTextLikeElement(element: IElement): boolean;
|
|
28
28
|
export declare function isTextElement(element: IElement): boolean;
|
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.133",
|
|
6
6
|
"description": "rich text editor by canvas/svg",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"package.json"
|
|
17
17
|
],
|
|
18
18
|
"typings": "./dist/src/editor/index.d.ts",
|
|
19
|
-
"main": "./dist/canvas-editor.umd.
|
|
20
|
-
"module": "./dist/canvas-editor.
|
|
19
|
+
"main": "./dist/canvas-editor.umd.cjs",
|
|
20
|
+
"module": "./dist/canvas-editor.js",
|
|
21
21
|
"homepage": "https://github.com/Hufe921/canvas-editor",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
@@ -29,42 +29,51 @@
|
|
|
29
29
|
"wysiwyg",
|
|
30
30
|
"emr"
|
|
31
31
|
],
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=16.9.1"
|
|
34
|
-
},
|
|
35
32
|
"type": "module",
|
|
36
33
|
"scripts": {
|
|
37
34
|
"dev": "vite",
|
|
38
|
-
"lib": "
|
|
39
|
-
"build": "
|
|
35
|
+
"lib": "eslint . && tsc && vitest run && vite build --mode lib",
|
|
36
|
+
"build": "eslint . && tsc && vitest run && vite build --mode app",
|
|
40
37
|
"serve": "vite preview",
|
|
41
|
-
"lint": "eslint .",
|
|
38
|
+
"lint": "eslint . && tsc --noEmit && vitest run",
|
|
42
39
|
"cypress:open": "cypress open",
|
|
43
40
|
"cypress:run": "cypress run",
|
|
41
|
+
"test:unit": "vitest run",
|
|
42
|
+
"test:unit:watch": "vitest",
|
|
43
|
+
"test:coverage": "vitest run --coverage",
|
|
44
44
|
"type:check": "tsc --noEmit",
|
|
45
45
|
"docs:dev": "vitepress dev docs",
|
|
46
46
|
"docs:build": "vitepress build docs",
|
|
47
47
|
"docs:preview": "vitepress preview docs",
|
|
48
|
-
"release": "node scripts/release.js"
|
|
48
|
+
"pre-release": "node scripts/pre-release.js"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@types/
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
51
|
+
"@eslint/js": "^10.0.1",
|
|
52
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
53
|
+
"@types/jsdom": "^28.0.1",
|
|
54
|
+
"@types/node": "^24.0.0",
|
|
55
|
+
"@types/prismjs": "^1.26.6",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.59.1",
|
|
57
|
+
"@typescript-eslint/parser": "^8.59.1",
|
|
58
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
59
|
+
"cypress": "^15.14.2",
|
|
57
60
|
"cypress-file-upload": "^5.0.8",
|
|
58
|
-
"eslint": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
61
|
+
"eslint": "^10.3.0",
|
|
62
|
+
"globals": "^17.6.0",
|
|
63
|
+
"jsdom": "^29.1.1",
|
|
64
|
+
"simple-git-hooks": "^2.13.1",
|
|
65
|
+
"tslib": "^2.8.1",
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"typescript-eslint": "^8.59.1",
|
|
68
|
+
"vite": "^8.0.10",
|
|
69
|
+
"vite-plugin-css-injected-by-js": "^5.0.1",
|
|
70
|
+
"vitepress": "^1.6.4",
|
|
71
|
+
"vitest": "^4.1.5",
|
|
72
|
+
"vitest-canvas-mock": "^1.1.4",
|
|
73
|
+
"vue": "^3.5.33"
|
|
65
74
|
},
|
|
66
75
|
"simple-git-hooks": {
|
|
67
76
|
"pre-commit": "npm run lint && npm run type:check",
|
|
68
77
|
"commit-msg": "node scripts/verifyCommit.js"
|
|
69
78
|
}
|
|
70
|
-
}
|
|
79
|
+
}
|