@atlaskit/editor-plugin-tasks-and-decisions 2.1.2 → 2.2.0

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,20 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#122895](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122895)
8
+ [`49b8c7658f3b5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/49b8c7658f3b5) -
9
+ [ED-24173] bump @atlaskit/adf-schema to 40.3.0 and @atlassian/adf-schema-json to 1.18.0
10
+
11
+ ### Patch Changes
12
+
13
+ - [#122776](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122776)
14
+ [`6ccf1a43db89a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6ccf1a43db89a) -
15
+ Fix tasks and decisions placeholder not disappearing when using type-ahead on React 18.
16
+ - Updated dependencies
17
+
3
18
  ## 2.1.2
4
19
 
5
20
  ### Patch Changes
@@ -92,20 +92,27 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
92
92
  value: function viewShouldUpdate(nextNode) {
93
93
  /**
94
94
  * To ensure the placeholder is correctly toggled we need to allow react to re-render
95
- * on first character insertion.
96
- * Note: last character deletion is handled externally and automatically re-renders.
95
+ * on first character insertion or when the last character is deleted.
97
96
  */
98
- return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
97
+ if ((0, _platformFeatureFlags.fg)('react_18_tasks_and_decisions_concurrent_mode')) {
98
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
99
+ } else {
100
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode);
101
+ }
99
102
  }
100
103
  }, {
101
104
  key: "update",
102
105
  value: function update(node, decorations) {
103
106
  var _this = this;
104
- return (0, _get2.default)((0, _getPrototypeOf2.default)(Decision.prototype), "update", this).call(this, node, decorations, undefined,
105
- // Toggle the placeholder based on whether user input exists.
106
- function (_currentNode, _newNode) {
107
- return !_this.isContentEmpty(_newNode);
108
- });
107
+ if ((0, _platformFeatureFlags.fg)('react_18_tasks_and_decisions_concurrent_mode')) {
108
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(Decision.prototype), "update", this).call(this, node, decorations);
109
+ } else {
110
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(Decision.prototype), "update", this).call(this, node, decorations, undefined,
111
+ // Toggle the placeholder based on whether user input exists.
112
+ function (_currentNode, _newNode) {
113
+ return !_this.isContentEmpty(_newNode);
114
+ });
115
+ }
109
116
  }
110
117
  }, {
111
118
  key: "ignoreMutation",
@@ -183,21 +183,30 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
183
183
  value: function viewShouldUpdate(nextNode) {
184
184
  /**
185
185
  * To ensure the placeholder is correctly toggled we need to allow react to re-render
186
- * on first character insertion.
187
- * Note: last character deletion is handled externally and automatically re-renders.
186
+ * on first character insertion or when the last character is deleted.
188
187
  */
189
- return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
188
+ if ((0, _platformFeatureFlags.fg)('react_18_tasks_and_decisions_concurrent_mode')) {
189
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
190
+ } else {
191
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode);
192
+ }
190
193
  }
191
194
  }, {
192
195
  key: "update",
193
196
  value: function update(node, decorations) {
194
197
  var _this2 = this;
195
- return (0, _get2.default)((0, _getPrototypeOf2.default)(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
196
- return (
197
- // Toggle the placeholder based on whether user input exists
198
- !_this2.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
199
- );
200
- });
198
+ if ((0, _platformFeatureFlags.fg)('react_18_tasks_and_decisions_concurrent_mode')) {
199
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
200
+ return !!(currentNode.attrs.state === newNode.attrs.state);
201
+ });
202
+ } else {
203
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
204
+ return (
205
+ // Toggle the placeholder based on whether user input exists
206
+ !_this2.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
207
+ );
208
+ });
209
+ }
201
210
  }
202
211
  }, {
203
212
  key: "ignoreMutation",
@@ -22,7 +22,10 @@ var _ToolbarDecision = _interopRequireDefault(require("./ui/ToolbarDecision"));
22
22
  var _ToolbarTask = _interopRequireDefault(require("./ui/ToolbarTask"));
23
23
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
24
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
25
- /** @jsx jsx */
25
+ /**
26
+ * @jsxRuntime classic
27
+ * @jsx jsx
28
+ */
26
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
27
30
 
28
31
  var taskDecisionToolbarGroupStyles = (0, _react.css)({
@@ -60,15 +60,22 @@ class Decision extends ReactNodeView {
60
60
  viewShouldUpdate(nextNode) {
61
61
  /**
62
62
  * To ensure the placeholder is correctly toggled we need to allow react to re-render
63
- * on first character insertion.
64
- * Note: last character deletion is handled externally and automatically re-renders.
63
+ * on first character insertion or when the last character is deleted.
65
64
  */
66
- return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
65
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
66
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
67
+ } else {
68
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode);
69
+ }
67
70
  }
68
71
  update(node, decorations) {
69
- return super.update(node, decorations, undefined,
70
- // Toggle the placeholder based on whether user input exists.
71
- (_currentNode, _newNode) => !this.isContentEmpty(_newNode));
72
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
73
+ return super.update(node, decorations);
74
+ } else {
75
+ return super.update(node, decorations, undefined,
76
+ // Toggle the placeholder based on whether user input exists.
77
+ (_currentNode, _newNode) => !this.isContentEmpty(_newNode));
78
+ }
72
79
  }
73
80
  ignoreMutation(mutation) {
74
81
  if (!fg('react_18_tasks_and_decisions_concurrent_mode')) {
@@ -153,15 +153,22 @@ class Task extends ReactNodeView {
153
153
  viewShouldUpdate(nextNode) {
154
154
  /**
155
155
  * To ensure the placeholder is correctly toggled we need to allow react to re-render
156
- * on first character insertion.
157
- * Note: last character deletion is handled externally and automatically re-renders.
156
+ * on first character insertion or when the last character is deleted.
158
157
  */
159
- return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
158
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
159
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
160
+ } else {
161
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode);
162
+ }
160
163
  }
161
164
  update(node, decorations) {
162
- return super.update(node, decorations, undefined, (currentNode, newNode) =>
163
- // Toggle the placeholder based on whether user input exists
164
- !this.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state));
165
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
166
+ return super.update(node, decorations, undefined, (currentNode, newNode) => !!(currentNode.attrs.state === newNode.attrs.state));
167
+ } else {
168
+ return super.update(node, decorations, undefined, (currentNode, newNode) =>
169
+ // Toggle the placeholder based on whether user input exists
170
+ !this.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state));
171
+ }
165
172
  }
