@hufe921/canvas-editor 0.9.12 → 0.9.14
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/dist/canvas-editor.es.js +394 -72
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +17 -15
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +2 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/ContextMenu.d.ts +1 -0
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +23 -0
- package/dist/src/editor/core/i18n/I18n.d.ts +9 -0
- package/dist/src/editor/core/register/Register.d.ts +4 -0
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/contextmenu/ContextMenu.d.ts +40 -0
- package/dist/src/editor/interface/i18n/I18n.d.ts +6 -0
- package/dist/src/editor/utils/clipboard.d.ts +5 -1
- package/dist/src/editor/utils/element.d.ts +2 -1
- package/package.json +1 -1
|
@@ -75,6 +75,7 @@ export declare class Command {
|
|
|
75
75
|
private static setPaperMargin;
|
|
76
76
|
private static insertElementList;
|
|
77
77
|
private static removeControl;
|
|
78
|
+
private static setLocale;
|
|
78
79
|
constructor(adapt: CommandAdapt);
|
|
79
80
|
executeMode(payload: EditorMode): void;
|
|
80
81
|
executeCut(): void;
|
|
@@ -145,4 +146,5 @@ export declare class Command {
|
|
|
145
146
|
executeSetPaperMargin(payload: IMargin): void;
|
|
146
147
|
executeInsertElementList(payload: IElement[]): void;
|
|
147
148
|
executeRemoveControl(): void;
|
|
149
|
+
executeSetLocale(payload: string): void;
|
|
148
150
|
}
|
|
@@ -20,6 +20,7 @@ export declare class CommandAdapt {
|
|
|
20
20
|
private control;
|
|
21
21
|
private workerManager;
|
|
22
22
|
private searchManager;
|
|
23
|
+
private i18n;
|
|
23
24
|
constructor(draw: Draw);
|
|
24
25
|
mode(payload: EditorMode): void;
|
|
25
26
|
cut(): void;
|
|
@@ -88,4 +89,5 @@ export declare class CommandAdapt {
|
|
|
88
89
|
setPaperMargin(payload: IMargin): void;
|
|
89
90
|
insertElementList(payload: IElement[]): void;
|
|
90
91
|
removeControl(): void;
|
|
92
|
+
setLocale(payload: string): void;
|
|
91
93
|
}
|
|
@@ -18,6 +18,7 @@ import { WorkerManager } from '../worker/WorkerManager';
|
|
|
18
18
|
import { Previewer } from './particle/previewer/Previewer';
|
|
19
19
|
import { DateParticle } from './particle/date/DateParticle';
|
|
20
20
|
import { IMargin } from '../../interface/Margin';
|
|
21
|
+
import { I18n } from '../i18n/I18n';
|
|
21
22
|
export declare class Draw {
|
|
22
23
|
private container;
|
|
23
24
|
private pageContainer;
|
|
@@ -29,6 +30,7 @@ export declare class Draw {
|
|
|
29
30
|
private position;
|
|
30
31
|
private elementList;
|
|
31
32
|
private listener;
|
|
33
|
+
private i18n;
|
|
32
34
|
private canvasEvent;
|
|
33
35
|
private globalEvent;
|
|
34
36
|
private cursor;
|
|
@@ -113,6 +115,7 @@ export declare class Draw {
|
|
|
113
115
|
getDateParticle(): DateParticle;
|
|
114
116
|
getControl(): Control;
|
|
115
117
|
getWorkerManager(): WorkerManager;
|
|
118
|
+
getI18n(): I18n;
|
|
116
119
|
getRowCount(): number;
|
|
117
120
|
getDataURL(): string[];
|
|
118
121
|
getPainterStyle(): IElementStyle | null;
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { IElement, IElementPosition } from '../../../../interface/Element';
|
|
2
|
+
export interface IDatePickerLang {
|
|
3
|
+
now: string;
|
|
4
|
+
confirm: string;
|
|
5
|
+
return: string;
|
|
6
|
+
timeSelect: string;
|
|
7
|
+
weeks: {
|
|
8
|
+
sun: string;
|
|
9
|
+
mon: string;
|
|
10
|
+
tue: string;
|
|
11
|
+
wed: string;
|
|
12
|
+
thu: string;
|
|
13
|
+
fri: string;
|
|
14
|
+
sat: string;
|
|
15
|
+
};
|
|
16
|
+
year: string;
|
|
17
|
+
month: string;
|
|
18
|
+
hour: string;
|
|
19
|
+
minute: string;
|
|
20
|
+
second: string;
|
|
21
|
+
}
|
|
2
22
|
export interface IDatePickerOption {
|
|
3
23
|
mountDom?: HTMLElement;
|
|
4
24
|
onSubmit?: (date: string) => any;
|
|
25
|
+
getLang?: () => IDatePickerLang;
|
|
5
26
|
}
|
|
6
27
|
interface IRenderOption {
|
|
7
28
|
value: string;
|
|
@@ -16,12 +37,14 @@ export declare class DatePicker {
|
|
|
16
37
|
private renderOptions;
|
|
17
38
|
private isDatePicker;
|
|
18
39
|
private pickDate;
|
|
40
|
+
private lang;
|
|
19
41
|
constructor(options?: IDatePickerOption);
|
|
20
42
|
private _createDom;
|
|
21
43
|
private _bindEvent;
|
|
22
44
|
private _setPosition;
|
|
23
45
|
isInvalidDate(value: Date): boolean;
|
|
24
46
|
private _setValue;
|
|
47
|
+
private _setLang;
|
|
25
48
|
private _update;
|
|
26
49
|
private _toggleDateTimePicker;
|
|
27
50
|
private _setDatePick;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ILang } from '../../interface/i18n/I18n';
|
|
2
|
+
export declare class I18n {
|
|
3
|
+
private langMap;
|
|
4
|
+
private currentLocale;
|
|
5
|
+
registerLangMap(locale: string, lang: ILang): void;
|
|
6
|
+
setLocale(locale: string): void;
|
|
7
|
+
getLang(): ILang;
|
|
8
|
+
t(path: string): string;
|
|
9
|
+
}
|
|
@@ -2,13 +2,17 @@ import { IRegisterContextMenu } from '../../interface/contextmenu/ContextMenu';
|
|
|
2
2
|
import { IRegisterShortcut } from '../../interface/shortcut/Shortcut';
|
|
3
3
|
import { ContextMenu } from '../contextmenu/ContextMenu';
|
|
4
4
|
import { Shortcut } from '../shortcut/Shortcut';
|
|
5
|
+
import { I18n } from '../i18n/I18n';
|
|
6
|
+
import { ILang } from '../../interface/i18n/I18n';
|
|
5
7
|
interface IRegisterPayload {
|
|
6
8
|
contextMenu: ContextMenu;
|
|
7
9
|
shortcut: Shortcut;
|
|
10
|
+
i18n: I18n;
|
|
8
11
|
}
|
|
9
12
|
export declare class Register {
|
|
10
13
|
contextMenuList: (payload: IRegisterContextMenu[]) => void;
|
|
11
14
|
shortcutList: (payload: IRegisterShortcut[]) => void;
|
|
15
|
+
langMap: (locale: string, lang: ILang) => void;
|
|
12
16
|
constructor(payload: IRegisterPayload);
|
|
13
17
|
}
|
|
14
18
|
export {};
|
|
@@ -15,6 +15,7 @@ import { INavigateInfo } from './core/draw/interactive/Search';
|
|
|
15
15
|
import { KeyMap } from './dataset/enum/KeyMap';
|
|
16
16
|
import { BlockType } from './dataset/enum/Block';
|
|
17
17
|
import { IBlock } from './interface/Block';
|
|
18
|
+
import { ILang } from './interface/i18n/I18n';
|
|
18
19
|
export default class Editor {
|
|
19
20
|
command: Command;
|
|
20
21
|
listener: Listener;
|
|
@@ -23,4 +24,4 @@ export default class Editor {
|
|
|
23
24
|
constructor(container: HTMLDivElement, elementList: IElement[], options?: IEditorOption);
|
|
24
25
|
}
|
|
25
26
|
export { Editor, RowFlex, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType };
|
|
26
|
-
export type { IElement, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock };
|
|
27
|
+
export type { IElement, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang };
|
|
@@ -10,6 +10,7 @@ export interface IContextMenuContext {
|
|
|
10
10
|
isCrossRowCol: boolean;
|
|
11
11
|
}
|
|
12
12
|
export interface IRegisterContextMenu {
|
|
13
|
+
i18nPath?: string;
|
|
13
14
|
isDivider?: boolean;
|
|
14
15
|
icon?: string;
|
|
15
16
|
name?: string;
|
|
@@ -18,3 +19,42 @@ export interface IRegisterContextMenu {
|
|
|
18
19
|
callback?: (command: Command, context: IContextMenuContext) => any;
|
|
19
20
|
childMenus?: IRegisterContextMenu[];
|
|
20
21
|
}
|
|
22
|
+
export interface IContextmenuLang {
|
|
23
|
+
global: {
|
|
24
|
+
cut: string;
|
|
25
|
+
copy: string;
|
|
26
|
+
paste: string;
|
|
27
|
+
selectAll: string;
|
|
28
|
+
print: string;
|
|
29
|
+
};
|
|
30
|
+
control: {
|
|
31
|
+
delete: string;
|
|
32
|
+
};
|
|
33
|
+
hyperlink: {
|
|
34
|
+
delete: string;
|
|
35
|
+
cancel: string;
|
|
36
|
+
edit: string;
|
|
37
|
+
};
|
|
38
|
+
image: {
|
|
39
|
+
change: string;
|
|
40
|
+
saveAs: string;
|
|
41
|
+
textWrap: string;
|
|
42
|
+
textWrapType: {
|
|
43
|
+
embed: string;
|
|
44
|
+
upDown: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
table: {
|
|
48
|
+
insertRowCol: string;
|
|
49
|
+
insertTopRow: string;
|
|
50
|
+
insertBottomRow: string;
|
|
51
|
+
insertLeftCol: string;
|
|
52
|
+
insertRightCol: string;
|
|
53
|
+
deleteRowCol: string;
|
|
54
|
+
deleteRow: string;
|
|
55
|
+
deleteCol: string;
|
|
56
|
+
deleteTable: string;
|
|
57
|
+
mergeCell: string;
|
|
58
|
+
mergeCancelCell: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -2,4 +2,8 @@ import { IEditorOption, IElement } from '..';
|
|
|
2
2
|
import { DeepRequired } from '../interface/Common';
|
|
3
3
|
export declare function writeClipboardItem(text: string, html: string): void;
|
|
4
4
|
export declare function writeElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): void;
|
|
5
|
-
|
|
5
|
+
interface IGetElementListByHTMLOption {
|
|
6
|
+
innerWidth: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
|
|
9
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEditorOption, IElement } from '..';
|
|
1
|
+
import { IEditorOption, IElement, RowFlex } from '..';
|
|
2
2
|
interface IFormatElementListOption {
|
|
3
3
|
isHandleFirstElement?: boolean;
|
|
4
4
|
editorOptions: Required<IEditorOption>;
|
|
@@ -7,4 +7,5 @@ export declare function formatElementList(elementList: IElement[], options: IFor
|
|
|
7
7
|
export declare function isSameElementExceptValue(source: IElement, target: IElement): boolean;
|
|
8
8
|
export declare function pickElementAttr(payload: IElement): IElement;
|
|
9
9
|
export declare function zipElementList(payload: IElement[]): IElement[];
|
|
10
|
+
export declare function getElementRowFlex(node: HTMLElement): RowFlex;
|
|
10
11
|
export {};
|