@hufe921/canvas-editor 0.9.23 → 0.9.27
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 +86 -0
- package/README.md +1 -1
- package/dist/canvas-editor.es.js +477 -123
- 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/command/Command.d.ts +7 -1
- package/dist/src/editor/core/command/CommandAdapt.d.ts +5 -0
- package/dist/src/editor/core/draw/Draw.d.ts +0 -1
- package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +5 -5
- package/dist/src/editor/core/range/RangeManager.d.ts +1 -0
- package/dist/src/editor/core/zone/Zone.d.ts +4 -1
- package/dist/src/editor/dataset/constant/PageNumber.d.ts +2 -0
- package/dist/src/editor/dataset/enum/VerticalAlign.d.ts +5 -0
- package/dist/src/editor/dataset/enum/table/Table.d.ts +5 -0
- package/dist/src/editor/index.d.ts +3 -1
- package/dist/src/editor/interface/Editor.d.ts +4 -4
- package/dist/src/editor/interface/Element.d.ts +3 -1
- package/dist/src/editor/interface/Listener.d.ts +1 -0
- package/dist/src/editor/interface/PageNumber.d.ts +8 -0
- package/dist/src/editor/interface/table/Td.d.ts +2 -0
- package/package.json +8 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IElement, ImageDisplay, INavigateInfo } from '../..';
|
|
1
|
+
import { IElement, ImageDisplay, INavigateInfo, TableBorder, VerticalAlign } from '../..';
|
|
2
2
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
3
|
import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
|
|
4
4
|
import { IEditorResult } from '../../interface/Editor';
|
|
@@ -19,6 +19,7 @@ export declare class Command {
|
|
|
19
19
|
private static applyPainterStyle;
|
|
20
20
|
private static format;
|
|
21
21
|
private static font;
|
|
22
|
+
private static size;
|
|
22
23
|
private static sizeAdd;
|
|
23
24
|
private static sizeMinus;
|
|
24
25
|
private static bold;
|
|
@@ -44,6 +45,8 @@ export declare class Command {
|
|
|
44
45
|
private static deleteTable;
|
|
45
46
|
private static mergeTableCell;
|
|
46
47
|
private static cancelMergeTableCell;
|
|
48
|
+
private static tableTdVerticalAlign;
|
|
49
|
+
private static tableBorderType;
|
|
47
50
|
private static image;
|
|
48
51
|
private static hyperlink;
|
|
49
52
|
private static deleteHyperlink;
|
|
@@ -91,6 +94,7 @@ export declare class Command {
|
|
|
91
94
|
executeApplyPainterStyle(): void;
|
|
92
95
|
executeFormat(): void;
|
|
93
96
|
executeFont(payload: string): void;
|
|
97
|
+
executeSize(payload: number): void;
|
|
94
98
|
executeSizeAdd(): void;
|
|
95
99
|
executeSizeMinus(): void;
|
|
96
100
|
executeBold(): void;
|
|
@@ -116,6 +120,8 @@ export declare class Command {
|
|
|
116
120
|
executeDeleteTable(): void;
|
|
117
121
|
executeMergeTableCell(): void;
|
|
118
122
|
executeCancelMergeTableCell(): void;
|
|
123
|
+
executeTableTdVerticalAlign(payload: VerticalAlign): void;
|
|
124
|
+
executeTableBorderType(payload: TableBorder): void;
|
|
119
125
|
executeHyperlink(payload: IElement): void;
|
|
120
126
|
executeDeleteHyperlink(): void;
|
|
121
127
|
executeCancelHyperlink(): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ImageDisplay } from '../../dataset/enum/Control';
|
|
2
2
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
3
|
import { RowFlex } from '../../dataset/enum/Row';
|
|
4
|
+
import { TableBorder } from '../../dataset/enum/table/Table';
|
|
5
|
+
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
4
6
|
import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
|
|
5
7
|
import { IEditorResult } from '../../interface/Editor';
|
|
6
8
|
import { IElement } from '../../interface/Element';
|
|
@@ -35,6 +37,7 @@ export declare class CommandAdapt {
|
|
|
35
37
|
applyPainterStyle(): void;
|
|
36
38
|
format(): void;
|
|
37
39
|
font(payload: string): void;
|
|
40
|
+
size(payload: number): void;
|
|
38
41
|
sizeAdd(): void;
|
|
39
42
|
sizeMinus(): void;
|
|
40
43
|
bold(): void;
|
|
@@ -57,6 +60,8 @@ export declare class CommandAdapt {
|
|
|
57
60
|
deleteTable(): void;
|
|
58
61
|
mergeTableCell(): void;
|
|
59
62
|
cancelMergeTableCell(): void;
|
|
63
|
+
tableTdVerticalAlign(payload: VerticalAlign): void;
|
|
64
|
+
tableBorderType(payload: TableBorder): void;
|
|
60
65
|
hyperlink(payload: IElement): void;
|
|
61
66
|
getHyperlinkRange(): [number, number] | null;
|
|
62
67
|
deleteHyperlink(): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IElement } from '../../../..';
|
|
2
|
-
import { IElementPosition } from '../../../../interface/Element';
|
|
3
1
|
import { Draw } from '../../Draw';
|
|
4
2
|
export declare class TableTool {
|
|
5
|
-
private readonly
|
|
6
|
-
private
|
|
3
|
+
private readonly MIN_TD_WIDTH;
|
|
4
|
+
private readonly ROW_COL_OFFSET;
|
|
5
|
+
private readonly BORDER_VALUE;
|
|
7
6
|
private draw;
|
|
8
7
|
private canvas;
|
|
9
8
|
private options;
|
|
@@ -11,12 +10,13 @@ export declare class TableTool {
|
|
|
11
10
|
private container;
|
|
12
11
|
private toolRowContainer;
|
|
13
12
|
private toolColContainer;
|
|
13
|
+
private toolBorderContainer;
|
|
14
14
|
private anchorLine;
|
|
15
15
|
private mousedownX;
|
|
16
16
|
private mousedownY;
|
|
17
17
|
constructor(draw: Draw);
|
|
18
18
|
dispose(): void;
|
|
19
|
-
render(
|
|
19
|
+
render(): void;
|
|
20
20
|
private _mousedown;
|
|
21
21
|
private _mousemove;
|
|
22
22
|
}
|
|
@@ -12,6 +12,7 @@ export declare class RangeManager {
|
|
|
12
12
|
getRange(): IRange;
|
|
13
13
|
clearRange(): void;
|
|
14
14
|
getSelection(): IElement[] | null;
|
|
15
|
+
getTextLikeSelection(): IElement[] | null;
|
|
15
16
|
getRangeRow(): RangeRowMap | null;
|
|
16
17
|
getIsPointInRange(x: number, y: number): boolean;
|
|
17
18
|
setRange(startIndex: number, endIndex: number, tableId?: string, startTdIndex?: number, endTdIndex?: number, startTrIndex?: number, endTrIndex?: number): void;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { EditorZone } from '../../dataset/enum/Editor';
|
|
2
2
|
import { Draw } from '../draw/Draw';
|
|
3
3
|
export declare class Zone {
|
|
4
|
+
private readonly INDICATOR_TITLE_TRANSLATE;
|
|
4
5
|
private draw;
|
|
6
|
+
private options;
|
|
7
|
+
private i18n;
|
|
5
8
|
private container;
|
|
6
9
|
private currentZone;
|
|
7
10
|
private headerIndicatorContainer;
|
|
@@ -10,6 +13,6 @@ export declare class Zone {
|
|
|
10
13
|
isMainActive(): boolean;
|
|
11
14
|
getZone(): EditorZone;
|
|
12
15
|
setZone(payload: EditorZone): void;
|
|
13
|
-
|
|
16
|
+
drawHeaderZoneIndicator(): void;
|
|
14
17
|
private _clearHeaderZoneIndicator;
|
|
15
18
|
}
|
|
@@ -16,6 +16,8 @@ import { KeyMap } from './dataset/enum/KeyMap';
|
|
|
16
16
|
import { BlockType } from './dataset/enum/Block';
|
|
17
17
|
import { IBlock } from './interface/Block';
|
|
18
18
|
import { ILang } from './interface/i18n/I18n';
|
|
19
|
+
import { VerticalAlign } from './dataset/enum/VerticalAlign';
|
|
20
|
+
import { TableBorder } from './dataset/enum/table/Table';
|
|
19
21
|
export default class Editor {
|
|
20
22
|
command: Command;
|
|
21
23
|
listener: Listener;
|
|
@@ -23,5 +25,5 @@ export default class Editor {
|
|
|
23
25
|
destroy: Function;
|
|
24
26
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
25
27
|
}
|
|
26
|
-
export { Editor, RowFlex, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection };
|
|
28
|
+
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder };
|
|
27
29
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang };
|
|
@@ -5,6 +5,7 @@ import { IControlOption } from './Control';
|
|
|
5
5
|
import { ICursorOption } from './Cursor';
|
|
6
6
|
import { IHeader } from './Header';
|
|
7
7
|
import { IMargin } from './Margin';
|
|
8
|
+
import { IPageNumber } from './PageNumber';
|
|
8
9
|
import { IWatermark } from './Watermark';
|
|
9
10
|
export interface IEditorData {
|
|
10
11
|
header?: IElement[];
|
|
@@ -16,6 +17,8 @@ export interface IEditorOption {
|
|
|
16
17
|
defaultType?: string;
|
|
17
18
|
defaultFont?: string;
|
|
18
19
|
defaultSize?: number;
|
|
20
|
+
minSize?: number;
|
|
21
|
+
maxSize?: number;
|
|
19
22
|
defaultBasicRowMarginHeight?: number;
|
|
20
23
|
defaultRowMargin?: number;
|
|
21
24
|
defaultTabWidth?: number;
|
|
@@ -23,9 +26,6 @@ export interface IEditorOption {
|
|
|
23
26
|
height?: number;
|
|
24
27
|
scale?: number;
|
|
25
28
|
pageGap?: number;
|
|
26
|
-
pageNumberBottom?: number;
|
|
27
|
-
pageNumberSize?: number;
|
|
28
|
-
pageNumberFont?: string;
|
|
29
29
|
underlineColor?: string;
|
|
30
30
|
strikeoutColor?: string;
|
|
31
31
|
rangeColor?: string;
|
|
@@ -44,10 +44,10 @@ export interface IEditorOption {
|
|
|
44
44
|
tdPadding?: number;
|
|
45
45
|
defaultTdHeight?: number;
|
|
46
46
|
defaultHyperlinkColor?: string;
|
|
47
|
-
headerTop?: number;
|
|
48
47
|
paperDirection?: PaperDirection;
|
|
49
48
|
inactiveAlpha?: number;
|
|
50
49
|
header?: IHeader;
|
|
50
|
+
pageNumber?: IPageNumber;
|
|
51
51
|
watermark?: IWatermark;
|
|
52
52
|
control?: IControlOption;
|
|
53
53
|
checkbox?: ICheckboxOption;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ControlComponent, ImageDisplay } from '../dataset/enum/Control';
|
|
2
2
|
import { ElementType } from '../dataset/enum/Element';
|
|
3
3
|
import { RowFlex } from '../dataset/enum/Row';
|
|
4
|
+
import { TableBorder } from '../dataset/enum/table/Table';
|
|
4
5
|
import { IBlock } from './Block';
|
|
5
6
|
import { ICheckbox } from './Checkbox';
|
|
6
7
|
import { IControl } from './Control';
|
|
@@ -29,18 +30,19 @@ export interface IElementStyle {
|
|
|
29
30
|
export interface ITableAttr {
|
|
30
31
|
colgroup?: IColgroup[];
|
|
31
32
|
trList?: ITr[];
|
|
33
|
+
borderType?: TableBorder;
|
|
32
34
|
}
|
|
33
35
|
export interface ITableElement {
|
|
34
36
|
tdId?: string;
|
|
35
37
|
trId?: string;
|
|
36
38
|
tableId?: string;
|
|
37
39
|
}
|
|
40
|
+
export declare type ITable = ITableAttr & ITableElement;
|
|
38
41
|
export interface IHyperlinkElement {
|
|
39
42
|
valueList?: IElement[];
|
|
40
43
|
url?: string;
|
|
41
44
|
hyperlinkId?: string;
|
|
42
45
|
}
|
|
43
|
-
export declare type ITable = ITableAttr & ITableElement;
|
|
44
46
|
export interface ISuperscriptSubscript {
|
|
45
47
|
actualSize?: number;
|
|
46
48
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
1
2
|
import { IElement, IElementPosition } from '../Element';
|
|
2
3
|
import { IRow } from '../Row';
|
|
3
4
|
export interface ITd {
|
|
@@ -16,4 +17,5 @@ export interface ITd {
|
|
|
16
17
|
colIndex?: number;
|
|
17
18
|
rowList?: IRow[];
|
|
18
19
|
positionList?: IElementPosition[];
|
|
20
|
+
verticalAlign?: VerticalAlign;
|
|
19
21
|
}
|
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.27",
|
|
6
6
|
"description": "rich text editor by canvas/svg",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=12.0.0"
|
|
34
34
|
},
|
|
35
|
+
"type": "module",
|
|
35
36
|
"scripts": {
|
|
36
37
|
"dev": "vite",
|
|
37
38
|
"lib": "npm run lint && tsc && vite build --mode lib",
|
|
@@ -43,7 +44,8 @@
|
|
|
43
44
|
"type:check": "tsc --noEmit",
|
|
44
45
|
"docs:dev": "vitepress dev docs",
|
|
45
46
|
"docs:build": "vitepress build docs",
|
|
46
|
-
"docs:preview": "vitepress preview docs"
|
|
47
|
+
"docs:preview": "vitepress preview docs",
|
|
48
|
+
"release": "node scripts/release.js"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@rollup/plugin-typescript": "^10.0.1",
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
"cypress": "^9.5.1",
|
|
55
57
|
"cypress-file-upload": "^5.0.8",
|
|
56
58
|
"eslint": "7.32.0",
|
|
59
|
+
"simple-git-hooks": "^2.8.1",
|
|
57
60
|
"typescript": "^4.3.2",
|
|
58
61
|
"vite": "^2.4.2",
|
|
59
62
|
"vite-plugin-css-injected-by-js": "^2.1.1",
|
|
@@ -62,5 +65,8 @@
|
|
|
62
65
|
},
|
|
63
66
|
"dependencies": {
|
|
64
67
|
"prismjs": "^1.27.0"
|
|
68
|
+
},
|
|
69
|
+
"simple-git-hooks": {
|
|
70
|
+
"commit-msg": "node scripts/verifyCommit.js"
|
|
65
71
|
}
|
|
66
72
|
}
|