@atlaskit/editor-plugin-card 39.0.0 → 39.0.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,21 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 39.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`564ce3988c6da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/564ce3988c6da) -
8
+ Behind the `platform_editor_phantom_edit_fix` experiment, tint two automatic document changes as
9
+ dirty transactions, so collab-edit doesn't track them as local organic changes:
10
+
11
+ - a datasource table saving its default columns when it has none saved
12
+ - a smart link falling back to a plain link after a fatal resolve error
13
+
14
+ Before this, opening a live doc where one of these ran autosaved a new version authored by the
15
+ viewer, and the doc's owner was notified that the viewer had edited it.
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 39.0.0
4
20
 
5
21
  ### Patch Changes
@@ -15,6 +15,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
  var _react2 = require("@emotion/react");
18
+ var _collab = require("@atlaskit/editor-common/collab");
18
19
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
19
20
  var _smartCard = require("@atlaskit/editor-common/styles/smart-card");
20
21
  var _UnsupportedInline = _interopRequireDefault(require("@atlaskit/editor-common/UnsupportedInline"));
@@ -23,6 +24,7 @@ var _datasourceTableViewWithWrappers = require("@atlaskit/link-datasource/dataso
23
24
  var _editorSmartCardProvider = require("@atlaskit/link-provider/editor-smart-card-provider");
24
25
  var _editorSmartCardProviderValueGuard = require("@atlaskit/link-provider/editor-smart-card-provider-value-guard");
25
26
  var _constants = require("@atlaskit/linking-common/constants");
27
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
26
28
  var _datasourceErrorBoundary = require("../ui/datasourceErrorBoundary");
27
29
  var _EditorAnalyticsContext = require("../ui/EditorAnalyticsContext");
28
30
  function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
@@ -63,8 +65,13 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
63
65
  _this$getColumnsInfo$ = _this$getColumnsInfo.wrappedColumnKeys,
64
66
  wrappedColumnKeys = _this$getColumnsInfo$ === void 0 ? [] : _this$getColumnsInfo$,
65
67
  _this$getColumnsInfo$2 = _this$getColumnsInfo.columnCustomSizes,
66
- columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2;
67
- _this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys);
68
+ columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2,
69
+ _this$getColumnsInfo$3 = _this$getColumnsInfo.visibleColumnKeys,
70
+ visibleColumnKeys = _this$getColumnsInfo$3 === void 0 ? [] : _this$getColumnsInfo$3;
71
+ // With no saved columns, the table view calls this itself to save its default columns once
72
+ // they load. The experiment is checked last so only that automatic update is exposed.
73
+ var isDefaultColumnsUpdate = visibleColumnKeys.length === 0 && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_phantom_edit_fix');
74
+ _this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys, isDefaultColumnsUpdate);
68
75
  });
69
76
  (0, _defineProperty2.default)(_this, "handleColumnResize", function (key, width) {
70
77
  var _this$getColumnsInfo2 = _this.getColumnsInfo(),
@@ -113,6 +120,7 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
113
120
  return (0, _createClass2.default)(DatasourceComponent, [{
114
121
  key: "updateTableProperties",
115
122
  value: function updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
123
+ var tintDirtyTr = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
116
124
  var _this$props$view = this.props.view,
117
125
  state = _this$props$view.state,
118
126
  dispatch = _this$props$view.dispatch;
@@ -153,6 +161,11 @@ var DatasourceComponent = exports.DatasourceComponent = /*#__PURE__*/function (_
153
161
  // Ensures dispatch does not contribute to undo history (otherwise user requires three undo's to revert table)
154
162
  tr.setMeta('addToHistory', false);
155
163
  tr.setMeta('scrollIntoView', false);
164
+ if (tintDirtyTr) {
165
+ // Tint as dirty: saving the table's default columns isn't a user edit. Hosts autosave
166
+ // local organic changes, so a viewer would create a new version of a live doc.
167
+ (0, _collab.tintDirtyTransaction)(tr);
168
+ }
156
169
  dispatch(tr);
157
170
  }
158
171
  }, {
@@ -14,12 +14,14 @@ var _linkingUtils = require("@atlaskit/editor-common/analytics/linking-utils");
14
14
  var _enums = require("@atlaskit/editor-common/analytics/types/enums");
15
15
  var _nodeEvents = require("@atlaskit/editor-common/analytics/types/node-events");
16
16
  var _card = require("@atlaskit/editor-common/card");
17
+ var _collab = require("@atlaskit/editor-common/collab");
17
18
  var _utils = require("@atlaskit/editor-common/link/utils");
18
19
  var _processRawValue3 = require("@atlaskit/editor-common/process-raw-value");
19
20
  var _annotation = require("@atlaskit/editor-common/utils/annotation");
20
21
  var _document = require("@atlaskit/editor-common/utils/document");
21
22
  var _hyperlink = require("@atlaskit/editor-common/utils/hyperlink");
22
23
  var _state = require("@atlaskit/editor-prosemirror/state");
24
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
23
25
  var _fg = require("@atlaskit/platform-feature-flags/fg");
24
26
  var _closeHistory = require("@atlaskit/prosemirror-history/closeHistory");
25
27
  var _actions = require("./actions");
@@ -420,6 +422,11 @@ var changeSelectedCardToLinkFallback = exports.changeSelectedCardToLinkFallback
420
422
  })(tr);
421
423
  }
422
424
  if (dispatch) {
425
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_phantom_edit_fix')) {
426
+ // Tint as dirty: falling back to a link after a resolve error isn't a user edit. Hosts
427
+ // autosave local organic changes, so a viewer would create a new version of a live doc.
428
+ (0, _collab.tintDirtyTransaction)(tr);
429
+ }
423
430
  dispatch(tr.setMeta('addToHistory', false));
424
431
  }
425
432
  return true;
@@ -7,6 +7,7 @@ import React from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
9
9
  import { jsx } from '@emotion/react';
10
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
10
11
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
11
12
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles/smart-card';
12
13
  import UnsupportedInline from '@atlaskit/editor-common/UnsupportedInline';
@@ -15,6 +16,7 @@ import { DatasourceTableViewWithWrappers as DatasourceTableView } from '@atlaski
15
16
  import { EditorSmartCardProvider } from '@atlaskit/link-provider/editor-smart-card-provider';
16
17
  import { EditorSmartCardProviderValueGuard } from '@atlaskit/link-provider/editor-smart-card-provider-value-guard';
17
18
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common/constants';
19
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
18
20
  import { DatasourceErrorBoundary } from '../ui/datasourceErrorBoundary';
19
21
  import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
20
22
  const getPosSafely = pos => {
@@ -39,9 +41,13 @@ export class DatasourceComponent extends React.PureComponent {
39
41
  _defineProperty(this, "handleColumnChange", columnKeys => {
40
42
  const {
41
43
  wrappedColumnKeys = [],
42
- columnCustomSizes = {}
44
+ columnCustomSizes = {},
45
+ visibleColumnKeys = []
43
46
  } = this.getColumnsInfo();
44
- this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys);
47
+ // With no saved columns, the table view calls this itself to save its default columns once
48
+ // they load. The experiment is checked last so only that automatic update is exposed.
49
+ const isDefaultColumnsUpdate = visibleColumnKeys.length === 0 && isExperimentEnabled('platform_editor_phantom_edit_fix');
50
+ this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys, isDefaultColumnsUpdate);
45
51
  });
46
52
  _defineProperty(this, "handleColumnResize", (key, width) => {
47
53
  const {
@@ -84,7 +90,7 @@ export class DatasourceComponent extends React.PureComponent {
84
90
  }
85
91
  });
86
92
  }
87
- updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
93
+ updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys, tintDirtyTr = false) {
88
94
  const {
89
95
  state,
90
96
  dispatch
@@ -130,6 +136,11 @@ export class DatasourceComponent extends React.PureComponent {
130
136
  // Ensures dispatch does not contribute to undo history (otherwise user requires three undo's to revert table)
131
137
  tr.setMeta('addToHistory', false);
132
138
  tr.setMeta('scrollIntoView', false);
139
+ if (tintDirtyTr) {
140
+ // Tint as dirty: saving the table's default columns isn't a user edit. Hosts autosave
141
+ // local organic changes, so a viewer would create a new version of a live doc.
142
+ tintDirtyTransaction(tr);
143
+ }
133
144
  dispatch(tr);
134
145
  }
135
146
  getColumnsInfo() {
@@ -4,12 +4,14 @@ import { unlinkPayload } from '@atlaskit/editor-common/analytics/linking-utils';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
5
5
  import { SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics/types/node-events';
6
6
  import { addLinkMetadata } from '@atlaskit/editor-common/card';
7
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
7
8
  import { getActiveLinkMark } from '@atlaskit/editor-common/link/utils';
8
9
  import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
9
10
  import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils/annotation';
10
11
  import { nodesBetweenChanged } from '@atlaskit/editor-common/utils/document';
11
12
  import { getLinkCreationAnalyticsEvent, isFromCurrentDomain } from '@atlaskit/editor-common/utils/hyperlink';
12
13
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
14
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
13
15
  import { fg } from '@atlaskit/platform-feature-flags/fg';
14
16
  import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
15
17
  import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
@@ -388,6 +390,11 @@ export const changeSelectedCardToLinkFallback = (text, href, sendAnalytics, node
388
390
  })(tr);
389
391
  }
390
392
  if (dispatch) {
393
+ if (isExperimentEnabled('platform_editor_phantom_edit_fix')) {
394
+ // Tint as dirty: falling back to a link after a resolve error isn't a user edit. Hosts
395
+ // autosave local organic changes, so a viewer would create a new version of a live doc.
396
+ tintDirtyTransaction(tr);
397
+ }
391
398
  dispatch(tr.setMeta('addToHistory', false));
392
399
  }
393
400
  return true;
@@ -19,6 +19,7 @@ import React from 'react';
19
19
 
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
21
21
  import { jsx } from '@emotion/react';
22
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
22
23
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
23
24
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles/smart-card';
24
25
  import UnsupportedInline from '@atlaskit/editor-common/UnsupportedInline';
@@ -27,6 +28,7 @@ import { DatasourceTableViewWithWrappers as DatasourceTableView } from '@atlaski
27
28
  import { EditorSmartCardProvider } from '@atlaskit/link-provider/editor-smart-card-provider';
28
29
  import { EditorSmartCardProviderValueGuard } from '@atlaskit/link-provider/editor-smart-card-provider-value-guard';
29
30
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common/constants';
31
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
30
32
  import { DatasourceErrorBoundary } from '../ui/datasourceErrorBoundary';
31
33
  import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
32
34
  var getPosSafely = function getPosSafely(pos) {
@@ -59,8 +61,13 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
59
61
  _this$getColumnsInfo$ = _this$getColumnsInfo.wrappedColumnKeys,
60
62
  wrappedColumnKeys = _this$getColumnsInfo$ === void 0 ? [] : _this$getColumnsInfo$,
61
63
  _this$getColumnsInfo$2 = _this$getColumnsInfo.columnCustomSizes,
62
- columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2;
63
- _this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys);
64
+ columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2,
65
+ _this$getColumnsInfo$3 = _this$getColumnsInfo.visibleColumnKeys,
66
+ visibleColumnKeys = _this$getColumnsInfo$3 === void 0 ? [] : _this$getColumnsInfo$3;
67
+ // With no saved columns, the table view calls this itself to save its default columns once
68
+ // they load. The experiment is checked last so only that automatic update is exposed.
69
+ var isDefaultColumnsUpdate = visibleColumnKeys.length === 0 && isExperimentEnabled('platform_editor_phantom_edit_fix');
70
+ _this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys, isDefaultColumnsUpdate);
64
71
  });
65
72
  _defineProperty(_this, "handleColumnResize", function (key, width) {
66
73
  var _this$getColumnsInfo2 = _this.getColumnsInfo(),
@@ -109,6 +116,7 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
109
116
  return _createClass(DatasourceComponent, [{
110
117
  key: "updateTableProperties",
111
118
  value: function updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
119
+ var tintDirtyTr = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
112
120
  var _this$props$view = this.props.view,
113
121
  state = _this$props$view.state,
114
122
  dispatch = _this$props$view.dispatch;
@@ -149,6 +157,11 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
149
157
  // Ensures dispatch does not contribute to undo history (otherwise user requires three undo's to revert table)
150
158
  tr.setMeta('addToHistory', false);
151
159
  tr.setMeta('scrollIntoView', false);
160
+ if (tintDirtyTr) {
161
+ // Tint as dirty: saving the table's default columns isn't a user edit. Hosts autosave
162
+ // local organic changes, so a viewer would create a new version of a live doc.
163
+ tintDirtyTransaction(tr);
164
+ }
152
165
  dispatch(tr);
153
166
  }
154
167
  }, {
@@ -9,12 +9,14 @@ import { unlinkPayload } from '@atlaskit/editor-common/analytics/linking-utils';
9
9
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
10
10
  import { SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics/types/node-events';
11
11
  import { addLinkMetadata } from '@atlaskit/editor-common/card';
12
+ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
12
13
  import { getActiveLinkMark } from '@atlaskit/editor-common/link/utils';
13
14
  import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
14
15
  import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils/annotation';
15
16
  import { nodesBetweenChanged } from '@atlaskit/editor-common/utils/document';
16
17
  import { getLinkCreationAnalyticsEvent, isFromCurrentDomain } from '@atlaskit/editor-common/utils/hyperlink';
17
18
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
19
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
18
20
  import { fg } from '@atlaskit/platform-feature-flags/fg';
19
21
  import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
20
22
  import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
@@ -414,6 +416,11 @@ export var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkF
414
416
  })(tr);
415
417
  }
416
418
  if (dispatch) {
419
+ if (isExperimentEnabled('platform_editor_phantom_edit_fix')) {
420
+ // Tint as dirty: falling back to a link after a resolve error isn't a user edit. Hosts
421
+ // autosave local organic changes, so a viewer would create a new version of a live doc.
422
+ tintDirtyTransaction(tr);
423
+ }
417
424
  dispatch(tr.setMeta('addToHistory', false));
418
425
  }
419
426
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "39.0.0",
3
+ "version": "39.0.1",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/prosemirror-history": "^1.3.0",
65
65
  "@atlaskit/smart-card": "^46.18.0",
66
66
  "@atlaskit/tmp-editor-statsig": "^264.0.0",
67
- "@atlaskit/tokens": "^20.12.0",
67
+ "@atlaskit/tokens": "^20.13.0",
68
68
  "@atlaskit/tooltip": "^24.4.0",
69
69
  "@babel/runtime": "^7.0.0",
70
70
  "@emotion/react": "^11.7.1",
@@ -73,7 +73,7 @@
73
73
  "uuid": "^11.1.1"
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/editor-common": "^137.0.0",
76
+ "@atlaskit/editor-common": "^137.1.0",
77
77
  "@atlaskit/link-provider": "^6.2.0",
78
78
  "react": "^18.2.0 || ^19.2.0",
79
79
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -107,7 +107,7 @@
107
107
  },
108
108
  "compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/e6f3220b-0ca2-445a-a4c5-78cff6ca2a34",
109
109
  "devDependencies": {
110
- "@atlaskit/editor-common": "^137.0.0",
110
+ "@atlaskit/editor-common": "^137.1.0",
111
111
  "@atlaskit/link-provider": "^6.2.0",
112
112
  "react": "^19.2.0",
113
113
  "react-intl": "^7.0.0"