@hufe921/canvas-editor 0.9.46 → 0.9.48
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 +42 -0
- package/dist/canvas-editor.es.js +281 -112
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +29 -29
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +3 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +7 -3
- package/dist/src/editor/core/draw/Draw.d.ts +9 -3
- package/dist/src/editor/core/draw/particle/PageBreak.d.ts +1 -4
- package/dist/src/editor/core/draw/particle/TextParticle.d.ts +1 -0
- package/dist/src/editor/core/override/Override.d.ts +3 -0
- package/dist/src/editor/dataset/constant/Common.d.ts +12 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +2 -0
- package/dist/src/editor/dataset/constant/PageBreak.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Regular.d.ts +0 -2
- package/dist/src/editor/dataset/enum/table/Table.d.ts +3 -0
- package/dist/src/editor/index.d.ts +7 -3
- package/dist/src/editor/interface/Common.d.ts +6 -0
- package/dist/src/editor/interface/Control.d.ts +2 -0
- package/dist/src/editor/interface/Draw.d.ts +3 -0
- package/dist/src/editor/interface/Editor.d.ts +5 -1
- package/dist/src/editor/interface/Element.d.ts +1 -0
- package/dist/src/editor/interface/PageBreak.d.ts +5 -0
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/dist/src/editor/interface/shortcut/Shortcut.d.ts +2 -1
- package/dist/src/editor/interface/table/Td.d.ts +2 -0
- package/dist/src/editor/utils/element.d.ts +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare class Command {
|
|
|
7
7
|
executeSelectAll: CommandAdapt['selectAll'];
|
|
8
8
|
executeBackspace: CommandAdapt['backspace'];
|
|
9
9
|
executeSetRange: CommandAdapt['setRange'];
|
|
10
|
+
executeForceUpdate: CommandAdapt['forceUpdate'];
|
|
10
11
|
executeUndo: CommandAdapt['undo'];
|
|
11
12
|
executeRedo: CommandAdapt['redo'];
|
|
12
13
|
executePainter: CommandAdapt['painter'];
|
|
@@ -40,6 +41,7 @@ export declare class Command {
|
|
|
40
41
|
executeCancelMergeTableCell: CommandAdapt['cancelMergeTableCell'];
|
|
41
42
|
executeTableTdVerticalAlign: CommandAdapt['tableTdVerticalAlign'];
|
|
42
43
|
executeTableBorderType: CommandAdapt['tableBorderType'];
|
|
44
|
+
executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
|
|
43
45
|
executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
|
|
44
46
|
executeTableSelectAll: CommandAdapt['tableSelectAll'];
|
|
45
47
|
executeImage: CommandAdapt['image'];
|
|
@@ -79,6 +81,7 @@ export declare class Command {
|
|
|
79
81
|
executeLocationGroup: CommandAdapt['locationGroup'];
|
|
80
82
|
getCatalog: CommandAdapt['getCatalog'];
|
|
81
83
|
getImage: CommandAdapt['getImage'];
|
|
84
|
+
getOptions: CommandAdapt['getOptions'];
|
|
82
85
|
getValue: CommandAdapt['getValue'];
|
|
83
86
|
getHTML: CommandAdapt['getHTML'];
|
|
84
87
|
getText: CommandAdapt['getText'];
|
|
@@ -2,12 +2,13 @@ import { ImageDisplay } from '../../dataset/enum/Control';
|
|
|
2
2
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
3
|
import { ListStyle, ListType } from '../../dataset/enum/List';
|
|
4
4
|
import { RowFlex } from '../../dataset/enum/Row';
|
|
5
|
-
import { TableBorder } from '../../dataset/enum/table/Table';
|
|
5
|
+
import { TableBorder, TdBorder } from '../../dataset/enum/table/Table';
|
|
6
6
|
import { TitleLevel } from '../../dataset/enum/Title';
|
|
7
7
|
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
8
8
|
import { ICatalog } from '../../interface/Catalog';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { DeepRequired } from '../../interface/Common';
|
|
10
|
+
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
11
|
+
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText } from '../../interface/Editor';
|
|
11
12
|
import { IElement } from '../../interface/Element';
|
|
12
13
|
import { IMargin } from '../../interface/Margin';
|
|
13
14
|
import { RangeContext } from '../../interface/Range';
|
|
@@ -34,6 +35,7 @@ export declare class CommandAdapt {
|
|
|
34
35
|
selectAll(): void;
|
|
35
36
|
backspace(): void;
|
|
36
37
|
setRange(startIndex: number, endIndex: number): void;
|
|
38
|
+
forceUpdate(options?: IForceUpdateOption): void;
|
|
37
39
|
undo(): void;
|
|
38
40
|
redo(): void;
|
|
39
41
|
painter(options: IPainterOption): void;
|
|
@@ -67,6 +69,7 @@ export declare class CommandAdapt {
|
|
|
67
69
|
cancelMergeTableCell(): void;
|
|
68
70
|
tableTdVerticalAlign(payload: VerticalAlign): void;
|
|
69
71
|
tableBorderType(payload: TableBorder): void;
|
|
72
|
+
tableTdBorderType(payload: TdBorder): void;
|
|
70
73
|
tableTdBackgroundColor(payload: string): void;
|
|
71
74
|
tableSelectAll(): void;
|
|
72
75
|
hyperlink(payload: IElement): void;
|
|
@@ -89,6 +92,7 @@ export declare class CommandAdapt {
|
|
|
89
92
|
saveAsImageElement(): void;
|
|
90
93
|
changeImageDisplay(element: IElement, display: ImageDisplay): void;
|
|
91
94
|
getImage(payload?: IGetImageOption): Promise<string[]>;
|
|
95
|
+
getOptions(): DeepRequired<IEditorOption>;
|
|
92
96
|
getValue(options?: IGetValueOption): IEditorResult;
|
|
93
97
|
getHTML(): IEditorHTML;
|
|
94
98
|
getText(): IEditorText;
|
|
@@ -16,7 +16,7 @@ import { HyperlinkParticle } from './particle/HyperlinkParticle';
|
|
|
16
16
|
import { Header } from './frame/Header';
|
|
17
17
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
18
18
|
import { Control } from './control/Control';
|
|
19
|
-
import { DeepRequired } from '../../interface/Common';
|
|
19
|
+
import { DeepRequired, IPadding } from '../../interface/Common';
|
|
20
20
|
import { WorkerManager } from '../worker/WorkerManager';
|
|
21
21
|
import { Previewer } from './particle/previewer/Previewer';
|
|
22
22
|
import { DateParticle } from './particle/date/DateParticle';
|
|
@@ -29,6 +29,7 @@ import { ListParticle } from './particle/ListParticle';
|
|
|
29
29
|
import { EventBus } from '../event/eventbus/EventBus';
|
|
30
30
|
import { EventBusMap } from '../../interface/EventBus';
|
|
31
31
|
import { Group } from './interactive/Group';
|
|
32
|
+
import { Override } from '../override/Override';
|
|
32
33
|
export declare class Draw {
|
|
33
34
|
private container;
|
|
34
35
|
private pageContainer;
|
|
@@ -43,6 +44,7 @@ export declare class Draw {
|
|
|
43
44
|
private elementList;
|
|
44
45
|
private listener;
|
|
45
46
|
private eventBus;
|
|
47
|
+
private override;
|
|
46
48
|
private i18n;
|
|
47
49
|
private canvasEvent;
|
|
48
50
|
private globalEvent;
|
|
@@ -81,6 +83,8 @@ export declare class Draw {
|
|
|
81
83
|
private scrollObserver;
|
|
82
84
|
private selectionObserver;
|
|
83
85
|
private imageObserver;
|
|
86
|
+
private LETTER_REG;
|
|
87
|
+
private WORD_LIKE_REG;
|
|
84
88
|
private rowList;
|
|
85
89
|
private pageRowList;
|
|
86
90
|
private painterStyle;
|
|
@@ -89,7 +93,8 @@ export declare class Draw {
|
|
|
89
93
|
private intersectionPageNo;
|
|
90
94
|
private lazyRenderIntersectionObserver;
|
|
91
95
|
private printModeData;
|
|
92
|
-
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap
|
|
96
|
+
constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap>, override: Override);
|
|
97
|
+
getLetterReg(): RegExp;
|
|
93
98
|
getMode(): EditorMode;
|
|
94
99
|
setMode(payload: EditorMode): void;
|
|
95
100
|
isReadonly(): boolean;
|
|
@@ -109,7 +114,7 @@ export declare class Draw {
|
|
|
109
114
|
getPageNumberBottom(): number;
|
|
110
115
|
getMarginIndicatorSize(): number;
|
|
111
116
|
getDefaultBasicRowMarginHeight(): number;
|
|
112
|
-
getTdPadding():
|
|
117
|
+
getTdPadding(): IPadding;
|
|
113
118
|
getContainer(): HTMLDivElement;
|
|
114
119
|
getPageContainer(): HTMLDivElement;
|
|
115
120
|
getVisiblePageNoList(): number[];
|
|
@@ -146,6 +151,7 @@ export declare class Draw {
|
|
|
146
151
|
getCanvasEvent(): CanvasEvent;
|
|
147
152
|
getListener(): Listener;
|
|
148
153
|
getEventBus(): EventBus<EventBusMap>;
|
|
154
|
+
getOverride(): Override;
|
|
149
155
|
getCursor(): Cursor;
|
|
150
156
|
getPreviewer(): Previewer;
|
|
151
157
|
getImageParticle(): ImageParticle;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { IRowElement } from '../../../interface/Row';
|
|
2
2
|
import { Draw } from '../Draw';
|
|
3
3
|
export declare class PageBreakParticle {
|
|
4
|
-
static readonly font: string;
|
|
5
|
-
static readonly fontSize: number;
|
|
6
|
-
static readonly displayName: string;
|
|
7
|
-
static readonly lineDash: number[];
|
|
8
4
|
private draw;
|
|
9
5
|
private options;
|
|
6
|
+
private i18n;
|
|
10
7
|
constructor(draw: Draw);
|
|
11
8
|
render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
|
|
12
9
|
}
|
|
@@ -6,3 +6,15 @@ export declare const NBSP = " ";
|
|
|
6
6
|
export declare const NON_BREAKING_SPACE = " ";
|
|
7
7
|
export declare const PUNCTUATION_LIST: string[];
|
|
8
8
|
export declare const maxHeightRadioMapping: Record<MaxHeightRatio, number>;
|
|
9
|
+
export declare const LETTER_CLASS: {
|
|
10
|
+
ENGLISH: string;
|
|
11
|
+
SPANISH: string;
|
|
12
|
+
FRENCH: string;
|
|
13
|
+
GERMAN: string;
|
|
14
|
+
RUSSIAN: string;
|
|
15
|
+
PORTUGUESE: string;
|
|
16
|
+
ITALIAN: string;
|
|
17
|
+
DUTCH: string;
|
|
18
|
+
SWEDISH: string;
|
|
19
|
+
GREEK: string;
|
|
20
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ElementType } from '../enum/Element';
|
|
2
2
|
import { IElement } from '../../interface/Element';
|
|
3
|
+
import { ITd } from '../../interface/table/Td';
|
|
3
4
|
export declare const EDITOR_ELEMENT_STYLE_ATTR: Array<keyof IElement>;
|
|
4
5
|
export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
|
|
5
6
|
export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
|
|
7
|
+
export declare const TABLE_TD_ZIP_ATTR: Array<keyof ITd>;
|
|
6
8
|
export declare const TABLE_CONTEXT_ATTR: Array<keyof IElement>;
|
|
7
9
|
export declare const TITLE_CONTEXT_ATTR: Array<keyof IElement>;
|
|
8
10
|
export declare const LIST_CONTEXT_ATTR: Array<keyof IElement>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare const NUMBER_REG: RegExp;
|
|
2
|
-
export declare const LETTER_REG: RegExp;
|
|
3
2
|
export declare const NUMBER_LIKE_REG: RegExp;
|
|
4
3
|
export declare const CHINESE_REG: RegExp;
|
|
5
|
-
export declare const WORD_LIKE_REG: RegExp;
|
|
6
4
|
export declare const SURROGATE_PAIR_REG: RegExp;
|
|
7
5
|
export declare const EMOJI_REG: RegExp;
|
|
8
6
|
export declare const UNICODE_SYMBOL_REG: RegExp;
|
|
@@ -17,7 +17,7 @@ import { BlockType } from './dataset/enum/Block';
|
|
|
17
17
|
import { IBlock } from './interface/Block';
|
|
18
18
|
import { ILang } from './interface/i18n/I18n';
|
|
19
19
|
import { VerticalAlign } from './dataset/enum/VerticalAlign';
|
|
20
|
-
import { TableBorder } from './dataset/enum/table/Table';
|
|
20
|
+
import { TableBorder, TdBorder } from './dataset/enum/table/Table';
|
|
21
21
|
import { MaxHeightRatio, NumberType } from './dataset/enum/Common';
|
|
22
22
|
import { TitleLevel } from './dataset/enum/Title';
|
|
23
23
|
import { ListStyle, ListType } from './dataset/enum/List';
|
|
@@ -25,14 +25,18 @@ import { ICatalog, ICatalogItem } from './interface/Catalog';
|
|
|
25
25
|
import { UsePlugin } from './interface/Plugin';
|
|
26
26
|
import { EventBus } from './core/event/eventbus/EventBus';
|
|
27
27
|
import { EventBusMap } from './interface/EventBus';
|
|
28
|
+
import { IRangeStyle } from './interface/Listener';
|
|
29
|
+
import { Override } from './core/override/Override';
|
|
30
|
+
import { LETTER_CLASS } from './dataset/constant/Common';
|
|
28
31
|
export default class Editor {
|
|
29
32
|
command: Command;
|
|
30
33
|
listener: Listener;
|
|
31
34
|
eventBus: EventBus<EventBusMap>;
|
|
35
|
+
override: Override;
|
|
32
36
|
register: Register;
|
|
33
37
|
destroy: () => void;
|
|
34
38
|
use: UsePlugin;
|
|
35
39
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
36
40
|
}
|
|
37
|
-
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent,
|
|
38
|
-
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem };
|
|
41
|
+
export { EDITOR_COMPONENT, LETTER_CLASS, Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak };
|
|
42
|
+
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRangeStyle };
|
|
@@ -6,3 +6,9 @@ export declare type DeepRequired<T> = T extends Error ? Required<T> : T extends
|
|
|
6
6
|
export declare type DeepPartial<T> = {
|
|
7
7
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
8
8
|
};
|
|
9
|
+
export declare type IPadding = [
|
|
10
|
+
top: number,
|
|
11
|
+
right: number,
|
|
12
|
+
bottom: number,
|
|
13
|
+
left: number
|
|
14
|
+
];
|
|
@@ -23,6 +23,8 @@ export interface IControlBasic {
|
|
|
23
23
|
conceptId?: string;
|
|
24
24
|
prefix?: string;
|
|
25
25
|
postfix?: string;
|
|
26
|
+
minWidth?: number;
|
|
27
|
+
underline?: boolean;
|
|
26
28
|
}
|
|
27
29
|
export declare type IControl = IControlBasic & Partial<IControlSelect> & Partial<IControlCheckbox>;
|
|
28
30
|
export interface IControlOption {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { IElement } from '..';
|
|
2
2
|
import { EditorMode, PageMode, PaperDirection, WordBreak } from '../dataset/enum/Editor';
|
|
3
3
|
import { ICheckboxOption } from './Checkbox';
|
|
4
|
+
import { IPadding } from './Common';
|
|
4
5
|
import { IControlOption } from './Control';
|
|
5
6
|
import { ICursorOption } from './Cursor';
|
|
6
7
|
import { IFooter } from './Footer';
|
|
7
8
|
import { IGroup } from './Group';
|
|
8
9
|
import { IHeader } from './Header';
|
|
9
10
|
import { IMargin } from './Margin';
|
|
11
|
+
import { IPageBreak } from './PageBreak';
|
|
10
12
|
import { IPageNumber } from './PageNumber';
|
|
11
13
|
import { IPlaceholder } from './Placeholder';
|
|
12
14
|
import { ITitleOption } from './Title';
|
|
@@ -45,7 +47,7 @@ export interface IEditorOption {
|
|
|
45
47
|
marginIndicatorColor?: string;
|
|
46
48
|
margins?: IMargin;
|
|
47
49
|
pageMode?: PageMode;
|
|
48
|
-
tdPadding?:
|
|
50
|
+
tdPadding?: IPadding;
|
|
49
51
|
defaultTrMinHeight?: number;
|
|
50
52
|
defaultColMinWidth?: number;
|
|
51
53
|
defaultHyperlinkColor?: string;
|
|
@@ -54,6 +56,7 @@ export interface IEditorOption {
|
|
|
54
56
|
historyMaxRecordCount?: number;
|
|
55
57
|
printPixelRatio?: number;
|
|
56
58
|
maskMargin?: IMargin;
|
|
59
|
+
letterClass?: string[];
|
|
57
60
|
wordBreak?: WordBreak;
|
|
58
61
|
header?: IHeader;
|
|
59
62
|
footer?: IFooter;
|
|
@@ -65,6 +68,7 @@ export interface IEditorOption {
|
|
|
65
68
|
title?: ITitleOption;
|
|
66
69
|
placeholder?: IPlaceholder;
|
|
67
70
|
group?: IGroup;
|
|
71
|
+
pageBreak?: IPageBreak;
|
|
68
72
|
}
|
|
69
73
|
export interface IEditorResult {
|
|
70
74
|
version: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
2
|
+
import { TdBorder } from '../../dataset/enum/table/Table';
|
|
2
3
|
import { IElement, IElementPosition } from '../Element';
|
|
3
4
|
import { IRow } from '../Row';
|
|
4
5
|
export interface ITd {
|
|
@@ -19,6 +20,7 @@ export interface ITd {
|
|
|
19
20
|
positionList?: IElementPosition[];
|
|
20
21
|
verticalAlign?: VerticalAlign;
|
|
21
22
|
backgroundColor?: string;
|
|
23
|
+
borderType?: TdBorder;
|
|
22
24
|
mainHeight?: number;
|
|
23
25
|
realHeight?: number;
|
|
24
26
|
realMinHeight?: number;
|
|
@@ -3,7 +3,7 @@ import { DeepRequired } from '../interface/Common';
|
|
|
3
3
|
export declare function unzipElementList(elementList: IElement[]): IElement[];
|
|
4
4
|
interface IFormatElementListOption {
|
|
5
5
|
isHandleFirstElement?: boolean;
|
|
6
|
-
editorOptions:
|
|
6
|
+
editorOptions: DeepRequired<IEditorOption>;
|
|
7
7
|
}
|
|
8
8
|
export declare function formatElementList(elementList: IElement[], options: IFormatElementListOption): void;
|
|
9
9
|
export declare function isSameElementExceptValue(source: IElement, target: IElement): boolean;
|