@hufe921/canvas-editor 0.9.24 → 0.9.27

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.
@@ -1,4 +1,4 @@
1
- import { IElement, ImageDisplay, INavigateInfo, VerticalAlign } from '../..';
1
+ import { IElement, ImageDisplay, INavigateInfo, TableBorder, VerticalAlign } from '../..';
2
2
  import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
3
3
  import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
4
4
  import { IEditorResult } from '../../interface/Editor';
@@ -46,6 +46,7 @@ export declare class Command {
46
46
  private static mergeTableCell;
47
47
  private static cancelMergeTableCell;
48
48
  private static tableTdVerticalAlign;
49
+ private static tableBorderType;
49
50
  private static image;
50
51
  private static hyperlink;
51
52
  private static deleteHyperlink;
@@ -120,6 +121,7 @@ export declare class Command {
120
121
  executeMergeTableCell(): void;
121
122
  executeCancelMergeTableCell(): void;
122
123
  executeTableTdVerticalAlign(payload: VerticalAlign): void;
124
+ executeTableBorderType(payload: TableBorder): void;
123
125
  executeHyperlink(payload: IElement): void;
124
126
  executeDeleteHyperlink(): void;
125
127
  executeCancelHyperlink(): void;
@@ -1,6 +1,7 @@
1
1
  import { ImageDisplay } from '../../dataset/enum/Control';
2
2
  import { EditorMode, PageMode, PaperDirection } from '../../dataset/enum/Editor';
3
3
  import { RowFlex } from '../../dataset/enum/Row';
4
+ import { TableBorder } from '../../dataset/enum/table/Table';
4
5
  import { VerticalAlign } from '../../dataset/enum/VerticalAlign';
5
6
  import { IDrawImagePayload, IPainterOptions } from '../../interface/Draw';
6
7
  import { IEditorResult } from '../../interface/Editor';
@@ -60,6 +61,7 @@ export declare class CommandAdapt {
60
61
  mergeTableCell(): void;
61
62
  cancelMergeTableCell(): void;
62
63
  tableTdVerticalAlign(payload: VerticalAlign): void;
64
+ tableBorderType(payload: TableBorder): void;
63
65
  hyperlink(payload: IElement): void;
64
66
  getHyperlinkRange(): [number, number] | null;
65
67
  deleteHyperlink(): void;
@@ -95,7 +95,6 @@ export declare class Draw {
95
95
  getOriginalMargins(): number[];
96
96
  getPageGap(): number;
97
97
  getPageNumberBottom(): number;
98
- getHeaderTop(): number;
99
98
  getMarginIndicatorSize(): number;
100
99
  getDefaultBasicRowMarginHeight(): number;
101
100
  getTdPadding(): number;
@@ -1,9 +1,8 @@
1
- import { IElement } from '../../../..';
2
- import { IElementPosition } from '../../../../interface/Element';
3
1
  import { Draw } from '../../Draw';
4
2
  export declare class TableTool {
5
- private readonly translate;
6
- private minTdWidth;
3
+ private readonly MIN_TD_WIDTH;
4
+ private readonly ROW_COL_OFFSET;
5
+ private readonly BORDER_VALUE;
7
6
  private draw;
8
7
  private canvas;
9
8
  private options;
@@ -11,12 +10,13 @@ export declare class TableTool {
11
10
  private container;
12
11
  private toolRowContainer;
13
12
  private toolColContainer;
13
+ private toolBorderContainer;
14
14
  private anchorLine;
15
15
  private mousedownX;
16
16
  private mousedownY;
17
17
  constructor(draw: Draw);
18
18
  dispose(): void;
19
- render(element: IElement, position: IElementPosition): void;
19
+ render(): void;
20
20
  private _mousedown;
21
21
  private _mousemove;
22
22
  }
@@ -1,7 +1,10 @@
1
1
  import { EditorZone } from '../../dataset/enum/Editor';
2
2
  import { Draw } from '../draw/Draw';
3
3
  export declare class Zone {
4
+ private readonly INDICATOR_TITLE_TRANSLATE;
4
5
  private draw;
6
+ private options;
7
+ private i18n;
5
8
  private container;
6
9
  private currentZone;
7
10
  private headerIndicatorContainer;
@@ -10,6 +13,6 @@ export declare class Zone {
10
13
  isMainActive(): boolean;
11
14
  getZone(): EditorZone;
12
15
  setZone(payload: EditorZone): void;
13
- private _drawHeaderZoneIndicator;
16
+ drawHeaderZoneIndicator(): void;
14
17
  private _clearHeaderZoneIndicator;
15
18
  }
@@ -0,0 +1,5 @@
1
+ export declare enum TableBorder {
2
+ ALL = "all",
3
+ EMPTY = "empty",
4
+ EXTERNAL = "external"
5
+ }
@@ -17,6 +17,7 @@ import { BlockType } from './dataset/enum/Block';
17
17
  import { IBlock } from './interface/Block';
18
18
  import { ILang } from './interface/i18n/I18n';
19
19
  import { VerticalAlign } from './dataset/enum/VerticalAlign';
20
+ import { TableBorder } from './dataset/enum/table/Table';
20
21
  export default class Editor {
21
22
  command: Command;
22
23
  listener: Listener;
@@ -24,5 +25,5 @@ export default class Editor {
24
25
  destroy: Function;
25
26
  constructor(container: HTMLDivElement, data: IEditorData | IElement[], options?: IEditorOption);
26
27
  }
27
- export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection };
28
+ export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, EDITOR_COMPONENT, PageMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder };
28
29
  export type { IElement, IEditorData, IEditorOption, IEditorResult, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang };
@@ -44,7 +44,6 @@ export interface IEditorOption {
44
44
  tdPadding?: number;
45
45
  defaultTdHeight?: number;
46
46
  defaultHyperlinkColor?: string;
47
- headerTop?: number;
48
47
  paperDirection?: PaperDirection;
49
48
  inactiveAlpha?: number;
50
49
  header?: IHeader;
@@ -1,6 +1,7 @@
1
1
  import { ControlComponent, ImageDisplay } from '../dataset/enum/Control';
2
2
  import { ElementType } from '../dataset/enum/Element';
3
3
  import { RowFlex } from '../dataset/enum/Row';
4
+ import { TableBorder } from '../dataset/enum/table/Table';
4
5
  import { IBlock } from './Block';
5
6
  import { ICheckbox } from './Checkbox';
6
7
  import { IControl } from './Control';
@@ -29,18 +30,19 @@ export interface IElementStyle {
29
30
  export interface ITableAttr {
30
31
  colgroup?: IColgroup[];
31
32
  trList?: ITr[];
33
+ borderType?: TableBorder;
32
34
  }
33
35
  export interface ITableElement {
34
36
  tdId?: string;
35
37
  trId?: string;
36
38
  tableId?: string;
37
39
  }
40
+ export declare type ITable = ITableAttr & ITableElement;
38
41
  export interface IHyperlinkElement {
39
42
  valueList?: IElement[];
40
43
  url?: string;
41
44
  hyperlinkId?: string;
42
45
  }
43
- export declare type ITable = ITableAttr & ITableElement;
44
46
  export interface ISuperscriptSubscript {
45
47
  actualSize?: number;
46
48
  }
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.24",
5
+ "version": "0.9.27",
6
6
  "description": "rich text editor by canvas/svg",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",
@@ -32,6 +32,7 @@
32
32
  "engines": {
33
33
  "node": ">=12.0.0"
34
34
  },
35
+ "type": "module",
35
36
  "scripts": {
36
37
  "dev": "vite",
37
38
  "lib": "npm run lint && tsc && vite build --mode lib",
@@ -43,7 +44,8 @@
43
44
  "type:check": "tsc --noEmit",
44
45
  "docs:dev": "vitepress dev docs",
45
46
  "docs:build": "vitepress build docs",
46
- "docs:preview": "vitepress preview docs"
47
+ "docs:preview": "vitepress preview docs",
48
+ "release": "node scripts/release.js"
47
49
  },
48
50
  "devDependencies": {
49
51
  "@rollup/plugin-typescript": "^10.0.1",
@@ -54,6 +56,7 @@
54
56
  "cypress": "^9.5.1",
55
57
  "cypress-file-upload": "^5.0.8",
56
58
  "eslint": "7.32.0",
59
+ "simple-git-hooks": "^2.8.1",
57
60
  "typescript": "^4.3.2",
58
61
  "vite": "^2.4.2",
59
62
  "vite-plugin-css-injected-by-js": "^2.1.1",
@@ -62,5 +65,8 @@
62
65
  },
63
66
  "dependencies": {
64
67
  "prismjs": "^1.27.0"
68
+ },
69
+ "simple-git-hooks": {
70
+ "commit-msg": "node scripts/verifyCommit.js"
65
71
  }
66
72
  }