@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.
@@ -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>;
@@ -0,0 +1,10 @@
1
+ import { Draw } from '../draw/Draw';
2
+ export declare class MouseObserver {
3
+ private draw;
4
+ private eventBus;
5
+ private pageContainer;
6
+ constructor(draw: Draw);
7
+ private _mousemove;
8
+ private _mouseenter;
9
+ private _mouseleave;
10
+ }
@@ -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;
@@ -9,4 +9,5 @@ export interface IPreviewerCreateResult {
9
9
  export interface IPreviewerDrawOption {
10
10
  mime?: 'png' | 'jpg' | 'jpeg' | 'svg';
11
11
  srcKey?: keyof Pick<IElement, 'value' | 'laTexSVG'>;
12
+ dragDisable?: boolean;
12
13
  }
@@ -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: Function, delay: number): (this: any, ...args: any[]) => void;
2
- export declare function throttle(func: Function, delay: number): (this: any, ...args: any[]) => void;
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;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hufe921/canvas-editor",
3
3
  "author": "Hufe",
4
4
  "license": "MIT",
5
- "version": "0.9.82",
5
+ "version": "0.9.84",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",