@hufe921/canvas-editor 0.9.95 → 0.9.97
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 +59 -0
- package/README.md +53 -18
- package/dist/canvas-editor.es.js +757 -136
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +32 -31
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +4 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +6 -1
- package/dist/src/editor/core/cursor/Cursor.d.ts +1 -0
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +5 -2
- package/dist/src/editor/core/draw/interactive/Area.d.ts +18 -0
- package/dist/src/editor/core/draw/particle/table/TableOperate.d.ts +2 -1
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +1 -0
- package/dist/src/editor/core/draw/particle/table/TableTool.d.ts +2 -0
- package/dist/src/editor/core/range/RangeManager.d.ts +6 -1
- package/dist/src/editor/dataset/constant/ContextMenu.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -0
- package/dist/src/editor/dataset/enum/Area.d.ts +5 -0
- package/dist/src/editor/dataset/enum/Control.d.ts +4 -0
- package/dist/src/editor/dataset/enum/Element.d.ts +1 -0
- package/dist/src/editor/dataset/enum/table/Table.d.ts +3 -1
- package/dist/src/editor/index.d.ts +6 -5
- package/dist/src/editor/interface/Area.d.ts +41 -0
- package/dist/src/editor/interface/Control.d.ts +15 -2
- package/dist/src/editor/interface/Element.d.ts +13 -2
- package/dist/src/editor/interface/Listener.d.ts +2 -2
- package/dist/src/editor/interface/Range.d.ts +2 -1
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/dist/src/editor/utils/element.d.ts +1 -0
- package/dist/src/editor/utils/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -73,6 +73,8 @@ export declare class Command {
|
|
|
73
73
|
executePaperDirection: CommandAdapt['paperDirection'];
|
|
74
74
|
executeSetPaperMargin: CommandAdapt['setPaperMargin'];
|
|
75
75
|
executeInsertElementList: CommandAdapt['insertElementList'];
|
|
76
|
+
executeInsertArea: CommandAdapt['insertArea'];
|
|
77
|
+
executeSetAreaProperties: CommandAdapt['setAreaProperties'];
|
|
76
78
|
executeAppendElementList: CommandAdapt['appendElementList'];
|
|
77
79
|
executeUpdateElementById: CommandAdapt['updateElementById'];
|
|
78
80
|
executeSetValue: CommandAdapt['setValue'];
|
|
@@ -98,6 +100,7 @@ export declare class Command {
|
|
|
98
100
|
getImage: CommandAdapt['getImage'];
|
|
99
101
|
getOptions: CommandAdapt['getOptions'];
|
|
100
102
|
getValue: CommandAdapt['getValue'];
|
|
103
|
+
getAreaValue: CommandAdapt['getAreaValue'];
|
|
101
104
|
getHTML: CommandAdapt['getHTML'];
|
|
102
105
|
getText: CommandAdapt['getText'];
|
|
103
106
|
getWordCount: CommandAdapt['getWordCount'];
|
|
@@ -118,5 +121,6 @@ export declare class Command {
|
|
|
118
121
|
getContainer: CommandAdapt['getContainer'];
|
|
119
122
|
getTitleValue: CommandAdapt['getTitleValue'];
|
|
120
123
|
getPositionContextByEvent: CommandAdapt['getPositionContextByEvent'];
|
|
124
|
+
getElementById: CommandAdapt['getElementById'];
|
|
121
125
|
constructor(adapt: CommandAdapt);
|
|
122
126
|
}
|
|
@@ -10,7 +10,7 @@ import { DeepRequired } from '../../interface/Common';
|
|
|
10
10
|
import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
|
|
11
11
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
12
12
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IFocusOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
|
|
13
|
-
import { IElement, IElementPosition, IUpdateElementByIdOption } from '../../interface/Element';
|
|
13
|
+
import { IElement, IElementPosition, IGetElementByIdOption, IUpdateElementByIdOption } from '../../interface/Element';
|
|
14
14
|
import { IPasteOption, IPositionContextByEvent } from '../../interface/Event';
|
|
15
15
|
import { IMargin } from '../../interface/Margin';
|
|
16
16
|
import { IRange, RangeContext } from '../../interface/Range';
|
|
@@ -20,6 +20,7 @@ import { IGetTitleValueOption, IGetTitleValueResult } from '../../interface/Titl
|
|
|
20
20
|
import { IWatermark } from '../../interface/Watermark';
|
|
21
21
|
import { Draw } from '../draw/Draw';
|
|
22
22
|
import { INavigateInfo } from '../draw/interactive/Search';
|
|
23
|
+
import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ISetAreaPropertiesOption } from '../../interface/Area';
|
|
23
24
|
export declare class CommandAdapt {
|
|
24
25
|
private draw;
|
|
25
26
|
private range;
|
|
@@ -104,6 +105,7 @@ export declare class CommandAdapt {
|
|
|
104
105
|
getImage(payload?: IGetImageOption): Promise<string[]>;
|
|
105
106
|
getOptions(): DeepRequired<IEditorOption>;
|
|
106
107
|
getValue(options?: IGetValueOption): IEditorResult;
|
|
108
|
+
getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
|
|
107
109
|
getHTML(): IEditorHTML;
|
|
108
110
|
getText(): IEditorText;
|
|
109
111
|
getWordCount(): Promise<number>;
|
|
@@ -126,6 +128,7 @@ export declare class CommandAdapt {
|
|
|
126
128
|
insertElementList(payload: IElement[]): void;
|
|
127
129
|
appendElementList(elementList: IElement[], options?: IAppendElementListOption): void;
|
|
128
130
|
updateElementById(payload: IUpdateElementByIdOption): void;
|
|
131
|
+
getElementById(payload: IGetElementByIdOption): IElement[];
|
|
129
132
|
setValue(payload: Partial<IEditorData>, options?: ISetValueOption): void;
|
|
130
133
|
removeControl(): void;
|
|
131
134
|
setLocale(payload: string): void;
|
|
@@ -153,4 +156,6 @@ export declare class CommandAdapt {
|
|
|
153
156
|
getPositionContextByEvent(evt: MouseEvent): IPositionContextByEvent | null;
|
|
154
157
|
insertTitle(payload: IElement): void;
|
|
155
158
|
focus(payload?: IFocusOption): void;
|
|
159
|
+
insertArea(payload: IInsertAreaOption): string | null;
|
|
160
|
+
setAreaProperties(payload: ISetAreaPropertiesOption): void;
|
|
156
161
|
}
|
|
@@ -32,6 +32,7 @@ export declare class Cursor {
|
|
|
32
32
|
private _blinkStop;
|
|
33
33
|
private _setBlinkTimeout;
|
|
34
34
|
private _clearBlinkTimeout;
|
|
35
|
+
focus(): void;
|
|
35
36
|
drawCursor(payload?: IDrawCursorOption): void;
|
|
36
37
|
recoveryCursor(): void;
|
|
37
38
|
moveCursorToVisible(payload: IMoveCursorToVisibleOption): void;
|
|
@@ -37,6 +37,7 @@ import { Override } from '../override/Override';
|
|
|
37
37
|
import { LineBreakParticle } from './particle/LineBreakParticle';
|
|
38
38
|
import { ITd } from '../../interface/table/Td';
|
|
39
39
|
import { TableOperate } from './particle/table/TableOperate';
|
|
40
|
+
import { Area } from './interactive/Area';
|
|
40
41
|
export declare class Draw {
|
|
41
42
|
private container;
|
|
42
43
|
private pageContainer;
|
|
@@ -61,6 +62,7 @@ export declare class Draw {
|
|
|
61
62
|
private background;
|
|
62
63
|
private search;
|
|
63
64
|
private group;
|
|
65
|
+
private area;
|
|
64
66
|
private underline;
|
|
65
67
|
private strikeout;
|
|
66
68
|
private highlight;
|
|
@@ -150,6 +152,7 @@ export declare class Draw {
|
|
|
150
152
|
getOptions(): DeepRequired<IEditorOption>;
|
|
151
153
|
getSearch(): Search;
|
|
152
154
|
getGroup(): Group;
|
|
155
|
+
getArea(): Area;
|
|
153
156
|
getHistoryManager(): HistoryManager;
|
|
154
157
|
getPosition(): Position;
|
|
155
158
|
getZone(): Zone;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlRowFlexOption, ISetControlValueOption } from '../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IDestroyControlOption, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, ISetControlRowFlexOption, ISetControlValueOption } from '../../../interface/Control';
|
|
2
2
|
import { IElement, IElementPosition } from '../../../interface/Element';
|
|
3
3
|
import { IRange } from '../../../interface/Range';
|
|
4
4
|
import { Draw } from '../Draw';
|
|
@@ -16,6 +16,7 @@ export declare class Control {
|
|
|
16
16
|
private options;
|
|
17
17
|
private controlOptions;
|
|
18
18
|
private activeControl;
|
|
19
|
+
private activeControlValue;
|
|
19
20
|
constructor(draw: Draw);
|
|
20
21
|
setHighlightList(payload: IControlHighlight[]): void;
|
|
21
22
|
computeHighlightList(): void;
|
|
@@ -27,6 +28,7 @@ export declare class Control {
|
|
|
27
28
|
getIsRangeWithinControl(): boolean;
|
|
28
29
|
getIsElementListContainFullControl(elementList: IElement[]): boolean;
|
|
29
30
|
getIsDisabledControl(context?: IControlContext): boolean;
|
|
31
|
+
getIsDisabledPasteControl(context?: IControlContext): boolean;
|
|
30
32
|
getContainer(): HTMLDivElement;
|
|
31
33
|
getElementList(): IElement[];
|
|
32
34
|
getPosition(): IElementPosition | null;
|
|
@@ -34,8 +36,9 @@ export declare class Control {
|
|
|
34
36
|
getRange(): IRange;
|
|
35
37
|
shrinkBoundary(context?: IControlContext): void;
|
|
36
38
|
getActiveControl(): IControlInstance | null;
|
|
39
|
+
updateActiveControlValue(): void;
|
|
37
40
|
initControl(): void;
|
|
38
|
-
destroyControl(): void;
|
|
41
|
+
destroyControl(options?: IDestroyControlOption): void;
|
|
39
42
|
repaintControl(options?: IRepaintControlOption): void;
|
|
40
43
|
reAwakeControl(): void;
|
|
41
44
|
moveCursor(position: IControlInitOption): IMoveCursorResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Draw } from '../Draw';
|
|
2
|
+
import { IAreaInfo, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ISetAreaPropertiesOption } from '../../../interface/Area';
|
|
3
|
+
export declare class Area {
|
|
4
|
+
private draw;
|
|
5
|
+
private zone;
|
|
6
|
+
private range;
|
|
7
|
+
private position;
|
|
8
|
+
private areaInfoMap;
|
|
9
|
+
constructor(draw: Draw);
|
|
10
|
+
getActiveAreaId(): string | null;
|
|
11
|
+
getActiveAreaInfo(): IAreaInfo | null;
|
|
12
|
+
isReadonly(): boolean;
|
|
13
|
+
insertArea(payload: IInsertAreaOption): string | null;
|
|
14
|
+
render(ctx: CanvasRenderingContext2D, pageNo: number): void;
|
|
15
|
+
compute(): void;
|
|
16
|
+
getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
|
|
17
|
+
setAreaProperties(payload: ISetAreaPropertiesOption): void;
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableBorder, VerticalAlign } from '../../../..';
|
|
1
|
+
import { IElement, TableBorder, VerticalAlign } from '../../../..';
|
|
2
2
|
import { TdBorder, TdSlash } from '../../../../dataset/enum/table/Table';
|
|
3
3
|
import { Draw } from '../../Draw';
|
|
4
4
|
export declare class TableOperate {
|
|
@@ -12,6 +12,7 @@ export declare class TableOperate {
|
|
|
12
12
|
insertTable(row: number, col: number): void;
|
|
13
13
|
insertTableTopRow(): void;
|
|
14
14
|
insertTableBottomRow(): void;
|
|
15
|
+
adjustColWidth(element: IElement): void;
|
|
15
16
|
insertTableLeftCol(): void;
|
|
16
17
|
insertTableRightCol(): void;
|
|
17
18
|
deleteTableRow(): void;
|
|
@@ -17,6 +17,7 @@ export declare class TableParticle {
|
|
|
17
17
|
getTableHeight(element: IElement): number;
|
|
18
18
|
getRowCountByColIndex(trList: ITr[], colIndex: number): number;
|
|
19
19
|
getTdListByColIndex(trList: ITr[], colIndex: number): ITd[];
|
|
20
|
+
getTdListByRowIndex(trList: ITr[], rowIndex: number): ITd[];
|
|
20
21
|
computeRowColInfo(element: IElement): void;
|
|
21
22
|
drawRange(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
22
23
|
render(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
@@ -11,6 +11,7 @@ export declare class TableTool {
|
|
|
11
11
|
private canvas;
|
|
12
12
|
private options;
|
|
13
13
|
private position;
|
|
14
|
+
private range;
|
|
14
15
|
private container;
|
|
15
16
|
private toolRowContainer;
|
|
16
17
|
private toolRowAddBtn;
|
|
@@ -24,6 +25,7 @@ export declare class TableTool {
|
|
|
24
25
|
constructor(draw: Draw);
|
|
25
26
|
dispose(): void;
|
|
26
27
|
render(): void;
|
|
28
|
+
private _setAnchorActive;
|
|
27
29
|
private _mousedown;
|
|
28
30
|
private _mousemove;
|
|
29
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IControlContext } from '../../interface/Control';
|
|
2
2
|
import { IElement } from '../../interface/Element';
|
|
3
|
-
import { IRange, IRangeParagraphInfo, RangeRowArray, RangeRowMap } from '../../interface/Range';
|
|
3
|
+
import { IRange, IRangeElementStyle, IRangeParagraphInfo, RangeRowArray, RangeRowMap } from '../../interface/Range';
|
|
4
4
|
import { Draw } from '../draw/Draw';
|
|
5
5
|
export declare class RangeManager {
|
|
6
6
|
private draw;
|
|
@@ -10,10 +10,15 @@ export declare class RangeManager {
|
|
|
10
10
|
private eventBus;
|
|
11
11
|
private position;
|
|
12
12
|
private historyManager;
|
|
13
|
+
private defaultStyle;
|
|
13
14
|
constructor(draw: Draw);
|
|
14
15
|
getRange(): IRange;
|
|
15
16
|
clearRange(): void;
|
|
17
|
+
setDefaultStyle(style: IRangeElementStyle | null): void;
|
|
18
|
+
getDefaultStyle(): IRangeElementStyle | null;
|
|
19
|
+
getRangeAnchorStyle(elementList: IElement[], anchorIndex: number): IElement | null;
|
|
16
20
|
getIsCollapsed(): boolean;
|
|
21
|
+
getIsSelection(): boolean;
|
|
17
22
|
getSelection(): IElement[] | null;
|
|
18
23
|
getSelectionElementList(): IElement[] | null;
|
|
19
24
|
getTextLikeSelection(): IElement[] | null;
|
|
@@ -31,7 +31,9 @@ export declare const INTERNAL_CONTEXT_MENU_KEY: {
|
|
|
31
31
|
BORDER: string;
|
|
32
32
|
BORDER_ALL: string;
|
|
33
33
|
BORDER_EMPTY: string;
|
|
34
|
+
BORDER_DASH: string;
|
|
34
35
|
BORDER_EXTERNAL: string;
|
|
36
|
+
BORDER_INTERNAL: string;
|
|
35
37
|
BORDER_TD: string;
|
|
36
38
|
BORDER_TD_TOP: string;
|
|
37
39
|
BORDER_TD_RIGHT: string;
|
|
@@ -12,6 +12,7 @@ export declare const TITLE_CONTEXT_ATTR: Array<keyof IElement>;
|
|
|
12
12
|
export declare const LIST_CONTEXT_ATTR: Array<keyof IElement>;
|
|
13
13
|
export declare const CONTROL_CONTEXT_ATTR: Array<keyof IElement>;
|
|
14
14
|
export declare const CONTROL_STYLE_ATTR: Array<keyof IControlStyle>;
|
|
15
|
+
export declare const AREA_CONTEXT_ATTR: Array<keyof IElement>;
|
|
15
16
|
export declare const EDITOR_ELEMENT_CONTEXT_ATTR: Array<keyof IElement>;
|
|
16
17
|
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
17
18
|
export declare const IMAGE_ELEMENT_TYPE: ElementType[];
|
|
@@ -9,9 +9,9 @@ import { ElementType } from './dataset/enum/Element';
|
|
|
9
9
|
import { Register } from './core/register/Register';
|
|
10
10
|
import { IContextMenuContext, IRegisterContextMenu } from './interface/contextmenu/ContextMenu';
|
|
11
11
|
import { EditorComponent, EditorZone, EditorMode, PageMode, PaperDirection, WordBreak, RenderMode } from './dataset/enum/Editor';
|
|
12
|
-
import { EDITOR_COMPONENT } from './dataset/constant/Editor';
|
|
12
|
+
import { EDITOR_CLIPBOARD, EDITOR_COMPONENT } from './dataset/constant/Editor';
|
|
13
13
|
import { IWatermark } from './interface/Watermark';
|
|
14
|
-
import { ControlIndentation, ControlType } from './dataset/enum/Control';
|
|
14
|
+
import { ControlIndentation, ControlState, ControlType } from './dataset/enum/Control';
|
|
15
15
|
import { INavigateInfo } from './core/draw/interactive/Search';
|
|
16
16
|
import { KeyMap } from './dataset/enum/KeyMap';
|
|
17
17
|
import { BlockType } from './dataset/enum/Block';
|
|
@@ -36,6 +36,7 @@ import { createDomFromElementList, getElementListByHTML, getTextFromElementList,
|
|
|
36
36
|
import { BackgroundRepeat, BackgroundSize } from './dataset/enum/Background';
|
|
37
37
|
import { TextDecorationStyle } from './dataset/enum/Text';
|
|
38
38
|
import { LineNumberType } from './dataset/enum/LineNumber';
|
|
39
|
+
import { AreaMode } from './dataset/enum/Area';
|
|
39
40
|
export default class Editor {
|
|
40
41
|
command: Command;
|
|
41
42
|
listener: Listener;
|
|
@@ -47,6 +48,6 @@ export default class Editor {
|
|
|
47
48
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
48
49
|
}
|
|
49
50
|
export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
|
|
50
|
-
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
|
|
51
|
-
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition,
|
|
52
|
-
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
|
|
51
|
+
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, EDITOR_CLIPBOARD };
|
|
52
|
+
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition, AreaMode, ControlState };
|
|
53
|
+
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, IGetElementListByHTMLOption };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AreaMode } from '../dataset/enum/Area';
|
|
2
|
+
import { LocationPosition } from '../dataset/enum/Common';
|
|
3
|
+
import { IElement, IElementPosition } from './Element';
|
|
4
|
+
export interface IAreaBasic {
|
|
5
|
+
extension?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface IAreaStyle {
|
|
8
|
+
top?: number;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IAreaRule {
|
|
13
|
+
mode?: AreaMode;
|
|
14
|
+
}
|
|
15
|
+
export type IArea = IAreaBasic & IAreaStyle & IAreaRule;
|
|
16
|
+
export interface IInsertAreaOption {
|
|
17
|
+
id?: string;
|
|
18
|
+
area: IArea;
|
|
19
|
+
value: IElement[];
|
|
20
|
+
position?: LocationPosition;
|
|
21
|
+
}
|
|
22
|
+
export interface ISetAreaPropertiesOption {
|
|
23
|
+
id?: string;
|
|
24
|
+
properties: IArea;
|
|
25
|
+
}
|
|
26
|
+
export interface IGetAreaValueOption {
|
|
27
|
+
id?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IGetAreaValueResult {
|
|
30
|
+
id?: string;
|
|
31
|
+
area: IArea;
|
|
32
|
+
startPageNo: number;
|
|
33
|
+
endPageNo: number;
|
|
34
|
+
value: IElement[];
|
|
35
|
+
}
|
|
36
|
+
export interface IAreaInfo {
|
|
37
|
+
id: string;
|
|
38
|
+
area: IArea;
|
|
39
|
+
elementList: IElement[];
|
|
40
|
+
positionList: IElementPosition[];
|
|
41
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LocationPosition } from '../dataset/enum/Common';
|
|
2
|
-
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
|
|
2
|
+
import { ControlType, ControlIndentation, ControlState } from '../dataset/enum/Control';
|
|
3
3
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
4
4
|
import { MoveDirection } from '../dataset/enum/Observer';
|
|
5
5
|
import { RowFlex } from '../dataset/enum/Row';
|
|
@@ -42,6 +42,7 @@ export interface IControlHighlight {
|
|
|
42
42
|
export interface IControlRule {
|
|
43
43
|
deletable?: boolean;
|
|
44
44
|
disabled?: boolean;
|
|
45
|
+
pasteDisabled?: boolean;
|
|
45
46
|
}
|
|
46
47
|
export interface IControlBasic {
|
|
47
48
|
type: ControlType;
|
|
@@ -88,7 +89,7 @@ export interface IControlInitResult {
|
|
|
88
89
|
export interface IControlInstance {
|
|
89
90
|
setElement(element: IElement): void;
|
|
90
91
|
getElement(): IElement;
|
|
91
|
-
getValue(): IElement[];
|
|
92
|
+
getValue(context?: IControlContext): IElement[];
|
|
92
93
|
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
93
94
|
keydown(evt: KeyboardEvent): number | null;
|
|
94
95
|
cut(): number;
|
|
@@ -104,6 +105,7 @@ export interface IControlRuleOption {
|
|
|
104
105
|
export interface IGetControlValueOption {
|
|
105
106
|
id?: string;
|
|
106
107
|
conceptId?: string;
|
|
108
|
+
areaId?: string;
|
|
107
109
|
}
|
|
108
110
|
export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
109
111
|
value: string | null;
|
|
@@ -114,17 +116,20 @@ export type IGetControlValueResult = (Omit<IControl, 'value'> & {
|
|
|
114
116
|
export interface ISetControlValueOption {
|
|
115
117
|
id?: string;
|
|
116
118
|
conceptId?: string;
|
|
119
|
+
areaId?: string;
|
|
117
120
|
value: string | IElement[];
|
|
118
121
|
}
|
|
119
122
|
export interface ISetControlExtensionOption {
|
|
120
123
|
id?: string;
|
|
121
124
|
conceptId?: string;
|
|
125
|
+
areaId?: string;
|
|
122
126
|
extension: unknown;
|
|
123
127
|
}
|
|
124
128
|
export type ISetControlHighlightOption = IControlHighlight[];
|
|
125
129
|
export type ISetControlProperties = {
|
|
126
130
|
id?: string;
|
|
127
131
|
conceptId?: string;
|
|
132
|
+
areaId?: string;
|
|
128
133
|
properties: Partial<Omit<IControl, 'value'>>;
|
|
129
134
|
};
|
|
130
135
|
export type IRepaintControlOption = Pick<IDrawOption, 'curIndex' | 'isCompute' | 'isSubmitHistory' | 'isSetCursor'>;
|
|
@@ -144,3 +149,11 @@ export interface ISetControlRowFlexOption {
|
|
|
144
149
|
availableWidth: number;
|
|
145
150
|
controlRealWidth: number;
|
|
146
151
|
}
|
|
152
|
+
export interface IControlChangeResult {
|
|
153
|
+
state: ControlState;
|
|
154
|
+
control: IControl;
|
|
155
|
+
controlId: string;
|
|
156
|
+
}
|
|
157
|
+
export interface IDestroyControlOption {
|
|
158
|
+
isEmitEvent?: boolean;
|
|
159
|
+
}
|
|
@@ -5,6 +5,7 @@ import { ListStyle, ListType } from '../dataset/enum/List';
|
|
|
5
5
|
import { RowFlex } from '../dataset/enum/Row';
|
|
6
6
|
import { TitleLevel } from '../dataset/enum/Title';
|
|
7
7
|
import { TableBorder } from '../dataset/enum/table/Table';
|
|
8
|
+
import { IArea } from './Area';
|
|
8
9
|
import { IBlock } from './Block';
|
|
9
10
|
import { ICheckbox } from './Checkbox';
|
|
10
11
|
import { IControl } from './Control';
|
|
@@ -106,7 +107,12 @@ export interface IImageElement {
|
|
|
106
107
|
export interface IBlockElement {
|
|
107
108
|
block?: IBlock;
|
|
108
109
|
}
|
|
109
|
-
export
|
|
110
|
+
export interface IAreaElement {
|
|
111
|
+
valueList?: IElement[];
|
|
112
|
+
areaId?: string;
|
|
113
|
+
area?: IArea;
|
|
114
|
+
}
|
|
115
|
+
export type IElement = IElementBasic & IElementStyle & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement;
|
|
110
116
|
export interface IElementMetrics {
|
|
111
117
|
width: number;
|
|
112
118
|
height: number;
|
|
@@ -139,6 +145,11 @@ export interface IElementFillRect {
|
|
|
139
145
|
height: number;
|
|
140
146
|
}
|
|
141
147
|
export interface IUpdateElementByIdOption {
|
|
142
|
-
id
|
|
148
|
+
id?: string;
|
|
149
|
+
conceptId?: string;
|
|
143
150
|
properties: Omit<Partial<IElement>, 'id'>;
|
|
144
151
|
}
|
|
152
|
+
export interface IGetElementByIdOption {
|
|
153
|
+
id?: string;
|
|
154
|
+
conceptId?: string;
|
|
155
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EditorZone, ElementType, ListStyle, ListType, PageMode, TitleLevel } from '..';
|
|
2
2
|
import { RowFlex } from '../dataset/enum/Row';
|
|
3
|
-
import {
|
|
3
|
+
import { IControlChangeResult } from './Control';
|
|
4
4
|
import { IEditorResult } from './Editor';
|
|
5
5
|
import { IPositionContext } from './Position';
|
|
6
6
|
import { ITextDecoration } from './Text';
|
|
@@ -34,7 +34,7 @@ export type IPageSizeChange = (payload: number) => void;
|
|
|
34
34
|
export type IPageScaleChange = (payload: number) => void;
|
|
35
35
|
export type ISaved = (payload: IEditorResult) => void;
|
|
36
36
|
export type IContentChange = () => void;
|
|
37
|
-
export type IControlChange = (payload:
|
|
37
|
+
export type IControlChange = (payload: IControlChangeResult) => void;
|
|
38
38
|
export type IPageModeChange = (payload: PageMode) => void;
|
|
39
39
|
export type IZoneChange = (payload: EditorZone) => void;
|
|
40
40
|
export type IMouseEventChange = (evt: MouseEvent) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
2
|
-
import { IElement, IElementFillRect } from './Element';
|
|
2
|
+
import { IElement, IElementFillRect, IElementStyle } from './Element';
|
|
3
3
|
export interface IRange {
|
|
4
4
|
startIndex: number;
|
|
5
5
|
endIndex: number;
|
|
@@ -35,3 +35,4 @@ export interface IRangeParagraphInfo {
|
|
|
35
35
|
elementList: IElement[];
|
|
36
36
|
startIndex: number;
|
|
37
37
|
}
|
|
38
|
+
export type IRangeElementStyle = Pick<IElementStyle, 'bold' | 'color' | 'highlight' | 'font' | 'size' | 'italic' | 'underline' | 'strikeout'>;
|
|
@@ -14,6 +14,7 @@ interface IPickElementOption {
|
|
|
14
14
|
export declare function pickElementAttr(payload: IElement, option?: IPickElementOption): IElement;
|
|
15
15
|
interface IZipElementListOption {
|
|
16
16
|
extraPickAttrs?: Array<keyof IElement>;
|
|
17
|
+
isClassifyArea?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare function zipElementList(payload: IElement[], options?: IZipElementListOption): IElement[];
|
|
19
20
|
export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
|
|
@@ -22,3 +22,4 @@ export declare function findScrollContainer(element: HTMLElement): HTMLElement;
|
|
|
22
22
|
export declare function isArrayEqual(arr1: unknown[], arr2: unknown[]): boolean;
|
|
23
23
|
export declare function isObjectEqual(obj1: unknown, obj2: unknown): boolean;
|
|
24
24
|
export declare function isRectIntersect(rect1: IElementFillRect, rect2: IElementFillRect): boolean;
|
|
25
|
+
export declare function isNonValue(value: unknown): boolean;
|