@hufe921/canvas-editor 0.9.42 → 0.9.44

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.
@@ -41,6 +41,7 @@ export declare class Command {
41
41
  executeTableTdVerticalAlign: CommandAdapt['tableTdVerticalAlign'];
42
42
  executeTableBorderType: CommandAdapt['tableBorderType'];
43
43
  executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
44
+ executeTableSelectAll: CommandAdapt['tableSelectAll'];
44
45
  executeImage: CommandAdapt['image'];
45
46
  executeHyperlink: CommandAdapt['hyperlink'];
46
47
  executeDeleteHyperlink: CommandAdapt['deleteHyperlink'];
@@ -77,6 +78,7 @@ export declare class Command {
77
78
  getImage: CommandAdapt['getImage'];
78
79
  getValue: CommandAdapt['getValue'];
79
80
  getHTML: CommandAdapt['getHTML'];
81
+ getText: CommandAdapt['getText'];
80
82
  getWordCount: CommandAdapt['getWordCount'];
81
83
  getRangeText: CommandAdapt['getRangeText'];
82
84
  getRangeContext: CommandAdapt['getRangeContext'];
@@ -6,8 +6,8 @@ import { TableBorder } from '../../dataset/enum/table/Table';
6
6
  import { TitleLevel } from '../../dataset/enum/Title';
7
7
  import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
8
8
  import { ICatalog } from '../../interface/Catalog';
9
- import { IAppendElementListOption, IDrawImagePayload, IGetValueOption, IPainterOption } from '../../interface/Draw';
10
- import { IEditorData, IEditorHTML, IEditorResult } from '../../interface/Editor';
9
+ import { IAppendElementListOption, IDrawImagePayload, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
10
+ import { IEditorData, IEditorHTML, IEditorResult, IEditorText } from '../../interface/Editor';
11
11
  import { IElement } from '../../interface/Element';
12
12
  import { IMargin } from '../../interface/Margin';
13
13
  import { RangeContext } from '../../interface/Range';
@@ -68,6 +68,7 @@ export declare class CommandAdapt {
68
68
  tableTdVerticalAlign(payload: VerticalAlign): void;
69
69
  tableBorderType(payload: TableBorder): void;
70
70
  tableTdBackgroundColor(payload: string): void;
71
+ tableSelectAll(): void;
71
72
  hyperlink(payload: IElement): void;
72
73
  getHyperlinkRange(): [number, number] | null;
73
74
  deleteHyperlink(): void;
@@ -87,9 +88,10 @@ export declare class CommandAdapt {
87
88
  replaceImageElement(payload: string): void;
88
89
  saveAsImageElement(): void;
89
90
  changeImageDisplay(element: IElement, display: ImageDisplay): void;
90
- getImage(pixelRatio?: number): Promise<string[]>;
91
+ getImage(payload?: IGetImageOption): Promise<string[]>;
91
92
  getValue(options?: IGetValueOption): IEditorResult;
92
93
  getHTML(): IEditorHTML;
94
+ getText(): IEditorText;
93
95
  getWordCount(): Promise<number>;
94
96
  getRangeText(): string;
95
97
  getRangeContext(): RangeContext | null;
@@ -1,4 +1,6 @@
1
+ import { MoveDirection } from '../../dataset/enum/Observer';
1
2
  import { ICursorOption } from '../../interface/Cursor';
3
+ import { IElementPosition } from '../../interface/Element';
2
4
  import { Draw } from '../draw/Draw';
3
5
  import { CanvasEvent } from '../event/CanvasEvent';
4
6
  export declare type IDrawCursorOption = ICursorOption & {
@@ -7,6 +9,10 @@ export declare type IDrawCursorOption = ICursorOption & {
7
9
  isFocus?: boolean;
8
10
  hitLineStartIndex?: number;
9
11
  };
12
+ export interface IMoveCursorToVisibleOption {
13
+ direction: MoveDirection;
14
+ cursorPosition: IElementPosition;
15
+ }
10
16
  export declare class Cursor {
11
17
  private readonly ANIMATION_CLASS;
12
18
  private draw;
@@ -28,4 +34,5 @@ export declare class Cursor {
28
34
  private _clearBlinkTimeout;
29
35
  drawCursor(payload?: IDrawCursorOption): void;
30
36
  recoveryCursor(): void;
37
+ moveCursorToVisible(payload: IMoveCursorToVisibleOption): void;
31
38
  }
@@ -1,4 +1,4 @@
1
- import { IAppendElementListOption, IDrawOption, IDrawRowPayload, IGetValueOption, IPainterOption } from '../../interface/Draw';
1
+ import { IAppendElementListOption, IDrawOption, IDrawRowPayload, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
2
2
  import { IEditorData, IEditorOption, IEditorResult } from '../../interface/Editor';
3
3
  import { IElement, IElementStyle } from '../../interface/Element';
4
4
  import { IRow } from '../../interface/Row';
@@ -86,6 +86,7 @@ export declare class Draw {
86
86
  private visiblePageNoList;
87
87
  private intersectionPageNo;
88
88
  private lazyRenderIntersectionObserver;
89
+ private printModeData;
89
90
  constructor(rootContainer: HTMLElement, options: DeepRequired<IEditorOption>, data: IEditorData, listener: Listener, eventBus: EventBus<EventBusMap>);
90
91
  getMode(): EditorMode;
91
92
  setMode(payload: EditorMode): void;
@@ -157,7 +158,7 @@ export declare class Draw {
157
158
  getImageObserver(): ImageObserver;
158
159
  getI18n(): I18n;
159
160
  getRowCount(): number;
160
- getDataURL(pixelRatio?: number): Promise<string[]>;
161
+ getDataURL(payload?: IGetImageOption): Promise<string[]>;
161
162
  getPainterStyle(): IElementStyle | null;
162
163
  getPainterOptions(): IPainterOption | null;
163
164
  setPainterStyle(payload: IElementStyle | null, options?: IPainterOption): void;
@@ -173,6 +174,7 @@ export declare class Draw {
173
174
  setPaperMargin(payload: IMargin): void;
174
175
  getValue(options?: IGetValueOption): IEditorResult;
175
176
  setValue(payload: Partial<IEditorData>): void;
177
+ setEditorData(payload: Partial<IEditorData>): void;
176
178
  private _wrapContainer;
177
179
  private _formatContainer;
178
180
  private _createPageContainer;
@@ -1,4 +1,5 @@
1
1
  import { IControlInitOption, IControlInstance } from '../../../interface/Control';
2
+ import { IEditorData } from '../../../interface/Editor';
2
3
  import { IElement, IElementPosition } from '../../../interface/Element';
3
4
  import { IRange } from '../../../interface/Range';
4
5
  import { Draw } from '../Draw';
@@ -15,8 +16,10 @@ export declare class Control {
15
16
  private activeControl;
16
17
  constructor(draw: Draw);
17
18
  getDraw(): Draw;
19
+ filterAssistElement(payload: Required<IEditorData>): Required<IEditorData>;
18
20
  isPartRangeInControlOutside(): boolean;
19
21
  isRangInPostfix(): boolean;
22
+ isRangeWithinControl(): boolean;
20
23
  getContainer(): HTMLDivElement;
21
24
  getElementList(): IElement[];
22
25
  getPosition(): IElementPosition | null;
@@ -14,8 +14,11 @@ export declare class RangeManager {
14
14
  clearRange(): void;
15
15
  getIsCollapsed(): boolean;
16
16
  getSelection(): IElement[] | null;
17
+ getSelectionElementList(): IElement[] | null;
17
18
  getTextLikeSelection(): IElement[] | null;
19
+ getTextLikeSelectionElementList(): IElement[] | null;
18
20
  getRangeRow(): RangeRowMap | null;
21
+ getRangeRowElementList(): IElement[] | null;
19
22
  getRangeParagraph(): RangeRowArray | null;
20
23
  getRangeElementList(): IElement[] | null;
21
24
  getIsSelectAll(): boolean;
@@ -14,7 +14,9 @@ export declare enum EditorContext {
14
14
  export declare enum EditorMode {
15
15
  EDIT = "edit",
16
16
  CLEAN = "clean",
17
- READONLY = "readonly"
17
+ READONLY = "readonly",
18
+ FORM = "form",
19
+ PRINT = "print"
18
20
  }
19
21
  export declare enum EditorZone {
20
22
  HEADER = "header",
@@ -1,4 +1,4 @@
1
- import { EditorZone } from '../dataset/enum/Editor';
1
+ import { EditorMode, EditorZone } from '../dataset/enum/Editor';
2
2
  import { IElement, IElementPosition } from './Element';
3
3
  import { IRow } from './Row';
4
4
  export interface IDrawOption {
@@ -38,3 +38,7 @@ export interface IGetValueOption {
38
38
  export interface IAppendElementListOption {
39
39
  isPrepend?: boolean;
40
40
  }
41
+ export interface IGetImageOption {
42
+ pixelRatio?: number;
43
+ mode?: EditorMode;
44
+ }
@@ -52,6 +52,7 @@ export interface IEditorOption {
52
52
  inactiveAlpha?: number;
53
53
  historyMaxRecordCount?: number;
54
54
  printPixelRatio?: number;
55
+ maskMargin?: IMargin;
55
56
  wordBreak?: WordBreak;
56
57
  header?: IHeader;
57
58
  footer?: IFooter;
@@ -76,3 +77,4 @@ export interface IEditorHTML {
76
77
  main: string;
77
78
  footer: string;
78
79
  }
80
+ export declare type IEditorText = IEditorHTML;
@@ -17,10 +17,12 @@ export interface IFormatElementContextOption {
17
17
  }
18
18
  export declare function formatElementContext(sourceElementList: IElement[], formatElementList: IElement[], anchorIndex: number, options?: IFormatElementContextOption): void;
19
19
  export declare function convertElementToDom(element: IElement, options: DeepRequired<IEditorOption>): HTMLElement;
20
+ export declare function splitListElement(elementList: IElement[]): Map<number, IElement[]>;
20
21
  export declare function createDomFromElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): HTMLDivElement;
21
22
  export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
22
23
  interface IGetElementListByHTMLOption {
23
24
  innerWidth: number;
24
25
  }
25
26
  export declare function getElementListByHTML(htmlText: string, options: IGetElementListByHTMLOption): IElement[];
27
+ export declare function getTextFromElementList(elementList: IElement[]): string;
26
28
  export {};
@@ -14,3 +14,4 @@ export declare function convertNumberToChinese(num: number): string;
14
14
  export declare function cloneProperty<T>(properties: (keyof T)[], sourceElement: T, targetElement: T): void;
15
15
  export declare function omitObject<T>(object: T, keys: (keyof T)[]): T;
16
16
  export declare function convertStringToBase64(input: string): string;
17
+ export declare function findScrollContainer(element: HTMLElement): HTMLElement;
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.42",
5
+ "version": "0.9.44",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",