@atlaskit/editor-plugin-tasks-and-decisions 6.0.1 → 6.0.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,14 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 6.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#187144](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/187144)
8
+ [`a16147d8fbdfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a16147d8fbdfe) -
9
+ Bump @atlaskit/adf-schema to v49.0.5
10
+ - Updated dependencies
11
+
3
12
  ## 6.0.1
4
13
 
5
14
  ### Patch Changes
@@ -12,6 +12,7 @@ var _bindEventListener = require("bind-event-listener");
12
12
  var _steps = require("@atlaskit/adf-schema/steps");
13
13
  var _messages = require("@atlaskit/editor-common/messages");
14
14
  var _model = require("@atlaskit/editor-prosemirror/model");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _helpers = require("../pm-plugins/helpers");
16
17
  var _taskItemNodeSpec = require("./taskItemNodeSpec");
17
18
  var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
@@ -48,11 +49,21 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
48
49
  var currentTaskDecisionState = (_this$api2 = _this.api) === null || _this$api2 === void 0 ? void 0 : _this$api2.taskDecision.sharedState.currentState();
49
50
 
50
51
  // logic is inspired from packages/elements/task-decision/src/components/ResourcedTaskItem.tsx
51
- if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && _this.objectId) {
52
- currentTaskDecisionState === null || currentTaskDecisionState === void 0 || currentTaskDecisionState.taskDecisionProvider.toggleTask({
53
- localId: localId,
54
- objectAri: _this.objectId
55
- }, isDone ? 'DONE' : 'TODO');
52
+ if ((0, _platformFeatureFlags.fg)('platform_editor_task_check_status_fix')) {
53
+ var objectAri = _this.getObjectAri();
54
+ if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && objectAri) {
55
+ currentTaskDecisionState === null || currentTaskDecisionState === void 0 || currentTaskDecisionState.taskDecisionProvider.toggleTask({
56
+ localId: localId,
57
+ objectAri: objectAri
58
+ }, nextState);
59
+ }
60
+ } else {
61
+ if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && _this.objectId) {
62
+ currentTaskDecisionState === null || currentTaskDecisionState === void 0 || currentTaskDecisionState.taskDecisionProvider.toggleTask({
63
+ localId: localId,
64
+ objectAri: _this.objectId
65
+ }, isDone ? 'DONE' : 'TODO');
66
+ }
56
67
  }
57
68
 
58
69
  // SetAttrsStep should be used to prevent task updates from being dropped when mapping task ticks
@@ -134,6 +145,12 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
134
145
  if (!isValidUpdate) {
135
146
  return false;
136
147
  }
148
+ if ((0, _platformFeatureFlags.fg)('platform_editor_task_check_status_fix')) {
149
+ // Only return false if this is a completely different task
150
+ if (this.node.attrs.localId !== node.attrs.localId) {
151
+ return false;
152
+ }
153
+ }
137
154
  this.updatePlaceholder(node);
138
155
  if (this.domElement && !node.sameMarkup(this.node)) {
139
156
  this.domElement.setAttribute('data-task-state', node.attrs.state);
@@ -31,6 +31,9 @@ var taskItemNodeSpec = exports.taskItemNodeSpec = function taskItemNodeSpec() {
31
31
  }
32
32
  });
33
33
  };
34
+ var getCheckBoxId = function getCheckBoxId(localId) {
35
+ return "task-checkbox-".concat(localId);
36
+ };
34
37
 
35
38
  // eslint-disable-next-line jsdoc/require-example
36
39
  /**
@@ -43,9 +46,10 @@ var taskItemNodeSpec = exports.taskItemNodeSpec = function taskItemNodeSpec() {
43
46
  */
44
47
  function taskItemToDom(node, placeholder, intl) {
45
48
  var checked = node.attrs.state === 'DONE';
49
+ var checkboxId = getCheckBoxId(node.attrs.localId);
46
50
  var inputAttrs = {
47
- name: node.attrs.localId,
48
- id: node.attrs.localId,
51
+ name: checkboxId,
52
+ id: checkboxId,
49
53
  type: 'checkbox',
50
54
  'aria-label': intl.formatMessage(checked ? _messages.tasksAndDecisionsMessages.markTaskAsNotCompleted : _messages.tasksAndDecisionsMessages.markTaskAsCompleted)
51
55
  };
@@ -21,6 +21,7 @@ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-
21
21
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
22
22
  var _heading = _interopRequireDefault(require("@atlaskit/heading"));
23
23
  var _checkMarkEditorDone = _interopRequireDefault(require("@atlaskit/icon/core/migration/check-mark--editor-done"));
24
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
25
  var _compiled = require("@atlaskit/primitives/compiled");
25
26
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
27
  // import Popup from '@atlaskit/popup';
@@ -126,7 +127,14 @@ var RequestToEditPopup = exports.RequestToEditPopup = function RequestToEditPopu
126
127
  setIsOpen(false);
127
128
  onClose();
128
129
  };
129
- var onHandleCancel = function onHandleCancel() {
130
+ var onHandleCancel = function onHandleCancel(event) {
131
+ if ((0, _platformFeatureFlags.fg)('platform_editor_task_check_status_fix')) {
132
+ // Check if the click is on task item checkbox, if so, do not close the popup
133
+ var target = event.target;
134
+ if (target && (element.contains(target) || element === target)) {
135
+ return;
136
+ }
137
+ }
130
138
  setIsOpen(false);
131
139
  onClose();
132
140
  };
@@ -3,6 +3,7 @@ import { bindAll } from 'bind-event-listener';
3
3
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
4
4
  import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
5
5
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { openRequestEditPopupAt } from '../pm-plugins/helpers';
7
8
  import { taskItemToDom } from './taskItemNodeSpec';
8
9
  export class TaskItemNodeView {
@@ -41,11 +42,21 @@ export class TaskItemNodeView {
41
42
  const currentTaskDecisionState = (_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : _this$api2.taskDecision.sharedState.currentState();
42
43
 
43
44
  // logic is inspired from packages/elements/task-decision/src/components/ResourcedTaskItem.tsx
44
- if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && this.objectId) {
45
- currentTaskDecisionState === null || currentTaskDecisionState === void 0 ? void 0 : currentTaskDecisionState.taskDecisionProvider.toggleTask({
46
- localId,
47
- objectAri: this.objectId
48
- }, isDone ? 'DONE' : 'TODO');
45
+ if (fg('platform_editor_task_check_status_fix')) {
46
+ const objectAri = this.getObjectAri();
47
+ if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && objectAri) {
48
+ currentTaskDecisionState === null || currentTaskDecisionState === void 0 ? void 0 : currentTaskDecisionState.taskDecisionProvider.toggleTask({
49
+ localId,
50
+ objectAri
51
+ }, nextState);
52
+ }
53
+ } else {
54
+ if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && this.objectId) {
55
+ currentTaskDecisionState === null || currentTaskDecisionState === void 0 ? void 0 : currentTaskDecisionState.taskDecisionProvider.toggleTask({
56
+ localId,
57
+ objectAri: this.objectId
58
+ }, isDone ? 'DONE' : 'TODO');
59
+ }
49
60
  }
50
61
 
51
62
  // SetAttrsStep should be used to prevent task updates from being dropped when mapping task ticks
@@ -118,6 +129,12 @@ export class TaskItemNodeView {
118
129
  if (!isValidUpdate) {
119
130
  return false;
120
131
  }
132
+ if (fg('platform_editor_task_check_status_fix')) {
133
+ // Only return false if this is a completely different task
134
+ if (this.node.attrs.localId !== node.attrs.localId) {
135
+ return false;
136
+ }
137
+ }
121
138
  this.updatePlaceholder(node);
122
139
  if (this.domElement && !node.sameMarkup(this.node)) {
123
140
  this.domElement.setAttribute('data-task-state', node.attrs.state);
@@ -19,6 +19,7 @@ export const taskItemNodeSpec = () => {
19
19
  toDOM: node => lazyTaskItemToDom(node)
20
20
  };
21
21
  };
22
+ const getCheckBoxId = localId => `task-checkbox-${localId}`;
22
23
 
23
24
  // eslint-disable-next-line jsdoc/require-example
24
25
  /**
@@ -31,9 +32,10 @@ export const taskItemNodeSpec = () => {
31
32
  */
32
33
  export function taskItemToDom(node, placeholder, intl) {
33
34
  const checked = node.attrs.state === 'DONE';
35
+ const checkboxId = getCheckBoxId(node.attrs.localId);
34
36
  const inputAttrs = {
35
- name: node.attrs.localId,
36
- id: node.attrs.localId,
37
+ name: checkboxId,
38
+ id: checkboxId,
37
39
  type: 'checkbox',
38
40
  'aria-label': intl.formatMessage(checked ? tasksAndDecisionsMessages.markTaskAsNotCompleted : tasksAndDecisionsMessages.markTaskAsCompleted)
39
41
  };
@@ -13,6 +13,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
13
13
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
14
14
  import Heading from '@atlaskit/heading';
15
15
  import EditorDoneIcon from '@atlaskit/icon/core/migration/check-mark--editor-done';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  import { Box, Pressable, Stack } from '@atlaskit/primitives/compiled';
17
18
  const PopupWithListeners = withOuterListeners(Popup);
18
19
  const TRYING_REQUEST_TIMEOUT = 3000;
@@ -112,7 +113,14 @@ export const RequestToEditPopup = ({
112
113
  setIsOpen(false);
113
114
  onClose();
114
115
  };
115
- const onHandleCancel = () => {
116
+ const onHandleCancel = event => {
117
+ if (fg('platform_editor_task_check_status_fix')) {
118
+ // Check if the click is on task item checkbox, if so, do not close the popup
119
+ const target = event.target;
120
+ if (target && (element.contains(target) || element === target)) {
121
+ return;
122
+ }
123
+ }
116
124
  setIsOpen(false);
117
125
  onClose();
118
126
  };
@@ -5,6 +5,7 @@ import { bindAll } from 'bind-event-listener';
5
5
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
6
6
  import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
7
7
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { openRequestEditPopupAt } from '../pm-plugins/helpers';
9
10
  import { taskItemToDom } from './taskItemNodeSpec';
10
11
  export var TaskItemNodeView = /*#__PURE__*/function () {
@@ -41,11 +42,21 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
41
42
  var currentTaskDecisionState = (_this$api2 = _this.api) === null || _this$api2 === void 0 ? void 0 : _this$api2.taskDecision.sharedState.currentState();
42
43
 
43
44
  // logic is inspired from packages/elements/task-decision/src/components/ResourcedTaskItem.tsx
44
- if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && _this.objectId) {
45
- currentTaskDecisionState === null || currentTaskDecisionState === void 0 || currentTaskDecisionState.taskDecisionProvider.toggleTask({
46
- localId: localId,
47
- objectAri: _this.objectId
48
- }, isDone ? 'DONE' : 'TODO');
45
+ if (fg('platform_editor_task_check_status_fix')) {
46
+ var objectAri = _this.getObjectAri();
47
+ if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && objectAri) {
48
+ currentTaskDecisionState === null || currentTaskDecisionState === void 0 || currentTaskDecisionState.taskDecisionProvider.toggleTask({
49
+ localId: localId,
50
+ objectAri: objectAri
51
+ }, nextState);
52
+ }
53
+ } else {
54
+ if (currentTaskDecisionState !== null && currentTaskDecisionState !== void 0 && currentTaskDecisionState.taskDecisionProvider && _this.objectId) {
55
+ currentTaskDecisionState === null || currentTaskDecisionState === void 0 || currentTaskDecisionState.taskDecisionProvider.toggleTask({
56
+ localId: localId,
57
+ objectAri: _this.objectId
58
+ }, isDone ? 'DONE' : 'TODO');
59
+ }
49
60
  }
50
61
 
51
62
  // SetAttrsStep should be used to prevent task updates from being dropped when mapping task ticks
@@ -127,6 +138,12 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
127
138
  if (!isValidUpdate) {
128
139
  return false;
129
140
  }
141
+ if (fg('platform_editor_task_check_status_fix')) {
142
+ // Only return false if this is a completely different task
143
+ if (this.node.attrs.localId !== node.attrs.localId) {
144
+ return false;
145
+ }
146
+ }
130
147
  this.updatePlaceholder(node);
131
148
  if (this.domElement && !node.sameMarkup(this.node)) {
132
149
  this.domElement.setAttribute('data-task-state', node.attrs.state);
@@ -23,6 +23,9 @@ export var taskItemNodeSpec = function taskItemNodeSpec() {
23
23
  }
24
24
  });
25
25
  };
26
+ var getCheckBoxId = function getCheckBoxId(localId) {
27
+ return "task-checkbox-".concat(localId);
28
+ };
26
29
 
27
30
  // eslint-disable-next-line jsdoc/require-example
28
31
  /**
@@ -35,9 +38,10 @@ export var taskItemNodeSpec = function taskItemNodeSpec() {
35
38
  */
36
39
  export function taskItemToDom(node, placeholder, intl) {
37
40
  var checked = node.attrs.state === 'DONE';
41
+ var checkboxId = getCheckBoxId(node.attrs.localId);
38
42
  var inputAttrs = {
39
- name: node.attrs.localId,
40
- id: node.attrs.localId,
43
+ name: checkboxId,
44
+ id: checkboxId,
41
45
  type: 'checkbox',
42
46
  'aria-label': intl.formatMessage(checked ? tasksAndDecisionsMessages.markTaskAsNotCompleted : tasksAndDecisionsMessages.markTaskAsCompleted)
43
47
  };
@@ -14,6 +14,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
14
14
  import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
15
15
  import Heading from '@atlaskit/heading';
16
16
  import EditorDoneIcon from '@atlaskit/icon/core/migration/check-mark--editor-done';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import { Box, Pressable, Stack } from '@atlaskit/primitives/compiled';
18
19
  var PopupWithListeners = withOuterListeners(Popup);
19
20
  var TRYING_REQUEST_TIMEOUT = 3000;
@@ -117,7 +118,14 @@ export var RequestToEditPopup = function RequestToEditPopup(_ref2) {
117
118
  setIsOpen(false);
118
119
  onClose();
119
120
  };
120
- var onHandleCancel = function onHandleCancel() {
121
+ var onHandleCancel = function onHandleCancel(event) {
122
+ if (fg('platform_editor_task_check_status_fix')) {
123
+ // Check if the click is on task item checkbox, if so, do not close the popup
124
+ var target = event.target;
125
+ if (target && (element.contains(target) || element === target)) {
126
+ return;
127
+ }
128
+ }
121
129
  setIsOpen(false);
122
130
  onClose();
123
131
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/adf-schema": "^47.6.0",
35
+ "@atlaskit/adf-schema": "^49.0.6",
36
36
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
37
37
  "@atlaskit/analytics-next": "^11.1.0",
38
38
  "@atlaskit/css": "^0.12.0",
@@ -49,14 +49,14 @@
49
49
  "@atlaskit/primitives": "^14.10.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.3.0",
51
51
  "@atlaskit/task-decision": "^19.2.0",
52
- "@atlaskit/tmp-editor-statsig": "^9.0.0",
53
- "@atlaskit/tokens": "^5.4.0",
52
+ "@atlaskit/tmp-editor-statsig": "^9.7.0",
53
+ "@atlaskit/tokens": "^5.5.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": "^107.7.0",
59
+ "@atlaskit/editor-common": "^107.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"
@@ -109,6 +109,9 @@
109
109
  "platform-feature-flags": {
110
110
  "should-render-to-parent-should-be-true-editor-ai": {
111
111
  "type": "boolean"
112
+ },
113
+ "platform_editor_task_check_status_fix": {
114
+ "type": "boolean"
112
115
  }
113
116
  }
114
117
  }