@atlaskit/editor-tables 2.3.0 → 2.3.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/CHANGELOG.md +6 -0
- package/cell-bookmark/package.json +2 -2
- package/cell-selection/package.json +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/pm-plugins/table-editing.d.ts +1 -1
- package/dist/types/table-map.d.ts +6 -6
- package/dist/types/types.d.ts +7 -7
- package/dist/types/utils/add-row-at.d.ts +1 -1
- package/dist/types/utils/create-table.d.ts +1 -1
- package/dist/types/utils/fix-tables.d.ts +1 -1
- package/dist/types/utils/for-each-cell.d.ts +1 -1
- package/dist/types/utils/reorder-utils.d.ts +1 -1
- package/dist/types/utils/select-nodes.d.ts +2 -2
- package/dist/types/utils/selection-rect.d.ts +1 -1
- package/dist/types/utils/split-cell-with-type.d.ts +2 -2
- package/dist/types/utils/table-node-types.d.ts +1 -1
- package/dist/types/utils/toggle-header.d.ts +1 -1
- package/package.json +10 -2
- package/pm-plugins/package.json +2 -2
- package/table-map/package.json +2 -2
- package/types/package.json +2 -2
- package/utils/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'prosemirror-state';
|
|
2
2
|
import { ReportFixedTable } from '../utils/fix-tables';
|
|
3
|
-
|
|
3
|
+
type PluginState = number | null;
|
|
4
4
|
export declare function tableEditing({ allowTableNodeSelection, reportFixedTable, }?: {
|
|
5
5
|
allowTableNodeSelection?: boolean;
|
|
6
6
|
reportFixedTable?: ReportFixedTable;
|
|
@@ -12,7 +12,7 @@ export interface TableRect extends Rect {
|
|
|
12
12
|
tableStart: number;
|
|
13
13
|
table: PMNode;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type TableContext = {
|
|
16
16
|
map: TableMap;
|
|
17
17
|
tableStart: number;
|
|
18
18
|
table: PMNode;
|
|
@@ -23,28 +23,28 @@ export declare enum TableProblemTypes {
|
|
|
23
23
|
MISSING = "missing",
|
|
24
24
|
COLWIDTH_MISMATCH = "colwidth mismatch"
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type TableProblemCollision = {
|
|
27
27
|
type: TableProblemTypes.COLLISION;
|
|
28
28
|
row: number;
|
|
29
29
|
pos: number;
|
|
30
30
|
n: number;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type TableProblemLongRowspan = {
|
|
33
33
|
type: TableProblemTypes.OVERLONG_ROWSPAN;
|
|
34
34
|
pos: number;
|
|
35
35
|
n: number;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type TableProblemMissing = {
|
|
38
38
|
type: TableProblemTypes.MISSING;
|
|
39
39
|
row: number;
|
|
40
40
|
n: number;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type TableProblemColWidthMismatch = {
|
|
43
43
|
type: TableProblemTypes;
|
|
44
44
|
pos: number;
|
|
45
45
|
colwidth: number;
|
|
46
46
|
};
|
|
47
|
-
export
|
|
47
|
+
export type TableProblem = TableProblemCollision | TableProblemLongRowspan | TableProblemMissing | TableProblemColWidthMismatch;
|
|
48
48
|
export declare const tableNewColumnMinWidth = 140;
|
|
49
49
|
export declare class TableMap {
|
|
50
50
|
width: number;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -21,16 +21,16 @@ export interface CellSelectionRect {
|
|
|
21
21
|
width: number;
|
|
22
22
|
rows: Fragment[];
|
|
23
23
|
}
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
24
|
+
export type Axis = 'horiz' | 'vert';
|
|
25
|
+
export type Direction = -1 | 1;
|
|
26
|
+
export type Dispatch = (tr: Transaction) => void;
|
|
27
|
+
export type Command = (state: EditorState, dispatch?: Dispatch) => boolean;
|
|
28
|
+
export type CommandWithView = (state: EditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
29
|
+
export type SelectionRange = {
|
|
30
30
|
$anchor: ResolvedPos;
|
|
31
31
|
$head: ResolvedPos;
|
|
32
32
|
indexes: number[];
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type CellAttributesWithColSpan = CellAttributes & {
|
|
35
35
|
colspan: number;
|
|
36
36
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Transaction } from 'prosemirror-state';
|
|
2
2
|
export declare const cloneRowAt: (rowIndex: number) => (tr: Transaction) => Transaction;
|
|
3
|
-
export declare const addRowAt: (rowIndex: number, clonePreviousRow?: boolean
|
|
3
|
+
export declare const addRowAt: (rowIndex: number, clonePreviousRow?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node } from 'prosemirror-model';
|
|
2
2
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
-
export
|
|
3
|
+
export type ReportFixedTable = ({ state, tr, reason, }: {
|
|
4
4
|
state: EditorState;
|
|
5
5
|
tr: Transaction;
|
|
6
6
|
reason: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Transaction } from 'prosemirror-state';
|
|
2
2
|
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
3
|
-
export declare const forEachCellInColumn: (columnIndex: number, cellTransform: (cell: ContentNodeWithPos, tr: Transaction) => Transaction, setCursorToLastCell?: boolean
|
|
3
|
+
export declare const forEachCellInColumn: (columnIndex: number, cellTransform: (cell: ContentNodeWithPos, tr: Transaction) => Transaction, setCursorToLastCell?: boolean) => (tr: Transaction) => Transaction;
|
|
4
4
|
export declare const forEachCellInRow: (rowIndex: number, cellTransform: (cell: ContentNodeWithPos, tr: Transaction) => Transaction, setCursorToLastCell: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node as PMNode } from 'prosemirror-model';
|
|
2
2
|
import { NodeWithPos } from 'prosemirror-utils';
|
|
3
|
-
|
|
3
|
+
type ArrayOfRows = Array<PMNode | null>[];
|
|
4
4
|
export declare const transpose: (array: Array<any>) => Array<any>;
|
|
5
5
|
export declare const convertArrayOfRowsToTableNode: (tableNode: PMNode, arrayOfNodes: ArrayOfRows) => PMNode;
|
|
6
6
|
export declare const convertTableNodeToArrayOfRows: (tableNode: PMNode) => ArrayOfRows;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedPos } from 'prosemirror-model';
|
|
2
2
|
import { Transaction } from 'prosemirror-state';
|
|
3
|
-
export declare const selectColumn: (index: number, expand?: boolean
|
|
4
|
-
export declare const selectRow: (index: number, expand?: boolean
|
|
3
|
+
export declare const selectColumn: (index: number, expand?: boolean) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const selectRow: (index: number, expand?: boolean) => (tr: Transaction) => Transaction;
|
|
5
5
|
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
6
6
|
export declare const selectTableClosestToPos: (tr: Transaction, $pos: ResolvedPos) => Transaction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state';
|
|
2
2
|
import { Rect, TableContext } from '../table-map';
|
|
3
|
-
export
|
|
3
|
+
export type SelectionRect = Rect & TableContext;
|
|
4
4
|
export declare function selectedRect(state: EditorState): SelectionRect;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NodeType, Node as PMNode, ResolvedPos } from 'prosemirror-model';
|
|
2
2
|
import { Command } from '../types';
|
|
3
3
|
export declare function cellWrapping($pos: ResolvedPos): PMNode | null;
|
|
4
|
-
export
|
|
4
|
+
export type GetCellTypeArgs = {
|
|
5
5
|
row: number;
|
|
6
6
|
col: number;
|
|
7
7
|
node: PMNode;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type GetCellTypeCallback = (option: GetCellTypeArgs) => NodeType;
|
|
10
10
|
export declare function splitCellWithType(getCellType: GetCellTypeCallback): Command;
|
|
11
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from '../types';
|
|
2
2
|
import { SelectionRect } from './selection-rect';
|
|
3
3
|
import { TableNodeCache } from './table-node-types';
|
|
4
|
-
export
|
|
4
|
+
export type ToggleType = 'column' | 'row';
|
|
5
5
|
export declare function isHeaderEnabledByType(type: ToggleType, rect: SelectionRect, types: TableNodeCache): boolean;
|
|
6
6
|
export declare function toggleHeader(type: ToggleType): Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A package that contains common classes and utility functions for editor tables",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
">=4.5 <4.9": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.5/*",
|
|
19
|
+
"dist/types-ts4.5/index.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
15
23
|
"sideEffects": false,
|
|
16
24
|
"atlaskit:src": "src/index.ts",
|
|
17
25
|
"atlassian": {
|
|
@@ -30,7 +38,7 @@
|
|
|
30
38
|
},
|
|
31
39
|
"devDependencies": {
|
|
32
40
|
"@atlaskit/adf-schema": "^25.6.0",
|
|
33
|
-
"@atlaskit/editor-test-helpers": "^18.
|
|
41
|
+
"@atlaskit/editor-test-helpers": "^18.3.0",
|
|
34
42
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1"
|
|
35
43
|
},
|
|
36
44
|
"techstack": {
|
package/pm-plugins/package.json
CHANGED
package/table-map/package.json
CHANGED
package/types/package.json
CHANGED