@hufe921/canvas-editor 0.9.113 → 0.9.115

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.
@@ -20,7 +20,7 @@ import { IGetTitleValueOption, IGetTitleValueResult } from '../../interface/Titl
20
20
  import { IWatermark } from '../../interface/Watermark';
21
21
  import { Draw } from '../draw/Draw';
22
22
  import { INavigateInfo } from '../draw/interactive/Search';
23
- import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ISetAreaPropertiesOption } from '../../interface/Area';
23
+ import { IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, ISetAreaPropertiesOption } from '../../interface/Area';
24
24
  import { IAreaBadge, IBadge } from '../../interface/Badge';
25
25
  import { IRichtextOption } from '../../interface/Command';
26
26
  export declare class CommandAdapt {
@@ -172,5 +172,5 @@ export declare class CommandAdapt {
172
172
  focus(payload?: IFocusOption): void;
173
173
  insertArea(payload: IInsertAreaOption): string | null;
174
174
  setAreaProperties(payload: ISetAreaPropertiesOption): void;
175
- locationArea(areaId: string): void;
175
+ locationArea(areaId: string, options?: ILocationAreaOption): void;
176
176
  }
@@ -1,5 +1,5 @@
1
1
  import { Draw } from '../Draw';
2
- import { IAreaInfo, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ISetAreaPropertiesOption } from '../../../interface/Area';
2
+ import { IAreaInfo, IGetAreaValueOption, IGetAreaValueResult, IInsertAreaOption, ILocationAreaOption, ISetAreaPropertiesOption } from '../../../interface/Area';
3
3
  import { IRange } from '../../../interface/Range';
4
4
  import { IElementPosition } from '../../../interface/Element';
5
5
  export declare class Area {
@@ -17,7 +17,7 @@ export declare class Area {
17
17
  render(ctx: CanvasRenderingContext2D, pageNo: number): void;
18
18
  compute(): void;
19
19
  getAreaValue(options?: IGetAreaValueOption): IGetAreaValueResult | null;
20
- getContextByAreaId(areaId: string): {
20
+ getContextByAreaId(areaId: string, options?: ILocationAreaOption): {
21
21
  range: IRange;
22
22
  elementPosition: IElementPosition;
23
23
  } | null;
@@ -2,6 +2,7 @@ import { AreaMode } from '../dataset/enum/Area';
2
2
  import { LocationPosition } from '../dataset/enum/Common';
3
3
  import { IElement, IElementPosition } from './Element';
4
4
  import { IPlaceholder } from './Placeholder';
5
+ import { IRange } from './Range';
5
6
  export interface IAreaBasic {
6
7
  extension?: unknown;
7
8
  placeholder?: IPlaceholder;
@@ -22,6 +23,7 @@ export interface IInsertAreaOption {
22
23
  area: IArea;
23
24
  value: IElement[];
24
25
  position?: LocationPosition;
26
+ range?: Pick<IRange, 'startIndex' | 'endIndex'>;
25
27
  }
26
28
  export interface ISetAreaPropertiesOption {
27
29
  id?: string;
@@ -43,3 +45,7 @@ export interface IAreaInfo {
43
45
  elementList: IElement[];
44
46
  positionList: IElementPosition[];
45
47
  }
48
+ export interface ILocationAreaOption {
49
+ position: LocationPosition;
50
+ isAppendLastLineBreak?: boolean;
51
+ }
@@ -22,6 +22,7 @@ export interface IDrawImagePayload {
22
22
  height: number;
23
23
  value: string;
24
24
  imgDisplay?: ImageDisplay;
25
+ extension?: unknown;
25
26
  }
26
27
  export interface IDrawRowPayload {
27
28
  elementList: IElement[];
@@ -37,6 +37,9 @@ export interface IElementStyle {
37
37
  letterSpacing?: number;
38
38
  textDecoration?: ITextDecoration;
39
39
  }
40
+ export interface IElementRule {
41
+ hide?: boolean;
42
+ }
40
43
  export interface IElementGroup {
41
44
  groupIds?: string[];
42
45
  }
@@ -123,7 +126,7 @@ export interface IAreaElement {
123
126
  areaIndex?: number;
124
127
  area?: IArea;
125
128
  }
126
- export type IElement = IElementBasic & IElementStyle & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement;
129
+ export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement;
127
130
  export interface IElementMetrics {
128
131
  width: number;
129
132
  height: number;
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.113",
5
+ "version": "0.9.115",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",