@atlaskit/editor-tables 2.3.14 → 2.3.16

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-tables
2
2
 
3
+ ## 2.3.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#58433](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58433) [`4d8e164d7760`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4d8e164d7760) - fix shift + click to expand column / row selection bug when `platform.editor.table.drag-and-drop` is enabled
8
+
9
+ ## 2.3.15
10
+
11
+ ### Patch Changes
12
+
13
+ - [#43255](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43255) [`6c1b3270538`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6c1b3270538) - Remove setSelection from move commands as it's unnecessary
14
+
3
15
  ## 2.3.14
4
16
 
5
17
  ### Patch Changes
@@ -131,7 +131,7 @@ function handleTripleClick(view, pos) {
131
131
  view.dispatch(view.state.tr.setSelection(new _cellSelection.CellSelection($cell)));
132
132
  return true;
133
133
  }
134
- function handleMouseDown(view, event) {
134
+ function handleMouseDown(view, event, dragAndDropEnabled) {
135
135
  var startEvent = event;
136
136
  // Prevent right clicks from making a cell selection https://product-fabric.atlassian.net/browse/ED-12527
137
137
  if (startEvent.ctrlKey || startEvent.metaKey || startEvent.button === 2 // right mouse click
@@ -142,6 +142,9 @@ function handleMouseDown(view, event) {
142
142
  var $anchor = (0, _cells.cellAround)(view.state.selection.$anchor);
143
143
  if (startEvent.shiftKey && view.state.selection instanceof _cellSelection.CellSelection) {
144
144
  // Adding to an existing cell selection
145
+ if (dragAndDropEnabled) {
146
+ return false;
147
+ }
145
148
  setCellSelection(view.state.selection.$anchorCell, startEvent);
146
149
  startEvent.preventDefault();
147
150
  } else if (startEvent.shiftKey && startDOMCell && $anchor !== null && cellUnderMouse(view, startEvent).pos !== $anchor.pos) {
@@ -28,6 +28,8 @@ function tableEditing() {
28
28
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
29
29
  _ref$allowTableNodeSe = _ref.allowTableNodeSelection,
30
30
  allowTableNodeSelection = _ref$allowTableNodeSe === void 0 ? false : _ref$allowTableNodeSe,
31
+ _ref$dragAndDropEnabl = _ref.dragAndDropEnabled,
32
+ dragAndDropEnabled = _ref$dragAndDropEnabl === void 0 ? false : _ref$dragAndDropEnabl,
31
33
  reportFixedTable = _ref.reportFixedTable;
32
34
  return new _state.Plugin({
33
35
  key: _pluginKey.tableEditingKey,
@@ -56,7 +58,9 @@ function tableEditing() {
56
58
  props: {
57
59
  decorations: _drawCellSelection.drawCellSelection,
58
60
  handleDOMEvents: {
59
- mousedown: _input.handleMouseDown
61
+ mousedown: function mousedown(view, event) {
62
+ (0, _input.handleMouseDown)(view, event, dragAndDropEnabled);
63
+ }
60
64
  },
61
65
  createSelectionBetween: function createSelectionBetween(view) {
62
66
  if (_pluginKey.tableEditingKey.getState(view.state) != null) {
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.moveColumn = void 0;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
7
  var _cloneTr = require("./clone-tr");
10
8
  var _find = require("./find");
11
9
  var _getSelectionRangeInColumn = require("./get-selection-range-in-column");
@@ -149,7 +147,6 @@ var moveColumn = exports.moveColumn = function moveColumn(originColumnIndex, tar
149
147
  if (!table) {
150
148
  return tr;
151
149
  }
152
- var anchor = tr.selection.anchor;
153
150
  var originalColumnRanges = (0, _getSelectionRangeInColumn.getSelectionRangeInColumn)(originColumnIndex)(tr);
154
151
  var targetColumnRanges = (0, _getSelectionRangeInColumn.getSelectionRangeInColumn)(targetColumnIndex)(tr);
155
152
  var indexesOriginColumn = (_originalColumnRanges = originalColumnRanges === null || originalColumnRanges === void 0 ? void 0 : originalColumnRanges.indexes) !== null && _originalColumnRanges !== void 0 ? _originalColumnRanges : [];
@@ -162,11 +159,6 @@ var moveColumn = exports.moveColumn = function moveColumn(originColumnIndex, tar
162
159
  }
163
160
  var newTable = (0, _reorderUtils.moveTableColumn)(table, indexesOriginColumn, indexesTargetColumn, options.direction);
164
161
  var newTr = (0, _cloneTr.cloneTr)(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
165
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
166
- // Set selection inside a newly created table
167
- return newTr.setSelection(_state.TextSelection.create(newTr.doc, anchor));
168
- } else {
169
- return newTr;
170
- }
162
+ return newTr;
171
163
  };
172
164
  };
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.moveRow = void 0;
7
- var _state = require("@atlaskit/editor-prosemirror/state");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
7
  var _cloneTr = require("./clone-tr");
10
8
  var _find = require("./find");
11
9
  var _getSelectionRangeInRow = require("./get-selection-range-in-row");
@@ -163,7 +161,6 @@ var moveRow = exports.moveRow = function moveRow(originRowIndex, targetRowIndex)
163
161
  if (!table) {
164
162
  return tr;
165
163
  }
166
- var anchor = tr.selection.anchor;
167
164
  var originalRowRanges = (0, _getSelectionRangeInRow.getSelectionRangeInRow)(originRowIndex)(tr);
168
165
  var targetRowRanges = (0, _getSelectionRangeInRow.getSelectionRangeInRow)(targetRowIndex)(tr);
169
166
  var indexesOriginRow = (originalRowRanges === null || originalRowRanges === void 0 ? void 0 : originalRowRanges.indexes) || [];
@@ -176,11 +173,6 @@ var moveRow = exports.moveRow = function moveRow(originRowIndex, targetRowIndex)
176
173
  }
177
174
  var newTable = (0, _reorderUtils.moveTableRow)(table, indexesOriginRow, indexesTargetRow, options.direction);
178
175
  var newTr = (0, _cloneTr.cloneTr)(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
179
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-and-drop')) {
180
- // Set selection inside a newly created table
181
- return newTr.setSelection(_state.TextSelection.create(newTr.doc, anchor));
182
- } else {
183
- return newTr;
184
- }
176
+ return newTr;
185
177
  };
186
178
  };
@@ -130,7 +130,7 @@ export function handleTripleClick(view, pos) {
130
130
  view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));
131
131
  return true;
132
132
  }
133
- export function handleMouseDown(view, event) {
133
+ export function handleMouseDown(view, event, dragAndDropEnabled) {
134
134
  const startEvent = event;
135
135
  // Prevent right clicks from making a cell selection https://product-fabric.atlassian.net/browse/ED-12527
136
136
  if (startEvent.ctrlKey || startEvent.metaKey || startEvent.button === 2 // right mouse click
@@ -141,6 +141,9 @@ export function handleMouseDown(view, event) {
141
141
  const $anchor = cellAround(view.state.selection.$anchor);
142
142
  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
143
143
  // Adding to an existing cell selection
144
+ if (dragAndDropEnabled) {
145
+ return false;
146
+ }
144
147
  setCellSelection(view.state.selection.$anchorCell, startEvent);
145
148
  startEvent.preventDefault();
146
149
  } else if (startEvent.shiftKey && startDOMCell && $anchor !== null && cellUnderMouse(view, startEvent).pos !== $anchor.pos) {
@@ -20,6 +20,7 @@ import { tableEditingKey } from './plugin-key';
20
20
  // perform more specific behavior.
21
21
  export function tableEditing({
22
22
  allowTableNodeSelection = false,
23
+ dragAndDropEnabled = false,
23
24
  reportFixedTable
24
25
  } = {}) {
25
26
  return new Plugin({
@@ -50,7 +51,9 @@ export function tableEditing({
50
51
  props: {
51
52
  decorations: drawCellSelection,
52
53
  handleDOMEvents: {
53
- mousedown: handleMouseDown
54
+ mousedown: (view, event) => {
55
+ handleMouseDown(view, event, dragAndDropEnabled);
56
+ }
54
57
  },
55
58
  createSelectionBetween(view) {
56
59
  if (tableEditingKey.getState(view.state) != null) {
@@ -1,5 +1,3 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
1
  import { cloneTr } from './clone-tr';
4
2
  import { findTable } from './find';
5
3
  import { getSelectionRangeInColumn } from './get-selection-range-in-column';
@@ -142,7 +140,6 @@ export const moveColumn = (originColumnIndex, targetColumnIndex, options = {
142
140
  if (!table) {
143
141
  return tr;
144
142
  }
145
- const anchor = tr.selection.anchor;
146
143
  const originalColumnRanges = getSelectionRangeInColumn(originColumnIndex)(tr);
147
144
  const targetColumnRanges = getSelectionRangeInColumn(targetColumnIndex)(tr);
148
145
  const indexesOriginColumn = (_originalColumnRanges = originalColumnRanges === null || originalColumnRanges === void 0 ? void 0 : originalColumnRanges.indexes) !== null && _originalColumnRanges !== void 0 ? _originalColumnRanges : [];
@@ -155,10 +152,5 @@ export const moveColumn = (originColumnIndex, targetColumnIndex, options = {
155
152
  }
156
153
  const newTable = moveTableColumn(table, indexesOriginColumn, indexesTargetColumn, options.direction);
157
154
  const newTr = cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
158
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
159
- // Set selection inside a newly created table
160
- return newTr.setSelection(TextSelection.create(newTr.doc, anchor));
161
- } else {
162
- return newTr;
163
- }
155
+ return newTr;
164
156
  };
@@ -1,5 +1,3 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
1
  import { cloneTr } from './clone-tr';
4
2
  import { findTable } from './find';
5
3
  import { getSelectionRangeInRow } from './get-selection-range-in-row';
@@ -156,7 +154,6 @@ export const moveRow = (originRowIndex, targetRowIndex, options = {
156
154
  if (!table) {
157
155
  return tr;
158
156
  }
159
- const anchor = tr.selection.anchor;
160
157
  const originalRowRanges = getSelectionRangeInRow(originRowIndex)(tr);
161
158
  const targetRowRanges = getSelectionRangeInRow(targetRowIndex)(tr);
162
159
  const indexesOriginRow = (originalRowRanges === null || originalRowRanges === void 0 ? void 0 : originalRowRanges.indexes) || [];
@@ -169,10 +166,5 @@ export const moveRow = (originRowIndex, targetRowIndex, options = {
169
166
  }
170
167
  const newTable = moveTableRow(table, indexesOriginRow, indexesTargetRow, options.direction);
171
168
  const newTr = cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
172
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
173
- // Set selection inside a newly created table
174
- return newTr.setSelection(TextSelection.create(newTr.doc, anchor));
175
- } else {
176
- return newTr;
177
- }
169
+ return newTr;
178
170
  };
@@ -123,7 +123,7 @@ export function handleTripleClick(view, pos) {
123
123
  view.dispatch(view.state.tr.setSelection(new CellSelection($cell)));
124
124
  return true;
125
125
  }
126
- export function handleMouseDown(view, event) {
126
+ export function handleMouseDown(view, event, dragAndDropEnabled) {
127
127
  var startEvent = event;
128
128
  // Prevent right clicks from making a cell selection https://product-fabric.atlassian.net/browse/ED-12527
129
129
  if (startEvent.ctrlKey || startEvent.metaKey || startEvent.button === 2 // right mouse click
@@ -134,6 +134,9 @@ export function handleMouseDown(view, event) {
134
134
  var $anchor = cellAround(view.state.selection.$anchor);
135
135
  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
136
136
  // Adding to an existing cell selection
137
+ if (dragAndDropEnabled) {
138
+ return false;
139
+ }
137
140
  setCellSelection(view.state.selection.$anchorCell, startEvent);
138
141
  startEvent.preventDefault();
139
142
  } else if (startEvent.shiftKey && startDOMCell && $anchor !== null && cellUnderMouse(view, startEvent).pos !== $anchor.pos) {
@@ -22,6 +22,8 @@ export function tableEditing() {
22
22
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
23
23
  _ref$allowTableNodeSe = _ref.allowTableNodeSelection,
24
24
  allowTableNodeSelection = _ref$allowTableNodeSe === void 0 ? false : _ref$allowTableNodeSe,
25
+ _ref$dragAndDropEnabl = _ref.dragAndDropEnabled,
26
+ dragAndDropEnabled = _ref$dragAndDropEnabl === void 0 ? false : _ref$dragAndDropEnabl,
25
27
  reportFixedTable = _ref.reportFixedTable;
26
28
  return new Plugin({
27
29
  key: tableEditingKey,
@@ -50,7 +52,9 @@ export function tableEditing() {
50
52
  props: {
51
53
  decorations: drawCellSelection,
52
54
  handleDOMEvents: {
53
- mousedown: handleMouseDown
55
+ mousedown: function mousedown(view, event) {
56
+ handleMouseDown(view, event, dragAndDropEnabled);
57
+ }
54
58
  },
55
59
  createSelectionBetween: function createSelectionBetween(view) {
56
60
  if (tableEditingKey.getState(view.state) != null) {
@@ -1,5 +1,3 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
1
  import { cloneTr } from './clone-tr';
4
2
  import { findTable } from './find';
5
3
  import { getSelectionRangeInColumn } from './get-selection-range-in-column';
@@ -144,7 +142,6 @@ export var moveColumn = function moveColumn(originColumnIndex, targetColumnIndex
144
142
  if (!table) {
145
143
  return tr;
146
144
  }
147
- var anchor = tr.selection.anchor;
148
145
  var originalColumnRanges = getSelectionRangeInColumn(originColumnIndex)(tr);
149
146
  var targetColumnRanges = getSelectionRangeInColumn(targetColumnIndex)(tr);
150
147
  var indexesOriginColumn = (_originalColumnRanges = originalColumnRanges === null || originalColumnRanges === void 0 ? void 0 : originalColumnRanges.indexes) !== null && _originalColumnRanges !== void 0 ? _originalColumnRanges : [];
@@ -157,11 +154,6 @@ export var moveColumn = function moveColumn(originColumnIndex, targetColumnIndex
157
154
  }
158
155
  var newTable = moveTableColumn(table, indexesOriginColumn, indexesTargetColumn, options.direction);
159
156
  var newTr = cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
160
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
161
- // Set selection inside a newly created table
162
- return newTr.setSelection(TextSelection.create(newTr.doc, anchor));
163
- } else {
164
- return newTr;
165
- }
157
+ return newTr;
166
158
  };
167
159
  };
@@ -1,5 +1,3 @@
1
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
1
  import { cloneTr } from './clone-tr';
4
2
  import { findTable } from './find';
5
3
  import { getSelectionRangeInRow } from './get-selection-range-in-row';
@@ -158,7 +156,6 @@ export var moveRow = function moveRow(originRowIndex, targetRowIndex) {
158
156
  if (!table) {
159
157
  return tr;
160
158
  }
161
- var anchor = tr.selection.anchor;
162
159
  var originalRowRanges = getSelectionRangeInRow(originRowIndex)(tr);
163
160
  var targetRowRanges = getSelectionRangeInRow(targetRowIndex)(tr);
164
161
  var indexesOriginRow = (originalRowRanges === null || originalRowRanges === void 0 ? void 0 : originalRowRanges.indexes) || [];
@@ -171,11 +168,6 @@ export var moveRow = function moveRow(originRowIndex, targetRowIndex) {
171
168
  }
172
169
  var newTable = moveTableRow(table, indexesOriginRow, indexesTargetRow, options.direction);
173
170
  var newTr = cloneTr(tr).replaceWith(table.pos, table.pos + table.node.nodeSize, newTable);
174
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
175
- // Set selection inside a newly created table
176
- return newTr.setSelection(TextSelection.create(newTr.doc, anchor));
177
- } else {
178
- return newTr;
179
- }
171
+ return newTr;
180
172
  };
181
173
  };
@@ -1,4 +1,4 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
3
3
  export declare function handleTripleClick(view: EditorView, pos: number): boolean;
4
- export declare function handleMouseDown(view: EditorView, event: Event): boolean;
4
+ export declare function handleMouseDown(view: EditorView, event: Event, dragAndDropEnabled: boolean): boolean;
@@ -1,8 +1,9 @@
1
1
  import { Plugin } from '@atlaskit/editor-prosemirror/state';
2
- import { ReportFixedTable } from '../utils/fix-tables';
2
+ import type { ReportFixedTable } from '../utils/fix-tables';
3
3
  type PluginState = number | null;
4
- export declare function tableEditing({ allowTableNodeSelection, reportFixedTable, }?: {
4
+ export declare function tableEditing({ allowTableNodeSelection, dragAndDropEnabled, reportFixedTable, }?: {
5
5
  allowTableNodeSelection?: boolean;
6
+ dragAndDropEnabled?: boolean;
6
7
  reportFixedTable?: ReportFixedTable;
7
8
  }): Plugin<PluginState>;
8
9
  export {};
@@ -1,4 +1,4 @@
1
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
1
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
2
  export declare const handleKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
3
3
  export declare function handleTripleClick(view: EditorView, pos: number): boolean;
4
- export declare function handleMouseDown(view: EditorView, event: Event): boolean;
4
+ export declare function handleMouseDown(view: EditorView, event: Event, dragAndDropEnabled: boolean): boolean;
@@ -1,8 +1,9 @@
1
1
  import { Plugin } from '@atlaskit/editor-prosemirror/state';
2
- import { ReportFixedTable } from '../utils/fix-tables';
2
+ import type { ReportFixedTable } from '../utils/fix-tables';
3
3
  type PluginState = number | null;
4
- export declare function tableEditing({ allowTableNodeSelection, reportFixedTable, }?: {
4
+ export declare function tableEditing({ allowTableNodeSelection, dragAndDropEnabled, reportFixedTable, }?: {
5
5
  allowTableNodeSelection?: boolean;
6
+ dragAndDropEnabled?: boolean;
6
7
  reportFixedTable?: ReportFixedTable;
7
8
  }): Plugin<PluginState>;
8
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-tables",
3
- "version": "2.3.14",
3
+ "version": "2.3.16",
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/"
@@ -59,9 +59,6 @@
59
59
  "platform.editor.custom-table-width": {
60
60
  "type": "boolean"
61
61
  },
62
- "platform.editor.table.drag-and-drop": {
63
- "type": "boolean"
64
- },
65
62
  "platform.editor.table-shift-click-selection-backward": {
66
63
  "type": "boolean"
67
64
  }
@@ -1,183 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-tables"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
8
- import { Mappable } from '@atlaskit/editor-prosemirror/transform';
9
- import { Mapping } from '@atlaskit/editor-prosemirror/transform';
10
- import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
11
- import { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
12
- import { Selection as Selection_2 } from '@atlaskit/editor-prosemirror/state';
13
- import { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
14
- import { Slice } from '@atlaskit/editor-prosemirror/model';
15
- import { Transaction } from '@atlaskit/editor-prosemirror/state';
16
-
17
- // @public (undocumented)
18
- type Axis = 'horiz' | 'vert';
19
-
20
- // @public (undocumented)
21
- class CellBookmark implements SelectionBookmark {
22
- constructor(anchor: number, head: number);
23
- // (undocumented)
24
- readonly anchor: number;
25
- // (undocumented)
26
- readonly head: number;
27
- // (undocumented)
28
- map(mapping: Mappable): SelectionBookmark;
29
- // (undocumented)
30
- resolve(doc: Node_2): Selection_2;
31
- }
32
-
33
- // @public (undocumented)
34
- export class CellSelection extends Selection_2 {
35
- // (undocumented)
36
- readonly $anchorCell: ResolvedPos;
37
- // (undocumented)
38
- readonly $headCell: ResolvedPos;
39
- constructor($anchorCell: ResolvedPos, $headCell?: ResolvedPos);
40
- // (undocumented)
41
- static colSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
42
- // (undocumented)
43
- content(): Slice;
44
- // (undocumented)
45
- static create(doc: Node_2, anchorCell: number, headCell?: number): CellSelection;
46
- // (undocumented)
47
- eq(other: CellSelection): boolean;
48
- // (undocumented)
49
- forEachCell(f: (node: Node_2, pos: number) => void): void;
50
- // (undocumented)
51
- static fromJSON(doc: Node_2, json: SerializedCellSelection): CellSelection;
52
- // (undocumented)
53
- getBookmark(): CellBookmark;
54
- // (undocumented)
55
- isColSelection(): boolean;
56
- // (undocumented)
57
- isRowSelection(): boolean;
58
- // (undocumented)
59
- map(doc: Node_2, mapping: Mapping): Selection_2;
60
- // (undocumented)
61
- replace(tr: Transaction, content?: Slice): void;
62
- // (undocumented)
63
- replaceWith(tr: Transaction, node: Node_2): void;
64
- // (undocumented)
65
- static rowSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
66
- // (undocumented)
67
- toJSON(): SerializedCellSelection;
68
- // (undocumented)
69
- readonly visible: boolean;
70
- }
71
-
72
- // @public (undocumented)
73
- export const findTable: (selection: Selection_2) => ContentNodeWithPos | undefined;
74
-
75
- // @public (undocumented)
76
- export class Rect {
77
- constructor(left: number, top: number, right: number, bottom: number);
78
- // (undocumented)
79
- bottom: number;
80
- // (undocumented)
81
- left: number;
82
- // (undocumented)
83
- right: number;
84
- // (undocumented)
85
- top: number;
86
- }
87
-
88
- // @public (undocumented)
89
- interface SerializedCellSelection {
90
- // (undocumented)
91
- anchor: number;
92
- // (undocumented)
93
- head: number;
94
- // (undocumented)
95
- type: 'cell';
96
- }
97
-
98
- // @public (undocumented)
99
- export class TableMap {
100
- constructor(width: number, height: number, map: number[], problems?: TableProblem[] | null);
101
- // (undocumented)
102
- cellsInRect(rect: Rect): number[];
103
- // (undocumented)
104
- colCount(pos: number): number;
105
- // (undocumented)
106
- findCell(pos: number): Rect;
107
- // (undocumented)
108
- static get(table: Node_2): TableMap;
109
- // (undocumented)
110
- getMaxColInRow(pos: ResolvedPos): number | undefined;
111
- // (undocumented)
112
- height: number;
113
- // (undocumented)
114
- isPosMerged(pos: number): boolean;
115
- // (undocumented)
116
- map: number[];
117
- // (undocumented)
118
- nextCell(pos: number, axis: Axis, dir: number): null | number;
119
- // (undocumented)
120
- positionAt(row: number, col: number, table: Node_2): number;
121
- // (undocumented)
122
- problems?: TableProblem[] | null;
123
- // (undocumented)
124
- rectBetween(a: number, b: number): Rect;
125
- // (undocumented)
126
- rowCount(pos: number): number;
127
- // (undocumented)
128
- width: number;
129
- }
130
-
131
- // @public (undocumented)
132
- type TableProblem = TableProblemColWidthMismatch | TableProblemCollision | TableProblemLongRowspan | TableProblemMissing;
133
-
134
- // @public (undocumented)
135
- type TableProblemCollision = {
136
- type: TableProblemTypes.COLLISION;
137
- row: number;
138
- pos: number;
139
- n: number;
140
- };
141
-
142
- // @public (undocumented)
143
- type TableProblemColWidthMismatch = {
144
- type: TableProblemTypes;
145
- pos: number;
146
- colwidth: number;
147
- };
148
-
149
- // @public (undocumented)
150
- type TableProblemLongRowspan = {
151
- type: TableProblemTypes.OVERLONG_ROWSPAN;
152
- pos: number;
153
- n: number;
154
- };
155
-
156
- // @public (undocumented)
157
- type TableProblemMissing = {
158
- type: TableProblemTypes.MISSING;
159
- row: number;
160
- n: number;
161
- };
162
-
163
- // @public (undocumented)
164
- enum TableProblemTypes {
165
- // (undocumented)
166
- COLLISION = "collision",
167
- // (undocumented)
168
- COLWIDTH_MISMATCH = "colwidth mismatch",
169
- // (undocumented)
170
- MISSING = "missing",
171
- // (undocumented)
172
- OVERLONG_ROWSPAN = "overlong_rowspan"
173
- }
174
-
175
- // @public (undocumented)
176
- export const uuid: {
177
- setStatic(value: false | string): void;
178
- generate(): string;
179
- };
180
-
181
- // (No @packageDocumentation comment for this package)
182
-
183
- ```