@atlaskit/editor-tables 2.1.5 → 2.2.0
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 +12 -0
- package/cell-bookmark/package.json +8 -1
- package/cell-selection/package.json +8 -1
- package/dist/cjs/pm-plugins/table-editing.js +3 -2
- package/dist/cjs/utils/analytics-helpers.js +63 -0
- package/dist/cjs/utils/fix-tables.js +11 -3
- package/dist/cjs/utils/replace-table.js +31 -0
- package/dist/cjs/utils.js +23 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/pm-plugins/table-editing.js +3 -2
- package/dist/es2019/utils/analytics-helpers.js +51 -0
- package/dist/es2019/utils/fix-tables.js +14 -5
- package/dist/es2019/utils/replace-table.js +18 -0
- package/dist/es2019/utils.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/pm-plugins/table-editing.js +3 -2
- package/dist/esm/utils/analytics-helpers.js +51 -0
- package/dist/esm/utils/fix-tables.js +14 -5
- package/dist/esm/utils/replace-table.js +18 -0
- package/dist/esm/utils.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/pm-plugins/table-editing.d.ts +4 -2
- package/dist/types/utils/analytics-helpers.d.ts +15 -0
- package/dist/types/utils/fix-tables.d.ts +7 -2
- package/dist/types/utils/replace-table.d.ts +3 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types-ts4.0/cell-bookmark.d.ts +10 -0
- package/dist/types-ts4.0/cell-selection.d.ts +25 -0
- package/dist/types-ts4.0/index.d.ts +27 -0
- package/dist/types-ts4.0/pm-plugins/input.d.ts +4 -0
- package/dist/types-ts4.0/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.0/pm-plugins/table-editing.d.ts +8 -0
- package/dist/types-ts4.0/pm-plugins.d.ts +2 -0
- package/dist/types-ts4.0/table-map.d.ts +62 -0
- package/dist/types-ts4.0/types.d.ts +36 -0
- package/dist/types-ts4.0/utils/add-column-at.d.ts +2 -0
- package/dist/types-ts4.0/utils/add-column.d.ts +5 -0
- package/dist/types-ts4.0/utils/add-row-at.d.ts +3 -0
- package/dist/types-ts4.0/utils/add-row.d.ts +3 -0
- package/dist/types-ts4.0/utils/analytics-helpers.d.ts +15 -0
- package/dist/types-ts4.0/utils/cells.d.ts +6 -0
- package/dist/types-ts4.0/utils/clone-tr.d.ts +2 -0
- package/dist/types-ts4.0/utils/colspan.d.ts +4 -0
- package/dist/types-ts4.0/utils/copy-paste.d.ts +8 -0
- package/dist/types-ts4.0/utils/create-table.d.ts +10 -0
- package/dist/types-ts4.0/utils/draw-cell-selection.d.ts +3 -0
- package/dist/types-ts4.0/utils/empty-cells.d.ts +4 -0
- package/dist/types-ts4.0/utils/find.d.ts +8 -0
- package/dist/types-ts4.0/utils/fix-tables.d.ts +9 -0
- package/dist/types-ts4.0/utils/for-each-cell.d.ts +4 -0
- package/dist/types-ts4.0/utils/get-cell-selection-ranges.d.ts +3 -0
- package/dist/types-ts4.0/utils/get-cells-in-column.d.ts +3 -0
- package/dist/types-ts4.0/utils/get-cells-in-row.d.ts +3 -0
- package/dist/types-ts4.0/utils/get-cells-in-table.d.ts +3 -0
- package/dist/types-ts4.0/utils/get-selection-range-in-column.d.ts +3 -0
- package/dist/types-ts4.0/utils/get-selection-range-in-row.d.ts +3 -0
- package/dist/types-ts4.0/utils/get-selection-rect.d.ts +3 -0
- package/dist/types-ts4.0/utils/go-to-next-cell.d.ts +2 -0
- package/dist/types-ts4.0/utils/handle-paste.d.ts +3 -0
- package/dist/types-ts4.0/utils/is-selected.d.ts +6 -0
- package/dist/types-ts4.0/utils/is-selection-type.d.ts +11 -0
- package/dist/types-ts4.0/utils/move-column.d.ts +5 -0
- package/dist/types-ts4.0/utils/move-row.d.ts +5 -0
- package/dist/types-ts4.0/utils/normalize-selection.d.ts +2 -0
- package/dist/types-ts4.0/utils/remove-column.d.ts +5 -0
- package/dist/types-ts4.0/utils/remove-row.d.ts +5 -0
- package/dist/types-ts4.0/utils/remove-table.d.ts +2 -0
- package/dist/types-ts4.0/utils/reorder-utils.d.ts +10 -0
- package/dist/types-ts4.0/utils/replace-table.d.ts +3 -0
- package/dist/types-ts4.0/utils/select-nodes.d.ts +4 -0
- package/dist/types-ts4.0/utils/selection-cell.d.ts +3 -0
- package/dist/types-ts4.0/utils/selection-rect.d.ts +4 -0
- package/dist/types-ts4.0/utils/set-cell-attrs.d.ts +4 -0
- package/dist/types-ts4.0/utils/split-cell-with-type.d.ts +11 -0
- package/dist/types-ts4.0/utils/split-cell.d.ts +2 -0
- package/dist/types-ts4.0/utils/table-node-types.d.ts +5 -0
- package/dist/types-ts4.0/utils/tables.d.ts +4 -0
- package/dist/types-ts4.0/utils/test-utils.d.ts +5 -0
- package/dist/types-ts4.0/utils/toggle-header.d.ts +3 -0
- package/dist/types-ts4.0/utils/uuid.d.ts +9 -0
- package/dist/types-ts4.0/utils.d.ts +43 -0
- package/package.json +10 -3
- package/pm-plugins/package.json +8 -1
- package/report.api.md +4 -2
- package/table-map/package.json +8 -1
- package/tsconfig.json +0 -1
- package/types/package.json +8 -1
- package/utils/package.json +8 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
This package is based on prosemirror-tables, https://github.com/ProseMirror/prosemirror-tables
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2015-2016 by Marijn Haverbeke <marijnh@gmail.com> and others
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export { TableMap, Rect } from './table-map';
|
|
25
|
+
export { CellSelection } from './cell-selection';
|
|
26
|
+
export { findTable } from './utils/find';
|
|
27
|
+
export { uuid } from './utils/uuid';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
export declare const handleKeyDown: (view: EditorView<any>, event: Event) => boolean;
|
|
3
|
+
export declare function handleTripleClick(view: EditorView, pos: number): boolean;
|
|
4
|
+
export declare function handleMouseDown(view: EditorView, event: Event): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
import { ReportFixedTable } from '../utils/fix-tables';
|
|
3
|
+
declare type PluginState = number | null;
|
|
4
|
+
export declare function tableEditing({ allowTableNodeSelection, reportFixedTable, }?: {
|
|
5
|
+
allowTableNodeSelection?: boolean;
|
|
6
|
+
reportFixedTable?: ReportFixedTable;
|
|
7
|
+
}): Plugin<PluginState>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Axis } from './types';
|
|
3
|
+
export declare class Rect {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
constructor(left: number, top: number, right: number, bottom: number);
|
|
9
|
+
}
|
|
10
|
+
export interface TableRect extends Rect {
|
|
11
|
+
map: TableMap;
|
|
12
|
+
tableStart: number;
|
|
13
|
+
table: PMNode;
|
|
14
|
+
}
|
|
15
|
+
export declare type TableContext = {
|
|
16
|
+
map: TableMap;
|
|
17
|
+
tableStart: number;
|
|
18
|
+
table: PMNode;
|
|
19
|
+
};
|
|
20
|
+
export declare enum TableProblemTypes {
|
|
21
|
+
COLLISION = "collision",
|
|
22
|
+
OVERLONG_ROWSPAN = "overlong_rowspan",
|
|
23
|
+
MISSING = "missing",
|
|
24
|
+
COLWIDTH_MISMATCH = "colwidth mismatch"
|
|
25
|
+
}
|
|
26
|
+
export declare type TableProblemCollision = {
|
|
27
|
+
type: TableProblemTypes.COLLISION;
|
|
28
|
+
row: number;
|
|
29
|
+
pos: number;
|
|
30
|
+
n: number;
|
|
31
|
+
};
|
|
32
|
+
export declare type TableProblemLongRowspan = {
|
|
33
|
+
type: TableProblemTypes.OVERLONG_ROWSPAN;
|
|
34
|
+
pos: number;
|
|
35
|
+
n: number;
|
|
36
|
+
};
|
|
37
|
+
export declare type TableProblemMissing = {
|
|
38
|
+
type: TableProblemTypes.MISSING;
|
|
39
|
+
row: number;
|
|
40
|
+
n: number;
|
|
41
|
+
};
|
|
42
|
+
export declare type TableProblemColWidthMismatch = {
|
|
43
|
+
type: TableProblemTypes;
|
|
44
|
+
pos: number;
|
|
45
|
+
colwidth: number;
|
|
46
|
+
};
|
|
47
|
+
export declare type TableProblem = TableProblemCollision | TableProblemLongRowspan | TableProblemMissing | TableProblemColWidthMismatch;
|
|
48
|
+
export declare const tableNewColumnMinWidth = 140;
|
|
49
|
+
export declare class TableMap {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
map: number[];
|
|
53
|
+
problems?: TableProblem[] | null;
|
|
54
|
+
constructor(width: number, height: number, map: number[], problems?: TableProblem[] | null);
|
|
55
|
+
findCell(pos: number): Rect;
|
|
56
|
+
colCount(pos: number): number;
|
|
57
|
+
nextCell(pos: number, axis: Axis, dir: number): number | null;
|
|
58
|
+
rectBetween(a: number, b: number): Rect;
|
|
59
|
+
cellsInRect(rect: Rect): number[];
|
|
60
|
+
positionAt(row: number, col: number, table: PMNode): number;
|
|
61
|
+
static get(table: PMNode): TableMap;
|
|
62
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Fragment, ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
export interface CellAttributes {
|
|
5
|
+
colspan?: number;
|
|
6
|
+
rowspan?: number;
|
|
7
|
+
colwidth?: number[];
|
|
8
|
+
background?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SelectionBounds {
|
|
11
|
+
$from: ResolvedPos;
|
|
12
|
+
$to: ResolvedPos;
|
|
13
|
+
}
|
|
14
|
+
export interface SerializedCellSelection {
|
|
15
|
+
type: 'cell';
|
|
16
|
+
anchor: number;
|
|
17
|
+
head: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CellSelectionRect {
|
|
20
|
+
height: number;
|
|
21
|
+
width: number;
|
|
22
|
+
rows: Fragment[];
|
|
23
|
+
}
|
|
24
|
+
export declare type Axis = 'horiz' | 'vert';
|
|
25
|
+
export declare type Direction = -1 | 1;
|
|
26
|
+
export declare type Dispatch = (tr: Transaction) => void;
|
|
27
|
+
export declare type Command = (state: EditorState, dispatch?: Dispatch) => boolean;
|
|
28
|
+
export declare type CommandWithView = (state: EditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
|
|
29
|
+
export declare type SelectionRange = {
|
|
30
|
+
$anchor: ResolvedPos;
|
|
31
|
+
$head: ResolvedPos;
|
|
32
|
+
indexes: number[];
|
|
33
|
+
};
|
|
34
|
+
export declare type CellAttributesWithColSpan = CellAttributes & {
|
|
35
|
+
colspan: number;
|
|
36
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
import { TableContext, TableMap } from '../table-map';
|
|
4
|
+
export declare function columnIsHeader(map: TableMap, table: PMNode, col: number): boolean;
|
|
5
|
+
export declare function addColumn(tr: Transaction, { map, tableStart, table }: TableContext, col: number): Transaction;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Selection } from 'prosemirror-state';
|
|
2
|
+
import { TableMap } from '../table-map';
|
|
3
|
+
export declare function getSelectedTableInfo(selection: Selection): {
|
|
4
|
+
table: import("prosemirror-utils").ContentNodeWithPos | undefined;
|
|
5
|
+
map: TableMap | undefined;
|
|
6
|
+
totalRowCount: number;
|
|
7
|
+
totalColumnCount: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function getSelectedCellInfo(selection: Selection): {
|
|
10
|
+
totalRowCount: number;
|
|
11
|
+
totalColumnCount: number;
|
|
12
|
+
horizontalCells: number;
|
|
13
|
+
verticalCells: number;
|
|
14
|
+
totalCells: number;
|
|
15
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { Axis } from '../types';
|
|
3
|
+
export declare function pointsAtCell($pos: ResolvedPos): false | import("prosemirror-model").Node<any> | null | undefined;
|
|
4
|
+
export declare function cellNear($pos: ResolvedPos): ResolvedPos | null;
|
|
5
|
+
export declare function cellAround($pos: ResolvedPos): ResolvedPos | null;
|
|
6
|
+
export declare function nextCell($pos: ResolvedPos, axis: Axis, dir: number): ResolvedPos | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CellAttributes, CellAttributesWithColSpan } from '../types';
|
|
2
|
+
export declare function removeColSpan(attrs: CellAttributes, pos: number, n?: number): CellAttributes;
|
|
3
|
+
export declare function assertColspan(attrs: CellAttributes): void;
|
|
4
|
+
export declare function addColSpan<T extends CellAttributesWithColSpan>(attrs: T, pos: number, n?: number): T;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NodeType, Node as PMNode, Slice } from 'prosemirror-model';
|
|
2
|
+
import { EditorState } from 'prosemirror-state';
|
|
3
|
+
import { Rect } from '../table-map';
|
|
4
|
+
import { CellSelectionRect, Dispatch } from '../types';
|
|
5
|
+
export declare function pastedCells(slice: Slice): CellSelectionRect | null;
|
|
6
|
+
export declare function fitSlice(nodeType: NodeType, slice: Slice): PMNode;
|
|
7
|
+
export declare function clipCells({ width: currentWidth, height: currentHeight, rows: currentRows, }: CellSelectionRect, newWidth: number, newHeight: number): CellSelectionRect;
|
|
8
|
+
export declare function insertCells(state: EditorState, dispatch: Dispatch, tableStart: number, rect: Rect, cells: CellSelectionRect): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Node as PMNode, Schema } from 'prosemirror-model';
|
|
2
|
+
declare type CreateTableProps = {
|
|
3
|
+
schema: Schema;
|
|
4
|
+
rowsCount?: number;
|
|
5
|
+
colsCount?: number;
|
|
6
|
+
withHeaderRow?: boolean;
|
|
7
|
+
cellContent?: PMNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const createTable: ({ schema, rowsCount, colsCount, withHeaderRow, cellContent, }: CreateTableProps) => PMNode;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { Selection } from 'prosemirror-state';
|
|
3
|
+
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
4
|
+
import { Rect } from '../table-map';
|
|
5
|
+
export declare const findTable: (selection: Selection) => ContentNodeWithPos | undefined;
|
|
6
|
+
export declare const findTableClosestToPos: ($pos: ResolvedPos) => ContentNodeWithPos | undefined;
|
|
7
|
+
export declare const findCellClosestToPos: ($pos: ResolvedPos) => ContentNodeWithPos | undefined;
|
|
8
|
+
export declare const findCellRectClosestToPos: ($pos: ResolvedPos) => Rect | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
+
export declare type ReportFixedTable = ({ state, tr, reason, }: {
|
|
4
|
+
state: EditorState;
|
|
5
|
+
tr: Transaction;
|
|
6
|
+
reason: string;
|
|
7
|
+
}) => void;
|
|
8
|
+
export declare function fixTables(state: EditorState, oldState?: EditorState, reportFixedTable?: ReportFixedTable): Transaction | undefined;
|
|
9
|
+
export declare function fixTable(state: EditorState, table: Node, tablePos: number, transaction?: Transaction, reportFixedTable?: ReportFixedTable): Transaction | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Transaction } from 'prosemirror-state';
|
|
2
|
+
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
3
|
+
export declare const forEachCellInColumn: (columnIndex: number, cellTransform: (cell: ContentNodeWithPos, tr: Transaction) => Transaction, setCursorToLastCell?: boolean | undefined) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const forEachCellInRow: (rowIndex: number, cellTransform: (cell: ContentNodeWithPos, tr: Transaction) => Transaction, setCursorToLastCell: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Selection } from 'prosemirror-state';
|
|
2
|
+
import { Rect } from '../table-map';
|
|
3
|
+
export declare const isRectSelected: (rect: Rect) => (selection: Selection) => boolean;
|
|
4
|
+
export declare const isColumnSelected: (columnIndex: number) => (selection: Selection) => boolean;
|
|
5
|
+
export declare const isRowSelected: (rowIndex: number) => (selection: Selection) => boolean;
|
|
6
|
+
export declare const isTableSelected: (selection: Selection) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { NodeSelection, Selection, TextSelection } from 'prosemirror-state';
|
|
3
|
+
interface CellSelectionShape extends Selection {
|
|
4
|
+
$anchorCell: ResolvedPos;
|
|
5
|
+
$headCell: ResolvedPos;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function isSelectionType(selection: Selection, type: 'cell'): selection is CellSelectionShape;
|
|
9
|
+
export declare function isSelectionType(selection: Selection, type: 'node'): selection is NodeSelection;
|
|
10
|
+
export declare function isSelectionType(selection: Selection, type: 'text'): selection is TextSelection;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
export declare const removeColumnAt: (columnIndex: number) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const removeSelectedColumns: (tr: Transaction) => Transaction;
|
|
5
|
+
export declare const removeColumnClosestToPos: ($pos: ResolvedPos) => (tr: Transaction) => Transaction;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
export declare const removeRowAt: (rowIndex: number) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const removeSelectedRows: (tr: Transaction) => Transaction;
|
|
5
|
+
export declare const removeRowClosestToPos: ($pos: ResolvedPos) => (tr: Transaction) => Transaction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { NodeWithPos } from 'prosemirror-utils';
|
|
3
|
+
declare type ArrayOfRows = Array<PMNode | null>[];
|
|
4
|
+
export declare const transpose: (array: Array<any>) => Array<any>;
|
|
5
|
+
export declare const convertArrayOfRowsToTableNode: (tableNode: PMNode, arrayOfNodes: ArrayOfRows) => PMNode;
|
|
6
|
+
export declare const convertTableNodeToArrayOfRows: (tableNode: PMNode) => ArrayOfRows;
|
|
7
|
+
export declare const moveTableRow: (table: NodeWithPos, indexesOrigin: number[], indexesTarget: number[], direction: number) => PMNode;
|
|
8
|
+
export declare const moveTableColumn: (table: NodeWithPos, indexesOrigin: number[], indexesTarget: number[], direction: number) => PMNode;
|
|
9
|
+
export declare const isValidReorder: (originIndex: number, targetIndex: number, targets: number[], type: 'row' | 'column') => boolean;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Transaction } from 'prosemirror-state';
|
|
2
|
+
export declare const selectColumn: (index: number, expand?: boolean | undefined) => (tr: Transaction) => Transaction;
|
|
3
|
+
export declare const selectRow: (index: number, expand?: boolean | undefined) => (tr: Transaction) => Transaction;
|
|
4
|
+
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeType, Node as PMNode, ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { Command } from '../types';
|
|
3
|
+
export declare function cellWrapping($pos: ResolvedPos): PMNode | null;
|
|
4
|
+
export declare type GetCellTypeArgs = {
|
|
5
|
+
row: number;
|
|
6
|
+
col: number;
|
|
7
|
+
node: PMNode;
|
|
8
|
+
};
|
|
9
|
+
declare type GetCellTypeCallback = (option: GetCellTypeArgs) => NodeType;
|
|
10
|
+
export declare function splitCellWithType(getCellType: GetCellTypeCallback): Command;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export { addColumnAt } from './utils/add-column-at';
|
|
2
|
+
export { addColumn, columnIsHeader } from './utils/add-column';
|
|
3
|
+
export { addRowAt } from './utils/add-row-at';
|
|
4
|
+
export { addRow } from './utils/add-row';
|
|
5
|
+
export { pointsAtCell, cellNear, cellAround, nextCell } from './utils/cells';
|
|
6
|
+
export { cloneTr } from './utils/clone-tr';
|
|
7
|
+
export { removeColSpan, addColSpan } from './utils/colspan';
|
|
8
|
+
export { createTable } from './utils/create-table';
|
|
9
|
+
export { drawCellSelection } from './utils/draw-cell-selection';
|
|
10
|
+
export { emptyCell } from './utils/empty-cells';
|
|
11
|
+
export { findTable, findTableClosestToPos, findCellClosestToPos, findCellRectClosestToPos, } from './utils/find';
|
|
12
|
+
export { fixTables } from './utils/fix-tables';
|
|
13
|
+
export { forEachCellInColumn, forEachCellInRow } from './utils/for-each-cell';
|
|
14
|
+
export { getCellSelectionRanges } from './utils/get-cell-selection-ranges';
|
|
15
|
+
export { getCellsInColumn } from './utils/get-cells-in-column';
|
|
16
|
+
export { getCellsInRow } from './utils/get-cells-in-row';
|
|
17
|
+
export { getCellsInTable } from './utils/get-cells-in-table';
|
|
18
|
+
export { getSelectionRangeInColumn } from './utils/get-selection-range-in-column';
|
|
19
|
+
export { getSelectionRangeInRow } from './utils/get-selection-range-in-row';
|
|
20
|
+
export { getSelectionRect } from './utils/get-selection-rect';
|
|
21
|
+
export { goToNextCell } from './utils/go-to-next-cell';
|
|
22
|
+
export { isRectSelected, isColumnSelected, isRowSelected, isTableSelected, } from './utils/is-selected';
|
|
23
|
+
export { isSelectionType } from './utils/is-selection-type';
|
|
24
|
+
export { moveColumn } from './utils/move-column';
|
|
25
|
+
export { moveRow } from './utils/move-row';
|
|
26
|
+
export { normalizeSelection } from './utils/normalize-selection';
|
|
27
|
+
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos, } from './utils/remove-column';
|
|
28
|
+
export { removeRowAt, removeSelectedRows, removeRowClosestToPos, } from './utils/remove-row';
|
|
29
|
+
export { removeTable } from './utils/remove-table';
|
|
30
|
+
export { selectColumn, selectRow, selectTable } from './utils/select-nodes';
|
|
31
|
+
export { selectionCell } from './utils/selection-cell';
|
|
32
|
+
export { selectedRect } from './utils/selection-rect';
|
|
33
|
+
export type { SelectionRect } from './utils/selection-rect';
|
|
34
|
+
export { setCellAttrs } from './utils/set-cell-attrs';
|
|
35
|
+
export { cellWrapping, splitCellWithType } from './utils/split-cell-with-type';
|
|
36
|
+
export { splitCell } from './utils/split-cell';
|
|
37
|
+
export { tableNodeTypes } from './utils/table-node-types';
|
|
38
|
+
export { isInTable, inSameTable } from './utils/tables';
|
|
39
|
+
export { toggleHeader } from './utils/toggle-header';
|
|
40
|
+
export { convertArrayOfRowsToTableNode, convertTableNodeToArrayOfRows, } from './utils/reorder-utils';
|
|
41
|
+
export { handlePaste } from './utils/handle-paste';
|
|
42
|
+
export { replaceSelectedTable } from './utils/replace-table';
|
|
43
|
+
export { getSelectedTableInfo, getSelectedCellInfo, } from './utils/analytics-helpers';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
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,13 @@
|
|
|
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.0 <4.5": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.0/*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
15
22
|
"sideEffects": false,
|
|
16
23
|
"atlaskit:src": "src/index.ts",
|
|
17
24
|
"atlassian": {
|
|
@@ -29,8 +36,8 @@
|
|
|
29
36
|
"prosemirror-view": "1.23.2"
|
|
30
37
|
},
|
|
31
38
|
"devDependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^
|
|
33
|
-
"@atlaskit/editor-test-helpers": "^17.
|
|
39
|
+
"@atlaskit/adf-schema": "^24.0.0",
|
|
40
|
+
"@atlaskit/editor-test-helpers": "^17.2.0",
|
|
34
41
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1"
|
|
35
42
|
},
|
|
36
43
|
"techstack": {
|
package/pm-plugins/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/pm-plugins.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/pm-plugins.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/pm-plugins.d.ts"
|
|
7
|
+
"types": "../dist/types/pm-plugins.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/pm-plugins.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/editor-tables"
|
|
1
|
+
## API Report File for "@atlaskit/editor-tables".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
import { ContentNodeWithPos } from 'prosemirror-utils';
|
package/table-map/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/table-map.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/table-map.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/table-map.d.ts"
|
|
7
|
+
"types": "../dist/types/table-map.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/table-map.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/tsconfig.json
CHANGED
package/types/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/types.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types.d.ts"
|
|
7
|
+
"types": "../dist/types/types.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/types.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|