@hufe921/canvas-editor 0.9.77 → 0.9.79
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 +47 -0
- package/dist/canvas-editor.es.js +731 -285
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +36 -36
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +1 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -1
- package/dist/src/editor/core/draw/control/Control.d.ts +6 -2
- package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +1 -0
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +2 -0
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -1
- package/dist/src/editor/interface/Control.d.ts +13 -0
- package/dist/src/editor/interface/Draw.d.ts +1 -0
- package/dist/src/editor/interface/Editor.d.ts +1 -0
- package/dist/src/editor/interface/Element.d.ts +1 -0
- package/dist/src/editor/interface/Range.d.ts +3 -0
- package/dist/src/editor/interface/contextmenu/ContextMenu.d.ts +3 -0
- package/dist/src/editor/utils/element.d.ts +9 -1
- package/dist/src/editor/utils/option.d.ts +3 -0
- package/package.json +1 -1
|
@@ -88,6 +88,7 @@ export declare class Command {
|
|
|
88
88
|
executeSetControlExtension: CommandAdapt['setControlExtension'];
|
|
89
89
|
executeSetControlProperties: CommandAdapt['setControlProperties'];
|
|
90
90
|
executeSetControlHighlight: CommandAdapt['setControlHighlight'];
|
|
91
|
+
executeUpdateOptions: CommandAdapt['updateOptions'];
|
|
91
92
|
getCatalog: CommandAdapt['getCatalog'];
|
|
92
93
|
getImage: CommandAdapt['getImage'];
|
|
93
94
|
getOptions: CommandAdapt['getOptions'];
|
|
@@ -9,7 +9,7 @@ import { ICatalog } from '../../interface/Catalog';
|
|
|
9
9
|
import { DeepRequired } from '../../interface/Common';
|
|
10
10
|
import { IGetControlValueOption, IGetControlValueResult, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
|
|
11
11
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
12
|
-
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText } from '../../interface/Editor';
|
|
12
|
+
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IUpdateOption } from '../../interface/Editor';
|
|
13
13
|
import { IElement } from '../../interface/Element';
|
|
14
14
|
import { IPasteOption } from '../../interface/Event';
|
|
15
15
|
import { IMargin } from '../../interface/Margin';
|
|
@@ -139,6 +139,7 @@ export declare class CommandAdapt {
|
|
|
139
139
|
setControlExtension(payload: ISetControlExtensionOption): void;
|
|
140
140
|
setControlProperties(payload: ISetControlProperties): void;
|
|
141
141
|
setControlHighlight(payload: ISetControlHighlightOption): void;
|
|
142
|
+
updateOptions(payload: IUpdateOption): void;
|
|
142
143
|
getControlList(): IElement[];
|
|
143
144
|
getContainer(): HTMLDivElement;
|
|
144
145
|
getTitleValue(payload: IGetTitleValueOption): IGetTitleValueResult | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, ISetControlExtensionOption, ISetControlProperties, ISetControlValueOption } from '../../../interface/Control';
|
|
1
|
+
import { IControlContext, IControlHighlight, IControlInitOption, IControlInstance, IGetControlValueOption, IGetControlValueResult, IInitNextControlOption, INextControlContext, IRepaintControlOption, ISetControlExtensionOption, ISetControlProperties, 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';
|
|
@@ -35,7 +35,8 @@ export declare class Control {
|
|
|
35
35
|
getActiveControl(): IControlInstance | null;
|
|
36
36
|
initControl(): void;
|
|
37
37
|
destroyControl(): void;
|
|
38
|
-
repaintControl(
|
|
38
|
+
repaintControl(options?: IRepaintControlOption): void;
|
|
39
|
+
reAwakeControl(): void;
|
|
39
40
|
moveCursor(position: IControlInitOption): IMoveCursorResult;
|
|
40
41
|
removeControl(startIndex: number, context?: IControlContext): number | null;
|
|
41
42
|
removePlaceholder(startIndex: number, context?: IControlContext): void;
|
|
@@ -50,5 +51,8 @@ export declare class Control {
|
|
|
50
51
|
getList(): IElement[];
|
|
51
52
|
recordBorderInfo(x: number, y: number, width: number, height: number): void;
|
|
52
53
|
drawBorder(ctx: CanvasRenderingContext2D): void;
|
|
54
|
+
getPreControlContext(): INextControlContext | null;
|
|
55
|
+
getNextControlContext(): INextControlContext | null;
|
|
56
|
+
initNextControl(option?: IInitNextControlOption): void;
|
|
53
57
|
}
|
|
54
58
|
export {};
|
|
@@ -5,6 +5,7 @@ export declare class CheckboxControl implements IControlInstance {
|
|
|
5
5
|
protected element: IElement;
|
|
6
6
|
protected control: Control;
|
|
7
7
|
constructor(element: IElement, control: Control);
|
|
8
|
+
setElement(element: IElement): void;
|
|
8
9
|
getElement(): IElement;
|
|
9
10
|
getCode(): string | null;
|
|
10
11
|
getValue(): IElement[];
|
|
@@ -7,7 +7,9 @@ export declare class SelectControl implements IControlInstance {
|
|
|
7
7
|
private isPopup;
|
|
8
8
|
private selectDom;
|
|
9
9
|
constructor(element: IElement, control: Control);
|
|
10
|
+
setElement(element: IElement): void;
|
|
10
11
|
getElement(): IElement;
|
|
12
|
+
getIsPopup(): boolean;
|
|
11
13
|
getCode(): string | null;
|
|
12
14
|
getValue(context?: IControlContext): IElement[];
|
|
13
15
|
setValue(): number;
|
|
@@ -5,6 +5,7 @@ export declare class TextControl implements IControlInstance {
|
|
|
5
5
|
private element;
|
|
6
6
|
private control;
|
|
7
7
|
constructor(element: IElement, control: Control);
|
|
8
|
+
setElement(element: IElement): void;
|
|
8
9
|
getElement(): IElement;
|
|
9
10
|
getValue(context?: IControlContext): IElement[];
|
|
10
11
|
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
@@ -15,6 +15,6 @@ export declare const CONTROL_STYLE_ATTR: Array<keyof IControlStyle>;
|
|
|
15
15
|
export declare const EDITOR_ELEMENT_CONTEXT_ATTR: Array<keyof IElement>;
|
|
16
16
|
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
17
17
|
export declare const IMAGE_ELEMENT_TYPE: ElementType[];
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const BLOCK_ELEMENT_TYPE: ElementType[];
|
|
19
19
|
export declare const INLINE_NODE_NAME: string[];
|
|
20
20
|
export declare const VIRTUAL_ELEMENT_TYPE: ElementType[];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
|
|
2
2
|
import { EditorZone } from '../dataset/enum/Editor';
|
|
3
|
+
import { MoveDirection } from '../dataset/enum/Observer';
|
|
3
4
|
import { ICheckbox } from './Checkbox';
|
|
5
|
+
import { IDrawOption } from './Draw';
|
|
4
6
|
import { IElement } from './Element';
|
|
7
|
+
import { IPositionContext } from './Position';
|
|
5
8
|
import { IRadio } from './Radio';
|
|
6
9
|
import { IRange } from './Range';
|
|
7
10
|
export interface IValueSet {
|
|
@@ -78,6 +81,7 @@ export interface IControlInitResult {
|
|
|
78
81
|
newIndex: number;
|
|
79
82
|
}
|
|
80
83
|
export interface IControlInstance {
|
|
84
|
+
setElement(element: IElement): void;
|
|
81
85
|
getElement(): IElement;
|
|
82
86
|
getValue(): IElement[];
|
|
83
87
|
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
|
|
@@ -90,6 +94,7 @@ export interface IControlContext {
|
|
|
90
94
|
}
|
|
91
95
|
export interface IControlRuleOption {
|
|
92
96
|
isIgnoreDisabledRule?: boolean;
|
|
97
|
+
isAddPlaceholder?: boolean;
|
|
93
98
|
}
|
|
94
99
|
export interface IGetControlValueOption {
|
|
95
100
|
conceptId: string;
|
|
@@ -112,3 +117,11 @@ export type ISetControlProperties = {
|
|
|
112
117
|
conceptId: string;
|
|
113
118
|
properties: Partial<Omit<IControl, 'value'>>;
|
|
114
119
|
};
|
|
120
|
+
export type IRepaintControlOption = Pick<IDrawOption, 'curIndex' | 'isCompute' | 'isSubmitHistory'>;
|
|
121
|
+
export interface INextControlContext {
|
|
122
|
+
positionContext: IPositionContext;
|
|
123
|
+
nextIndex: number;
|
|
124
|
+
}
|
|
125
|
+
export interface IInitNextControlOption {
|
|
126
|
+
direction?: MoveDirection;
|
|
127
|
+
}
|
|
@@ -95,3 +95,4 @@ export interface IEditorHTML {
|
|
|
95
95
|
footer: string;
|
|
96
96
|
}
|
|
97
97
|
export type IEditorText = IEditorHTML;
|
|
98
|
+
export type IUpdateOption = Omit<IEditorOption, 'mode' | 'width' | 'height' | 'scale' | 'pageGap' | 'pageMode' | 'paperDirection' | 'historyMaxRecordCount' | 'scrollContainerSelector'>;
|
|
@@ -23,6 +23,9 @@ export type RangeContext = {
|
|
|
23
23
|
rangeRects: RangeRect[];
|
|
24
24
|
zone: EditorZone;
|
|
25
25
|
isTable: boolean;
|
|
26
|
+
trIndex: number | null;
|
|
27
|
+
tdIndex: number | null;
|
|
28
|
+
tableElement: IElement | null;
|
|
26
29
|
};
|
|
27
30
|
export interface IRangeParagraphInfo {
|
|
28
31
|
elementList: IElement[];
|
|
@@ -10,6 +10,9 @@ export interface IContextMenuContext {
|
|
|
10
10
|
isInTable: boolean;
|
|
11
11
|
isCrossRowCol: boolean;
|
|
12
12
|
zone: EditorZone;
|
|
13
|
+
trIndex: number | null;
|
|
14
|
+
tdIndex: number | null;
|
|
15
|
+
tableElement: IElement | null;
|
|
13
16
|
}
|
|
14
17
|
export interface IRegisterContextMenu {
|
|
15
18
|
key?: string;
|
|
@@ -9,7 +9,9 @@ export declare function formatElementList(elementList: IElement[], options: IFor
|
|
|
9
9
|
export declare function isSameElementExceptValue(source: IElement, target: IElement): boolean;
|
|
10
10
|
export declare function pickElementAttr(payload: IElement): IElement;
|
|
11
11
|
export declare function zipElementList(payload: IElement[]): IElement[];
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function convertTextAlignToRowFlex(node: HTMLElement): RowFlex;
|
|
13
|
+
export declare function convertRowFlexToTextAlign(rowFlex: RowFlex): RowFlex.LEFT | RowFlex.CENTER | RowFlex.RIGHT | RowFlex.JUSTIFY | "justify";
|
|
14
|
+
export declare function convertRowFlexToJustifyContent(rowFlex: RowFlex): "center" | "flex-start" | "flex-end" | "space-between";
|
|
13
15
|
export declare function isTextLikeElement(element: IElement): boolean;
|
|
14
16
|
export declare function getAnchorElement(elementList: IElement[], anchorIndex: number): IElement | null;
|
|
15
17
|
export interface IFormatElementContextOption {
|
|
@@ -18,6 +20,11 @@ export interface IFormatElementContextOption {
|
|
|
18
20
|
export declare function formatElementContext(sourceElementList: IElement[], formatElementList: IElement[], anchorIndex: number, options?: IFormatElementContextOption): void;
|
|
19
21
|
export declare function convertElementToDom(element: IElement, options: DeepRequired<IEditorOption>): HTMLElement;
|
|
20
22
|
export declare function splitListElement(elementList: IElement[]): Map<number, IElement[]>;
|
|
23
|
+
export interface IElementListGroupRowFlex {
|
|
24
|
+
rowFlex: RowFlex | null;
|
|
25
|
+
data: IElement[];
|
|
26
|
+
}
|
|
27
|
+
export declare function groupElementListByRowFlex(elementList: IElement[]): IElementListGroupRowFlex[];
|
|
21
28
|
export declare function createDomFromElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): HTMLDivElement;
|
|
22
29
|
export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
|
|
23
30
|
interface IGetElementListByHTMLOption {
|
|
@@ -26,4 +33,5 @@ interface IGetElementListByHTMLOption {
|
|
|
26
33
|
export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
|
|
27
34
|
export declare function getTextFromElementList(elementList: IElement[]): string;
|
|
28
35
|
export declare function getSlimCloneElementList(elementList: IElement[]): IElement[];
|
|
36
|
+
export declare function getIsBlockElement(element?: IElement): boolean;
|
|
29
37
|
export {};
|