@atlaskit/editor-plugin-tasks-and-decisions 2.1.0 → 2.1.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,21 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 2.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#120417](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/120417)
14
+ [`f0b8c2371f9a2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f0b8c2371f9a2) -
15
+ [ux] Fixing tasks and decisions to stop them infinitely re-rendering in React 18 when using
16
+ createRoot.
17
+ - Updated dependencies
18
+
3
19
  ## 2.1.0
4
20
 
5
21
  ### Minor Changes
@@ -13,6 +13,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
13
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _Decision = _interopRequireDefault(require("../ui/Decision"));
17
18
  var _useShowPlaceholder = require("./hooks/use-show-placeholder");
18
19
  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); }; }
@@ -106,6 +107,17 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
106
107
  return !_this.isContentEmpty(_newNode);
107
108
  });
108
109
  }
110
+ }, {
111
+ key: "ignoreMutation",
112
+ value: function ignoreMutation(mutation) {
113
+ if (!(0, _platformFeatureFlags.fg)('react_18_tasks_and_decisions_concurrent_mode')) {
114
+ return false;
115
+ }
116
+ if (!this.contentDOM) {
117
+ return true;
118
+ }
119
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
120
+ }
109
121
  }]);
110
122
  return Decision;
111
123
  }(_reactNodeView.default);
@@ -18,6 +18,7 @@ var _steps = require("@atlaskit/adf-schema/steps");
18
18
  var _analyticsNext = require("@atlaskit/analytics-next");
19
19
  var _hooks = require("@atlaskit/editor-common/hooks");
20
20
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
22
  var _Task = _interopRequireDefault(require("../ui/Task"));
22
23
  var _useShowPlaceholder = require("./hooks/use-show-placeholder");
23
24
  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; }
@@ -198,6 +199,17 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
198
199
  );
199
200
  });
200
201
  }
202
+ }, {
203
+ key: "ignoreMutation",
204
+ value: function ignoreMutation(mutation) {
205
+ if (!(0, _platformFeatureFlags.fg)('react_18_tasks_and_decisions_concurrent_mode')) {
206
+ return false;
207
+ }
208
+ if (!this.contentDOM) {
209
+ return true;
210
+ }
211
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
212
+ }
201
213
  }]);
202
214
  return Task;
203
215
  }(_reactNodeView.default);
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import DecisionItem from '../ui/Decision';
4
5
  import { useShowPlaceholder } from './hooks/use-show-placeholder';
5
6
  const DecisionItemWrapper = ({
@@ -69,6 +70,15 @@ class Decision extends ReactNodeView {
69
70
  // Toggle the placeholder based on whether user input exists.
70
71
  (_currentNode, _newNode) => !this.isContentEmpty(_newNode));
71
72
  }
73
+ ignoreMutation(mutation) {
74
+ if (!fg('react_18_tasks_and_decisions_concurrent_mode')) {
75
+ return false;
76
+ }
77
+ if (!this.contentDOM) {
78
+ return true;
79
+ }
80
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
81
+ }
72
82
  }
73
83
  export const decisionItemNodeView = (portalProviderAPI, eventDispatcher, api) => (node, view, getPos) => {
74
84
  return new Decision(node, view, getPos, portalProviderAPI, eventDispatcher, {}).initWithAPI(api);
@@ -4,6 +4,7 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
4
4
  import { AnalyticsListener } from '@atlaskit/analytics-next';
5
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
6
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import TaskItem from '../ui/Task';
8
9
  import { useShowPlaceholder } from './hooks/use-show-placeholder';
9
10
  const TaskItemWrapper = ({
@@ -162,6 +163,15 @@ class Task extends ReactNodeView {
162
163
  // Toggle the placeholder based on whether user input exists
163
164
  !this.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state));
164
165
  }
166
+ ignoreMutation(mutation) {
167
+ if (!fg('react_18_tasks_and_decisions_concurrent_mode')) {
168
+ return false;
169
+ }
170
+ if (!this.contentDOM) {
171
+ return true;
172
+ }
173
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
174
+ }
165
175
  }
166
176
  export function taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api) {
167
177
  return (node, view, getPos) => {
@@ -8,6 +8,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
8
8
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
9
  import React from 'react';
10
10
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import DecisionItem from '../ui/Decision';
12
13
  import { useShowPlaceholder } from './hooks/use-show-placeholder';
13
14
  var DecisionItemWrapper = function DecisionItemWrapper(_ref) {
@@ -99,6 +100,17 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
99
100
  return !_this.isContentEmpty(_newNode);
100
101
  });
101
102
  }
103
+ }, {
104
+ key: "ignoreMutation",
105
+ value: function ignoreMutation(mutation) {
106
+ if (!fg('react_18_tasks_and_decisions_concurrent_mode')) {
107
+ return false;
108
+ }
109
+ if (!this.contentDOM) {
110
+ return true;
111
+ }
112
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
113
+ }
102
114
  }]);
103
115
  return Decision;
104
116
  }(ReactNodeView);
@@ -15,6 +15,7 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
15
15
  import { AnalyticsListener } from '@atlaskit/analytics-next';
16
16
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
17
17
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import TaskItem from '../ui/Task';
19
20
  import { useShowPlaceholder } from './hooks/use-show-placeholder';
20
21
  var TaskItemWrapper = function TaskItemWrapper(_ref) {
@@ -191,6 +192,17 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
191
192
  );
192
193
  });
193
194
  }
195
+ }, {
196
+ key: "ignoreMutation",
197
+ value: function ignoreMutation(mutation) {
198
+ if (!fg('react_18_tasks_and_decisions_concurrent_mode')) {
199
+ return false;
200
+ }
201
+ if (!this.contentDOM) {
202
+ return true;
203
+ }
204
+ return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
205
+ }
194
206
  }]);
195
207
  return Task;
196
208
  }(ReactNodeView);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,12 +36,13 @@
36
36
  "@atlaskit/adf-schema": "^39.0.3",
37
37
  "@atlaskit/analytics-namespaced-context": "^6.10.0",
38
38
  "@atlaskit/analytics-next": "^9.3.0",
39
- "@atlaskit/editor-common": "^85.0.0",
39
+ "@atlaskit/editor-common": "^86.0.0",
40
40
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
41
41
  "@atlaskit/editor-plugin-context-identifier": "^1.1.0",
42
42
  "@atlaskit/editor-plugin-type-ahead": "^1.4.0",
43
43
  "@atlaskit/editor-prosemirror": "4.0.1",
44
44
  "@atlaskit/icon": "^22.6.0",
45
+ "@atlaskit/platform-feature-flags": "^0.3.0",
45
46
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
46
47
  "@atlaskit/task-decision": "^17.10.0",
47
48
  "@babel/runtime": "^7.0.0",
@@ -54,7 +55,6 @@
54
55
  "devDependencies": {
55
56
  "@af/integration-testing": "*",
56
57
  "@af/visual-regression": "*",
57
- "@atlaskit/platform-feature-flags": "^0.3.0",
58
58
  "@atlaskit/ssr": "*",
59
59
  "@atlaskit/util-data-test": "^17.9.0",
60
60
  "@atlaskit/visual-regression": "*",
@@ -96,5 +96,10 @@
96
96
  "import-no-extraneous-disable-for-examples-and-docs"
97
97
  ]
98
98
  }
99
+ },
100
+ "platform-feature-flags": {
101
+ "react_18_tasks_and_decisions_concurrent_mode": {
102
+ "type": "boolean"
103
+ }
99
104
  }
100
105
  }