@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,55 @@
|
|
|
1
|
+
import { IElement } from '..';
|
|
2
|
+
import { EditorMode, PageMode } from '../dataset/enum/Editor';
|
|
3
|
+
import { ICheckboxOption } from './Checkbox';
|
|
4
|
+
import { IControlOption } from './Control';
|
|
5
|
+
import { IHeader } from './Header';
|
|
6
|
+
import { IMargin } from './Margin';
|
|
7
|
+
import { IWatermark } from './Watermark';
|
|
8
|
+
export interface IEditorOption {
|
|
9
|
+
mode?: EditorMode;
|
|
10
|
+
defaultType?: string;
|
|
11
|
+
defaultFont?: string;
|
|
12
|
+
defaultSize?: number;
|
|
13
|
+
defaultBasicRowMarginHeight?: number;
|
|
14
|
+
defaultRowMargin?: number;
|
|
15
|
+
defaultTabWidth?: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
scale?: number;
|
|
19
|
+
pageGap?: number;
|
|
20
|
+
pageNumberBottom?: number;
|
|
21
|
+
pageNumberSize?: number;
|
|
22
|
+
pageNumberFont?: string;
|
|
23
|
+
underlineColor?: string;
|
|
24
|
+
strikeoutColor?: string;
|
|
25
|
+
rangeColor?: string;
|
|
26
|
+
rangeAlpha?: number;
|
|
27
|
+
rangeMinWidth?: number;
|
|
28
|
+
searchMatchColor?: string;
|
|
29
|
+
searchNavigateMatchColor?: string;
|
|
30
|
+
searchMatchAlpha?: number;
|
|
31
|
+
highlightAlpha?: number;
|
|
32
|
+
resizerColor?: string;
|
|
33
|
+
resizerSize?: number;
|
|
34
|
+
marginIndicatorSize?: number;
|
|
35
|
+
marginIndicatorColor?: string;
|
|
36
|
+
margins?: IMargin;
|
|
37
|
+
pageMode?: PageMode;
|
|
38
|
+
tdPadding?: number;
|
|
39
|
+
defaultTdHeight?: number;
|
|
40
|
+
defaultHyperlinkColor?: string;
|
|
41
|
+
headerTop?: number;
|
|
42
|
+
header?: IHeader;
|
|
43
|
+
watermark?: IWatermark;
|
|
44
|
+
control?: IControlOption;
|
|
45
|
+
checkbox?: ICheckboxOption;
|
|
46
|
+
}
|
|
47
|
+
export interface IEditorResult {
|
|
48
|
+
version: string;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
margins: IMargin;
|
|
52
|
+
header?: IHeader;
|
|
53
|
+
watermark?: IWatermark;
|
|
54
|
+
data: IElement[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ControlComponent, ImageDisplay } from '../dataset/enum/Control';
|
|
2
|
+
import { ElementType } from '../dataset/enum/Element';
|
|
3
|
+
import { RowFlex } from '../dataset/enum/Row';
|
|
4
|
+
import { IBlock } from './Block';
|
|
5
|
+
import { ICheckbox } from './Checkbox';
|
|
6
|
+
import { IControl } from './Control';
|
|
7
|
+
import { IColgroup } from './table/Colgroup';
|
|
8
|
+
import { ITr } from './table/Tr';
|
|
9
|
+
export interface IElementBasic {
|
|
10
|
+
id?: string;
|
|
11
|
+
type?: ElementType;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IElementStyle {
|
|
15
|
+
font?: string;
|
|
16
|
+
size?: number;
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
bold?: boolean;
|
|
20
|
+
color?: string;
|
|
21
|
+
highlight?: string;
|
|
22
|
+
italic?: boolean;
|
|
23
|
+
underline?: boolean;
|
|
24
|
+
strikeout?: boolean;
|
|
25
|
+
rowFlex?: RowFlex;
|
|
26
|
+
rowMargin?: number;
|
|
27
|
+
letterSpacing?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ITableAttr {
|
|
30
|
+
colgroup?: IColgroup[];
|
|
31
|
+
trList?: ITr[];
|
|
32
|
+
}
|
|
33
|
+
export interface ITableElement {
|
|
34
|
+
tdId?: string;
|
|
35
|
+
trId?: string;
|
|
36
|
+
tableId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IHyperlinkElement {
|
|
39
|
+
valueList?: IElement[];
|
|
40
|
+
url?: string;
|
|
41
|
+
hyperlinkId?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare type ITable = ITableAttr & ITableElement;
|
|
44
|
+
export interface ISuperscriptSubscript {
|
|
45
|
+
actualSize?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface ISeparator {
|
|
48
|
+
dashArray?: number[];
|
|
49
|
+
}
|
|
50
|
+
export interface IControlElement {
|
|
51
|
+
control?: IControl;
|
|
52
|
+
controlId?: string;
|
|
53
|
+
controlComponent?: ControlComponent;
|
|
54
|
+
}
|
|
55
|
+
export interface ICheckboxElement {
|
|
56
|
+
checkbox?: ICheckbox;
|
|
57
|
+
}
|
|
58
|
+
export interface ILaTexElement {
|
|
59
|
+
laTexSVG?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface IDateElement {
|
|
62
|
+
dateFormat?: string;
|
|
63
|
+
dateId?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface IImageElement {
|
|
66
|
+
imgDisplay?: ImageDisplay;
|
|
67
|
+
}
|
|
68
|
+
export interface IBlockElement {
|
|
69
|
+
block?: IBlock;
|
|
70
|
+
}
|
|
71
|
+
export declare type IElement = IElementBasic & IElementStyle & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & ILaTexElement & IDateElement & IImageElement & IBlockElement;
|
|
72
|
+
export interface IElementMetrics {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
boundingBoxAscent: number;
|
|
76
|
+
boundingBoxDescent: number;
|
|
77
|
+
}
|
|
78
|
+
export interface IElementPosition {
|
|
79
|
+
pageNo: number;
|
|
80
|
+
index: number;
|
|
81
|
+
value: string;
|
|
82
|
+
rowNo: number;
|
|
83
|
+
ascent: number;
|
|
84
|
+
lineHeight: number;
|
|
85
|
+
metrics: IElementMetrics;
|
|
86
|
+
isLastLetter: boolean;
|
|
87
|
+
coordinate: {
|
|
88
|
+
leftTop: number[];
|
|
89
|
+
leftBottom: number[];
|
|
90
|
+
rightTop: number[];
|
|
91
|
+
rightBottom: number[];
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface IElementFillRect {
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
width: number;
|
|
98
|
+
height: number;
|
|
99
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ElementType, PageMode } from '..';
|
|
2
|
+
import { RowFlex } from '../dataset/enum/Row';
|
|
3
|
+
import { IControl } from './Control';
|
|
4
|
+
import { IEditorResult } from './Editor';
|
|
5
|
+
export interface IRangeStyle {
|
|
6
|
+
type: ElementType | null;
|
|
7
|
+
undo: boolean;
|
|
8
|
+
redo: boolean;
|
|
9
|
+
painter: boolean;
|
|
10
|
+
font: string;
|
|
11
|
+
bold: boolean;
|
|
12
|
+
italic: boolean;
|
|
13
|
+
underline: boolean;
|
|
14
|
+
strikeout: boolean;
|
|
15
|
+
color: string | null;
|
|
16
|
+
highlight: string | null;
|
|
17
|
+
rowFlex: RowFlex | null;
|
|
18
|
+
rowMargin: number;
|
|
19
|
+
dashArray: number[];
|
|
20
|
+
}
|
|
21
|
+
export declare type IRangeStyleChange = (payload: IRangeStyle) => void;
|
|
22
|
+
export declare type IVisiblePageNoListChange = (payload: number[]) => void;
|
|
23
|
+
export declare type IIntersectionPageNoChange = (payload: number) => void;
|
|
24
|
+
export declare type IPageSizeChange = (payload: number) => void;
|
|
25
|
+
export declare type IPageScaleChange = (payload: number) => void;
|
|
26
|
+
export declare type ISaved = (payload: IEditorResult) => void;
|
|
27
|
+
export declare type IContentChange = () => void;
|
|
28
|
+
export declare type IControlChange = (payload: IControl | null) => void;
|
|
29
|
+
export declare type IPageModeChange = (payload: PageMode) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type IMargin = [top: number, right: number, bottom: number, left: number];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IElement } from '..';
|
|
2
|
+
import { IElementPosition } from './Element';
|
|
3
|
+
import { ITd } from './table/Td';
|
|
4
|
+
export interface ICurrentPosition {
|
|
5
|
+
index: number;
|
|
6
|
+
isCheckbox?: boolean;
|
|
7
|
+
isControl?: boolean;
|
|
8
|
+
isImage?: boolean;
|
|
9
|
+
isTable?: boolean;
|
|
10
|
+
isDirectHit?: boolean;
|
|
11
|
+
trIndex?: number;
|
|
12
|
+
tdIndex?: number;
|
|
13
|
+
tdValueIndex?: number;
|
|
14
|
+
tdId?: string;
|
|
15
|
+
trId?: string;
|
|
16
|
+
tableId?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IGetPositionByXYPayload {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
isTable?: boolean;
|
|
22
|
+
td?: ITd;
|
|
23
|
+
tablePosition?: IElementPosition;
|
|
24
|
+
elementList?: IElement[];
|
|
25
|
+
positionList?: IElementPosition[];
|
|
26
|
+
}
|
|
27
|
+
export interface IPositionContext {
|
|
28
|
+
isTable: boolean;
|
|
29
|
+
isCheckbox?: boolean;
|
|
30
|
+
isControl?: boolean;
|
|
31
|
+
index?: number;
|
|
32
|
+
trIndex?: number;
|
|
33
|
+
tdIndex?: number;
|
|
34
|
+
tdId?: string;
|
|
35
|
+
trId?: string;
|
|
36
|
+
tableId?: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IElement } from './Element';
|
|
2
|
+
export interface IPreviewerCreateResult {
|
|
3
|
+
resizerSelection: HTMLDivElement;
|
|
4
|
+
resizerHandleList: HTMLDivElement[];
|
|
5
|
+
resizerImageContainer: HTMLDivElement;
|
|
6
|
+
resizerImage: HTMLImageElement;
|
|
7
|
+
}
|
|
8
|
+
export interface IPreviewerDrawOption {
|
|
9
|
+
mime?: 'png' | 'jpg' | 'jpeg' | 'svg';
|
|
10
|
+
srcKey?: keyof Pick<IElement, 'value' | 'laTexSVG'>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IRange {
|
|
2
|
+
startIndex: number;
|
|
3
|
+
endIndex: number;
|
|
4
|
+
isCrossRowCol?: boolean;
|
|
5
|
+
tableId?: string;
|
|
6
|
+
startTdIndex?: number;
|
|
7
|
+
endTdIndex?: number;
|
|
8
|
+
startTrIndex?: number;
|
|
9
|
+
endTrIndex?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare type RangeRowMap = Map<number, Set<number>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RowFlex } from '../dataset/enum/Row';
|
|
2
|
+
import { IElement, IElementMetrics } from './Element';
|
|
3
|
+
export declare type IRowElement = IElement & {
|
|
4
|
+
metrics: IElementMetrics;
|
|
5
|
+
style: string;
|
|
6
|
+
};
|
|
7
|
+
export interface IRow {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
ascent: number;
|
|
11
|
+
rowFlex?: RowFlex;
|
|
12
|
+
isPageBreak?: boolean;
|
|
13
|
+
elementList: IRowElement[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditorContext } from '../dataset/enum/Editor';
|
|
2
|
+
export interface ISearchResultBasic {
|
|
3
|
+
type: EditorContext;
|
|
4
|
+
index: number;
|
|
5
|
+
groupId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ISearchResultRestArgs {
|
|
8
|
+
tableIndex?: number;
|
|
9
|
+
trIndex?: number;
|
|
10
|
+
tdIndex?: number;
|
|
11
|
+
tdId?: string;
|
|
12
|
+
startIndex?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare type ISearchResult = ISearchResultBasic & ISearchResultRestArgs;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from '../../core/command/Command';
|
|
2
|
+
import { IElement } from '../Element';
|
|
3
|
+
export interface IContextMenuContext {
|
|
4
|
+
startElement: IElement | null;
|
|
5
|
+
endElement: IElement | null;
|
|
6
|
+
isReadonly: boolean;
|
|
7
|
+
editorHasSelection: boolean;
|
|
8
|
+
editorTextFocus: boolean;
|
|
9
|
+
isInTable: boolean;
|
|
10
|
+
isCrossRowCol: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface IRegisterContextMenu {
|
|
13
|
+
isDivider?: boolean;
|
|
14
|
+
icon?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
shortCut?: string;
|
|
17
|
+
when?: (payload: IContextMenuContext) => boolean;
|
|
18
|
+
callback?: (command: Command, context: IContextMenuContext) => any;
|
|
19
|
+
childMenus?: IRegisterContextMenu[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '../../core/command/Command';
|
|
2
|
+
import { KeyMap } from '../../dataset/enum/KeyMap';
|
|
3
|
+
export interface IRegisterShortcut {
|
|
4
|
+
key: KeyMap;
|
|
5
|
+
ctrl?: boolean;
|
|
6
|
+
shift?: boolean;
|
|
7
|
+
alt?: boolean;
|
|
8
|
+
isGlobal?: boolean;
|
|
9
|
+
callback: (command: Command) => any;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IElement, IElementPosition } from '../Element';
|
|
2
|
+
import { IRow } from '../Row';
|
|
3
|
+
export interface ITd {
|
|
4
|
+
id?: string;
|
|
5
|
+
x?: number;
|
|
6
|
+
y?: number;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
colspan: number;
|
|
10
|
+
rowspan: number;
|
|
11
|
+
value: IElement[];
|
|
12
|
+
isLastRowTd?: boolean;
|
|
13
|
+
isLastColTd?: boolean;
|
|
14
|
+
isLastTd?: boolean;
|
|
15
|
+
rowIndex?: number;
|
|
16
|
+
colIndex?: number;
|
|
17
|
+
rowList?: IRow[];
|
|
18
|
+
positionList?: IElementPosition[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IEditorOption, IElement } from '..';
|
|
2
|
+
import { DeepRequired } from '../interface/Common';
|
|
3
|
+
export declare function writeClipboardItem(text: string, html: string): void;
|
|
4
|
+
export declare function writeElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): void;
|
|
5
|
+
export declare function getElementListByHTML(htmlText: string): IElement[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IEditorOption, IElement } from '..';
|
|
2
|
+
interface IFormatElementListOption {
|
|
3
|
+
isHandleFirstElement?: boolean;
|
|
4
|
+
editorOptions: Required<IEditorOption>;
|
|
5
|
+
}
|
|
6
|
+
export declare function formatElementList(elementList: IElement[], options: IFormatElementListOption): void;
|
|
7
|
+
export declare function isSameElementExceptValue(source: IElement, target: IElement): boolean;
|
|
8
|
+
export declare function pickElementAttr(payload: IElement): IElement;
|
|
9
|
+
export declare function zipElementList(payload: IElement[]): IElement[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function debounce(func: Function, delay: number): (...args: any) => void;
|
|
2
|
+
export declare function deepClone<T>(obj: T): T;
|
|
3
|
+
export declare function isBody(node: Element): boolean;
|
|
4
|
+
export declare function findParent(node: Element, filterFn: Function, includeSelf: boolean): Element | null;
|
|
5
|
+
export declare function getUUID(): string;
|
|
6
|
+
export declare function splitText(text: string): string[];
|
|
7
|
+
export declare function downloadFile(href: string, fileName: string): void;
|
|
8
|
+
export declare function threeClick(dom: HTMLElement, fn: (evt: MouseEvent) => any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printImageBase64(base64List: string[], width: number, height: number): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hufe921/canvas-editor",
|
|
3
|
+
"author": "Hufe",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"version": "0.9.9",
|
|
6
|
+
"description": "rich text editor by canvas/svg",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/",
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"package.json"
|
|
16
|
+
],
|
|
17
|
+
"typings": "./dist/src/editor/index.d.ts",
|
|
18
|
+
"main": "./dist/canvas-editor.umd.js",
|
|
19
|
+
"module": "./dist/canvas-editor.es.js",
|
|
20
|
+
"homepage": "https://github.com/Hufe921/canvas-editor",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/Hufe921/canvas-editor.git"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"canvas-editor",
|
|
27
|
+
"editor",
|
|
28
|
+
"wysiwyg",
|
|
29
|
+
"emr"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=12.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "vite",
|
|
36
|
+
"lib": "npm run lint && tsc && vite build --mode lib",
|
|
37
|
+
"build": "npm run lint && tsc && vite build --mode app",
|
|
38
|
+
"serve": "vite preview",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"cypress:open": "cypress open",
|
|
41
|
+
"cypress:run": "cypress run",
|
|
42
|
+
"type:check": "tsc --noEmit"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@rollup/plugin-typescript": "^10.0.1",
|
|
46
|
+
"@types/node": "^16.11.12",
|
|
47
|
+
"@types/prismjs": "^1.26.0",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "4.33.0",
|
|
49
|
+
"@typescript-eslint/parser": "4.33.0",
|
|
50
|
+
"cypress": "^9.5.1",
|
|
51
|
+
"cypress-file-upload": "^5.0.8",
|
|
52
|
+
"eslint": "7.32.0",
|
|
53
|
+
"typescript": "^4.3.2",
|
|
54
|
+
"vite": "^2.4.2",
|
|
55
|
+
"vite-plugin-css-injected-by-js": "^2.1.1"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"prismjs": "^1.27.0"
|
|
59
|
+
}
|
|
60
|
+
}
|