@hufe921/canvas-editor 0.9.36 → 0.9.37

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.
@@ -66,6 +66,7 @@ export declare class Command {
66
66
  executePaperDirection: CommandAdapt['paperDirection'];
67
67
  executeSetPaperMargin: CommandAdapt['setPaperMargin'];
68
68
  executeInsertElementList: CommandAdapt['insertElementList'];
69
+ executeSetValue: CommandAdapt['setValue'];
69
70
  executeRemoveControl: CommandAdapt['removeControl'];
70
71
  executeSetLocale: CommandAdapt['setLocale'];
71
72
  executeLocationCatalog: CommandAdapt['locationCatalog'];
@@ -7,7 +7,7 @@ import { TitleLevel } from '../../dataset/enum/Title';
7
7
  import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
8
8
  import { ICatalog } from '../../interface/Catalog';
9
9
  import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
10
- import { IEditorResult } from '../../interface/Editor';
10
+ import { IEditorData, IEditorResult } from '../../interface/Editor';
11
11
  import { IElement } from '../../interface/Element';
12
12
  import { IMargin } from '../../interface/Margin';
13
13
  import { IWatermark } from '../../interface/Watermark';
@@ -100,6 +100,7 @@ export declare class CommandAdapt {
100
100
  getPaperMargin(): number[];
101
101
  setPaperMargin(payload: IMargin): void;
102
102
  insertElementList(payload: IElement[]): void;
103
+ setValue(payload: Partial<IEditorData>): void;
103
104
  removeControl(): void;
104
105
  setLocale(payload: string): void;
105
106
  getCatalog(): Promise<ICatalog | null>;
@@ -166,6 +166,7 @@ export declare class Draw {
166
166
  setPaperDirection(payload: PaperDirection): void;
167
167
  setPaperMargin(payload: IMargin): void;
168
168
  getValue(): IEditorResult;
169
+ setValue(payload: Partial<IEditorData>): void;
169
170
  private _wrapContainer;
170
171
  private _formatContainer;
171
172
  private _createPageContainer;
@@ -7,5 +7,6 @@ export declare class ImageParticle {
7
7
  protected imageCache: Map<string, HTMLImageElement>;
8
8
  constructor(draw: Draw);
9
9
  protected addImageObserver(promise: Promise<unknown>): void;
10
+ protected getFallbackImage(width: number, height: number): HTMLImageElement;
10
11
  render(ctx: CanvasRenderingContext2D, element: IElement, x: number, y: number): void;
11
12
  }
@@ -9,4 +9,5 @@ export declare class HistoryManager {
9
9
  execute(fn: Function): void;
10
10
  isCanUndo(): boolean;
11
11
  isCanRedo(): boolean;
12
+ recovery(): void;
12
13
  }
@@ -0,0 +1,7 @@
1
+ import Editor from '../..';
2
+ import { PluginFunction } from '../../interface/Plugin';
3
+ export declare class Plugin {
4
+ private editor;
5
+ constructor(editor: Editor);
6
+ use<Options>(pluginFunction: PluginFunction<Options>, options?: Options): void;
7
+ }
@@ -22,11 +22,13 @@ import { MaxHeightRatio, NumberType } from './dataset/enum/Common';
22
22
  import { TitleLevel } from './dataset/enum/Title';
23
23
  import { ListStyle, ListType } from './dataset/enum/List';
24
24
  import { ICatalog, ICatalogItem } from './interface/Catalog';
25
+ import { UsePlugin } from './interface/Plugin';
25
26
  export default class Editor {
26
27
  command: Command;
27
28
  listener: Listener;
28
29
  register: Register;
29
- destroy: Function;
30
+ destroy: () => void;
31
+ use: UsePlugin;
30
32
  constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
31
33
  }
32
34
  export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle };
@@ -0,0 +1,3 @@
1
+ import Editor from '..';
2
+ export declare type PluginFunction<Options> = (editor: Editor, options?: Options) => any;
3
+ export declare type UsePlugin = <Options>(pluginFunction: PluginFunction<Options>, options?: Options) => void;
@@ -12,3 +12,4 @@ export declare function mergeObject<T>(source: T, target: T): T;
12
12
  export declare function nextTick(fn: Function): void;
13
13
  export declare function convertNumberToChinese(num: number): string;
14
14
  export declare function cloneProperty<T>(properties: (keyof T)[], sourceElement: T, targetElement: T): void;
15
+ export declare function convertStringToBase64(input: string): string;
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.36",
5
+ "version": "0.9.37",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",