@hufe921/canvas-editor 0.9.9
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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/canvas-editor.es.js +11339 -0
- package/dist/canvas-editor.es.js.map +1 -0
- package/dist/canvas-editor.umd.js +59 -0
- package/dist/canvas-editor.umd.js.map +1 -0
- package/dist/src/editor/core/command/Command.d.ts +148 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +91 -0
- package/dist/src/editor/core/contextmenu/ContextMenu.d.ts +25 -0
- package/dist/src/editor/core/contextmenu/menus/controlMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/globalMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/hyperlinkMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/imageMenus.d.ts +2 -0
- package/dist/src/editor/core/contextmenu/menus/tableMenus.d.ts +2 -0
- package/dist/src/editor/core/cursor/Cursor.d.ts +15 -0
- package/dist/src/editor/core/cursor/CursorAgent.d.ts +15 -0
- package/dist/src/editor/core/draw/Draw.d.ts +134 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +35 -0
- package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +15 -0
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +21 -0
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +13 -0
- package/dist/src/editor/core/draw/frame/Background.d.ts +6 -0
- package/dist/src/editor/core/draw/frame/Header.d.ts +7 -0
- package/dist/src/editor/core/draw/frame/Margin.d.ts +7 -0
- package/dist/src/editor/core/draw/frame/PageNumber.d.ts +7 -0
- package/dist/src/editor/core/draw/frame/Watermark.d.ts +7 -0
- package/dist/src/editor/core/draw/interactive/Search.d.ts +26 -0
- package/dist/src/editor/core/draw/particle/CheckboxParticle.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/HyperlinkParticle.d.ts +16 -0
- package/dist/src/editor/core/draw/particle/ImageParticle.d.ts +9 -0
- package/dist/src/editor/core/draw/particle/PageBreak.d.ts +12 -0
- package/dist/src/editor/core/draw/particle/Separator.d.ts +4 -0
- package/dist/src/editor/core/draw/particle/Subscript.d.ts +4 -0
- package/dist/src/editor/core/draw/particle/Superscript.d.ts +4 -0
- package/dist/src/editor/core/draw/particle/TextParticle.d.ts +18 -0
- package/dist/src/editor/core/draw/particle/block/BlockParticle.d.ts +14 -0
- package/dist/src/editor/core/draw/particle/block/modules/BaseBlock.d.ts +15 -0
- package/dist/src/editor/core/draw/particle/block/modules/IFrameBlock.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/block/modules/VideoBlock.d.ts +6 -0
- package/dist/src/editor/core/draw/particle/date/DateParticle.d.ts +14 -0
- package/dist/src/editor/core/draw/particle/date/DatePicker.d.ts +41 -0
- package/dist/src/editor/core/draw/particle/latex/LaTexParticle.d.ts +7 -0
- package/dist/src/editor/core/draw/particle/latex/utils/LaTexUtils.d.ts +47 -0
- package/dist/src/editor/core/draw/particle/latex/utils/hershey.d.ts +10 -0
- package/dist/src/editor/core/draw/particle/latex/utils/symbols.d.ts +8 -0
- package/dist/src/editor/core/draw/particle/previewer/Previewer.d.ts +34 -0
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +11 -0
- package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +22 -0
- package/dist/src/editor/core/draw/richtext/AbstractRichText.d.ts +14 -0
- package/dist/src/editor/core/draw/richtext/Highlight.d.ts +7 -0
- package/dist/src/editor/core/draw/richtext/Strikeout.d.ts +7 -0
- package/dist/src/editor/core/draw/richtext/Underline.d.ts +7 -0
- package/dist/src/editor/core/event/CanvasEvent.d.ts +37 -0
- package/dist/src/editor/core/event/GlobalEvent.d.ts +20 -0
- package/dist/src/editor/core/history/HistoryManager.d.ts +10 -0
- package/dist/src/editor/core/listener/Listener.d.ts +13 -0
- package/dist/src/editor/core/observer/ScrollObserver.d.ts +9 -0
- package/dist/src/editor/core/observer/SelectionObserver.d.ts +16 -0
- package/dist/src/editor/core/position/Position.d.ts +19 -0
- package/dist/src/editor/core/range/RangeManager.d.ts +21 -0
- package/dist/src/editor/core/register/Register.d.ts +14 -0
- package/dist/src/editor/core/shortcut/Shortcut.d.ts +14 -0
- package/dist/src/editor/core/shortcut/keys/richtextKeys.d.ts +2 -0
- package/dist/src/editor/core/worker/WorkerManager.d.ts +7 -0
- package/dist/src/editor/core/worker/works/wordCount.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Checkbox.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Common.d.ts +4 -0
- package/dist/src/editor/dataset/constant/ContextMenu.d.ts +3 -0
- package/dist/src/editor/dataset/constant/Control.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Cursor.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Editor.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +6 -0
- package/dist/src/editor/dataset/constant/Header.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Regular.d.ts +4 -0
- package/dist/src/editor/dataset/constant/Watermark.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Block.d.ts +4 -0
- package/dist/src/editor/dataset/enum/Control.d.ts +16 -0
- package/dist/src/editor/dataset/enum/Editor.d.ts +21 -0
- package/dist/src/editor/dataset/enum/Element.d.ts +16 -0
- package/dist/src/editor/dataset/enum/ElementStyle.d.ts +12 -0
- package/dist/src/editor/dataset/enum/Event.d.ts +5 -0
- package/dist/src/editor/dataset/enum/KeyMap.d.ts +82 -0
- package/dist/src/editor/dataset/enum/Observer.d.ts +6 -0
- package/dist/src/editor/dataset/enum/Row.d.ts +6 -0
- package/dist/src/editor/dataset/enum/table/TableTool.d.ts +4 -0
- package/dist/src/editor/index.d.ts +25 -0
- package/dist/src/editor/interface/Block.d.ts +12 -0
- package/dist/src/editor/interface/Checkbox.d.ts +13 -0
- package/dist/src/editor/interface/Common.d.ts +5 -0
- package/dist/src/editor/interface/Control.d.ts +50 -0
- package/dist/src/editor/interface/Draw.d.ts +30 -0
- package/dist/src/editor/interface/Editor.d.ts +55 -0
- package/dist/src/editor/interface/Element.d.ts +99 -0
- package/dist/src/editor/interface/Header.d.ts +6 -0
- package/dist/src/editor/interface/Listener.d.ts +29 -0
- package/dist/src/editor/interface/Margin.d.ts +1 -0
- package/dist/src/editor/interface/Position.d.ts +37 -0
- package/dist/src/editor/interface/Previewer.d.ts +11 -0
- package/dist/src/editor/interface/Range.d.ts +11 -0
- package/dist/src/editor/interface/Row.d.ts +14 -0
- package/dist/src/editor/interface/Search.d.ts +14 -0
- package/dist/src/editor/interface/Watermark.d.ts +7 -0
- package/dist/src/editor/interface/contextmenu/ContextMenu.d.ts +20 -0
- package/dist/src/editor/interface/shortcut/Shortcut.d.ts +10 -0
- package/dist/src/editor/interface/table/Colgroup.d.ts +4 -0
- package/dist/src/editor/interface/table/Td.d.ts +19 -0
- package/dist/src/editor/interface/table/Tr.d.ts +6 -0
- package/dist/src/editor/utils/clipboard.d.ts +5 -0
- package/dist/src/editor/utils/element.d.ts +10 -0
- package/dist/src/editor/utils/index.d.ts +8 -0
- package/dist/src/editor/utils/print.d.ts +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IElement } from '../../../..';
|
|
2
|
+
import { IElementPosition } from '../../../../interface/Element';
|
|
3
|
+
import { Draw } from '../../Draw';
|
|
4
|
+
export declare class TableTool {
|
|
5
|
+
private readonly translate;
|
|
6
|
+
private minTdWidth;
|
|
7
|
+
private draw;
|
|
8
|
+
private canvas;
|
|
9
|
+
private options;
|
|
10
|
+
private position;
|
|
11
|
+
private container;
|
|
12
|
+
private toolRowContainer;
|
|
13
|
+
private toolColContainer;
|
|
14
|
+
private anchorLine;
|
|
15
|
+
private mousedownX;
|
|
16
|
+
private mousedownY;
|
|
17
|
+
constructor(draw: Draw);
|
|
18
|
+
dispose(): void;
|
|
19
|
+
render(element: IElement, position: IElementPosition): void;
|
|
20
|
+
private _mousedown;
|
|
21
|
+
private _mousemove;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IElementFillRect } from '../../../interface/Element';
|
|
2
|
+
export declare abstract class AbstractRichText {
|
|
3
|
+
fillRect: IElementFillRect;
|
|
4
|
+
fillColor?: string;
|
|
5
|
+
constructor();
|
|
6
|
+
clearFillInfo(): {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
recordFillInfo(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height?: number, color?: string): void;
|
|
13
|
+
abstract render(ctx: CanvasRenderingContext2D): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Draw } from '../draw/Draw';
|
|
2
|
+
export declare class CanvasEvent {
|
|
3
|
+
private isAllowDrag;
|
|
4
|
+
private isCompositing;
|
|
5
|
+
private mouseDownStartPosition;
|
|
6
|
+
private draw;
|
|
7
|
+
private options;
|
|
8
|
+
private pageContainer;
|
|
9
|
+
private pageList;
|
|
10
|
+
private position;
|
|
11
|
+
private range;
|
|
12
|
+
private cursor;
|
|
13
|
+
private historyManager;
|
|
14
|
+
private previewer;
|
|
15
|
+
private tableTool;
|
|
16
|
+
private hyperlinkParticle;
|
|
17
|
+
private dateParticle;
|
|
18
|
+
private listener;
|
|
19
|
+
private control;
|
|
20
|
+
constructor(draw: Draw);
|
|
21
|
+
register(): void;
|
|
22
|
+
setIsAllowDrag(payload: boolean): void;
|
|
23
|
+
clearPainterStyle(): void;
|
|
24
|
+
applyPainterStyle(): void;
|
|
25
|
+
mousemove(evt: MouseEvent): void;
|
|
26
|
+
mousedown(evt: MouseEvent): void;
|
|
27
|
+
mouseleave(evt: MouseEvent): void;
|
|
28
|
+
keydown(evt: KeyboardEvent): void;
|
|
29
|
+
dblclick(): void;
|
|
30
|
+
threeClick(): void;
|
|
31
|
+
input(data: string): void;
|
|
32
|
+
cut(): void;
|
|
33
|
+
copy(): void;
|
|
34
|
+
selectAll(): void;
|
|
35
|
+
compositionstart(): void;
|
|
36
|
+
compositionend(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Draw } from '../draw/Draw';
|
|
2
|
+
import { CanvasEvent } from './CanvasEvent';
|
|
3
|
+
export declare class GlobalEvent {
|
|
4
|
+
private draw;
|
|
5
|
+
private canvas;
|
|
6
|
+
private options;
|
|
7
|
+
private cursor;
|
|
8
|
+
private canvasEvent;
|
|
9
|
+
private range;
|
|
10
|
+
private previewer;
|
|
11
|
+
private tableTool;
|
|
12
|
+
private hyperlinkParticle;
|
|
13
|
+
private control;
|
|
14
|
+
constructor(draw: Draw, canvasEvent: CanvasEvent);
|
|
15
|
+
register(): void;
|
|
16
|
+
recoverEffect(evt: MouseEvent): void;
|
|
17
|
+
setDragState(): void;
|
|
18
|
+
setRangeStyle(): void;
|
|
19
|
+
setPageScale(evt: WheelEvent): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IContentChange, IControlChange, IIntersectionPageNoChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange } from '../../interface/Listener';
|
|
2
|
+
export declare class Listener {
|
|
3
|
+
rangeStyleChange: IRangeStyleChange | null;
|
|
4
|
+
visiblePageNoListChange: IVisiblePageNoListChange | null;
|
|
5
|
+
intersectionPageNoChange: IIntersectionPageNoChange | null;
|
|
6
|
+
pageSizeChange: IPageSizeChange | null;
|
|
7
|
+
pageScaleChange: IPageScaleChange | null;
|
|
8
|
+
saved: ISaved | null;
|
|
9
|
+
contentChange: IContentChange | null;
|
|
10
|
+
controlChange: IControlChange | null;
|
|
11
|
+
pageModeChange: IPageModeChange | null;
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class SelectionObserver {
|
|
2
|
+
private threshold;
|
|
3
|
+
private requestAnimationFrameId;
|
|
4
|
+
private tippingPoints;
|
|
5
|
+
private isMousedown;
|
|
6
|
+
private isMoving;
|
|
7
|
+
private clientWidth;
|
|
8
|
+
private clientHeight;
|
|
9
|
+
constructor();
|
|
10
|
+
private _mousedown;
|
|
11
|
+
private _mouseup;
|
|
12
|
+
private _mousemove;
|
|
13
|
+
private _move;
|
|
14
|
+
private _startMove;
|
|
15
|
+
private _stopMove;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IElementPosition } from '../../interface/Element';
|
|
2
|
+
import { ICurrentPosition, IGetPositionByXYPayload, IPositionContext } from '../../interface/Position';
|
|
3
|
+
import { Draw } from '../draw/Draw';
|
|
4
|
+
export declare class Position {
|
|
5
|
+
private cursorPosition;
|
|
6
|
+
private positionContext;
|
|
7
|
+
private positionList;
|
|
8
|
+
private draw;
|
|
9
|
+
private options;
|
|
10
|
+
constructor(draw: Draw);
|
|
11
|
+
getOriginalPositionList(): IElementPosition[];
|
|
12
|
+
getPositionList(): IElementPosition[];
|
|
13
|
+
setPositionList(payload: IElementPosition[]): void;
|
|
14
|
+
setCursorPosition(position: IElementPosition | null): void;
|
|
15
|
+
getCursorPosition(): IElementPosition | null;
|
|
16
|
+
getPositionContext(): IPositionContext;
|
|
17
|
+
setPositionContext(payload: IPositionContext): void;
|
|
18
|
+
getPositionByXY(payload: IGetPositionByXYPayload): ICurrentPosition;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IElement } from '../../interface/Element';
|
|
2
|
+
import { IRange, RangeRowMap } from '../../interface/Range';
|
|
3
|
+
import { Draw } from '../draw/Draw';
|
|
4
|
+
export declare class RangeManager {
|
|
5
|
+
private draw;
|
|
6
|
+
private options;
|
|
7
|
+
private range;
|
|
8
|
+
private listener;
|
|
9
|
+
private position;
|
|
10
|
+
private historyManager;
|
|
11
|
+
constructor(draw: Draw);
|
|
12
|
+
getRange(): IRange;
|
|
13
|
+
getSelection(): IElement[] | null;
|
|
14
|
+
getRangeRow(): RangeRowMap | null;
|
|
15
|
+
setRange(startIndex: number, endIndex: number, tableId?: string, startTdIndex?: number, endTdIndex?: number, startTrIndex?: number, endTrIndex?: number): void;
|
|
16
|
+
setRangeStyle(): void;
|
|
17
|
+
recoveryRangeStyle(): void;
|
|
18
|
+
shrinkBoundary(): void;
|
|
19
|
+
render(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number): void;
|
|
20
|
+
toString(): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IRegisterContextMenu } from '../../interface/contextmenu/ContextMenu';
|
|
2
|
+
import { IRegisterShortcut } from '../../interface/shortcut/Shortcut';
|
|
3
|
+
import { ContextMenu } from '../contextmenu/ContextMenu';
|
|
4
|
+
import { Shortcut } from '../shortcut/Shortcut';
|
|
5
|
+
interface IRegisterPayload {
|
|
6
|
+
contextMenu: ContextMenu;
|
|
7
|
+
shortcut: Shortcut;
|
|
8
|
+
}
|
|
9
|
+
export declare class Register {
|
|
10
|
+
contextMenuList: (payload: IRegisterContextMenu[]) => void;
|
|
11
|
+
shortcutList: (payload: IRegisterShortcut[]) => void;
|
|
12
|
+
constructor(payload: IRegisterPayload);
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IRegisterShortcut } from '../../interface/shortcut/Shortcut';
|
|
2
|
+
import { Command } from '../command/Command';
|
|
3
|
+
import { Draw } from '../draw/Draw';
|
|
4
|
+
export declare class Shortcut {
|
|
5
|
+
private command;
|
|
6
|
+
private globalShortcutList;
|
|
7
|
+
private agentShortcutList;
|
|
8
|
+
constructor(draw: Draw, command: Command);
|
|
9
|
+
private _addShortcutList;
|
|
10
|
+
registerShortcutList(payload: IRegisterShortcut[]): void;
|
|
11
|
+
private _globalKeydown;
|
|
12
|
+
private _agentKeydown;
|
|
13
|
+
private _execute;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CURSOR_AGENT_HEIGHT = 12;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EDITOR_COMPONENT = "editor-component";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ElementType } from '../enum/Element';
|
|
2
|
+
import { IElement } from '../../interface/Element';
|
|
3
|
+
export declare const EDITOR_ELEMENT_STYLE_ATTR: string[];
|
|
4
|
+
export declare const EDITOR_ELEMENT_COPY_ATTR: Array<keyof IElement>;
|
|
5
|
+
export declare const EDITOR_ELEMENT_ZIP_ATTR: Array<keyof IElement>;
|
|
6
|
+
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum ControlType {
|
|
2
|
+
TEXT = "text",
|
|
3
|
+
SELECT = "select",
|
|
4
|
+
CHECKBOX = "checkbox"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ControlComponent {
|
|
7
|
+
PREFIX = "prefix",
|
|
8
|
+
POSTFIX = "postfix",
|
|
9
|
+
PLACEHOLDER = "placeholder",
|
|
10
|
+
VALUE = "value",
|
|
11
|
+
CHECKBOX = "checkbox"
|
|
12
|
+
}
|
|
13
|
+
export declare enum ImageDisplay {
|
|
14
|
+
INLINE = "inline",
|
|
15
|
+
BLOCK = "block"
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum EditorComponent {
|
|
2
|
+
COMPONENT = "component",
|
|
3
|
+
MENU = "menu",
|
|
4
|
+
MAIN = "main",
|
|
5
|
+
FOOTER = "footer",
|
|
6
|
+
CONTEXTMENU = "contextmenu",
|
|
7
|
+
POPUP = "popup"
|
|
8
|
+
}
|
|
9
|
+
export declare enum EditorContext {
|
|
10
|
+
PAGE = "page",
|
|
11
|
+
TABLE = "table"
|
|
12
|
+
}
|
|
13
|
+
export declare enum EditorMode {
|
|
14
|
+
EDIT = "edit",
|
|
15
|
+
CLEAN = "clean",
|
|
16
|
+
READONLY = "readonly"
|
|
17
|
+
}
|
|
18
|
+
export declare enum PageMode {
|
|
19
|
+
PAGING = "paging",
|
|
20
|
+
CONTINUITY = "continuity"
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum ElementType {
|
|
2
|
+
TEXT = "text",
|
|
3
|
+
IMAGE = "image",
|
|
4
|
+
TABLE = "table",
|
|
5
|
+
HYPERLINK = "hyperlink",
|
|
6
|
+
SUPERSCRIPT = "superscript",
|
|
7
|
+
SUBSCRIPT = "subscript",
|
|
8
|
+
SEPARATOR = "separator",
|
|
9
|
+
PAGE_BREAK = "pageBreak",
|
|
10
|
+
CONTROL = "control",
|
|
11
|
+
CHECKBOX = "checkbox",
|
|
12
|
+
LATEX = "latex",
|
|
13
|
+
TAB = "tab",
|
|
14
|
+
DATE = "date",
|
|
15
|
+
BLOCK = "block"
|
|
16
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare enum KeyMap {
|
|
2
|
+
Delete = "Delete",
|
|
3
|
+
Backspace = "Backspace",
|
|
4
|
+
Enter = "Enter",
|
|
5
|
+
Left = "ArrowLeft",
|
|
6
|
+
Right = "ArrowRight",
|
|
7
|
+
Up = "ArrowUp",
|
|
8
|
+
Down = "ArrowDown",
|
|
9
|
+
ESC = "Escape",
|
|
10
|
+
TAB = "Tab",
|
|
11
|
+
LEFT_BRACKET = "[",
|
|
12
|
+
RIGHT_BRACKET = "]",
|
|
13
|
+
COMMA = ",",
|
|
14
|
+
PERIOD = ".",
|
|
15
|
+
LEFT_ANGLE_BRACKET = "<",
|
|
16
|
+
RIGHT_ANGLE_BRACKET = ">",
|
|
17
|
+
EQUAL = "=",
|
|
18
|
+
MINUS = "-",
|
|
19
|
+
PLUS = "+",
|
|
20
|
+
A = "a",
|
|
21
|
+
B = "b",
|
|
22
|
+
C = "c",
|
|
23
|
+
D = "d",
|
|
24
|
+
E = "e",
|
|
25
|
+
F = "f",
|
|
26
|
+
G = "g",
|
|
27
|
+
H = "h",
|
|
28
|
+
I = "i",
|
|
29
|
+
J = "j",
|
|
30
|
+
K = "k",
|
|
31
|
+
L = "l",
|
|
32
|
+
M = "m",
|
|
33
|
+
N = "n",
|
|
34
|
+
O = "o",
|
|
35
|
+
P = "p",
|
|
36
|
+
Q = "q",
|
|
37
|
+
R = "r",
|
|
38
|
+
S = "s",
|
|
39
|
+
T = "t",
|
|
40
|
+
U = "u",
|
|
41
|
+
V = "v",
|
|
42
|
+
W = "w",
|
|
43
|
+
X = "x",
|
|
44
|
+
Y = "y",
|
|
45
|
+
Z = "z",
|
|
46
|
+
A_UPPERCASE = "A",
|
|
47
|
+
B_UPPERCASE = "B",
|
|
48
|
+
C_UPPERCASE = "C",
|
|
49
|
+
D_UPPERCASE = "D",
|
|
50
|
+
E_UPPERCASE = "E",
|
|
51
|
+
F_UPPERCASE = "F",
|
|
52
|
+
G_UPPERCASE = "G",
|
|
53
|
+
H_UPPERCASE = "H",
|
|
54
|
+
I_UPPERCASE = "I",
|
|
55
|
+
J_UPPERCASE = "J",
|
|
56
|
+
K_UPPERCASE = "K",
|
|
57
|
+
L_UPPERCASE = "L",
|
|
58
|
+
M_UPPERCASE = "M",
|
|
59
|
+
N_UPPERCASE = "N",
|
|
60
|
+
O_UPPERCASE = "O",
|
|
61
|
+
P_UPPERCASE = "P",
|
|
62
|
+
Q_UPPERCASE = "Q",
|
|
63
|
+
R_UPPERCASE = "R",
|
|
64
|
+
S_UPPERCASE = "S",
|
|
65
|
+
T_UPPERCASE = "T",
|
|
66
|
+
U_UPPERCASE = "U",
|
|
67
|
+
V_UPPERCASE = "V",
|
|
68
|
+
W_UPPERCASE = "W",
|
|
69
|
+
X_UPPERCASE = "X",
|
|
70
|
+
Y_UPPERCASE = "Y",
|
|
71
|
+
Z_UPPERCASE = "Z",
|
|
72
|
+
ZERO = "0",
|
|
73
|
+
ONE = "1",
|
|
74
|
+
TWO = "2",
|
|
75
|
+
THREE = "3",
|
|
76
|
+
FOUR = "4",
|
|
77
|
+
FIVE = "5",
|
|
78
|
+
SIX = "6",
|
|
79
|
+
SEVEN = "7",
|
|
80
|
+
EIGHT = "8",
|
|
81
|
+
NINE = "9"
|
|
82
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './assets/css/index.css';
|
|
2
|
+
import { IEditorOption, IEditorResult } from './interface/Editor';
|
|
3
|
+
import { IElement } from './interface/Element';
|
|
4
|
+
import { Command } from './core/command/Command';
|
|
5
|
+
import { Listener } from './core/listener/Listener';
|
|
6
|
+
import { RowFlex } from './dataset/enum/Row';
|
|
7
|
+
import { ElementType } from './dataset/enum/Element';
|
|
8
|
+
import { Register } from './core/register/Register';
|
|
9
|
+
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu';
|
|
10
|
+
import { EditorComponent, EditorMode, PageMode } from './dataset/enum/Editor';
|
|
11
|
+
import { EDITOR_COMPONENT } from './dataset/constant/Editor';
|
|
12
|
+
import { IWatermark } from './interface/Watermark';
|
|
13
|
+
import { ControlType, ImageDisplay } from './dataset/enum/Control';
|
|
14
|
+
import { INavigateInfo } from './core/draw/interactive/Search';
|
|
15
|
+
import { KeyMap } from './dataset/enum/KeyMap';
|
|
16
|
+
import { BlockType } from './dataset/enum/Block';
|
|
17
|
+
import { IBlock } from './interface/Block';
|
|
18
|
+
export default class Editor {
|
|
19
|
+
command: Command;
|
|
20
|
+
listener: Listener;
|
|
21
|
+
register: Register;
|
|
22
|
+
constructor(container: HTMLDivElement, elementList: IElement[], options?: IEditorOption);
|
|
23
|
+
}
|
|
24
|
+
export { Editor, RowFlex, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType };
|
|
25
|
+
export type { IElement, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BlockType } from '../dataset/enum/Block';
|
|
2
|
+
export interface IIFrameBlock {
|
|
3
|
+
src: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IVideoBlock {
|
|
6
|
+
src: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IBlock {
|
|
9
|
+
type: BlockType;
|
|
10
|
+
iframeBlock?: IIFrameBlock;
|
|
11
|
+
videoBlock?: IVideoBlock;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ICheckbox {
|
|
2
|
+
value: boolean | null;
|
|
3
|
+
code?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ICheckboxOption {
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
gap?: number;
|
|
10
|
+
lineWidth?: number;
|
|
11
|
+
fillStyle?: string;
|
|
12
|
+
fontStyle?: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
2
|
+
export declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
|
3
|
+
export declare type DeepRequired<T> = T extends Error ? Required<T> : T extends Builtin ? T : T extends Map<infer K, infer V> ? Map<DeepRequired<K>, DeepRequired<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepRequired<K>, DeepRequired<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepRequired<K>, DeepRequired<V>> : T extends Set<infer U> ? Set<DeepRequired<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepRequired<U>> : T extends WeakSet<infer U> ? WeakSet<DeepRequired<U>> : T extends Promise<infer U> ? Promise<DeepRequired<U>> : T extends {} ? {
|
|
4
|
+
[K in keyof T]-?: DeepRequired<T[K]>;
|
|
5
|
+
} : Required<T>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ControlType } from '../dataset/enum/Control';
|
|
2
|
+
import { ICheckbox } from './Checkbox';
|
|
3
|
+
import { IElement } from './Element';
|
|
4
|
+
export interface IValueSet {
|
|
5
|
+
value: string;
|
|
6
|
+
code: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IControlSelect {
|
|
9
|
+
code: string | null;
|
|
10
|
+
valueSets: IValueSet[];
|
|
11
|
+
}
|
|
12
|
+
export interface IControlCheckbox {
|
|
13
|
+
code: string | null;
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
valueSets: IValueSet[];
|
|
17
|
+
checkbox?: ICheckbox;
|
|
18
|
+
}
|
|
19
|
+
export interface IControlBasic {
|
|
20
|
+
type: ControlType;
|
|
21
|
+
value: IElement[] | null;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
conceptId?: string;
|
|
24
|
+
prefix?: string;
|
|
25
|
+
postfix?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare type IControl = IControlBasic & Partial<IControlSelect> & Partial<IControlCheckbox>;
|
|
28
|
+
export interface IControlOption {
|
|
29
|
+
placeholderColor?: string;
|
|
30
|
+
bracketColor?: string;
|
|
31
|
+
prefix?: string;
|
|
32
|
+
postfix?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface IControlInitOption {
|
|
35
|
+
index: number;
|
|
36
|
+
isTable?: boolean;
|
|
37
|
+
trIndex?: number;
|
|
38
|
+
tdIndex?: number;
|
|
39
|
+
tdValueIndex?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface IControlInitResult {
|
|
42
|
+
newIndex: number;
|
|
43
|
+
}
|
|
44
|
+
export interface IControlInstance {
|
|
45
|
+
getElement(): IElement;
|
|
46
|
+
getValue(): IElement[];
|
|
47
|
+
setValue(data: IElement[]): number;
|
|
48
|
+
keydown(evt: KeyboardEvent): number;
|
|
49
|
+
cut(): number;
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IElementPosition } from './Element';
|
|
2
|
+
import { IRow } from './Row';
|
|
3
|
+
export interface IDrawOption {
|
|
4
|
+
curIndex?: number;
|
|
5
|
+
isSetCursor?: boolean;
|
|
6
|
+
isSubmitHistory?: boolean;
|
|
7
|
+
isComputeRowList?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IDrawImagePayload {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IDrawRowPayload {
|
|
15
|
+
positionList: IElementPosition[];
|
|
16
|
+
rowList: IRow[];
|
|
17
|
+
pageNo: number;
|
|
18
|
+
startIndex: number;
|
|
19
|
+
startX: number;
|
|
20
|
+
startY: number;
|
|
21
|
+
innerWidth: number;
|
|
22
|
+
}
|
|
23
|
+
export interface IDrawRowResult {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
index: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IPainterOptions {
|
|
29
|
+
isDblclick: boolean;
|
|
30
|
+
}
|