@atlaskit/editor-plugin-tasks-and-decisions 8.4.2 → 8.4.4

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
+ ## 8.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9662879e8506e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9662879e8506e) -
8
+ [ux] EDITOR-1354 Prevent remount of taskItemNodeView children when state is changed
9
+ - Updated dependencies
10
+
11
+ ## 8.4.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [`3922df338eb20`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3922df338eb20) -
16
+ ED-29170: fix tasks under hydration
17
+ - Updated dependencies
18
+
3
19
  ## 8.4.2
4
20
 
5
21
  ### Patch Changes
@@ -146,9 +146,11 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
146
146
  }, {
147
147
  key: "update",
148
148
  value: function update(node) {
149
- var isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
150
- if (!isValidUpdate) {
151
- return false;
149
+ if (!(0, _expValEquals.expValEquals)('platform_editor_prevent_taskitem_remount', 'isEnabled', true)) {
150
+ var isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
151
+ if (!isValidUpdate) {
152
+ return false;
153
+ }
152
154
  }
153
155
  if ((0, _platformFeatureFlags.fg)('platform_editor_task_check_status_fix')) {
154
156
  // Only return false if this is a completely different task
@@ -156,6 +158,19 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
156
158
  return false;
157
159
  }
158
160
  }
161
+ if ((0, _expValEquals.expValEquals)('platform_editor_prevent_taskitem_remount', 'isEnabled', true)) {
162
+ if (node.type !== this.node.type) {
163
+ return false;
164
+ }
165
+ var stateChanged = node.type === this.node.type && !!(node.attrs.state !== this.node.attrs.state);
166
+
167
+ // Update task checkbox state to match document state.
168
+ // It's possible the state may have changed from a collab edit and not from a checkbox click
169
+ // so we need to update the checkbox to match.
170
+ if (stateChanged && this.input) {
171
+ this.input.checked = node.attrs.state === 'DONE';
172
+ }
173
+ }
159
174
  this.updatePlaceholder(node);
160
175
  if (this.domElement && !node.sameMarkup(this.node)) {
161
176
  this.domElement.setAttribute('data-task-state', node.attrs.state);
@@ -60,12 +60,15 @@ function ContentComponent(_ref2) {
60
60
  popupsBoundariesElement = _ref2.popupsBoundariesElement,
61
61
  popupsScrollableElement = _ref2.popupsScrollableElement,
62
62
  dependencyApi = _ref2.dependencyApi;
63
- var domAtPos = editorView.domAtPos.bind(editorView);
64
63
  var openRequestToEditPopupAt = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(dependencyApi, 'taskDecision.openRequestToEditPopupAt');
65
64
  var hasEditPermission = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(dependencyApi, 'taskDecision.hasEditPermission');
65
+ if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
66
+ return null;
67
+ }
66
68
  if (hasEditPermission || !openRequestToEditPopupAt) {
67
69
  return null;
68
70
  }
71
+ var domAtPos = editorView.domAtPos.bind(editorView);
69
72
 
70
73
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
71
74
  var element = (0, _utils.findDomRefAtPos)(openRequestToEditPopupAt, domAtPos);
@@ -130,9 +130,11 @@ export class TaskItemNodeView {
130
130
  }
131
131
  }
132
132
  update(node) {
133
- const isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
134
- if (!isValidUpdate) {
135
- return false;
133
+ if (!expValEquals('platform_editor_prevent_taskitem_remount', 'isEnabled', true)) {
134
+ const isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
135
+ if (!isValidUpdate) {
136
+ return false;
137
+ }
136
138
  }
137
139
  if (fg('platform_editor_task_check_status_fix')) {
138
140
  // Only return false if this is a completely different task
@@ -140,6 +142,19 @@ export class TaskItemNodeView {
140
142
  return false;
141
143
  }
142
144
  }
145
+ if (expValEquals('platform_editor_prevent_taskitem_remount', 'isEnabled', true)) {
146
+ if (node.type !== this.node.type) {
147
+ return false;
148
+ }
149
+ const stateChanged = node.type === this.node.type && !!(node.attrs.state !== this.node.attrs.state);
150
+
151
+ // Update task checkbox state to match document state.
152
+ // It's possible the state may have changed from a collab edit and not from a checkbox click
153
+ // so we need to update the checkbox to match.
154
+ if (stateChanged && this.input) {
155
+ this.input.checked = node.attrs.state === 'DONE';
156
+ }
157
+ }
143
158
  this.updatePlaceholder(node);
144
159
  if (this.domElement && !node.sameMarkup(this.node)) {
145
160
  this.domElement.setAttribute('data-task-state', node.attrs.state);
@@ -49,12 +49,15 @@ function ContentComponent({
49
49
  popupsScrollableElement,
50
50
  dependencyApi
51
51
  }) {
52
- const domAtPos = editorView.domAtPos.bind(editorView);
53
52
  const openRequestToEditPopupAt = useSharedPluginStateSelector(dependencyApi, 'taskDecision.openRequestToEditPopupAt');
54
53
  const hasEditPermission = useSharedPluginStateSelector(dependencyApi, 'taskDecision.hasEditPermission');
54
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
55
+ return null;
56
+ }
55
57
  if (hasEditPermission || !openRequestToEditPopupAt) {
56
58
  return null;
57
59
  }
60
+ const domAtPos = editorView.domAtPos.bind(editorView);
58
61
 
59
62
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
60
63
  const element = findDomRefAtPos(openRequestToEditPopupAt, domAtPos);
@@ -139,9 +139,11 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
139
139
  }, {
140
140
  key: "update",
141
141
  value: function update(node) {
142
- var isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
143
- if (!isValidUpdate) {
144
- return false;
142
+ if (!expValEquals('platform_editor_prevent_taskitem_remount', 'isEnabled', true)) {
143
+ var isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
144
+ if (!isValidUpdate) {
145
+ return false;
146
+ }
145
147
  }
146
148
  if (fg('platform_editor_task_check_status_fix')) {
147
149
  // Only return false if this is a completely different task
@@ -149,6 +151,19 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
149
151
  return false;
150
152
  }
151
153
  }
154
+ if (expValEquals('platform_editor_prevent_taskitem_remount', 'isEnabled', true)) {
155
+ if (node.type !== this.node.type) {
156
+ return false;
157
+ }
158
+ var stateChanged = node.type === this.node.type && !!(node.attrs.state !== this.node.attrs.state);
159
+
160
+ // Update task checkbox state to match document state.
161
+ // It's possible the state may have changed from a collab edit and not from a checkbox click
162
+ // so we need to update the checkbox to match.
163
+ if (stateChanged && this.input) {
164
+ this.input.checked = node.attrs.state === 'DONE';
165
+ }
166
+ }
152
167
  this.updatePlaceholder(node);
153
168
  if (this.domElement && !node.sameMarkup(this.node)) {
154
169
  this.domElement.setAttribute('data-task-state', node.attrs.state);
@@ -51,12 +51,15 @@ function ContentComponent(_ref2) {
51
51
  popupsBoundariesElement = _ref2.popupsBoundariesElement,
52
52
  popupsScrollableElement = _ref2.popupsScrollableElement,
53
53
  dependencyApi = _ref2.dependencyApi;
54
- var domAtPos = editorView.domAtPos.bind(editorView);
55
54
  var openRequestToEditPopupAt = useSharedPluginStateSelector(dependencyApi, 'taskDecision.openRequestToEditPopupAt');
56
55
  var hasEditPermission = useSharedPluginStateSelector(dependencyApi, 'taskDecision.hasEditPermission');
56
+ if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
57
+ return null;
58
+ }
57
59
  if (hasEditPermission || !openRequestToEditPopupAt) {
58
60
  return null;
59
61
  }
62
+ var domAtPos = editorView.domAtPos.bind(editorView);
60
63
 
61
64
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
62
65
  var element = findDomRefAtPos(openRequestToEditPopupAt, domAtPos);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "8.4.2",
3
+ "version": "8.4.4",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,20 +43,20 @@
43
43
  "@atlaskit/editor-shared-styles": "^3.6.0",
44
44
  "@atlaskit/editor-toolbar": "^0.9.0",
45
45
  "@atlaskit/heading": "^5.2.0",
46
- "@atlaskit/icon": "^28.1.0",
46
+ "@atlaskit/icon": "^28.2.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
- "@atlaskit/popup": "^4.3.0",
48
+ "@atlaskit/popup": "^4.4.0",
49
49
  "@atlaskit/primitives": "^14.14.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
51
51
  "@atlaskit/task-decision": "^19.2.0",
52
- "@atlaskit/tmp-editor-statsig": "^12.21.0",
52
+ "@atlaskit/tmp-editor-statsig": "^12.23.0",
53
53
  "@atlaskit/tokens": "^6.3.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@compiled/react": "^0.18.3",
56
56
  "bind-event-listener": "^3.0.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^109.6.0",
59
+ "@atlaskit/editor-common": "^109.8.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
62
  "react-intl-next": "npm:react-intl@^5.18.1"