@hufe921/canvas-editor 0.9.133 → 0.9.135
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 +45 -0
- package/README.md +166 -53
- package/dist/assets/{catalog-Cno2frQt.js.map → catalog-B-cbxN0s.js.map} +1 -1
- package/dist/assets/{group-Bz5rW3In.js.map → group-BZtj1M7o.js.map} +1 -1
- package/dist/assets/value-By4_Dx3W.js.map +1 -0
- package/dist/assets/{wordCount-C2BnvS6l.js.map → wordCount-Osi0e4qK.js.map} +1 -1
- package/dist/canvas-editor.js +1446 -1204
- package/dist/canvas-editor.js.map +1 -1
- package/dist/canvas-editor.umd.cjs +31 -31
- package/dist/canvas-editor.umd.cjs.map +1 -1
- package/dist/src/editor/core/accessibility/Accessibility.d.ts +14 -0
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/interactive/Search.d.ts +2 -1
- package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +25 -0
- package/dist/src/editor/core/position/Position.d.ts +5 -0
- package/dist/src/editor/dataset/constant/Accessibility.d.ts +2 -0
- package/dist/src/editor/dataset/enum/DatePicker.d.ts +5 -0
- package/dist/src/editor/interface/Accessibility.d.ts +3 -0
- package/dist/src/editor/interface/Editor.d.ts +3 -0
- package/dist/src/editor/interface/EventBus.d.ts +2 -1
- package/dist/src/editor/interface/Listener.d.ts +2 -0
- package/dist/src/editor/interface/Position.d.ts +1 -0
- package/dist/src/editor/interface/i18n/Accessibility.d.ts +4 -0
- package/dist/src/editor/interface/i18n/I18n.d.ts +2 -0
- package/package.json +13 -13
- package/dist/assets/value-CEZhhW6y.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Draw } from '../draw/Draw';
|
|
2
|
+
export declare class Accessibility {
|
|
3
|
+
private draw;
|
|
4
|
+
private i18n;
|
|
5
|
+
private disabled;
|
|
6
|
+
private assertiveDom;
|
|
7
|
+
private rangeChangeHandler;
|
|
8
|
+
constructor(draw: Draw);
|
|
9
|
+
private handleRangeChange;
|
|
10
|
+
selection(): void;
|
|
11
|
+
input(data: string): void;
|
|
12
|
+
assertive(message: string): void;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
}
|
|
@@ -42,6 +42,7 @@ import { Area } from './interactive/Area';
|
|
|
42
42
|
import { Badge } from './frame/Badge';
|
|
43
43
|
import { Graffiti } from './graffiti/Graffiti';
|
|
44
44
|
import { Magnifier } from './interactive/Magnifier';
|
|
45
|
+
import { Accessibility } from '../accessibility/Accessibility';
|
|
45
46
|
export declare class Draw {
|
|
46
47
|
private container;
|
|
47
48
|
private pageContainer;
|
|
@@ -107,6 +108,7 @@ export declare class Draw {
|
|
|
107
108
|
private selectionObserver;
|
|
108
109
|
private imageObserver;
|
|
109
110
|
private graffiti;
|
|
111
|
+
private accessibility;
|
|
110
112
|
private LETTER_REG;
|
|
111
113
|
private WORD_LIKE_REG;
|
|
112
114
|
private rowList;
|
|
@@ -212,6 +214,7 @@ export declare class Draw {
|
|
|
212
214
|
getImageObserver(): ImageObserver;
|
|
213
215
|
getI18n(): I18n;
|
|
214
216
|
getGraffiti(): Graffiti;
|
|
217
|
+
getAccessibility(): Accessibility;
|
|
215
218
|
getRowCount(): number;
|
|
216
219
|
getDataURL(payload?: IGetImageOption): Promise<string[]>;
|
|
217
220
|
getPainterStyle(): IElementStyle | null;
|
|
@@ -17,10 +17,11 @@ export declare class Search {
|
|
|
17
17
|
constructor(draw: Draw);
|
|
18
18
|
getSearchKeyword(): string | null;
|
|
19
19
|
setSearchKeyword(payload: string | null, options?: ISearchOption): void;
|
|
20
|
+
private getSearchMatchGroupStartIndex;
|
|
20
21
|
searchNavigatePre(): number | null;
|
|
21
22
|
searchNavigateNext(): number | null;
|
|
22
23
|
searchNavigateScrollIntoView(position: IElementPosition): void;
|
|
23
|
-
getSearchNavigateIndexList():
|
|
24
|
+
getSearchNavigateIndexList(): number[];
|
|
24
25
|
getSearchMatchList(): ISearchResult[];
|
|
25
26
|
getSearchNavigateInfo(): null | INavigateInfo;
|
|
26
27
|
getMatchList(payload: string, originalElementList: IElement[]): ISearchResult[];
|
|
@@ -16,6 +16,20 @@ export interface IDatePickerLang {
|
|
|
16
16
|
};
|
|
17
17
|
year: string;
|
|
18
18
|
month: string;
|
|
19
|
+
months: {
|
|
20
|
+
jan: string;
|
|
21
|
+
feb: string;
|
|
22
|
+
mar: string;
|
|
23
|
+
apr: string;
|
|
24
|
+
may: string;
|
|
25
|
+
jun: string;
|
|
26
|
+
jul: string;
|
|
27
|
+
aug: string;
|
|
28
|
+
sep: string;
|
|
29
|
+
oct: string;
|
|
30
|
+
nov: string;
|
|
31
|
+
dec: string;
|
|
32
|
+
};
|
|
19
33
|
hour: string;
|
|
20
34
|
minute: string;
|
|
21
35
|
second: string;
|
|
@@ -37,15 +51,24 @@ export declare class DatePicker {
|
|
|
37
51
|
private isDatePicker;
|
|
38
52
|
private pickDate;
|
|
39
53
|
private lang;
|
|
54
|
+
private datePickerType;
|
|
55
|
+
private viewMode;
|
|
56
|
+
private yearPageStart;
|
|
40
57
|
constructor(draw: Draw, options?: IDatePickerOption);
|
|
41
58
|
private _createDom;
|
|
42
59
|
private _bindEvent;
|
|
43
60
|
private _setPosition;
|
|
44
61
|
isInvalidDate(value: Date): boolean;
|
|
45
62
|
private _setValue;
|
|
63
|
+
private _getDatePickerType;
|
|
46
64
|
private _getLang;
|
|
47
65
|
private _setLangChange;
|
|
48
66
|
private _update;
|
|
67
|
+
private _updateTitleVisibility;
|
|
68
|
+
private _updateDateView;
|
|
69
|
+
private _updateYearView;
|
|
70
|
+
private _updateMonthView;
|
|
71
|
+
private _switchView;
|
|
49
72
|
private _toggleDateTimePicker;
|
|
50
73
|
private _setDatePick;
|
|
51
74
|
private _setTimePick;
|
|
@@ -53,6 +76,8 @@ export declare class DatePicker {
|
|
|
53
76
|
private _nextMonth;
|
|
54
77
|
private _preYear;
|
|
55
78
|
private _nextYear;
|
|
79
|
+
private _preYearPage;
|
|
80
|
+
private _nextYearPage;
|
|
56
81
|
private _now;
|
|
57
82
|
private _toggleVisible;
|
|
58
83
|
private _submit;
|
|
@@ -20,6 +20,11 @@ export declare class Position {
|
|
|
20
20
|
getSelectionPositionList(): IElementPosition[] | null;
|
|
21
21
|
setPositionList(payload: IElementPosition[]): void;
|
|
22
22
|
setFloatPositionList(payload: IFloatPosition[]): void;
|
|
23
|
+
getFloatPositionByElement(element: IElement): IFloatPosition | null;
|
|
24
|
+
getFloatPositionCoordinate(floatPosition: IFloatPosition): {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
};
|
|
23
28
|
computePageRowPosition(payload: IComputePageRowPositionPayload): IComputePageRowPositionResult;
|
|
24
29
|
computePositionList(): void;
|
|
25
30
|
computeRowPosition(payload: IComputeRowPositionPayload): IElementPosition[];
|
|
@@ -28,6 +28,7 @@ import { IRange } from './Range';
|
|
|
28
28
|
import { IGraffitiData, IGraffitiOption } from './Graffiti';
|
|
29
29
|
import { IWhiteSpaceOption } from './WhiteSpace';
|
|
30
30
|
import { IMagnifierOption } from './Magnifier';
|
|
31
|
+
import { IAccessibilityOption } from './Accessibility';
|
|
31
32
|
export interface IEditorData {
|
|
32
33
|
header?: IElement[];
|
|
33
34
|
main: IElement[];
|
|
@@ -106,6 +107,7 @@ export interface IEditorOption {
|
|
|
106
107
|
imgCaption?: IImgCaptionOption;
|
|
107
108
|
list?: IListOption;
|
|
108
109
|
magnifier?: IMagnifierOption;
|
|
110
|
+
accessibility?: IAccessibilityOption;
|
|
109
111
|
}
|
|
110
112
|
export interface IEditorResult {
|
|
111
113
|
version: string;
|
|
@@ -132,6 +134,7 @@ export interface IPrintModeRule {
|
|
|
132
134
|
imagePreviewerDisabled?: boolean;
|
|
133
135
|
backgroundDisabled?: boolean;
|
|
134
136
|
filterEmptyControl?: boolean;
|
|
137
|
+
filterHideElementRow?: boolean;
|
|
135
138
|
}
|
|
136
139
|
export interface IReadonlyModeRule {
|
|
137
140
|
imagePreviewerDisabled?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IContentChange, IControlChange, IControlContentChange, IImageDblclick, IImageMousedown, IImageSizeChange, IInputEventChange, IIntersectionPageNoChange, ILabelMousedown, IMouseEventChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IPositionContextChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange, IZoneChange } from './Listener';
|
|
1
|
+
import { IContentChange, IControlChange, IControlContentChange, IImageDblclick, IImageMousedown, IImageSizeChange, IInputEventChange, IIntersectionPageNoChange, ILabelMousedown, IMouseEventChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IPositionContextChange, IRangeChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange, IZoneChange } from './Listener';
|
|
2
2
|
export interface EventBusMap {
|
|
3
3
|
rangeStyleChange: IRangeStyleChange;
|
|
4
4
|
visiblePageNoListChange: IVisiblePageNoListChange;
|
|
@@ -23,4 +23,5 @@ export interface EventBusMap {
|
|
|
23
23
|
imageMousedown: IImageMousedown;
|
|
24
24
|
imageDblclick: IImageDblclick;
|
|
25
25
|
labelMousedown: ILabelMousedown;
|
|
26
|
+
rangeChange: IRangeChange;
|
|
26
27
|
}
|
|
@@ -7,6 +7,7 @@ import { IControlChangeResult, IControlContentChangeResult } from './Control';
|
|
|
7
7
|
import { IEditorResult } from './Editor';
|
|
8
8
|
import { IElement } from './Element';
|
|
9
9
|
import { IPositionContext } from './Position';
|
|
10
|
+
import { IRange } from './Range';
|
|
10
11
|
import { ITextDecoration } from './Text';
|
|
11
12
|
export interface IRangeStyle {
|
|
12
13
|
type: ElementType | null;
|
|
@@ -64,3 +65,4 @@ export type ILabelMousedown = (payload: {
|
|
|
64
65
|
evt: MouseEvent;
|
|
65
66
|
element: IElement;
|
|
66
67
|
}) => void;
|
|
68
|
+
export type IRangeChange = (payload: IRange) => void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IDatePickerLang } from '../../core/draw/particle/date/DatePicker';
|
|
2
2
|
import { IContextmenuLang } from '../contextmenu/ContextMenu';
|
|
3
|
+
import { IAccessibilityLang } from './Accessibility';
|
|
3
4
|
export interface ILang {
|
|
4
5
|
contextmenu: IContextmenuLang;
|
|
5
6
|
datePicker: IDatePickerLang;
|
|
7
|
+
accessibility: IAccessibilityLang;
|
|
6
8
|
}
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@hufe921/canvas-editor",
|
|
3
3
|
"author": "Hufe",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.9.
|
|
6
|
-
"description": "rich text editor
|
|
5
|
+
"version": "0.9.135",
|
|
6
|
+
"description": "A Canvas/SVG-based rich text editor",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
9
9
|
"access": "public"
|
|
@@ -50,27 +50,27 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^10.0.1",
|
|
52
52
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
53
|
-
"@types/jsdom": "^28.0.
|
|
54
|
-
"@types/node": "^24.
|
|
53
|
+
"@types/jsdom": "^28.0.3",
|
|
54
|
+
"@types/node": "^24.12.4",
|
|
55
55
|
"@types/prismjs": "^1.26.6",
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
57
|
-
"@typescript-eslint/parser": "^8.59.
|
|
58
|
-
"@vitest/coverage-v8": "^4.1.
|
|
59
|
-
"cypress": "^15.
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
57
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
58
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
59
|
+
"cypress": "^15.15.0",
|
|
60
60
|
"cypress-file-upload": "^5.0.8",
|
|
61
|
-
"eslint": "^10.
|
|
61
|
+
"eslint": "^10.4.0",
|
|
62
62
|
"globals": "^17.6.0",
|
|
63
63
|
"jsdom": "^29.1.1",
|
|
64
64
|
"simple-git-hooks": "^2.13.1",
|
|
65
65
|
"tslib": "^2.8.1",
|
|
66
66
|
"typescript": "^6.0.3",
|
|
67
|
-
"typescript-eslint": "^8.59.
|
|
68
|
-
"vite": "^8.0.
|
|
67
|
+
"typescript-eslint": "^8.59.3",
|
|
68
|
+
"vite": "^8.0.13",
|
|
69
69
|
"vite-plugin-css-injected-by-js": "^5.0.1",
|
|
70
70
|
"vitepress": "^1.6.4",
|
|
71
|
-
"vitest": "^4.1.
|
|
71
|
+
"vitest": "^4.1.6",
|
|
72
72
|
"vitest-canvas-mock": "^1.1.4",
|
|
73
|
-
"vue": "^3.5.
|
|
73
|
+
"vue": "^3.5.34"
|
|
74
74
|
},
|
|
75
75
|
"simple-git-hooks": {
|
|
76
76
|
"pre-commit": "npm run lint && npm run type:check",
|