@hufe921/canvas-editor 0.9.60 → 0.9.62

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.
@@ -17,6 +17,7 @@ import { HyperlinkParticle } from './particle/HyperlinkParticle';
17
17
  import { Header } from './frame/Header';
18
18
  import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
19
19
  import { Control } from './control/Control';
20
+ import { CheckboxParticle } from './particle/CheckboxParticle';
20
21
  import { DeepRequired, IPadding } from '../../interface/Common';
21
22
  import { WorkerManager } from '../worker/WorkerManager';
22
23
  import { Previewer } from './particle/previewer/Previewer';
@@ -165,6 +166,7 @@ export declare class Draw {
165
166
  getHyperlinkParticle(): HyperlinkParticle;
166
167
  getDateParticle(): DateParticle;
167
168
  getListParticle(): ListParticle;
169
+ getCheckboxParticle(): CheckboxParticle;
168
170
  getControl(): Control;
169
171
  getWorkerManager(): WorkerManager;
170
172
  getImageObserver(): ImageObserver;
@@ -2,6 +2,10 @@ import { Draw } from '../Draw';
2
2
  export declare class Background {
3
3
  private draw;
4
4
  private options;
5
+ private imageCache;
5
6
  constructor(draw: Draw);
7
+ private _renderBackgroundColor;
8
+ private _drawImage;
9
+ private _renderBackgroundImage;
6
10
  render(ctx: CanvasRenderingContext2D, pageNo: number): void;
7
11
  }
@@ -1,7 +1,10 @@
1
+ import { IElement } from '../../../interface/Element';
1
2
  import { IRowElement } from '../../../interface/Row';
2
3
  import { Draw } from '../Draw';
3
4
  export declare class CheckboxParticle {
5
+ private draw;
4
6
  private options;
5
7
  constructor(draw: Draw);
8
+ setSelect(element: IElement): void;
6
9
  render(ctx: CanvasRenderingContext2D, element: IRowElement, x: number, y: number): void;
7
10
  }
@@ -1,12 +1,17 @@
1
+ import { ListStyle, ListType } from '../../../dataset/enum/List';
1
2
  import { IElement, IElementPosition } from '../../../interface/Element';
2
3
  import { IRow } from '../../../interface/Row';
3
4
  import { Draw } from '../Draw';
4
5
  export declare class ListParticle {
6
+ private draw;
7
+ private range;
5
8
  private options;
6
9
  private readonly UN_COUNT_STYLE_WIDTH;
7
10
  private readonly MEASURE_BASE_TEXT;
8
11
  private readonly LIST_GAP;
9
12
  constructor(draw: Draw);
13
+ setList(listType: ListType | null, listStyle?: ListStyle): void;
14
+ unsetList(): void;
10
15
  computeListStyle(ctx: CanvasRenderingContext2D, elementList: IElement[]): Map<string, number>;
11
16
  getListStyleWidth(ctx: CanvasRenderingContext2D, listElementList: IElement[]): number;
12
17
  drawListStyle(ctx: CanvasRenderingContext2D, row: IRow, position: IElementPosition): void;
@@ -7,6 +7,7 @@ export interface IMeasureWordResult {
7
7
  }
8
8
  export declare class TextParticle {
9
9
  private draw;
10
+ private options;
10
11
  private ctx;
11
12
  private curX;
12
13
  private curY;
@@ -0,0 +1,2 @@
1
+ import { CanvasEvent } from '../../CanvasEvent';
2
+ export declare function enter(evt: KeyboardEvent, host: CanvasEvent): void;
@@ -1,2 +1,2 @@
1
- import { CanvasEvent } from '../CanvasEvent';
1
+ import { CanvasEvent } from '../../CanvasEvent';
2
2
  export declare function keydown(evt: KeyboardEvent, host: CanvasEvent): void;
@@ -0,0 +1,2 @@
1
+ import { IBackgroundOption } from '../../interface/Background';
2
+ export declare const defaultBackground: Readonly<Required<IBackgroundOption>>;
@@ -30,7 +30,10 @@ export declare const INTERNAL_CONTEXT_MENU_KEY: {
30
30
  BORDER_EMPTY: string;
31
31
  BORDER_EXTERNAL: string;
32
32
  BORDER_TD: string;
33
+ BORDER_TD_TOP: string;
34
+ BORDER_TD_RIGHT: string;
33
35
  BORDER_TD_BOTTOM: string;
36
+ BORDER_TD_LEFT: string;
34
37
  BORDER_TD_FORWARD: string;
35
38
  BORDER_TD_BACK: string;
36
39
  VERTICAL_ALIGN: string;
@@ -0,0 +1,10 @@
1
+ export declare enum BackgroundSize {
2
+ CONTAIN = "contain",
3
+ COVER = "cover"
4
+ }
5
+ export declare enum BackgroundRepeat {
6
+ REPEAT = "repeat",
7
+ NO_REPEAT = "no-repeat",
8
+ REPEAT_X = "repeat-x",
9
+ REPEAT_Y = "repeat-y"
10
+ }
@@ -4,7 +4,10 @@ export declare enum TableBorder {
4
4
  EXTERNAL = "external"
5
5
  }
6
6
  export declare enum TdBorder {
7
- BOTTOM = "bottom"
7
+ TOP = "top",
8
+ RIGHT = "right",
9
+ BOTTOM = "bottom",
10
+ LEFT = "left"
8
11
  }
9
12
  export declare enum TdSlash {
10
13
  FORWARD = "forward",
@@ -31,6 +31,7 @@ import { LETTER_CLASS } from './dataset/constant/Common';
31
31
  import { INTERNAL_CONTEXT_MENU_KEY } from './dataset/constant/ContextMenu';
32
32
  import { IRange } from './interface/Range';
33
33
  import { splitText } from './utils';
34
+ import { BackgroundRepeat, BackgroundSize } from './dataset/enum/Background';
34
35
  export default class Editor {
35
36
  command: Command;
36
37
  listener: Listener;
@@ -43,5 +44,5 @@ export default class Editor {
43
44
  }
44
45
  export { splitText };
45
46
  export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY };
46
- export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation };
47
+ export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, BackgroundRepeat, BackgroundSize };
47
48
  export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle };
@@ -0,0 +1,7 @@
1
+ import { BackgroundRepeat, BackgroundSize } from '../dataset/enum/Background';
2
+ export interface IBackgroundOption {
3
+ color?: string;
4
+ image?: string;
5
+ size?: BackgroundSize;
6
+ repeat?: BackgroundRepeat;
7
+ }
@@ -1,5 +1,6 @@
1
1
  import { IElement } from '..';
2
2
  import { EditorMode, PageMode, PaperDirection, WordBreak } from '../dataset/enum/Editor';
3
+ import { IBackgroundOption } from './Background';
3
4
  import { ICheckboxOption } from './Checkbox';
4
5
  import { IPadding } from './Common';
5
6
  import { IControlOption } from './Control';
@@ -22,6 +23,7 @@ export interface IEditorData {
22
23
  export interface IEditorOption {
23
24
  mode?: EditorMode;
24
25
  defaultType?: string;
26
+ defaultColor?: string;
25
27
  defaultFont?: string;
26
28
  defaultSize?: number;
27
29
  minSize?: number;
@@ -33,7 +35,6 @@ export interface IEditorOption {
33
35
  height?: number;
34
36
  scale?: number;
35
37
  pageGap?: number;
36
- backgroundColor?: string;
37
38
  underlineColor?: string;
38
39
  strikeoutColor?: string;
39
40
  rangeColor?: string;
@@ -74,6 +75,7 @@ export interface IEditorOption {
74
75
  group?: IGroup;
75
76
  pageBreak?: IPageBreak;
76
77
  zone?: IZoneOption;
78
+ background?: IBackgroundOption;
77
79
  }
78
80
  export interface IEditorResult {
79
81
  version: 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.60",
5
+ "version": "0.9.62",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",