@hufe921/canvas-editor 0.9.33 → 0.9.35
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.
- package/CHANGELOG.md +48 -0
- package/README.md +5 -5
- package/dist/canvas-editor.es.js +289 -78
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +16 -16
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +7 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +4 -0
- package/dist/src/editor/core/cursor/Cursor.d.ts +6 -0
- package/dist/src/editor/core/draw/Draw.d.ts +2 -0
- package/dist/src/editor/core/draw/particle/table/TableParticle.d.ts +5 -0
- package/dist/src/editor/core/worker/WorkerManager.d.ts +3 -0
- package/dist/src/editor/core/worker/works/catalog.d.ts +1 -0
- package/dist/src/editor/dataset/enum/Editor.d.ts +2 -1
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/Catalog.d.ts +8 -0
- package/dist/src/editor/interface/PageNumber.d.ts +2 -0
- package/dist/src/editor/interface/table/Td.d.ts +1 -0
- package/dist/src/editor/utils/clipboard.d.ts +1 -0
- package/dist/src/editor/utils/element.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IElement, ImageDisplay, INavigateInfo, ListStyle, ListType, TableBorder, TitleLevel, VerticalAlign } from '../..';
|
|
2
2
|
import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
|
|
3
|
+
import { ICatalog } from '../../interface/Catalog';
|
|
3
4
|
import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
|
|
4
5
|
import { IEditorResult } from '../../interface/Editor';
|
|
5
6
|
import { IMargin } from '../../interface/Margin';
|
|
@@ -49,6 +50,7 @@ export declare class Command {
|
|
|
49
50
|
private static cancelMergeTableCell;
|
|
50
51
|
private static tableTdVerticalAlign;
|
|
51
52
|
private static tableBorderType;
|
|
53
|
+
private static tableTdBackgroundColor;
|
|
52
54
|
private static image;
|
|
53
55
|
private static hyperlink;
|
|
54
56
|
private static deleteHyperlink;
|
|
@@ -82,6 +84,8 @@ export declare class Command {
|
|
|
82
84
|
private static insertElementList;
|
|
83
85
|
private static removeControl;
|
|
84
86
|
private static setLocale;
|
|
87
|
+
private static getCatalog;
|
|
88
|
+
private static locationCatalog;
|
|
85
89
|
constructor(adapt: CommandAdapt);
|
|
86
90
|
executeMode(payload: EditorMode): void;
|
|
87
91
|
executeCut(): void;
|
|
@@ -126,6 +130,7 @@ export declare class Command {
|
|
|
126
130
|
executeCancelMergeTableCell(): void;
|
|
127
131
|
executeTableTdVerticalAlign(payload: VerticalAlign): void;
|
|
128
132
|
executeTableBorderType(payload: TableBorder): void;
|
|
133
|
+
executeTableTdBackgroundColor(payload: string): void;
|
|
129
134
|
executeHyperlink(payload: IElement): void;
|
|
130
135
|
executeDeleteHyperlink(): void;
|
|
131
136
|
executeCancelHyperlink(): void;
|
|
@@ -159,4 +164,6 @@ export declare class Command {
|
|
|
159
164
|
executeInsertElementList(payload: IElement[]): void;
|
|
160
165
|
executeRemoveControl(): void;
|
|
161
166
|
executeSetLocale(payload: string): void;
|
|
167
|
+
getCatalog(): Promise<ICatalog | null>;
|
|
168
|
+
executeLocationCatalog(titleId: string): void;
|
|
162
169
|
}
|
|
@@ -5,6 +5,7 @@ import { RowFlex } from '../../dataset/enum/Row';
|
|
|
5
5
|
import { TableBorder } from '../../dataset/enum/table/Table';
|
|
6
6
|
import { TitleLevel } from '../../dataset/enum/Title';
|
|
7
7
|
import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
|
|
8
|
+
import { ICatalog } from '../../interface/Catalog';
|
|
8
9
|
import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
|
|
9
10
|
import { IEditorResult } from '../../interface/Editor';
|
|
10
11
|
import { IElement } from '../../interface/Element';
|
|
@@ -66,6 +67,7 @@ export declare class CommandAdapt {
|
|
|
66
67
|
cancelMergeTableCell(): void;
|
|
67
68
|
tableTdVerticalAlign(payload: VerticalAlign): void;
|
|
68
69
|
tableBorderType(payload: TableBorder): void;
|
|
70
|
+
tableTdBackgroundColor(payload: string): void;
|
|
69
71
|
hyperlink(payload: IElement): void;
|
|
70
72
|
getHyperlinkRange(): [number, number] | null;
|
|
71
73
|
deleteHyperlink(): void;
|
|
@@ -100,4 +102,6 @@ export declare class CommandAdapt {
|
|
|
100
102
|
insertElementList(payload: IElement[]): void;
|
|
101
103
|
removeControl(): void;
|
|
102
104
|
setLocale(payload: string): void;
|
|
105
|
+
getCatalog(): Promise<ICatalog | null>;
|
|
106
|
+
locationCatalog(titleId: string): void;
|
|
103
107
|
}
|
|
@@ -6,17 +6,23 @@ export declare type IDrawCursorOption = ICursorOption & {
|
|
|
6
6
|
isBlink?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare class Cursor {
|
|
9
|
+
private readonly ANIMATION_CLASS;
|
|
9
10
|
private draw;
|
|
10
11
|
private container;
|
|
11
12
|
private options;
|
|
12
13
|
private position;
|
|
13
14
|
private cursorDom;
|
|
14
15
|
private cursorAgent;
|
|
16
|
+
private blinkTimeout;
|
|
15
17
|
constructor(draw: Draw, canvasEvent: CanvasEvent);
|
|
16
18
|
getCursorDom(): HTMLDivElement;
|
|
17
19
|
getAgentDom(): HTMLTextAreaElement;
|
|
18
20
|
getAgentDomValue(): string;
|
|
19
21
|
clearAgentDomValue(): string;
|
|
22
|
+
private _blinkStart;
|
|
23
|
+
private _blinkStop;
|
|
24
|
+
private _setBlinkTimeout;
|
|
25
|
+
private _clearBlinkTimeout;
|
|
20
26
|
drawCursor(payload?: IDrawCursorOption): void;
|
|
21
27
|
recoveryCursor(): void;
|
|
22
28
|
}
|
|
@@ -10,6 +10,7 @@ import { Position } from '../position/Position';
|
|
|
10
10
|
import { RangeManager } from '../range/RangeManager';
|
|
11
11
|
import { Search } from './interactive/Search';
|
|
12
12
|
import { ImageParticle } from './particle/ImageParticle';
|
|
13
|
+
import { TableParticle } from './particle/table/TableParticle';
|
|
13
14
|
import { TableTool } from './particle/table/TableTool';
|
|
14
15
|
import { HyperlinkParticle } from './particle/HyperlinkParticle';
|
|
15
16
|
import { Header } from './frame/Header';
|
|
@@ -140,6 +141,7 @@ export declare class Draw {
|
|
|
140
141
|
getPreviewer(): Previewer;
|
|
141
142
|
getImageParticle(): ImageParticle;
|
|
142
143
|
getTableTool(): TableTool;
|
|
144
|
+
getTableParticle(): TableParticle;
|
|
143
145
|
getHeader(): Header;
|
|
144
146
|
getFooter(): Footer;
|
|
145
147
|
getHyperlinkParticle(): HyperlinkParticle;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { IElement } from '../../../..';
|
|
2
|
+
import { ITd } from '../../../../interface/table/Td';
|
|
2
3
|
import { ITr } from '../../../../interface/table/Tr';
|
|
3
4
|
import { Draw } from '../../Draw';
|
|
4
5
|
export declare class TableParticle {
|
|
6
|
+
private draw;
|
|
5
7
|
private range;
|
|
6
8
|
private options;
|
|
7
9
|
constructor(draw: Draw);
|
|
8
10
|
getTrListGroupByCol(payload: ITr[]): ITr[];
|
|
11
|
+
getRangeRowCol(): ITd[][] | null;
|
|
12
|
+
private _drawOuterBorder;
|
|
9
13
|
private _drawBorder;
|
|
14
|
+
private _drawBackgroundColor;
|
|
10
15
|
computeRowColInfo(element: IElement): void;
|
|
11
16
|
drawRange(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
12
17
|
render(ctx: CanvasRenderingContext2D, element: IElement, startX: number, startY: number): void;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Draw } from '../draw/Draw';
|
|
2
|
+
import { ICatalog } from '../../interface/Catalog';
|
|
2
3
|
export declare class WorkerManager {
|
|
3
4
|
private draw;
|
|
4
5
|
private wordCountWorker;
|
|
6
|
+
private catalogWorker;
|
|
5
7
|
constructor(draw: Draw);
|
|
6
8
|
getWordCount(): Promise<number>;
|
|
9
|
+
getCatalog(): Promise<ICatalog | null>;
|
|
7
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -21,6 +21,7 @@ import { TableBorder } from './dataset/enum/table/Table';
|
|
|
21
21
|
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
|
+
import { ICatalog, ICatalogItem } from './interface/Catalog';
|
|
24
25
|
export default class Editor {
|
|
25
26
|
command: Command;
|
|
26
27
|
listener: Listener;
|
|
@@ -29,4 +30,4 @@ export default class Editor {
|
|
|
29
30
|
constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
|
|
30
31
|
}
|
|
31
32
|
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle };
|
|
32
|
-
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang };
|
|
33
|
+
export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem };
|
|
@@ -3,6 +3,7 @@ import { DeepRequired } from '../interface/Common';
|
|
|
3
3
|
export declare function writeClipboardItem(text: string, html: string): void;
|
|
4
4
|
export declare function convertElementToDom(element: IElement, options: DeepRequired<IEditorOption>): HTMLElement;
|
|
5
5
|
export declare function writeElementList(elementList: IElement[], options: DeepRequired<IEditorOption>): void;
|
|
6
|
+
export declare function convertTextNodeToElement(textNode: Element | Node): IElement | null;
|
|
6
7
|
interface IGetElementListByHTMLOption {
|
|
7
8
|
innerWidth: number;
|
|
8
9
|
}
|
|
@@ -11,5 +11,8 @@ export declare function zipElementList(payload: IElement[]): IElement[];
|
|
|
11
11
|
export declare function getElementRowFlex(node: HTMLElement): RowFlex;
|
|
12
12
|
export declare function isTextLikeElement(element: IElement): boolean;
|
|
13
13
|
export declare function getAnchorElement(elementList: IElement[], anchorIndex: number): IElement | null;
|
|
14
|
-
export
|
|
14
|
+
export interface IFormatElementContextOption {
|
|
15
|
+
isBreakWhenWrap: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function formatElementContext(sourceElementList: IElement[], formatElementList: IElement[], anchorIndex: number, options?: IFormatElementContextOption): void;
|
|
15
18
|
export {};
|