@atlaskit/editor-plugin-table 2.12.5 → 2.12.6

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-plugin-table
2
2
 
3
+ ## 2.12.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1f6e908f2bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1f6e908f2bd) - Workaround invalid getPos error occuring for TableComponent
8
+
3
9
  ## 2.12.5
4
10
 
5
11
  ### Patch Changes
@@ -415,7 +415,19 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
415
415
  visibility: visible ? 'visible' : 'hidden'
416
416
  };
417
417
  });
418
- var isNested = (0, _utils4.isTableNested)(view.state, getPos());
418
+
419
+ /**
420
+ * ED-19838
421
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
422
+ * before CR6 lands in production
423
+ */
424
+ var tablePos;
425
+ try {
426
+ tablePos = getPos ? getPos() : undefined;
427
+ } catch (e) {
428
+ tablePos = undefined;
429
+ }
430
+ var isNested = (0, _utils4.isTableNested)(view.state, tablePos);
419
431
  return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer, {
420
432
  className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_CONTAINER, (_classnames = {}, (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.WITH_CONTROLS, allowControls && tableActive), (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.HOVERED_DELETE_BUTTON, isInDanger), (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.TABLE_SELECTED, (0, _utils2.isTableSelected)(view.state.selection)), _classnames)),
421
433
  editorView: view,
@@ -157,11 +157,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
157
157
  /**
158
158
  * ED-19810
159
159
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
160
- * before CR6 lands in production
160
+ * directly to confluence since this bug is now in production.
161
161
  */
162
162
  var tablePos;
163
163
  try {
164
- tablePos = typeof props.getPos === 'function' ? props.getPos() : undefined;
164
+ tablePos = props.getPos ? props.getPos() : undefined;
165
165
  } catch (e) {
166
166
  tablePos = undefined;
167
167
  }
@@ -407,7 +407,19 @@ class TableComponent extends React.Component {
407
407
  const shadowStyle = memoizeOne(visible => ({
408
408
  visibility: visible ? 'visible' : 'hidden'
409
409
  }));
410
- const isNested = isTableNested(view.state, getPos());
410
+
411
+ /**
412
+ * ED-19838
413
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
414
+ * before CR6 lands in production
415
+ */
416
+ let tablePos;
417
+ try {
418
+ tablePos = getPos ? getPos() : undefined;
419
+ } catch (e) {
420
+ tablePos = undefined;
421
+ }
422
+ const isNested = isTableNested(view.state, tablePos);
411
423
  return /*#__PURE__*/React.createElement(TableContainer, {
412
424
  className: classnames(ClassName.TABLE_CONTAINER, {
413
425
  [ClassName.WITH_CONTROLS]: allowControls && tableActive,
@@ -129,11 +129,11 @@ export default class TableView extends ReactNodeView {
129
129
  /**
130
130
  * ED-19810
131
131
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
132
- * before CR6 lands in production
132
+ * directly to confluence since this bug is now in production.
133
133
  */
134
134
  let tablePos;
135
135
  try {
136
- tablePos = typeof props.getPos === 'function' ? props.getPos() : undefined;
136
+ tablePos = props.getPos ? props.getPos() : undefined;
137
137
  } catch (e) {
138
138
  tablePos = undefined;
139
139
  }
@@ -408,7 +408,19 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
408
408
  visibility: visible ? 'visible' : 'hidden'
409
409
  };
410
410
  });
411
- var isNested = isTableNested(view.state, getPos());
411
+
412
+ /**
413
+ * ED-19838
414
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
415
+ * before CR6 lands in production
416
+ */
417
+ var tablePos;
418
+ try {
419
+ tablePos = getPos ? getPos() : undefined;
420
+ } catch (e) {
421
+ tablePos = undefined;
422
+ }
423
+ var isNested = isTableNested(view.state, tablePos);
412
424
  return /*#__PURE__*/React.createElement(TableContainer, {
413
425
  className: classnames(ClassName.TABLE_CONTAINER, (_classnames = {}, _defineProperty(_classnames, ClassName.WITH_CONTROLS, allowControls && tableActive), _defineProperty(_classnames, ClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), _defineProperty(_classnames, ClassName.HOVERED_DELETE_BUTTON, isInDanger), _defineProperty(_classnames, ClassName.TABLE_SELECTED, isTableSelected(view.state.selection)), _classnames)),
414
426
  editorView: view,
@@ -150,11 +150,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
150
150
  /**
151
151
  * ED-19810
152
152
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
153
- * before CR6 lands in production
153
+ * directly to confluence since this bug is now in production.
154
154
  */
155
155
  var tablePos;
156
156
  try {
157
- tablePos = typeof props.getPos === 'function' ? props.getPos() : undefined;
157
+ tablePos = props.getPos ? props.getPos() : undefined;
158
158
  } catch (e) {
159
159
  tablePos = undefined;
160
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.12.5",
3
+ "version": "2.12.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/icon": "^21.12.0",
39
39
  "@atlaskit/platform-feature-flags": "^0.2.1",
40
40
  "@atlaskit/theme": "^12.6.0",
41
- "@atlaskit/tokens": "^1.18.0",
41
+ "@atlaskit/tokens": "^1.19.0",
42
42
  "@atlaskit/tooltip": "^17.8.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
@@ -342,7 +342,19 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
342
342
  ({ visibility: visible ? 'visible' : 'hidden' } as CSSProperties),
343
343
  );
344
344
 
345
- const isNested = isTableNested(view.state, getPos());
345
+ /**
346
+ * ED-19838
347
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
348
+ * before CR6 lands in production
349
+ */
350
+ let tablePos: number | undefined;
351
+ try {
352
+ tablePos = getPos ? getPos() : undefined;
353
+ } catch (e) {
354
+ tablePos = undefined;
355
+ }
356
+
357
+ const isNested = isTableNested(view.state, tablePos);
346
358
 
347
359
  return (
348
360
  <TableContainer
@@ -225,12 +225,11 @@ export default class TableView extends ReactNodeView<Props> {
225
225
  /**
226
226
  * ED-19810
227
227
  * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
228
- * before CR6 lands in production
228
+ * directly to confluence since this bug is now in production.
229
229
  */
230
230
  let tablePos: number | undefined;
231
231
  try {
232
- tablePos =
233
- typeof props.getPos === 'function' ? props.getPos() : undefined;
232
+ tablePos = props.getPos ? props.getPos() : undefined;
234
233
  } catch (e) {
235
234
  tablePos = undefined;
236
235
  }