@hufe921/canvas-editor 0.9.56 → 0.9.57
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 +25 -0
- package/dist/canvas-editor.es.js +252 -104
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +25 -25
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +4 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +7 -3
- package/dist/src/editor/core/draw/control/Control.d.ts +2 -1
- package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +2 -2
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +3 -3
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +3 -3
- package/dist/src/editor/core/draw/interactive/Search.d.ts +1 -0
- package/dist/src/editor/core/draw/particle/Separator.d.ts +3 -0
- package/dist/src/editor/core/draw/particle/Subscript.d.ts +1 -0
- package/dist/src/editor/core/draw/particle/Superscript.d.ts +1 -0
- package/dist/src/editor/core/range/RangeManager.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Cursor.d.ts +1 -1
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/Control.d.ts +5 -1
- package/dist/src/editor/interface/Search.d.ts +1 -0
- package/package.json +2 -2
|
@@ -7,6 +7,8 @@ export declare class Command {
|
|
|
7
7
|
executeSelectAll: CommandAdapt['selectAll'];
|
|
8
8
|
executeBackspace: CommandAdapt['backspace'];
|
|
9
9
|
executeSetRange: CommandAdapt['setRange'];
|
|
10
|
+
executeReplaceRange: CommandAdapt['replaceRange'];
|
|
11
|
+
executeSetPositionContext: CommandAdapt['setPositionContext'];
|
|
10
12
|
executeForceUpdate: CommandAdapt['forceUpdate'];
|
|
11
13
|
executeBlur: CommandAdapt['blur'];
|
|
12
14
|
executeUndo: CommandAdapt['undo'];
|
|
@@ -81,6 +83,7 @@ export declare class Command {
|
|
|
81
83
|
executeSetGroup: CommandAdapt['setGroup'];
|
|
82
84
|
executeDeleteGroup: CommandAdapt['deleteGroup'];
|
|
83
85
|
executeLocationGroup: CommandAdapt['locationGroup'];
|
|
86
|
+
executeSetZone: CommandAdapt['setZone'];
|
|
84
87
|
executeSetControlValue: CommandAdapt['setControlValue'];
|
|
85
88
|
executeSetControlExtension: CommandAdapt['setControlExtension'];
|
|
86
89
|
getCatalog: CommandAdapt['getCatalog'];
|
|
@@ -94,6 +97,7 @@ export declare class Command {
|
|
|
94
97
|
getRangeContext: CommandAdapt['getRangeContext'];
|
|
95
98
|
getRangeRow: CommandAdapt['getRangeRow'];
|
|
96
99
|
getRangeParagraph: CommandAdapt['getRangeParagraph'];
|
|
100
|
+
getKeywordRangeList: CommandAdapt['getKeywordRangeList'];
|
|
97
101
|
getPaperMargin: CommandAdapt['getPaperMargin'];
|
|
98
102
|
getSearchNavigateInfo: CommandAdapt['getSearchNavigateInfo'];
|
|
99
103
|
getLocale: CommandAdapt['getLocale'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImageDisplay } from '../../dataset/enum/Control';
|
|
2
|
-
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
2
|
+
import { EditorMode, EditorZone, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
3
|
import { ListStyle, ListType } from '../../dataset/enum/List';
|
|
4
4
|
import { RowFlex } from '../../dataset/enum/Row';
|
|
5
5
|
import { TableBorder, TdBorder, TdSlash } from '../../dataset/enum/table/Table';
|
|
@@ -13,7 +13,7 @@ import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText } f
|
|
|
13
13
|
import { IElement } from '../../interface/Element';
|
|
14
14
|
import { IPasteOption } from '../../interface/Event';
|
|
15
15
|
import { IMargin } from '../../interface/Margin';
|
|
16
|
-
import { RangeContext } from '../../interface/Range';
|
|
16
|
+
import { IRange, RangeContext } from '../../interface/Range';
|
|
17
17
|
import { IWatermark } from '../../interface/Watermark';
|
|
18
18
|
import { Draw } from '../draw/Draw';
|
|
19
19
|
import { INavigateInfo } from '../draw/interactive/Search';
|
|
@@ -36,7 +36,9 @@ export declare class CommandAdapt {
|
|
|
36
36
|
paste(payload?: IPasteOption): void;
|
|
37
37
|
selectAll(): void;
|
|
38
38
|
backspace(): void;
|
|
39
|
-
setRange(startIndex: number, endIndex: number): void;
|
|
39
|
+
setRange(startIndex: number, endIndex: number, tableId?: string, startTdIndex?: number, endTdIndex?: number, startTrIndex?: number, endTrIndex?: number): void;
|
|
40
|
+
replaceRange(range: IRange): void;
|
|
41
|
+
setPositionContext(range: IRange): void;
|
|
40
42
|
forceUpdate(options?: IForceUpdateOption): void;
|
|
41
43
|
blur(): void;
|
|
42
44
|
undo(): void;
|
|
@@ -105,6 +107,7 @@ export declare class CommandAdapt {
|
|
|
105
107
|
getRangeContext(): RangeContext | null;
|
|
106
108
|
getRangeRow(): IElement[] | null;
|
|
107
109
|
getRangeParagraph(): IElement[] | null;
|
|
110
|
+
getKeywordRangeList(payload: string): IRange[];
|
|
108
111
|
pageMode(payload: PageMode): void;
|
|
109
112
|
pageScaleRecovery(): void;
|
|
110
113
|
pageScaleMinus(): void;
|
|
@@ -127,6 +130,7 @@ export declare class CommandAdapt {
|
|
|
127
130
|
deleteGroup(groupId: string): void;
|
|
128
131
|
getGroupIds(): Promise<string[]>;
|
|
129
132
|
locationGroup(groupId: string): void;
|
|
133
|
+
setZone(zone: EditorZone): void;
|
|
130
134
|
getControlValue(payload: IGetControlValueOption): IGetControlValueResult | null;
|
|
131
135
|
setControlValue(payload: ISetControlValueOption): void;
|
|
132
136
|
setControlExtension(payload: ISetControlExtensionOption): void;
|
|
@@ -19,6 +19,7 @@ export declare class Control {
|
|
|
19
19
|
isPartRangeInControlOutside(): boolean;
|
|
20
20
|
isRangInPostfix(): boolean;
|
|
21
21
|
isRangeWithinControl(): boolean;
|
|
22
|
+
isDisabledControl(): boolean;
|
|
22
23
|
getContainer(): HTMLDivElement;
|
|
23
24
|
getElementList(): IElement[];
|
|
24
25
|
getPosition(): IElementPosition | null;
|
|
@@ -28,7 +29,7 @@ export declare class Control {
|
|
|
28
29
|
getActiveControl(): IControlInstance | null;
|
|
29
30
|
initControl(): void;
|
|
30
31
|
destroyControl(): void;
|
|
31
|
-
repaintControl(curIndex
|
|
32
|
+
repaintControl(curIndex?: number): void;
|
|
32
33
|
moveCursor(position: IControlInitOption): IMoveCursorResult;
|
|
33
34
|
removeControl(startIndex: number, context?: IControlContext): number | null;
|
|
34
35
|
removePlaceholder(startIndex: number, context?: IControlContext): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlInstance } from '../../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlInstance, IControlRuleOption } from '../../../../interface/Control';
|
|
2
2
|
import { IElement } from '../../../../interface/Element';
|
|
3
3
|
import { Control } from '../Control';
|
|
4
4
|
export declare class CheckboxControl implements IControlInstance {
|
|
@@ -9,7 +9,7 @@ export declare class CheckboxControl implements IControlInstance {
|
|
|
9
9
|
getCode(): string | null;
|
|
10
10
|
getValue(): IElement[];
|
|
11
11
|
setValue(): number;
|
|
12
|
-
setSelect(context?: IControlContext): void;
|
|
12
|
+
setSelect(codes: string[], context?: IControlContext, options?: IControlRuleOption): void;
|
|
13
13
|
keydown(evt: KeyboardEvent): number | null;
|
|
14
14
|
cut(): number;
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlInstance } from '../../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlInstance, IControlRuleOption } from '../../../../interface/Control';
|
|
2
2
|
import { IElement } from '../../../../interface/Element';
|
|
3
3
|
import { Control } from '../Control';
|
|
4
4
|
export declare class SelectControl implements IControlInstance {
|
|
@@ -13,8 +13,8 @@ export declare class SelectControl implements IControlInstance {
|
|
|
13
13
|
setValue(): number;
|
|
14
14
|
keydown(evt: KeyboardEvent): number | null;
|
|
15
15
|
cut(): number;
|
|
16
|
-
clearSelect(context?: IControlContext): number;
|
|
17
|
-
setSelect(code: string, context?: IControlContext): void;
|
|
16
|
+
clearSelect(context?: IControlContext, options?: IControlRuleOption): number;
|
|
17
|
+
setSelect(code: string, context?: IControlContext, options?: IControlRuleOption): void;
|
|
18
18
|
private _createSelectPopupDom;
|
|
19
19
|
awake(): void;
|
|
20
20
|
destroy(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlInstance } from '../../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlInstance, IControlRuleOption } from '../../../../interface/Control';
|
|
2
2
|
import { IElement } from '../../../../interface/Element';
|
|
3
3
|
import { Control } from '../Control';
|
|
4
4
|
export declare class TextControl implements IControlInstance {
|
|
@@ -7,8 +7,8 @@ export declare class TextControl implements IControlInstance {
|
|
|
7
7
|
constructor(element: IElement, control: Control);
|
|
8
8
|
getElement(): IElement;
|
|
9
9
|
getValue(): IElement[];
|
|
10
|
-
setValue(data: IElement[], context?: IControlContext): number;
|
|
11
|
-
clearValue(context?: IControlContext): number;
|
|
10
|
+
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
11
|
+
clearValue(context?: IControlContext, options?: IControlRuleOption): number;
|
|
12
12
|
keydown(evt: KeyboardEvent): number | null;
|
|
13
13
|
cut(): number;
|
|
14
14
|
}
|
|
@@ -21,6 +21,7 @@ export declare class Search {
|
|
|
21
21
|
getSearchNavigateIndexList(): any[];
|
|
22
22
|
getSearchMatchList(): ISearchResult[];
|
|
23
23
|
getSearchNavigateInfo(): null | INavigateInfo;
|
|
24
|
+
getMatchList(payload: string): ISearchResult[];
|
|
24
25
|
compute(payload: string): void;
|
|
25
26
|
render(ctx: CanvasRenderingContext2D, pageIndex: number): void;
|
|
26
27
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { IRowElement } from '../../../interface/Row';
|
|
2
|
+
import { Draw } from '../Draw';
|
|
2
3
|
export declare class SeparatorParticle {
|
|
4
|
+
private options;
|
|
5
|
+
constructor(draw: Draw);
|
|
3
6
|
render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
4
7
|
}
|
|
@@ -23,6 +23,7 @@ export declare class RangeManager {
|
|
|
23
23
|
getRangeParagraphElementList(): IElement[] | null;
|
|
24
24
|
getIsSelectAll(): boolean;
|
|
25
25
|
getIsPointInRange(x: number, y: number): boolean;
|
|
26
|
+
getKeywordRangeList(payload: string): IRange[];
|
|
26
27
|
setRange(startIndex: number, endIndex: number, tableId?: string, startTdIndex?: number, endTdIndex?: number, startTrIndex?: number, endTrIndex?: number): void;
|
|
27
28
|
replaceRange(range: IRange): void;
|
|
28
29
|
setRangeStyle(): void;
|
|
@@ -29,6 +29,7 @@ import { IRangeStyle } from './interface/Listener';
|
|
|
29
29
|
import { Override } from './core/override/Override';
|
|
30
30
|
import { LETTER_CLASS } from './dataset/constant/Common';
|
|
31
31
|
import { INTERNAL_CONTEXT_MENU_KEY } from './dataset/constant/ContextMenu';
|
|
32
|
+
import { IRange } from './interface/Range';
|
|
32
33
|
export default class Editor {
|
|
33
34
|
command: Command;
|
|
34
35
|
listener: Listener;
|
|
@@ -40,4 +41,4 @@ export default class Editor {
|
|
|
40
41
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
41
42
|
}
|
|
42
43
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak };
|
|
43
|
-
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRangeStyle };
|
|
44
|
+
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
|
|
@@ -19,6 +19,7 @@ export interface IControlCheckbox {
|
|
|
19
19
|
}
|
|
20
20
|
export interface IControlRule {
|
|
21
21
|
deletable?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export interface IControlBasic {
|
|
24
25
|
type: ControlType;
|
|
@@ -51,7 +52,7 @@ export interface IControlInitResult {
|
|
|
51
52
|
export interface IControlInstance {
|
|
52
53
|
getElement(): IElement;
|
|
53
54
|
getValue(): IElement[];
|
|
54
|
-
setValue(data: IElement[]): number;
|
|
55
|
+
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
55
56
|
keydown(evt: KeyboardEvent): number | null;
|
|
56
57
|
cut(): number;
|
|
57
58
|
}
|
|
@@ -59,6 +60,9 @@ export interface IControlContext {
|
|
|
59
60
|
range?: IRange;
|
|
60
61
|
elementList?: IElement[];
|
|
61
62
|
}
|
|
63
|
+
export interface IControlRuleOption {
|
|
64
|
+
isIgnoreDisabledRule?: boolean;
|
|
65
|
+
}
|
|
62
66
|
export interface IGetControlValueOption {
|
|
63
67
|
conceptId: string;
|
|
64
68
|
}
|
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.57",
|
|
6
6
|
"description": "rich text editor by canvas/svg",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/prismjs": "^1.26.0",
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "4.33.0",
|
|
55
55
|
"@typescript-eslint/parser": "4.33.0",
|
|
56
|
-
"cypress": "
|
|
56
|
+
"cypress": "13.6.0",
|
|
57
57
|
"cypress-file-upload": "^5.0.8",
|
|
58
58
|
"eslint": "7.32.0",
|
|
59
59
|
"simple-git-hooks": "^2.8.1",
|