@atlaskit/editor-tables 2.5.7 → 2.5.8

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,11 @@
1
1
  # @atlaskit/editor-tables
2
2
 
3
+ ## 2.5.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#80612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80612) [`b3a6ffbe9e15`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b3a6ffbe9e15) - [ux] Fix Firefox table drag handle shift click selection
8
+
3
9
  ## 2.5.7
4
10
 
5
11
  ### Patch Changes
@@ -22,7 +22,7 @@ var _tables = require("./utils/tables");
22
22
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } // Was copied from https://github.com/ProseMirror/prosemirror-tables/blob/master/src/cellselection.js
25
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // Was copied from https://github.com/ProseMirror/prosemirror-tables/blob/master/src/cellselection.js
26
26
  // This file defines a ProseMirror selection subclass that models
27
27
  // table cell selections. The table plugin needs to be active to wire
28
28
  // in the user interaction part of table selections (so that you
@@ -140,9 +140,10 @@ 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');
145
143
  if (startEvent.shiftKey && view.state.selection instanceof _cellSelection.CellSelection) {
144
+ var isDragHandleElement;
145
+ var targetElement = event.target instanceof HTMLElement || event.target instanceof SVGElement ? event.target : null;
146
+ isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container');
146
147
  // Adding to an existing cell selection
147
148
  if (dragAndDropEnabled && isDragHandleElement) {
148
149
  return false;
@@ -18,6 +18,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
18
18
  // document-relative positions. So code that uses them will typically
19
19
  // compute the start position of the table and offset positions passed
20
20
  // to or gotten from this structure by that amount.
21
+
21
22
  var readFromCache, addToCache;
22
23
  // Prefer using a weak map to cache table maps. Fall back on a
23
24
  // fixed-size cache if that's not supported.
@@ -30,6 +30,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
30
30
  // clipped to the selection's rectangle, optionally repeating the
31
31
  // pasted cells when they are smaller than the selection.
32
32
  // Utilities to help with copying and pasting table cells
33
+
33
34
  /**
34
35
  * Replace any header cells with table cells.
35
36
  *
@@ -17,6 +17,7 @@ var createCell = function createCell(cellType, cellContent) {
17
17
  // Returns a table node of a given size.
18
18
  // `withHeaderRow` defines whether the first row of the table will be a header row.
19
19
  // `cellContent` defines the content of each cell.
20
+
20
21
  var createTable = exports.createTable = function createTable(_ref) {
21
22
  var schema = _ref.schema,
22
23
  _ref$rowsCount = _ref.rowsCount,
@@ -139,9 +139,10 @@ 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');
144
142
  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
143
+ let isDragHandleElement;
144
+ const targetElement = event.target instanceof HTMLElement || event.target instanceof SVGElement ? event.target : null;
145
+ isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container');
145
146
  // Adding to an existing cell selection
146
147
  if (dragAndDropEnabled && isDragHandleElement) {
147
148
  return false;
@@ -18,6 +18,7 @@ import { tableEditingKey } from './plugin-key';
18
18
  // rather broadly, and other plugins, like the gap cursor or the
19
19
  // column-width dragging plugin, might want to get a turn first to
20
20
  // perform more specific behavior.
21
+
21
22
  export function tableEditing({
22
23
  allowTableNodeSelection = false,
23
24
  dragAndDropEnabled = false,
@@ -9,6 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  // document-relative positions. So code that uses them will typically
10
10
  // compute the start position of the table and offset positions passed
11
11
  // to or gotten from this structure by that amount.
12
+
12
13
  let readFromCache, addToCache;
13
14
  // Prefer using a weak map to cache table maps. Fall back on a
14
15
  // fixed-size cache if that's not supported.
@@ -11,6 +11,7 @@ const createCell = (cellType, cellContent) => {
11
11
  // Returns a table node of a given size.
12
12
  // `withHeaderRow` defines whether the first row of the table will be a header row.
13
13
  // `cellContent` defines the content of each cell.
14
+
14
15
  export const createTable = ({
15
16
  schema,
16
17
  rowsCount = 3,
@@ -5,6 +5,7 @@ import { TableMap } from '../table-map';
5
5
  // [A2, B2, null, D1],
6
6
  // [A3. B3, C2, null],
7
7
  // ]
8
+
8
9
  // This function transposes an array of array flipping the columns for rows,
9
10
  // transposition is a familiar algebra concept;
10
11
  // you can get more details here:
@@ -7,7 +7,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  // Was copied from https://github.com/ProseMirror/prosemirror-tables/blob/master/src/cellselection.js
12
12
 
13
13
  // This file defines a ProseMirror selection subclass that models
@@ -132,9 +132,10 @@ 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');
137
135
  if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
136
+ var isDragHandleElement;
137
+ var targetElement = event.target instanceof HTMLElement || event.target instanceof SVGElement ? event.target : null;
138
+ isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container');
138
139
  // Adding to an existing cell selection
139
140
  if (dragAndDropEnabled && isDragHandleElement) {
140
141
  return false;
@@ -18,6 +18,7 @@ import { tableEditingKey } from './plugin-key';
18
18
  // rather broadly, and other plugins, like the gap cursor or the
19
19
  // column-width dragging plugin, might want to get a turn first to
20
20
  // perform more specific behavior.
21
+
21
22
  export function tableEditing() {
22
23
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
23
24
  _ref$allowTableNodeSe = _ref.allowTableNodeSelection,
@@ -11,6 +11,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
11
11
  // document-relative positions. So code that uses them will typically
12
12
  // compute the start position of the table and offset positions passed
13
13
  // to or gotten from this structure by that amount.
14
+
14
15
  var readFromCache, addToCache;
15
16
  // Prefer using a weak map to cache table maps. Fall back on a
16
17
  // fixed-size cache if that's not supported.
@@ -11,6 +11,7 @@ var createCell = function createCell(cellType, cellContent) {
11
11
  // Returns a table node of a given size.
12
12
  // `withHeaderRow` defines whether the first row of the table will be a header row.
13
13
  // `cellContent` defines the content of each cell.
14
+
14
15
  export var createTable = function createTable(_ref) {
15
16
  var schema = _ref.schema,
16
17
  _ref$rowsCount = _ref.rowsCount,
@@ -5,6 +5,7 @@ import { TableMap } from '../table-map';
5
5
  // [A2, B2, null, D1],
6
6
  // [A3. B3, C2, null],
7
7
  // ]
8
+
8
9
  // This function transposes an array of array flipping the columns for rows,
9
10
  // transposition is a familiar algebra concept;
10
11
  // you can get more details here:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-tables",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
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/"