@hufe921/canvas-editor 0.9.95 → 0.9.96
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 +28 -0
- package/README.md +53 -18
- package/dist/canvas-editor.es.js +213 -42
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +33 -33
- 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/cursor/Cursor.d.ts +1 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +1 -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 +1 -0
- package/dist/src/editor/dataset/constant/ContextMenu.d.ts +2 -0
- package/dist/src/editor/dataset/enum/table/Table.d.ts +3 -1
- package/dist/src/editor/index.d.ts +2 -2
- package/dist/src/editor/interface/Control.d.ts +1 -0
- package/dist/src/editor/interface/Element.d.ts +6 -1
- package/package.json +1 -1
|
@@ -118,5 +118,6 @@ export declare class Command {
|
|
|
118
118
|
getContainer: CommandAdapt['getContainer'];
|
|
119
119
|
getTitleValue: CommandAdapt['getTitleValue'];
|
|
120
120
|
getPositionContextByEvent: CommandAdapt['getPositionContextByEvent'];
|
|
121
|
+
getElementById: CommandAdapt['getElementById'];
|
|
121
122
|
constructor(adapt: CommandAdapt);
|
|
122
123
|
}
|
|
@@ -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';
|
|
@@ -126,6 +126,7 @@ export declare class CommandAdapt {
|
|
|
126
126
|
insertElementList(payload: IElement[]): void;
|
|
127
127
|
appendElementList(elementList: IElement[], options?: IAppendElementListOption): void;
|
|
128
128
|
updateElementById(payload: IUpdateElementByIdOption): void;
|
|
129
|
+
getElementById(payload: IGetElementByIdOption): IElement[];
|
|
129
130
|
setValue(payload: Partial<IEditorData>, options?: ISetValueOption): void;
|
|
130
131
|
removeControl(): void;
|
|
131
132
|
setLocale(payload: string): void;
|
|
@@ -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;
|
|
@@ -27,6 +27,7 @@ export declare class Control {
|
|
|
27
27
|
getIsRangeWithinControl(): boolean;
|
|
28
28
|
getIsElementListContainFullControl(elementList: IElement[]): boolean;
|
|
29
29
|
getIsDisabledControl(context?: IControlContext): boolean;
|
|
30
|
+
getIsDisabledPasteControl(context?: IControlContext): boolean;
|
|
30
31
|
getContainer(): HTMLDivElement;
|
|
31
32
|
getElementList(): IElement[];
|
|
32
33
|
getPosition(): IElementPosition | null;
|
|
@@ -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
|
}
|
|
@@ -14,6 +14,7 @@ export declare class RangeManager {
|
|
|
14
14
|
getRange(): IRange;
|
|
15
15
|
clearRange(): void;
|
|
16
16
|
getIsCollapsed(): boolean;
|
|
17
|
+
getIsSelection(): boolean;
|
|
17
18
|
getSelection(): IElement[] | null;
|
|
18
19
|
getSelectionElementList(): IElement[] | null;
|
|
19
20
|
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;
|
|
@@ -9,7 +9,7 @@ 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
14
|
import { ControlIndentation, ControlType } from './dataset/enum/Control';
|
|
15
15
|
import { INavigateInfo } from './core/draw/interactive/Search';
|
|
@@ -47,6 +47,6 @@ export default class Editor {
|
|
|
47
47
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
48
48
|
}
|
|
49
49
|
export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
|
|
50
|
-
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
|
|
50
|
+
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, EDITOR_CLIPBOARD };
|
|
51
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, IGetElementListByHTMLOption };
|
|
52
52
|
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
|
|
@@ -139,6 +139,11 @@ export interface IElementFillRect {
|
|
|
139
139
|
height: number;
|
|
140
140
|
}
|
|
141
141
|
export interface IUpdateElementByIdOption {
|
|
142
|
-
id
|
|
142
|
+
id?: string;
|
|
143
|
+
conceptId?: string;
|
|
143
144
|
properties: Omit<Partial<IElement>, 'id'>;
|
|
144
145
|
}
|
|
146
|
+
export interface IGetElementByIdOption {
|
|
147
|
+
id?: string;
|
|
148
|
+
conceptId?: string;
|
|
149
|
+
}
|