@atlaskit/editor-tables 2.5.5 → 2.5.7

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.5.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#77796](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77796) [`eab996d08513`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eab996d08513) - Add new statsig experiement for preserve table width, add support for passing through width to create table. Allow tables to be inserted at full width
8
+
9
+ ## 2.5.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#77516](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77516) [`d6e79c5637c7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d6e79c5637c7) - [ux] fix expand current selection by shift click
14
+
3
15
  ## 2.5.5
4
16
 
5
17
  ### Patch Changes
@@ -140,9 +140,11 @@ function handleMouseDown(view, event, dragAndDropEnabled) {
140
140
  }
141
141
  var startDOMCell = domInCell(view, startEvent.target);
142
142
  var $anchor = (0, _cells.cellAround)(view.state.selection.$anchor);
143
+ var targetElement = event.target instanceof HTMLElement && event.target;
144
+ var isDragHandleElement = targetElement && targetElement.matches('button.pm-table-drag-handle-button-container');
143
145
  if (startEvent.shiftKey && view.state.selection instanceof _cellSelection.CellSelection) {
144
146
  // Adding to an existing cell selection
145
- if (dragAndDropEnabled) {
147
+ if (dragAndDropEnabled && isDragHandleElement) {
146
148
  return false;
147
149
  }
148
150
  setCellSelection(view.state.selection.$anchorCell, startEvent);
@@ -25,7 +25,8 @@ var createTable = exports.createTable = function createTable(_ref) {
25
25
  colsCount = _ref$colsCount === void 0 ? 3 : _ref$colsCount,
26
26
  _ref$withHeaderRow = _ref.withHeaderRow,
27
27
  withHeaderRow = _ref$withHeaderRow === void 0 ? true : _ref$withHeaderRow,
28
- cellContent = _ref.cellContent;
28
+ cellContent = _ref.cellContent,
29
+ tableWidth = _ref.tableWidth;
29
30
  var _tableNodeTypes = (0, _tableNodeTypes2.tableNodeTypes)(schema),
30
31
  tableCell = _tableNodeTypes.cell,
31
32
  tableHeader = _tableNodeTypes.header_cell,
@@ -52,7 +53,7 @@ var createTable = exports.createTable = function createTable(_ref) {
52
53
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width')) {
53
54
  return table.createChecked({
54
55
  localId: _uuid.uuid.generate(),
55
- width: 760
56
+ width: tableWidth !== null && tableWidth !== void 0 ? tableWidth : 760
56
57
  }, rows);
57
58
  }
58
59
  return table.createChecked({
@@ -139,9 +139,11 @@ export function handleMouseDown(view, event, dragAndDropEnabled) {
139
139
  }
140
140
  const startDOMCell = domInCell(view, startEvent.target);
141
141
  const $anchor = cellAround(view.state.selection.$anchor);
142
+ const targetElement = event.target instanceof HTMLElement && event.target;
143
+ const isDragHandleElement = targetElement && targetElement.matches('button.pm-table-drag-handle-button-container');
142
144
  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
143
145
  // Adding to an existing cell selection
144
- if (dragAndDropEnabled) {
146
+ if (dragAndDropEnabled && isDragHandleElement) {
145
147
  return false;
146
148
  }
147
149
  setCellSelection(view.state.selection.$anchorCell, startEvent);
@@ -16,7 +16,8 @@ export const createTable = ({
16
16
  rowsCount = 3,
17
17
  colsCount = 3,
18
18
  withHeaderRow = true,
19
- cellContent
19
+ cellContent,
20
+ tableWidth
20
21
  }) => {
21
22
  const {
22
23
  cell: tableCell,
@@ -45,7 +46,7 @@ export const createTable = ({
45
46
  if (getBooleanFF('platform.editor.custom-table-width')) {
46
47
  return table.createChecked({
47
48
  localId: uuid.generate(),
48
- width: 760
49
+ width: tableWidth !== null && tableWidth !== void 0 ? tableWidth : 760
49
50
  }, rows);
50
51
  }
51
52
  return table.createChecked({
@@ -132,9 +132,11 @@ export function handleMouseDown(view, event, dragAndDropEnabled) {
132
132
  }
133
133
  var startDOMCell = domInCell(view, startEvent.target);
134
134
  var $anchor = cellAround(view.state.selection.$anchor);
135
+ var targetElement = event.target instanceof HTMLElement && event.target;
136
+ var isDragHandleElement = targetElement && targetElement.matches('button.pm-table-drag-handle-button-container');
135
137
  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
136
138
  // Adding to an existing cell selection
137
- if (dragAndDropEnabled) {
139
+ if (dragAndDropEnabled && isDragHandleElement) {
138
140
  return false;
139
141
  }
140
142
  setCellSelection(view.state.selection.$anchorCell, startEvent);
@@ -19,7 +19,8 @@ export var createTable = function createTable(_ref) {
19
19
  colsCount = _ref$colsCount === void 0 ? 3 : _ref$colsCount,
20
20
  _ref$withHeaderRow = _ref.withHeaderRow,
21
21
  withHeaderRow = _ref$withHeaderRow === void 0 ? true : _ref$withHeaderRow,
22
- cellContent = _ref.cellContent;
22
+ cellContent = _ref.cellContent,
23
+ tableWidth = _ref.tableWidth;
23
24
  var _tableNodeTypes = tableNodeTypes(schema),
24
25
  tableCell = _tableNodeTypes.cell,
25
26
  tableHeader = _tableNodeTypes.header_cell,
@@ -46,7 +47,7 @@ export var createTable = function createTable(_ref) {
46
47
  if (getBooleanFF('platform.editor.custom-table-width')) {
47
48
  return table.createChecked({
48
49
  localId: uuid.generate(),
49
- width: 760
50
+ width: tableWidth !== null && tableWidth !== void 0 ? tableWidth : 760
50
51
  }, rows);
51
52
  }
52
53
  return table.createChecked({
@@ -5,6 +5,7 @@ type CreateTableProps = {
5
5
  colsCount?: number;
6
6
  withHeaderRow?: boolean;
7
7
  cellContent?: PMNode;
8
+ tableWidth?: number;
8
9
  };
9
- export declare const createTable: ({ schema, rowsCount, colsCount, withHeaderRow, cellContent, }: CreateTableProps) => PMNode;
10
+ export declare const createTable: ({ schema, rowsCount, colsCount, withHeaderRow, cellContent, tableWidth, }: CreateTableProps) => PMNode;
10
11
  export {};
@@ -5,6 +5,7 @@ type CreateTableProps = {
5
5
  colsCount?: number;
6
6
  withHeaderRow?: boolean;
7
7
  cellContent?: PMNode;
8
+ tableWidth?: number;
8
9
  };
9
- export declare const createTable: ({ schema, rowsCount, colsCount, withHeaderRow, cellContent, }: CreateTableProps) => PMNode;
10
+ export declare const createTable: ({ schema, rowsCount, colsCount, withHeaderRow, cellContent, tableWidth, }: CreateTableProps) => PMNode;
10
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-tables",
3
- "version": "2.5.5",
3
+ "version": "2.5.7",
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/"