@atlaskit/editor-plugin-table 2.3.0 → 2.3.1

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.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a9c98fc8503`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a9c98fc8503) - [ED-19028] Remove less-padding class when using table width resizer
8
+
3
9
  ## 2.3.0
4
10
 
5
11
  ### Minor Changes
@@ -445,7 +445,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
445
445
  }) : NOOP;
446
446
  var isNested = (0, _utils4.isTableNested)(view.state, getPos());
447
447
  return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer, {
448
- 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, _utils.isTableSelected)(view.state.selection)), (0, _defineProperty3.default)(_classnames, 'less-padding', containerWidth.width < _editorSharedStyles.akEditorMobileBreakoutPoint), _classnames)),
448
+ 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, _utils.isTableSelected)(view.state.selection)), _classnames)),
449
449
  editorView: view,
450
450
  getPos: getPos,
451
451
  node: node,
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
@@ -12,6 +13,8 @@ var _styles = require("@atlaskit/editor-common/styles");
12
13
  var _types = require("../types");
13
14
  var _TableResizer = require("./TableResizer");
14
15
  var _utils = require("../pm-plugins/table-resizing/utils");
16
+ var _classnames = _interopRequireDefault(require("classnames"));
17
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
20
  var getMarginLeft = function getMarginLeft(lineLength, tableWidth) {
@@ -129,7 +132,9 @@ var TableContainer = function TableContainer(_ref3) {
129
132
  var tableWidth = isBreakoutEnabled ? (0, _styles.calcTableWidth)(node.attrs.layout, editorWidth) : 'inherit';
130
133
  return /*#__PURE__*/_react.default.createElement(InnerContainer, {
131
134
  node: node,
132
- className: className,
135
+ className: (0, _classnames.default)(className, {
136
+ 'less-padding': editorWidth < _editorSharedStyles.akEditorMobileBreakoutPoint
137
+ }),
133
138
  style: {
134
139
  width: tableWidth,
135
140
  marginLeft: getMarginLeft(lineLength, tableWidth)
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,7 @@ import rafSchedule from 'raf-schd';
6
6
  import { findTable } from '@atlaskit/editor-tables/utils';
7
7
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
8
8
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
9
- import { akEditorMobileBreakoutPoint, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
9
+ import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
10
10
  import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
11
11
  import { autoSizeTable, clearHoverSelection } from '../commands';
12
12
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -442,8 +442,7 @@ class TableComponent extends React.Component {
442
442
  [ClassName.WITH_CONTROLS]: allowControls && tableActive,
443
443
  [ClassName.TABLE_STICKY]: this.state.stickyHeader && hasHeaderRow,
444
444
  [ClassName.HOVERED_DELETE_BUTTON]: isInDanger,
445
- [ClassName.TABLE_SELECTED]: isTableSelected(view.state.selection),
446
- 'less-padding': containerWidth.width < akEditorMobileBreakoutPoint
445
+ [ClassName.TABLE_SELECTED]: isTableSelected(view.state.selection)
447
446
  }),
448
447
  editorView: view,
449
448
  getPos: getPos,
@@ -5,6 +5,8 @@ import { calcTableWidth } from '@atlaskit/editor-common/styles';
5
5
  import { TableCssClassName as ClassName } from '../types';
6
6
  import { TableResizer } from './TableResizer';
7
7
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
8
+ import classNames from 'classnames';
9
+ import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
8
10
  const getMarginLeft = (lineLength, tableWidth) => {
9
11
  let marginLeft;
10
12
  if (tableWidth !== 'inherit' && lineLength) {
@@ -122,7 +124,9 @@ export const TableContainer = ({
122
124
  const tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
123
125
  return /*#__PURE__*/React.createElement(InnerContainer, {
124
126
  node: node,
125
- className: className,
127
+ className: classNames(className, {
128
+ 'less-padding': editorWidth < akEditorMobileBreakoutPoint
129
+ }),
126
130
  style: {
127
131
  width: tableWidth,
128
132
  marginLeft: getMarginLeft(lineLength, tableWidth)
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -16,7 +16,7 @@ import rafSchedule from 'raf-schd';
16
16
  import { findTable } from '@atlaskit/editor-tables/utils';
17
17
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
18
18
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
19
- import { akEditorMobileBreakoutPoint, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
19
+ import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
20
20
  import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
21
21
  import { autoSizeTable, clearHoverSelection } from '../commands';
22
22
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -439,7 +439,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
439
439
  }) : NOOP;
440
440
  var isNested = isTableNested(view.state, getPos());
441
441
  return /*#__PURE__*/React.createElement(TableContainer, {
442
- 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)), _defineProperty(_classnames, 'less-padding', containerWidth.width < akEditorMobileBreakoutPoint), _classnames)),
442
+ 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)),
443
443
  editorView: view,
444
444
  getPos: getPos,
445
445
  node: node,
@@ -5,6 +5,8 @@ import { calcTableWidth } from '@atlaskit/editor-common/styles';
5
5
  import { TableCssClassName as ClassName } from '../types';
6
6
  import { TableResizer } from './TableResizer';
7
7
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
8
+ import classNames from 'classnames';
9
+ import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
8
10
  var getMarginLeft = function getMarginLeft(lineLength, tableWidth) {
9
11
  var marginLeft;
10
12
  if (tableWidth !== 'inherit' && lineLength) {
@@ -118,7 +120,9 @@ export var TableContainer = function TableContainer(_ref3) {
118
120
  var tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
119
121
  return /*#__PURE__*/React.createElement(InnerContainer, {
120
122
  node: node,
121
- className: className,
123
+ className: classNames(className, {
124
+ 'less-padding': editorWidth < akEditorMobileBreakoutPoint
125
+ }),
122
126
  style: {
123
127
  width: tableWidth,
124
128
  marginLeft: getMarginLeft(lineLength, tableWidth)
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -8,10 +8,7 @@ import { findTable } from '@atlaskit/editor-tables/utils';
8
8
 
9
9
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
10
10
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
11
- import {
12
- akEditorMobileBreakoutPoint,
13
- akEditorTableToolbarSize as tableToolbarSize,
14
- } from '@atlaskit/editor-shared-styles';
11
+ import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
15
12
 
16
13
  import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
17
14
  import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
@@ -396,7 +393,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
396
393
  [ClassName.TABLE_STICKY]: this.state.stickyHeader && hasHeaderRow,
397
394
  [ClassName.HOVERED_DELETE_BUTTON]: isInDanger,
398
395
  [ClassName.TABLE_SELECTED]: isTableSelected(view.state.selection),
399
- 'less-padding': containerWidth.width < akEditorMobileBreakoutPoint,
400
396
  })}
401
397
  editorView={view}
402
398
  getPos={getPos}
@@ -16,6 +16,8 @@ import type { GuidelineConfig } from '@atlaskit/editor-plugin-guideline';
16
16
  import { PluginInjectionAPI, TableCssClassName as ClassName } from '../types';
17
17
  import { TableResizer } from './TableResizer';
18
18
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
19
+ import classNames from 'classnames';
20
+ import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
19
21
 
20
22
  const getMarginLeft = (lineLength: number, tableWidth: number | 'inherit') => {
21
23
  let marginLeft;
@@ -209,7 +211,9 @@ export const TableContainer = ({
209
211
  return (
210
212
  <InnerContainer
211
213
  node={node}
212
- className={className}
214
+ className={classNames(className, {
215
+ 'less-padding': editorWidth < akEditorMobileBreakoutPoint,
216
+ })}
213
217
  style={{
214
218
  width: tableWidth,
215
219
  marginLeft: getMarginLeft(lineLength!, tableWidth),
@@ -1,106 +0,0 @@
1
- ## API Report File for "@atlaskit/editor-plugin-table"
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 { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
8
- import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
9
- import type { Command } from '@atlaskit/editor-common/types';
10
- import type { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
11
- import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
12
- import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
13
- import type { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
14
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
15
- import { TableLayout } from '@atlaskit/adf-schema';
16
- import type { widthPlugin } from '@atlaskit/editor-plugin-width';
17
-
18
- // @public (undocumented)
19
- type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
20
-
21
- // @public (undocumented)
22
- type PermittedLayoutsDescriptor = 'all' | TableLayout[];
23
-
24
- // @public (undocumented)
25
- interface PluginConfig {
26
- // (undocumented)
27
- advanced?: boolean;
28
- // (undocumented)
29
- allowAddColumnWithCustomStep?: boolean;
30
- // (undocumented)
31
- allowBackgroundColor?: boolean;
32
- // (undocumented)
33
- allowCellOptionsInFloatingToolbar?: boolean;
34
- // (undocumented)
35
- allowCollapse?: boolean;
36
- // (undocumented)
37
- allowColumnResizing?: boolean;
38
- // (undocumented)
39
- allowColumnSorting?: boolean;
40
- // (undocumented)
41
- allowControls?: boolean;
42
- // (undocumented)
43
- allowDistributeColumns?: boolean;
44
- // (undocumented)
45
- allowHeaderColumn?: boolean;
46
- // (undocumented)
47
- allowHeaderRow?: boolean;
48
- // (undocumented)
49
- allowMergeCells?: boolean;
50
- // (undocumented)
51
- allowNumberColumn?: boolean;
52
- // (undocumented)
53
- initialRenderOptimization?: boolean;
54
- // (undocumented)
55
- isHeaderRowRequired?: boolean;
56
- // (undocumented)
57
- mouseMoveOptimization?: boolean;
58
- // (undocumented)
59
- permittedLayouts?: PermittedLayoutsDescriptor;
60
- // (undocumented)
61
- stickyHeaders?: boolean;
62
- // (undocumented)
63
- stickyHeadersOptimization?: boolean;
64
- // (undocumented)
65
- tableCellOptimization?: boolean;
66
- // (undocumented)
67
- tableOverflowShadowsOptimization?: boolean;
68
- // (undocumented)
69
- tableRenderOptimization?: boolean;
70
- }
71
-
72
- // @public (undocumented)
73
- interface TablePluginOptions {
74
- // (undocumented)
75
- allowContextualMenu?: boolean;
76
- // (undocumented)
77
- breakoutEnabled?: boolean;
78
- // (undocumented)
79
- editorSelectionAPI?: EditorSelectionAPI;
80
- // (undocumented)
81
- fullWidthEnabled?: boolean;
82
- // (undocumented)
83
- getEditorFeatureFlags?: GetEditorFeatureFlags;
84
- // (undocumented)
85
- tableOptions: PluginConfig;
86
- // (undocumented)
87
- wasFullWidthEnabled?: boolean;
88
- }
89
-
90
- // @public (undocumented)
91
- export const tablesPlugin: NextEditorPlugin<'table', {
92
- pluginConfiguration: TablePluginOptions | undefined;
93
- actions: {
94
- insertTable: InsertTableAction;
95
- };
96
- dependencies: [
97
- typeof analyticsPlugin,
98
- typeof contentInsertionPlugin,
99
- typeof widthPlugin,
100
- typeof guidelinePlugin
101
- ];
102
- }>;
103
-
104
- // (No @packageDocumentation comment for this package)
105
-
106
- ```