@atlaskit/editor-plugin-table 7.19.1 → 7.19.2

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,15 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.19.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#115086](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115086)
8
+ [`e22c1261d6b17`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e22c1261d6b17) -
9
+ Add a tint to table transactions that are not created by users to avoid issues for view only live
10
+ pages
11
+ - Updated dependencies
12
+
3
13
  ## 7.19.1
4
14
 
5
15
  ### Patch Changes
@@ -19,6 +19,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
19
19
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
20
20
  var _reactIntlNext = require("react-intl-next");
21
21
  var _analytics = require("@atlaskit/editor-common/analytics");
22
+ var _collab = require("@atlaskit/editor-common/collab");
22
23
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
23
24
  var _styles = require("@atlaskit/editor-common/styles");
24
25
  var _utils = require("@atlaskit/editor-common/utils");
@@ -164,7 +165,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
164
165
  if (shouldScaleTable) {
165
166
  _this.scaleTable({
166
167
  parentWidth: parentWidth
167
- });
168
+ }, hasNumberedColumnChanged);
168
169
  }
169
170
 
170
171
  // only when table resizing is enabled and toggle numbered column to run scaleTable
@@ -172,7 +173,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
172
173
  if (!(0, _colgroup.hasTableBeenResized)(prevNode)) {
173
174
  _this.scaleTable({
174
175
  parentWidth: node.attrs.width
175
- });
176
+ }, true);
176
177
  }
177
178
  }
178
179
  _this.updateParentWidth(parentWidth);
@@ -183,6 +184,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
183
184
  });
184
185
  // Function gets called when table is nested.
185
186
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "scaleTable", function (scaleOptions) {
187
+ var isUserTriggered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
186
188
  var _this$props2 = _this.props,
187
189
  view = _this$props2.view,
188
190
  getNode = _this$props2.getNode,
@@ -209,6 +211,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
209
211
  // isTableScalingEnabled doesn't change the behavior of nested tables
210
212
  false // shouldUseIncreasedScalingPercent set to false for nested tables
211
213
  )(state.tr);
214
+ if (!isUserTriggered) {
215
+ (0, _collab.tintDirtyTransaction)(tr);
216
+ }
212
217
  dispatch(tr);
213
218
  });
214
219
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
@@ -5,6 +5,7 @@ import memoizeOne from 'memoize-one';
5
5
  import rafSchedule from 'raf-schd';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
8
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
8
9
  import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
9
10
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
10
11
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
@@ -148,7 +149,7 @@ class TableComponent extends React.Component {
148
149
  if (shouldScaleTable) {
149
150
  this.scaleTable({
150
151
  parentWidth
151
- });
152
+ }, hasNumberedColumnChanged);
152
153
  }
153
154
 
154
155
  // only when table resizing is enabled and toggle numbered column to run scaleTable
@@ -156,7 +157,7 @@ class TableComponent extends React.Component {
156
157
  if (!hasTableBeenResized(prevNode)) {
157
158
  this.scaleTable({
158
159
  parentWidth: node.attrs.width
159
- });
160
+ }, true);
160
161
  }
161
162
  }
162
163
  this.updateParentWidth(parentWidth);
@@ -166,7 +167,7 @@ class TableComponent extends React.Component {
166
167
  this.layoutSize = layoutSize;
167
168
  });
168
169
  // Function gets called when table is nested.