166
173
  ignoreMutation(mutation) {
167
174
  if (!fg('react_18_tasks_and_decisions_concurrent_mode')) {
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { css, jsx } from '@emotion/react';
4
7
  import { decisionItem, decisionList, taskItem, taskList } from '@atlaskit/adf-schema';
@@ -85,20 +85,27 @@ var Decision = /*#__PURE__*/function (_ReactNodeView) {
85
85
  value: function viewShouldUpdate(nextNode) {
86
86
  /**
87
87
  * To ensure the placeholder is correctly toggled we need to allow react to re-render
88
- * on first character insertion.
89
- * Note: last character deletion is handled externally and automatically re-renders.
88
+ * on first character insertion or when the last character is deleted.
90
89
  */
91
- return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
90
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
91
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
92
+ } else {
93
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode);
94
+ }
92
95
  }
93
96
  }, {
94
97
  key: "update",
95
98
  value: function update(node, decorations) {
96
99
  var _this = this;
97
- return _get(_getPrototypeOf(Decision.prototype), "update", this).call(this, node, decorations, undefined,
98
- // Toggle the placeholder based on whether user input exists.
99
- function (_currentNode, _newNode) {
100
- return !_this.isContentEmpty(_newNode);
101
- });
100
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
101
+ return _get(_getPrototypeOf(Decision.prototype), "update", this).call(this, node, decorations);
102
+ } else {
103
+ return _get(_getPrototypeOf(Decision.prototype), "update", this).call(this, node, decorations, undefined,
104
+ // Toggle the placeholder based on whether user input exists.
105
+ function (_currentNode, _newNode) {
106
+ return !_this.isContentEmpty(_newNode);
107
+ });
108
+ }
102
109
  }
103
110
  }, {
104
111
  key: "ignoreMutation",
@@ -176,21 +176,30 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
176
176
  value: function viewShouldUpdate(nextNode) {
177
177
  /**
178
178
  * To ensure the placeholder is correctly toggled we need to allow react to re-render
179
- * on first character insertion.
180
- * Note: last character deletion is handled externally and automatically re-renders.
179
+ * on first character insertion or when the last character is deleted.
181
180
  */
182
- return this.isContentEmpty(this.node) && !!nextNode.content.childCount;
181
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
182
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode) || this.isContentEmpty(nextNode) && !this.isContentEmpty(this.node);
183
+ } else {
184
+ return this.isContentEmpty(this.node) && !this.isContentEmpty(nextNode);
185
+ }
183
186
  }
184
187
  }, {
185
188
  key: "update",
186
189
  value: function update(node, decorations) {
187
190
  var _this2 = this;
188
- return _get(_getPrototypeOf(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
189
- return (
190
- // Toggle the placeholder based on whether user input exists
191
- !_this2.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
192
- );
193
- });
191
+ if (fg('react_18_tasks_and_decisions_concurrent_mode')) {
192
+ return _get(_getPrototypeOf(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
193
+ return !!(currentNode.attrs.state === newNode.attrs.state);
194
+ });
195
+ } else {
196
+ return _get(_getPrototypeOf(Task.prototype), "update", this).call(this, node, decorations, undefined, function (currentNode, newNode) {
197
+ return (
198
+ // Toggle the placeholder based on whether user input exists
199
+ !_this2.isContentEmpty(newNode) && !!(currentNode.attrs.state === newNode.attrs.state)
200
+ );
201
+ });
202
+ }
194
203
  }
195
204
  }, {
196
205
  key: "ignoreMutation",
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { css, jsx } from '@emotion/react';
4
7
  import { decisionItem, decisionList, taskItem, taskList } from '@atlaskit/adf-schema';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,15 +33,15 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/adf-schema": "^39.0.3",
36
+ "@atlaskit/adf-schema": "^40.3.0",
37
37
  "@atlaskit/analytics-namespaced-context": "^6.10.0",
38
38
  "@atlaskit/analytics-next": "^9.3.0",
39
- "@atlaskit/editor-common": "^86.0.0",
40
- "@atlaskit/editor-plugin-analytics": "^1.4.0",
39
+ "@atlaskit/editor-common": "^86.7.0",
40
+ "@atlaskit/editor-plugin-analytics": "^1.5.0",
41
41
  "@atlaskit/editor-plugin-context-identifier": "^1.1.0",
42
- "@atlaskit/editor-plugin-type-ahead": "^1.4.0",
42
+ "@atlaskit/editor-plugin-type-ahead": "^1.5.0",
43
43
  "@atlaskit/editor-prosemirror": "4.0.1",
44
- "@atlaskit/icon": "^22.6.0",
44
+ "@atlaskit/icon": "^22.7.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/prosemirror-input-rules": "^3.1.0",
47
47
  "@atlaskit/task-decision": "^17.10.0",