@hufe921/canvas-editor 0.9.128 → 0.9.130

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.
@@ -85,6 +85,7 @@ export declare class Command {
85
85
  executeInsertArea: CommandAdapt['insertArea'];
86
86
  executeSetAreaValue: CommandAdapt['setAreaValue'];
87
87
  executeSetAreaProperties: CommandAdapt['setAreaProperties'];
88
+ executeDeleteArea: CommandAdapt['deleteArea'];
88
89
  executeLocationArea: CommandAdapt['locationArea'];
89
90
  executeClearGraffiti: CommandAdapt['clearGraffiti'];
90
91
  executeAppendElementList: CommandAdapt['appendElementList'];
@@ -21,7 +21,7 @@ import { IGetTitleValueOption, IGetTitleValueResult } from '../../interface/Titl
21
21
  import { IWatermark } from '../../interface/Watermark';
22
22
  import { Draw } from '../draw/Draw';
23
23
  import { INavigateInfo } from '../draw/interactive/Search';
24
- import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../interface/Area';
24
+ import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, IDeleteAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../interface/Area';
25
25
  import { IAreaBadge, IBadge } from '../../interface/Badge';
26
26
  import { IRichtextOption } from '../../interface/Command';
27
27
  export declare class CommandAdapt {
@@ -185,6 +185,7 @@ export declare class CommandAdapt {
185
185
  insertArea(payload: IInsertAreaOption): string | null;
186
186
  setAreaValue(payload: ISetAreaValueOption): void;
187
187
  setAreaProperties(payload: ISetAreaPropertiesOption): void;
188
+ deleteArea(options?: IDeleteAreaOption): void;
188
189
  locationArea(areaId: string, options?: ILocationAreaOption): void;
189
190
  clearGraffiti(): void;
190
191
  }
@@ -25,6 +25,7 @@ import { WorkerManager } from '../worker/WorkerManager';
25
25
  import { Previewer } from './particle/previewer/Previewer';
26
26
  import { DateParticle } from './particle/date/DateParticle';
27
27
  import { IMargin } from '../../interface/Margin';
28
+ import { BlockParticle } from './particle/block/BlockParticle';
28
29
  import { I18n } from '../i18n/I18n';
29
30
  import { ImageObserver } from '../observer/ImageObserver';
30
31
  import { Zone } from '../zone/Zone';
@@ -195,6 +196,7 @@ export declare class Draw {
195
196
  getTableTool(): TableTool;
196
197
  getTableOperate(): TableOperate;
197
198
  getTableParticle(): TableParticle;
199
+ getBlockParticle(): BlockParticle;
198
200
  getHeader(): Header;
199
201
  getFooter(): Footer;
200
202
  getHyperlinkParticle(): HyperlinkParticle;
@@ -1,5 +1,5 @@
1
1
  import { Draw } from '../Draw';
2
- import { IAreaInfo, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../../interface/Area';
2
+ import { IAreaInfo, IDeleteAreaOption, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, ISetAreaPropertiesOption, ISetAreaValueOption } from '../../../interface/Area';
3
3
  import { IRange } from '../../../interface/Range';
4
4
  import { IElementPosition } from '../../../interface/Element';
5
5
  export declare class Area {
@@ -24,4 +24,5 @@ export declare class Area {
24
24
  } | null;
25
25
  setAreaProperties(payload: ISetAreaPropertiesOption): void;
26
26
  setAreaValue(payload: ISetAreaValueOption): void;
27
+ deleteArea(options?: IDeleteAreaOption): void;
27
28
  }
@@ -1,7 +1,9 @@
1
+ import { IIframeInfo } from '../../../../interface/Block';
1
2
  import { IRowElement } from '../../../../interface/Row';
2
3
  import { Draw } from '../../Draw';
3
4
  export declare class BlockParticle {
4
5
  private draw;
6
+ private options;
5
7
  private container;
6
8
  private blockContainer;
7
9
  private blockMap;
@@ -11,4 +13,7 @@ export declare class BlockParticle {
11
13
  getBlockContainer(): HTMLDivElement;
12
14
  render(ctx: CanvasRenderingContext2D, pageNo: number, element: IRowElement, x: number, y: number): void;
13
15
  clear(): void;
16
+ update(): void;
17
+ drawIframeToPage(pageList: HTMLCanvasElement[], snapDomFunction: (iframe: HTMLIFrameElement) => Promise<string>): Promise<void>;
18
+ pickIframeInfo(): IIframeInfo[][];
14
19
  }
@@ -9,6 +9,7 @@ export declare class BaseBlock {
9
9
  private block;
10
10
  private blockContainer;
11
11
  private blockItem;
12
+ private positionInfo;
12
13
  protected blockCache: Map<string, IFrameBlock | VideoBlock>;
13
14
  private resizerMask;
14
15
  private resizerSelection;
@@ -22,12 +23,19 @@ export declare class BaseBlock {
22
23
  constructor(blockParticle: BlockParticle, element: IRowElement);
23
24
  getBlockElement(): IRowElement;
24
25
  getBlockWidth(): number;
26
+ getIFrameBlock(): IFrameBlock | null;
27
+ getPositionInfo(): {
28
+ pageNo: number;
29
+ x: number;
30
+ y: number;
31
+ } | null;
25
32
  private _createBlockItem;
26
33
  private _updateResizerRect;
27
34
  private _mousedown;
28
35
  private _mousemove;
29
- snapshot(ctx: CanvasRenderingContext2D, x: number, y: number): void;
36
+ snapshot(ctx: CanvasRenderingContext2D, pageNo: number, x: number, y: number): void;
30
37
  render(): void;
31
38
  setClientRects(pageNo: number, x: number, y: number): void;
39
+ setStatus(): void;
32
40
  remove(): void;
33
41
  }
@@ -3,7 +3,11 @@ export declare class IFrameBlock {
3
3
  static readonly sandbox: string[];
4
4
  static readonly allow: string[];
5
5
  private element;
6
+ private iframe;
7
+ private isReadonly;
6
8
  constructor(element: IRowElement);
9
+ getIframe(): HTMLIFrameElement | null;
7
10
  private _defineIframeProperties;
8
11
  render(blockItemContainer: HTMLDivElement): void;
12
+ setReadonly(readonly: boolean): void;
9
13
  }
@@ -53,3 +53,6 @@ export interface ILocationAreaOption {
53
53
  position: LocationPosition;
54
54
  isAppendLastLineBreak?: boolean;
55
55
  }
56
+ export interface IDeleteAreaOption {
57
+ id?: string;
58
+ }
@@ -13,3 +13,11 @@ export interface IBlock {
13
13
  iframeBlock?: IIFrameBlock;
14
14
  videoBlock?: IVideoBlock;
15
15
  }
16
+ export interface IIframeInfo {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ src?: string;
22
+ srcdoc?: string;
23
+ }
@@ -60,6 +60,7 @@ export interface IAppendElementListOption {
60
60
  export interface IGetImageOption {
61
61
  pixelRatio?: number;
62
62
  mode?: EditorMode;
63
+ snapDomFunction?: (iframe: HTMLIFrameElement) => Promise<string>;
63
64
  }
64
65
  export interface IComputeRowListPayload {
65
66
  innerWidth: number;
@@ -26,6 +26,7 @@ export declare function isArrayEqual(arr1: unknown[], arr2: unknown[]): boolean;
26
26
  export declare function isObjectEqual(obj1: unknown, obj2: unknown): boolean;
27
27
  export declare function isRectIntersect(rect1: IElementFillRect, rect2: IElementFillRect): boolean;
28
28
  export declare function isNonValue(value: unknown): boolean;
29
+ export declare function loadImage(src: string): Promise<HTMLImageElement>;
29
30
  export declare function normalizeLineBreak(text: string): string;
30
31
  export declare function indexOf(source: string, search: string | RegExp, fromIndex?: number): {
31
32
  index: number;
@@ -1,7 +1,9 @@
1
1
  import { PaperDirection } from '../dataset/enum/Editor';
2
- export interface IPrintImageBase64Option {
2
+ import { IIframeInfo } from '../interface/Block';
3
+ export interface IPrintOption {
3
4
  width: number;
4
5
  height: number;
5
6
  direction?: PaperDirection;
7
+ iframeInfoList?: IIframeInfo[][];
6
8
  }
7
- export declare function printImageBase64(base64List: string[], options: IPrintImageBase64Option): void;
9
+ export declare function print(base64List: string[], options: IPrintOption): Promise<void>;
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.128",
5
+ "version": "0.9.130",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",