169
- _defineProperty(this, "scaleTable", scaleOptions => {
170
+ _defineProperty(this, "scaleTable", (scaleOptions, isUserTriggered = false) => {
170
171
  const {
171
172
  view,
172
173
  getNode,
@@ -200,6 +201,9 @@ class TableComponent extends React.Component {
200
201
  // isTableScalingEnabled doesn't change the behavior of nested tables
201
202
  false // shouldUseIncreasedScalingPercent set to false for nested tables
202
203
  )(state.tr);
204
+ if (!isUserTriggered) {
205
+ tintDirtyTransaction(tr);
206
+ }
203
207
  dispatch(tr);
204
208
  });
205
209
  _defineProperty(this, "setTimerToSendInitialOverflowCaptured", isOverflowing => {
@@ -19,6 +19,7 @@ import memoizeOne from 'memoize-one';
19
19
  import rafSchedule from 'raf-schd';
20
20
  import { injectIntl } from 'react-intl-next';
21
21
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
22
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
22
23
  import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
23
24
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
24
25
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
@@ -157,7 +158,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
157
158
  if (shouldScaleTable) {
158
159
  _this.scaleTable({
159
160
  parentWidth: parentWidth
160
- });
161
+ }, hasNumberedColumnChanged);
161
162
  }
162
163
 
163
164
  // only when table resizing is enabled and toggle numbered column to run scaleTable
@@ -165,7 +166,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
165
166
  if (!hasTableBeenResized(prevNode)) {
166
167
  _this.scaleTable({
167
168
  parentWidth: node.attrs.width
168
- });
169
+ }, true);
169
170
  }
170
171
  }
171
172
  _this.updateParentWidth(parentWidth);
@@ -176,6 +177,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
176
177
  });
177
178
  // Function gets called when table is nested.
178
179
  _defineProperty(_assertThisInitialized(_this), "scaleTable", function (scaleOptions) {
180
+ var isUserTriggered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
179
181
  var _this$props2 = _this.props,
180
182
  view = _this$props2.view,
181
183
  getNode = _this$props2.getNode,
@@ -202,6 +204,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
202
204
  // isTableScalingEnabled doesn't change the behavior of nested tables
203
205
  false // shouldUseIncreasedScalingPercent set to false for nested tables
204
206
  )(state.tr);
207
+ if (!isUserTriggered) {
208
+ tintDirtyTransaction(tr);
209
+ }
205
210
  dispatch(tr);
206
211
  });
207
212
  _defineProperty(_assertThisInitialized(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.19.1",
3
+ "version": "7.19.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/adf-schema": "^38.0.0",
32
32
  "@atlaskit/button": "^18.0.0",
33
33
  "@atlaskit/custom-steps": "^0.4.0",
34
- "@atlaskit/editor-common": "^83.3.0",
34
+ "@atlaskit/editor-common": "^83.4.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
@@ -10,6 +10,7 @@ import { injectIntl } from 'react-intl-next';
10
10
  import type { TableColumnOrdering } from '@atlaskit/custom-steps';
11
11
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
12
12
  import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
13
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
13
14
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
14
15
  import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
15
16
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
@@ -966,17 +967,23 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
966
967
 
967
968
  // If column has been inserted/deleted avoid multi dispatch
968
969
  if (shouldScaleTable) {
969
- this.scaleTable({
970
- parentWidth,
971
- });
970
+ this.scaleTable(
971
+ {
972
+ parentWidth,
973
+ },
974
+ hasNumberedColumnChanged,
975
+ );
972
976
  }
973
977
 
974
978
  // only when table resizing is enabled and toggle numbered column to run scaleTable
975
979
  if (options?.isTableResizingEnabled && hasNumberedColumnChanged) {
976
980
  if (!hasTableBeenResized(prevNode)) {
977
- this.scaleTable({
978
- parentWidth: node.attrs.width,
979
- });
981
+ this.scaleTable(
982
+ {
983
+ parentWidth: node.attrs.width,
984
+ },
985
+ true,
986
+ );
980
987
  }
981
988
  }
982
989
 
@@ -989,7 +996,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
989
996
  };
990
997
 
991
998
  // Function gets called when table is nested.
992
- private scaleTable = (scaleOptions: { parentWidth?: number }) => {
999
+ private scaleTable = (scaleOptions: { parentWidth?: number }, isUserTriggered = false) => {
993
1000
  const { view, getNode, getPos, containerWidth, options } = this.props;
994
1001
  const node = getNode();
995
1002
  const { state, dispatch } = view;
@@ -1019,6 +1026,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
1019
1026
  false, // shouldUseIncreasedScalingPercent set to false for nested tables
1020
1027
  )(state.tr);
1021
1028
 
1029
+ if (!isUserTriggered) {
1030
+ tintDirtyTransaction(tr);
1031
+ }
1032
+
1022
1033
  dispatch(tr);
1023
1034
  };
1024
1035