@viveeditor/ext-table 0.1.0 → 1.0.0-rc.1

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/README.md CHANGED
@@ -27,6 +27,12 @@ editor.commands.insertTable({ rows: 3, cols: 3, headerRow: true })
27
27
 
28
28
  Merged cells, header rows, column widths by dragging, and Tab to the next cell. Saved HTML keeps column widths on any site.
29
29
 
30
+ Table properties: `setTableWidth('full' | null)`, `setTableAlign('center' | null)`, `setTableBorder('rows' | 'none' | null)`, `setTableStriped(boolean)` and `setTableBorderColor(color | null)`, read back with `editor.query.tableStyle()`. Cell properties apply to every selected cell: `setCellBackground`, `setCellVerticalAlign` and `setCellTextAlign('center' | 'right' | 'justify' | null)`, read back with `editor.query.cellStyle()`. `selectRow`, `selectColumn` and `selectTable` select cells; `distributeColumns` gives every column the same width.
31
+
32
+ ```html
33
+ <table data-width="full" data-align="center" data-border="rows" data-striped="true" style="--vive-table-border-color: #aabbcc">
34
+ ```
35
+
30
36
  ## License
31
37
 
32
38
  MIT
package/dist/index.d.ts CHANGED
@@ -5,6 +5,23 @@ export interface TableOptions {
5
5
  cellMinWidth: number;
6
6
  maxSize: number;
7
7
  }
8
+ export type CellVerticalAlign = "middle" | "bottom";
9
+ export type CellTextAlign = "center" | "right" | "justify";
10
+ export interface CellStyle {
11
+ background: string | null;
12
+ verticalAlign: CellVerticalAlign | null;
13
+ textAlign: CellTextAlign | null;
14
+ }
15
+ export type TableWidth = "full";
16
+ export type TableAlign = "center";
17
+ export type TableBorder = "rows" | "none";
18
+ export interface TableStyle {
19
+ width: TableWidth | null;
20
+ align: TableAlign | null;
21
+ border: TableBorder | null;
22
+ striped: boolean;
23
+ borderColor: string | null;
24
+ }
8
25
  export interface InsertTableOptions {
9
26
  rows?: number;
10
27
  cols?: number;
@@ -25,9 +42,26 @@ declare module "@viveeditor/core" {
25
42
  toggleHeaderRow: () => Command;
26
43
  toggleHeaderColumn: () => Command;
27
44
  resizeColumn: (delta: number) => Command;
45
+ setRowHeight: (height: number | null) => Command;
46
+ resizeRow: (delta: number) => Command;
47
+ setCellBackground: (color: string | null) => Command;
48
+ setCellVerticalAlign: (align: CellVerticalAlign | null) => Command;
49
+ setCellTextAlign: (align: CellTextAlign | null) => Command;
50
+ setTableWidth: (width: TableWidth | null) => Command;
51
+ setTableAlign: (align: TableAlign | null) => Command;
52
+ setTableBorder: (border: TableBorder | null) => Command;
53
+ setTableStriped: (striped: boolean) => Command;
54
+ setTableBorderColor: (color: string | null) => Command;
55
+ selectRow: () => Command;
56
+ selectColumn: () => Command;
57
+ selectTable: () => Command;
58
+ distributeColumns: () => Command;
28
59
  }
29
60
  interface QueryRegistry {
30
61
  inTable: () => boolean;
62
+ cellStyle: () => CellStyle | null;
63
+ tableStyle: () => TableStyle | null;
64
+ rowHeight: () => number | null;
31
65
  }
32
66
  }
33
67
  export declare const Table: Extension<TableOptions>;