@hufe921/canvas-editor 0.9.82 → 0.9.84
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 +33 -0
- package/dist/canvas-editor.es.js +252 -91
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +28 -28
- 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 +3 -1
- package/dist/src/editor/core/event/handlers/copy.d.ts +1 -1
- package/dist/src/editor/core/event/handlers/drop.d.ts +1 -1
- package/dist/src/editor/core/event/handlers/paste.d.ts +1 -1
- package/dist/src/editor/core/observer/MouseObserver.d.ts +10 -0
- package/dist/src/editor/core/override/Override.d.ts +6 -3
- package/dist/src/editor/core/range/RangeManager.d.ts +1 -0
- package/dist/src/editor/interface/Event.d.ts +7 -0
- package/dist/src/editor/interface/EventBus.d.ts +4 -1
- package/dist/src/editor/interface/Listener.d.ts +1 -0
- package/dist/src/editor/interface/Previewer.d.ts +1 -0
- package/dist/src/editor/interface/contextmenu/ContextMenu.d.ts +3 -0
- package/dist/src/editor/interface/table/Td.d.ts +3 -0
- package/dist/src/editor/utils/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -113,5 +113,6 @@ export declare class Command {
|
|
|
113
113
|
getControlList: CommandAdapt['getControlList'];
|
|
114
114
|
getContainer: CommandAdapt['getContainer'];
|
|
115
115
|
getTitleValue: CommandAdapt['getTitleValue'];
|
|
116
|
+
getPositionContextByEvent: CommandAdapt['getPositionContextByEvent'];
|
|
116
117
|
constructor(adapt: CommandAdapt);
|
|
117
118
|
}
|
|
@@ -11,7 +11,7 @@ import { IGetControlValueOption, IGetControlValueResult, ISetControlExtensionOpt
|
|
|
11
11
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
12
12
|
import { IEditorData, IEditorHTML, IEditorOption, IEditorResult, IEditorText, IUpdateOption } from '../../interface/Editor';
|
|
13
13
|
import { IElement, IUpdateElementByIdOption } from '../../interface/Element';
|
|
14
|
-
import { IPasteOption } from '../../interface/Event';
|
|
14
|
+
import { IPasteOption, IPositionContextByEvent } from '../../interface/Event';
|
|
15
15
|
import { IMargin } from '../../interface/Margin';
|
|
16
16
|
import { IRange, RangeContext } from '../../interface/Range';
|
|
17
17
|
import { ITextDecoration } from '../../interface/Text';
|
|
@@ -31,6 +31,7 @@ export declare class CommandAdapt {
|
|
|
31
31
|
private workerManager;
|
|
32
32
|
private searchManager;
|
|
33
33
|
private i18n;
|
|
34
|
+
private zone;
|
|
34
35
|
constructor(draw: Draw);
|
|
35
36
|
mode(payload: EditorMode): void;
|
|
36
37
|
cut(): void;
|
|
@@ -145,5 +146,6 @@ export declare class CommandAdapt {
|
|
|
145
146
|
locationControl(controlId: string): void;
|
|
146
147
|
getContainer(): HTMLDivElement;
|
|
147
148
|
getTitleValue(payload: IGetTitleValueOption): IGetTitleValueResult | null;
|
|
149
|
+
getPositionContextByEvent(evt: MouseEvent): IPositionContextByEvent | null;
|
|
148
150
|
insertTitle(payload: IElement): void;
|
|
149
151
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CanvasEvent } from '../CanvasEvent';
|
|
2
|
-
export declare function copy(host: CanvasEvent): void
|
|
2
|
+
export declare function copy(host: CanvasEvent): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CanvasEvent } from '../CanvasEvent';
|
|
2
|
-
export declare function drop(evt: DragEvent, host: CanvasEvent): void
|
|
2
|
+
export declare function drop(evt: DragEvent, host: CanvasEvent): Promise<void>;
|
|
@@ -4,5 +4,5 @@ import { CanvasEvent } from '../CanvasEvent';
|
|
|
4
4
|
export declare function pasteElement(host: CanvasEvent, elementList: IElement[]): void;
|
|
5
5
|
export declare function pasteHTML(host: CanvasEvent, htmlText: string): void;
|
|
6
6
|
export declare function pasteImage(host: CanvasEvent, file: File | Blob): void;
|
|
7
|
-
export declare function pasteByEvent(host: CanvasEvent, evt: ClipboardEvent): void
|
|
7
|
+
export declare function pasteByEvent(host: CanvasEvent, evt: ClipboardEvent): Promise<void>;
|
|
8
8
|
export declare function pasteByApi(host: CanvasEvent, options?: IPasteOption): Promise<void>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export interface IOverrideResult {
|
|
2
|
+
preventDefault?: boolean;
|
|
3
|
+
}
|
|
1
4
|
export declare class Override {
|
|
2
|
-
paste: ((evt?: ClipboardEvent) => void) | undefined;
|
|
3
|
-
copy: (() => void) | undefined;
|
|
4
|
-
drop: ((evt: DragEvent) => void) | undefined;
|
|
5
|
+
paste: ((evt?: ClipboardEvent) => void | Promise<void> | IOverrideResult | Promise<IOverrideResult>) | undefined;
|
|
6
|
+
copy: (() => void | Promise<void> | IOverrideResult | Promise<IOverrideResult>) | undefined;
|
|
7
|
+
drop: ((evt: DragEvent) => void | Promise<void> | IOverrideResult | Promise<IOverrideResult>) | undefined;
|
|
5
8
|
}
|
|
@@ -23,6 +23,7 @@ export declare class RangeManager {
|
|
|
23
23
|
getRangeParagraph(): RangeRowArray | null;
|
|
24
24
|
getRangeParagraphInfo(): IRangeParagraphInfo | null;
|
|
25
25
|
getRangeParagraphElementList(): IElement[] | null;
|
|
26
|
+
getRangeTableElement(): IElement | null;
|
|
26
27
|
getIsSelectAll(): boolean;
|
|
27
28
|
getIsPointInRange(x: number, y: number): boolean;
|
|
28
29
|
getKeywordRangeList(payload: string): IRange[];
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { IElement } from './Element';
|
|
2
|
+
import { RangeRect } from './Range';
|
|
1
3
|
export interface IPasteOption {
|
|
2
4
|
isPlainText: boolean;
|
|
3
5
|
}
|
|
6
|
+
export interface IPositionContextByEvent {
|
|
7
|
+
pageNo: number;
|
|
8
|
+
element: IElement | null;
|
|
9
|
+
rangeRect: RangeRect | null;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IContentChange, IControlChange, IIntersectionPageNoChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange, IZoneChange } from './Listener';
|
|
1
|
+
import { IContentChange, IControlChange, IIntersectionPageNoChange, IMouseEventChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange, IZoneChange } from './Listener';
|
|
2
2
|
export interface EventBusMap {
|
|
3
3
|
rangeStyleChange: IRangeStyleChange;
|
|
4
4
|
visiblePageNoListChange: IVisiblePageNoListChange;
|
|
@@ -10,4 +10,7 @@ export interface EventBusMap {
|
|
|
10
10
|
controlChange: IControlChange;
|
|
11
11
|
pageModeChange: IPageModeChange;
|
|
12
12
|
zoneChange: IZoneChange;
|
|
13
|
+
mousemove: IMouseEventChange;
|
|
14
|
+
mouseleave: IMouseEventChange;
|
|
15
|
+
mouseenter: IMouseEventChange;
|
|
13
16
|
}
|
|
@@ -36,3 +36,4 @@ export type IContentChange = () => void;
|
|
|
36
36
|
export type IControlChange = (payload: IControl | null) => void;
|
|
37
37
|
export type IPageModeChange = (payload: PageMode) => void;
|
|
38
38
|
export type IZoneChange = (payload: EditorZone) => void;
|
|
39
|
+
export type IMouseEventChange = (evt: MouseEvent) => void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Command } from '../../core/command/Command';
|
|
2
2
|
import { EditorZone } from '../../dataset/enum/Editor';
|
|
3
|
+
import { DeepRequired } from '../Common';
|
|
4
|
+
import { IEditorOption } from '../Editor';
|
|
3
5
|
import { IElement } from '../Element';
|
|
4
6
|
export interface IContextMenuContext {
|
|
5
7
|
startElement: IElement | null;
|
|
@@ -13,6 +15,7 @@ export interface IContextMenuContext {
|
|
|
13
15
|
trIndex: number | null;
|
|
14
16
|
tdIndex: number | null;
|
|
15
17
|
tableElement: IElement | null;
|
|
18
|
+
options: DeepRequired<IEditorOption>;
|
|
16
19
|
}
|
|
17
20
|
export interface IRegisterContextMenu {
|
|
18
21
|
key?: string;
|
|
@@ -3,6 +3,7 @@ import { TdBorder, TdSlash } from '../../dataset/enum/table/Table';
|
|
|
3
3
|
import { IElement, IElementPosition } from '../Element';
|
|
4
4
|
import { IRow } from '../Row';
|
|
5
5
|
export interface ITd {
|
|
6
|
+
conceptId?: string;
|
|
6
7
|
id?: string;
|
|
7
8
|
x?: number;
|
|
8
9
|
y?: number;
|
|
@@ -11,6 +12,8 @@ export interface ITd {
|
|
|
11
12
|
colspan: number;
|
|
12
13
|
rowspan: number;
|
|
13
14
|
value: IElement[];
|
|
15
|
+
trIndex?: number;
|
|
16
|
+
tdIndex?: number;
|
|
14
17
|
isLastRowTd?: boolean;
|
|
15
18
|
isLastColTd?: boolean;
|
|
16
19
|
isLastTd?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function debounce(func:
|
|
2
|
-
export declare function throttle(func:
|
|
1
|
+
export declare function debounce<T extends unknown[]>(func: (...arg: T) => unknown, delay: number): (this: unknown, ...args: T) => void;
|
|
2
|
+
export declare function throttle<T extends unknown[]>(func: (...arg: T) => unknown, delay: number): (this: unknown, ...args: T) => void;
|
|
3
3
|
export declare function deepCloneOmitKeys<T, K>(obj: T, omitKeys: (keyof K)[]): T;
|
|
4
4
|
export declare function deepClone<T>(obj: T): T;
|
|
5
5
|
export declare function isBody(node: Element): boolean;
|
|
@@ -20,3 +20,4 @@ export declare function convertStringToBase64(input: string): string;
|
|
|
20
20
|
export declare function findScrollContainer(element: HTMLElement): HTMLElement;
|
|
21
21
|
export declare function isArrayEqual(arr1: unknown[], arr2: unknown[]): boolean;
|
|
22
22
|
export declare function isObjectEqual(obj1: unknown, obj2: unknown): boolean;
|
|
23
|
+
export declare function isPromiseFunction(fn: Function): boolean;
|