@atlaskit/editor-plugin-tasks-and-decisions 2.6.2 → 2.6.3

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,13 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 2.6.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#142911](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142911)
8
+ [`f661df7842ec7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f661df7842ec7) -
9
+ [ux] [ED-24772] create request to edit component under feature toggle
10
+
3
11
  ## 2.6.2
4
12
 
5
13
  ### Patch Changes
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -13,14 +14,18 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
13
14
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _react = _interopRequireDefault(require("react"));
17
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
18
+ var _react = _interopRequireWildcard(require("react"));
17
19
  var _steps = require("@atlaskit/adf-schema/steps");
18
20
  var _analyticsNext = require("@atlaskit/analytics-next");
19
21
  var _hooks = require("@atlaskit/editor-common/hooks");
20
22
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
21
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
+ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
22
25
  var _Task = _interopRequireDefault(require("../ui/Task"));
23
26
  var _useShowPlaceholder = require("./hooks/use-show-placeholder");
27
+ 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); }
28
+ 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 && {}.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; }
24
29
  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; }
25
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
31
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
@@ -38,20 +43,78 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
38
43
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['taskDecision']),
39
44
  taskDecisionState = _useSharedPluginState.taskDecisionState;
40
45
  var isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
46
+ var _useState = (0, _react.useState)(false),
47
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
48
+ isOpen = _useState2[0],
49
+ setIsOpen = _useState2[1];
41
50
  var showPlaceholder = (0, _useShowPlaceholder.useShowPlaceholder)({
42
51
  editorView: editorView,
43
52
  isContentNodeEmpty: isContentNodeEmpty,
44
53
  getPos: getPos,
45
54
  api: api
46
55
  });
47
- return /*#__PURE__*/_react.default.createElement(_Task.default, {
48
- taskId: localId,
49
- contentRef: forwardRef,
50
- isDone: isDone,
51
- onChange: onChange,
52
- isFocused: isFocused,
53
- showPlaceholder: showPlaceholder,
54
- providers: providerFactory
56
+ var onHandleClick = function onHandleClick() {
57
+ if ((0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
58
+ var _api$taskDecision;
59
+ setIsOpen(true);
60
+ var tr = editorView.state.tr;
61
+ var nodePos = getPos();
62
+ if (typeof nodePos !== 'number') {
63
+ return false;
64
+ }
65
+ tr.setMeta('scrollIntoView', false);
66
+
67
+ /**
68
+ * This is a test implementation to call the request to edit mutation
69
+ * from within editor when toggling a task where a user has no edit access.
70
+ *
71
+ * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
72
+ * to connect up the correct user action
73
+ */
74
+ if (!(api !== null && api !== void 0 && (_api$taskDecision = api.taskDecision) !== null && _api$taskDecision !== void 0 && (_api$taskDecision = _api$taskDecision.sharedState.currentState()) !== null && _api$taskDecision !== void 0 && _api$taskDecision.hasEditPermission)) {
75
+ var _api$taskDecision2;
76
+ var requestToEdit = api === null || api === void 0 || (_api$taskDecision2 = api.taskDecision) === null || _api$taskDecision2 === void 0 || (_api$taskDecision2 = _api$taskDecision2.sharedState.currentState()) === null || _api$taskDecision2 === void 0 ? void 0 : _api$taskDecision2.requestToEditContent;
77
+ if (requestToEdit) {
78
+ requestToEdit();
79
+ }
80
+ }
81
+ editorView.dispatch(tr);
82
+ }
83
+ };
84
+ if (!(0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
85
+ return /*#__PURE__*/_react.default.createElement(_Task.default, {
86
+ taskId: localId,
87
+ contentRef: forwardRef,
88
+ isDone: isDone,
89
+ onChange: onChange,
90
+ isFocused: isFocused,
91
+ showPlaceholder: showPlaceholder,
92
+ providers: providerFactory
93
+ });
94
+ }
95
+ return /*#__PURE__*/_react.default.createElement(_popup.default, {
96
+ isOpen: isOpen,
97
+ onClose: function onClose() {
98
+ return setIsOpen(false);
99
+ },
100
+ content: function content() {
101
+ return /*#__PURE__*/_react.default.createElement("div", null, "Content");
102
+ },
103
+ trigger: function trigger(triggerProps) {
104
+ return /*#__PURE__*/_react.default.createElement(_Task.default, {
105
+ taskId: localId,
106
+ contentRef: forwardRef,
107
+ inputRef: triggerProps.ref,
108
+ isDone: isDone,
109
+ onChange: onChange,
110
+ onClick: onHandleClick,
111
+ isFocused: isFocused,
112
+ showPlaceholder: showPlaceholder,
113
+ providers: providerFactory,
114
+ disableOnChange: true
115
+ });
116
+ },
117
+ placement: 'bottom'
55
118
  });
56
119
  };
57
120
  var Task = /*#__PURE__*/function (_ReactNodeView) {
@@ -65,7 +128,6 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
65
128
  }
66
129
  _this = _super.call.apply(_super, [this].concat(args));
67
130
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOnChange", function (taskId, isChecked) {
68
- var _this$api;
69
131
  var tr = _this.view.state.tr;
70
132
  var nodePos = _this.getPos();
71
133
  if (typeof nodePos !== 'number') {
@@ -79,21 +141,6 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
79
141
  localId: taskId
80
142
  }));
81
143
  tr.setMeta('scrollIntoView', false);
82
-
83
- /**
84
- * This is a test implementation to call the request to edit mutation
85
- * from within editor when toggling a task where a user has no edit access.
86
- *
87
- * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
88
- * to connect up the correct user action
89
- */
90
- if (!((_this$api = _this.api) !== null && _this$api !== void 0 && (_this$api = _this$api.taskDecision) !== null && _this$api !== void 0 && (_this$api = _this$api.sharedState.currentState()) !== null && _this$api !== void 0 && _this$api.hasEditPermission) && (0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
91
- var _this$api2;
92
- var requestToEdit = (_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.taskDecision) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.sharedState.currentState()) === null || _this$api2 === void 0 ? void 0 : _this$api2.requestToEditContent;
93
- if (requestToEdit) {
94
- requestToEdit();
95
- }
96
- }
97
144
  _this.view.dispatch(tr);
98
145
  });
99
146
  /**
@@ -116,7 +163,7 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
116
163
  var listSize = resolvedPos.parent.childCount;
117
164
  var listLocalId = resolvedPos.parent.attrs.localId;
118
165
  event.update(function (payload) {
119
- var _this$api3;
166
+ var _this$api;
120
167
  var _payload$attributes = payload.attributes,
121
168
  attributes = _payload$attributes === void 0 ? {} : _payload$attributes,
122
169
  actionSubject = payload.actionSubject;
@@ -130,7 +177,7 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
130
177
  listSize: listSize,
131
178
  listLocalId: listLocalId
132
179
  }, (0, _platformFeatureFlags.fg)('editor_request_to_edit_task') && {
133
- hasEditPermission: (_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.taskDecision) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.sharedState.currentState()) === null || _this$api3 === void 0 ? void 0 : _this$api3.hasEditPermission
180
+ hasEditPermission: (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.taskDecision) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.hasEditPermission
134
181
  })
135
182
  });
136
183
  });
@@ -1,10 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  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
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import Popup from '@atlaskit/popup';
8
9
  import TaskItem from '../ui/Task';
9
10
  import { useShowPlaceholder } from './hooks/use-show-placeholder';
10
11
  const TaskItemWrapper = ({
@@ -22,27 +23,79 @@ const TaskItemWrapper = ({
22
23
  taskDecisionState
23
24
  } = useSharedPluginState(api, ['taskDecision']);
24
25
  const isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
26
+ const [isOpen, setIsOpen] = useState(false);
25
27
  const showPlaceholder = useShowPlaceholder({
26
28
  editorView,
27
29
  isContentNodeEmpty,
28
30
  getPos,
29
31
  api
30
32
  });
31
- return /*#__PURE__*/React.createElement(TaskItem, {
32
- taskId: localId,
33
- contentRef: forwardRef,
34
- isDone: isDone,
35
- onChange: onChange,
36
- isFocused: isFocused,
37
- showPlaceholder: showPlaceholder,
38
- providers: providerFactory
33
+ const onHandleClick = () => {
34
+ if (fg('editor_request_to_edit_task')) {
35
+ var _api$taskDecision, _api$taskDecision$sha;
36
+ setIsOpen(true);
37
+ const {
38
+ tr
39
+ } = editorView.state;
40
+ const nodePos = getPos();
41
+ if (typeof nodePos !== 'number') {
42
+ return false;
43
+ }
44
+ tr.setMeta('scrollIntoView', false);
45
+
46
+ /**
47
+ * This is a test implementation to call the request to edit mutation
48
+ * from within editor when toggling a task where a user has no edit access.
49
+ *
50
+ * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
51
+ * to connect up the correct user action
52
+ */
53
+ if (!(api !== null && api !== void 0 && (_api$taskDecision = api.taskDecision) !== null && _api$taskDecision !== void 0 && (_api$taskDecision$sha = _api$taskDecision.sharedState.currentState()) !== null && _api$taskDecision$sha !== void 0 && _api$taskDecision$sha.hasEditPermission)) {
54
+ var _api$taskDecision2, _api$taskDecision2$sh;
55
+ const requestToEdit = api === null || api === void 0 ? void 0 : (_api$taskDecision2 = api.taskDecision) === null || _api$taskDecision2 === void 0 ? void 0 : (_api$taskDecision2$sh = _api$taskDecision2.sharedState.currentState()) === null || _api$taskDecision2$sh === void 0 ? void 0 : _api$taskDecision2$sh.requestToEditContent;
56
+ if (requestToEdit) {
57
+ requestToEdit();
58
+ }
59
+ }
60
+ editorView.dispatch(tr);
61
+ }
62
+ };
63
+ if (!fg('editor_request_to_edit_task')) {
64
+ return /*#__PURE__*/React.createElement(TaskItem, {
65
+ taskId: localId,
66
+ contentRef: forwardRef,
67
+ isDone: isDone,
68
+ onChange: onChange,
69
+ isFocused: isFocused,
70
+ showPlaceholder: showPlaceholder,
71
+ providers: providerFactory
72
+ });
73
+ }
74
+ return /*#__PURE__*/React.createElement(Popup, {
75
+ isOpen: isOpen,
76
+ onClose: () => setIsOpen(false),
77
+ content: () => /*#__PURE__*/React.createElement("div", null, "Content"),
78
+ trigger: triggerProps => {
79
+ return /*#__PURE__*/React.createElement(TaskItem, {
80
+ taskId: localId,
81
+ contentRef: forwardRef,
82
+ inputRef: triggerProps.ref,
83
+ isDone: isDone,
84
+ onChange: onChange,
85
+ onClick: onHandleClick,
86
+ isFocused: isFocused,
87
+ showPlaceholder: showPlaceholder,
88
+ providers: providerFactory,
89
+ disableOnChange: true
90
+ });
91
+ },
92
+ placement: 'bottom'
39
93
  });
40
94
  };
41
95
  class Task extends ReactNodeView {
42
96
  constructor(...args) {
43
97
  super(...args);
44
98
  _defineProperty(this, "handleOnChange", (taskId, isChecked) => {
45
- var _this$api, _this$api$taskDecisio, _this$api$taskDecisio2;
46
99
  const {
47
100
  tr
48
101
  } = this.view.state;
@@ -58,21 +111,6 @@ class Task extends ReactNodeView {
58
111
  localId: taskId
59
112
  }));
60
113
  tr.setMeta('scrollIntoView', false);
61
-
62
- /**
63
- * This is a test implementation to call the request to edit mutation
64
- * from within editor when toggling a task where a user has no edit access.
65
- *
66
- * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
67
- * to connect up the correct user action
68
- */
69
- if (!((_this$api = this.api) !== null && _this$api !== void 0 && (_this$api$taskDecisio = _this$api.taskDecision) !== null && _this$api$taskDecisio !== void 0 && (_this$api$taskDecisio2 = _this$api$taskDecisio.sharedState.currentState()) !== null && _this$api$taskDecisio2 !== void 0 && _this$api$taskDecisio2.hasEditPermission) && fg('editor_request_to_edit_task')) {
70
- var _this$api2, _this$api2$taskDecisi, _this$api2$taskDecisi2;
71
- const requestToEdit = (_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : (_this$api2$taskDecisi = _this$api2.taskDecision) === null || _this$api2$taskDecisi === void 0 ? void 0 : (_this$api2$taskDecisi2 = _this$api2$taskDecisi.sharedState.currentState()) === null || _this$api2$taskDecisi2 === void 0 ? void 0 : _this$api2$taskDecisi2.requestToEditContent;
72
- if (requestToEdit) {
73
- requestToEdit();
74
- }
75
- }
76
114
  this.view.dispatch(tr);
77
115
  });
78
116
  /**
@@ -95,7 +133,7 @@ class Task extends ReactNodeView {
95
133
  const listSize = resolvedPos.parent.childCount;
96
134
  const listLocalId = resolvedPos.parent.attrs.localId;
97
135
  event.update(payload => {
98
- var _this$api3, _this$api3$taskDecisi, _this$api3$taskDecisi2;
136
+ var _this$api, _this$api$taskDecisio, _this$api$taskDecisio2;
99
137
  const {
100
138
  attributes = {},
101
139
  actionSubject
@@ -112,7 +150,7 @@ class Task extends ReactNodeView {
112
150
  listSize,
113
151
  listLocalId,
114
152
  ...(fg('editor_request_to_edit_task') && {
115
- hasEditPermission: (_this$api3 = this.api) === null || _this$api3 === void 0 ? void 0 : (_this$api3$taskDecisi = _this$api3.taskDecision) === null || _this$api3$taskDecisi === void 0 ? void 0 : (_this$api3$taskDecisi2 = _this$api3$taskDecisi.sharedState.currentState()) === null || _this$api3$taskDecisi2 === void 0 ? void 0 : _this$api3$taskDecisi2.hasEditPermission
153
+ hasEditPermission: (_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$taskDecisio = _this$api.taskDecision) === null || _this$api$taskDecisio === void 0 ? void 0 : (_this$api$taskDecisio2 = _this$api$taskDecisio.sharedState.currentState()) === null || _this$api$taskDecisio2 === void 0 ? void 0 : _this$api$taskDecisio2.hasEditPermission
116
154
  })
117
155
  }
118
156
  };
@@ -6,16 +6,18 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
9
10
  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; }
10
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
12
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
12
13
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
- import React from 'react';
14
+ import React, { useState } from 'react';
14
15
  import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
15
16
  import { AnalyticsListener } from '@atlaskit/analytics-next';
16
17
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
17
18
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
18
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
+ import Popup from '@atlaskit/popup';
19
21
  import TaskItem from '../ui/Task';
20
22
  import { useShowPlaceholder } from './hooks/use-show-placeholder';
21
23
  var TaskItemWrapper = function TaskItemWrapper(_ref) {
@@ -31,20 +33,78 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
31
33
  var _useSharedPluginState = useSharedPluginState(api, ['taskDecision']),
32
34
  taskDecisionState = _useSharedPluginState.taskDecisionState;
33
35
  var isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
36
+ var _useState = useState(false),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ isOpen = _useState2[0],
39
+ setIsOpen = _useState2[1];
34
40
  var showPlaceholder = useShowPlaceholder({
35
41
  editorView: editorView,
36
42
  isContentNodeEmpty: isContentNodeEmpty,
37
43
  getPos: getPos,
38
44
  api: api
39
45
  });
40
- return /*#__PURE__*/React.createElement(TaskItem, {
41
- taskId: localId,
42
- contentRef: forwardRef,
43
- isDone: isDone,
44
- onChange: onChange,
45
- isFocused: isFocused,
46
- showPlaceholder: showPlaceholder,
47
- providers: providerFactory
46
+ var onHandleClick = function onHandleClick() {
47
+ if (fg('editor_request_to_edit_task')) {
48
+ var _api$taskDecision;
49
+ setIsOpen(true);
50
+ var tr = editorView.state.tr;
51
+ var nodePos = getPos();
52
+ if (typeof nodePos !== 'number') {
53
+ return false;
54
+ }
55
+ tr.setMeta('scrollIntoView', false);
56
+
57
+ /**
58
+ * This is a test implementation to call the request to edit mutation
59
+ * from within editor when toggling a task where a user has no edit access.
60
+ *
61
+ * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
62
+ * to connect up the correct user action
63
+ */
64
+ if (!(api !== null && api !== void 0 && (_api$taskDecision = api.taskDecision) !== null && _api$taskDecision !== void 0 && (_api$taskDecision = _api$taskDecision.sharedState.currentState()) !== null && _api$taskDecision !== void 0 && _api$taskDecision.hasEditPermission)) {
65
+ var _api$taskDecision2;
66
+ var requestToEdit = api === null || api === void 0 || (_api$taskDecision2 = api.taskDecision) === null || _api$taskDecision2 === void 0 || (_api$taskDecision2 = _api$taskDecision2.sharedState.currentState()) === null || _api$taskDecision2 === void 0 ? void 0 : _api$taskDecision2.requestToEditContent;
67
+ if (requestToEdit) {
68
+ requestToEdit();
69
+ }
70
+ }
71
+ editorView.dispatch(tr);
72
+ }
73
+ };
74
+ if (!fg('editor_request_to_edit_task')) {
75
+ return /*#__PURE__*/React.createElement(TaskItem, {
76
+ taskId: localId,
77
+ contentRef: forwardRef,
78
+ isDone: isDone,
79
+ onChange: onChange,
80
+ isFocused: isFocused,
81
+ showPlaceholder: showPlaceholder,
82
+ providers: providerFactory
83
+ });
84
+ }
85
+ return /*#__PURE__*/React.createElement(Popup, {
86
+ isOpen: isOpen,
87
+ onClose: function onClose() {
88
+ return setIsOpen(false);
89
+ },
90
+ content: function content() {
91
+ return /*#__PURE__*/React.createElement("div", null, "Content");
92
+ },
93
+ trigger: function trigger(triggerProps) {
94
+ return /*#__PURE__*/React.createElement(TaskItem, {
95
+ taskId: localId,
96
+ contentRef: forwardRef,
97
+ inputRef: triggerProps.ref,
98
+ isDone: isDone,
99
+ onChange: onChange,
100
+ onClick: onHandleClick,
101
+ isFocused: isFocused,
102
+ showPlaceholder: showPlaceholder,
103
+ providers: providerFactory,
104
+ disableOnChange: true
105
+ });
106
+ },
107
+ placement: 'bottom'
48
108
  });
49
109
  };
50
110
  var Task = /*#__PURE__*/function (_ReactNodeView) {
@@ -58,7 +118,6 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
58
118
  }
59
119
  _this = _super.call.apply(_super, [this].concat(args));
60
120
  _defineProperty(_assertThisInitialized(_this), "handleOnChange", function (taskId, isChecked) {
61
- var _this$api;
62
121
  var tr = _this.view.state.tr;
63
122
  var nodePos = _this.getPos();
64
123
  if (typeof nodePos !== 'number') {
@@ -72,21 +131,6 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
72
131
  localId: taskId
73
132
  }));
74
133
  tr.setMeta('scrollIntoView', false);
75
-
76
- /**
77
- * This is a test implementation to call the request to edit mutation
78
- * from within editor when toggling a task where a user has no edit access.
79
- *
80
- * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
81
- * to connect up the correct user action
82
- */
83
- if (!((_this$api = _this.api) !== null && _this$api !== void 0 && (_this$api = _this$api.taskDecision) !== null && _this$api !== void 0 && (_this$api = _this$api.sharedState.currentState()) !== null && _this$api !== void 0 && _this$api.hasEditPermission) && fg('editor_request_to_edit_task')) {
84
- var _this$api2;
85
- var requestToEdit = (_this$api2 = _this.api) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.taskDecision) === null || _this$api2 === void 0 || (_this$api2 = _this$api2.sharedState.currentState()) === null || _this$api2 === void 0 ? void 0 : _this$api2.requestToEditContent;
86
- if (requestToEdit) {
87
- requestToEdit();
88
- }
89
- }
90
134
  _this.view.dispatch(tr);
91
135
  });
92
136
  /**
@@ -109,7 +153,7 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
109
153
  var listSize = resolvedPos.parent.childCount;
110
154
  var listLocalId = resolvedPos.parent.attrs.localId;
111
155
  event.update(function (payload) {
112
- var _this$api3;
156
+ var _this$api;
113
157
  var _payload$attributes = payload.attributes,
114
158
  attributes = _payload$attributes === void 0 ? {} : _payload$attributes,
115
159
  actionSubject = payload.actionSubject;
@@ -123,7 +167,7 @@ var Task = /*#__PURE__*/function (_ReactNodeView) {
123
167
  listSize: listSize,
124
168
  listLocalId: listLocalId
125
169
  }, fg('editor_request_to_edit_task') && {
126
- hasEditPermission: (_this$api3 = _this.api) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.taskDecision) === null || _this$api3 === void 0 || (_this$api3 = _this$api3.sharedState.currentState()) === null || _this$api3 === void 0 ? void 0 : _this$api3.hasEditPermission
170
+ hasEditPermission: (_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.taskDecision) === null || _this$api === void 0 || (_this$api = _this$api.sharedState.currentState()) === null || _this$api === void 0 ? void 0 : _this$api.hasEditPermission
127
171
  })
128
172
  });
129
173
  });
@@ -1,4 +1,4 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ReactElement, Ref } from 'react';
2
2
  import React, { PureComponent } from 'react';
3
3
  import type { WrappedComponentProps } from 'react-intl-next';
4
4
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
@@ -9,10 +9,13 @@ export interface TaskProps {
9
9
  isFocused?: boolean;
10
10
  contentRef?: ContentRef;
11
11
  onChange?: (taskId: string, isChecked: boolean) => void;
12
+ onClick?: () => void;
12
13
  showPlaceholder?: boolean;
13
14
  children?: ReactElement<any>;
14
15
  providers?: ProviderFactory;
15
16
  disabled?: boolean;
17
+ disableOnChange?: boolean;
18
+ inputRef?: Ref<HTMLInputElement>;
16
19
  }
17
20
  export declare class TaskItem extends PureComponent<TaskProps & WrappedComponentProps, {}> {
18
21
  static displayName: string;
@@ -1,4 +1,4 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ReactElement, Ref } from 'react';
2
2
  import React, { PureComponent } from 'react';
3
3
  import type { WrappedComponentProps } from 'react-intl-next';
4
4
  import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
@@ -9,10 +9,13 @@ export interface TaskProps {
9
9
  isFocused?: boolean;
10
10
  contentRef?: ContentRef;
11
11
  onChange?: (taskId: string, isChecked: boolean) => void;
12
+ onClick?: () => void;
12
13
  showPlaceholder?: boolean;
13
14
  children?: ReactElement<any>;
14
15
  providers?: ProviderFactory;
15
16
  disabled?: boolean;
17
+ disableOnChange?: boolean;
18
+ inputRef?: Ref<HTMLInputElement>;
16
19
  }
17
20
  export declare class TaskItem extends PureComponent<TaskProps & WrappedComponentProps, {}> {
18
21
  static displayName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,6 +41,7 @@
41
41
  "@atlaskit/editor-prosemirror": "6.0.0",
42
42
  "@atlaskit/icon": "^22.18.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
+ "@atlaskit/popup": "1.27.0",
44
45
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
45
46
  "@atlaskit/task-decision": "^17.10.0",
46
47
  "@atlaskit/tmp-editor-statsig": "^2.1.8",