@atlaskit/editor-plugin-tasks-and-decisions 2.6.5 → 2.6.7

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,19 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 2.6.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.6.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#144261](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144261)
14
+ [`db163b6e55bdb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/db163b6e55bdb) -
15
+ [ux] ED-24773 implement request to edit link in request to edit dialog
16
+
3
17
  ## 2.6.5
4
18
 
5
19
  ### Patch Changes
@@ -23,6 +23,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
23
23
  var _messages = require("@atlaskit/editor-common/messages");
24
24
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
25
25
  var _heading = _interopRequireDefault(require("@atlaskit/heading"));
26
+ var _done = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/done"));
26
27
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
28
  var _popup = _interopRequireDefault(require("@atlaskit/popup"));
28
29
  var _primitives = require("@atlaskit/primitives");
@@ -45,7 +46,8 @@ var wrapperStyles = (0, _primitives.xcss)({
45
46
  });
46
47
  var wrapperBoxStyles = (0, _primitives.xcss)({
47
48
  display: 'flex',
48
- gap: 'space.050'
49
+ gap: 'space.050',
50
+ color: 'color.text.disabled'
49
51
  });
50
52
  var dotStyles = (0, _primitives.xcss)({
51
53
  margin: 'space.100',
@@ -65,18 +67,36 @@ var pressableStyles = (0, _primitives.xcss)({
65
67
  ':active': {
66
68
  color: 'color.text.information'
67
69
  },
68
- padding: 'space.0'
70
+ padding: 'space.0',
71
+ fontSize: '14px'
69
72
  });
70
- var TaskItemWrapper = function TaskItemWrapper(_ref) {
71
- var localId = _ref.localId,
72
- forwardRef = _ref.forwardRef,
73
- isDone = _ref.isDone,
74
- onChange = _ref.onChange,
75
- providerFactory = _ref.providerFactory,
76
- isContentNodeEmpty = _ref.isContentNodeEmpty,
77
- api = _ref.api,
78
- getPos = _ref.getPos,
79
- editorView = _ref.editorView;
73
+ var RequestedMessage = function RequestedMessage() {
74
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
75
+ formatMessage = _useIntl.formatMessage;
76
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, formatMessage(_messages.tasksAndDecisionsMessages.requestToEdit), /*#__PURE__*/_react.default.createElement(_done.default, {
77
+ label: "requested-to-edit",
78
+ primaryColor: "var(--ds-icon-disabled, #091E424F)"
79
+ }));
80
+ };
81
+ var RequestToEditButton = function RequestToEditButton(_ref) {
82
+ var onClick = _ref.onClick;
83
+ var _useIntl2 = (0, _reactIntlNext.useIntl)(),
84
+ formatMessage = _useIntl2.formatMessage;
85
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
86
+ onClick: onClick,
87
+ xcss: pressableStyles
88
+ }, formatMessage(_messages.tasksAndDecisionsMessages.requestToEdit)));
89
+ };
90
+ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
91
+ var localId = _ref2.localId,
92
+ forwardRef = _ref2.forwardRef,
93
+ isDone = _ref2.isDone,
94
+ onChange = _ref2.onChange,
95
+ providerFactory = _ref2.providerFactory,
96
+ isContentNodeEmpty = _ref2.isContentNodeEmpty,
97
+ api = _ref2.api,
98
+ getPos = _ref2.getPos,
99
+ editorView = _ref2.editorView;
80
100
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['taskDecision']),
81
101
  taskDecisionState = _useSharedPluginState.taskDecisionState;
82
102
  var isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
@@ -84,32 +104,28 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
84
104
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
85
105
  isOpen = _useState2[0],
86
106
  setIsOpen = _useState2[1];
87
- var _useIntl = (0, _reactIntlNext.useIntl)(),
88
- formatMessage = _useIntl.formatMessage;
107
+ var _useState3 = (0, _react.useState)(false),
108
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
109
+ requested = _useState4[0],
110
+ setRequested = _useState4[1];
111
+ var _useIntl3 = (0, _reactIntlNext.useIntl)(),
112
+ formatMessage = _useIntl3.formatMessage;
89
113
  var showPlaceholder = (0, _useShowPlaceholder.useShowPlaceholder)({
90
114
  editorView: editorView,
91
115
  isContentNodeEmpty: isContentNodeEmpty,
92
116
  getPos: getPos,
93
117
  api: api
94
118
  });
95
- var onHandleClick = function onHandleClick() {
119
+ var onHandleEdit = function onHandleEdit() {
96
120
  if ((0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
97
121
  var _api$taskDecision;
98
- setIsOpen(true);
122
+ setRequested(true);
99
123
  var tr = editorView.state.tr;
100
124
  var nodePos = getPos();
101
125
  if (typeof nodePos !== 'number') {
102
126
  return;
103
127
  }
104
128
  tr.setMeta('scrollIntoView', false);
105
-
106
- /**
107
- * This is a test implementation to call the request to edit mutation
108
- * from within editor when toggling a task where a user has no edit access.
109
- *
110
- * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
111
- * to connect up the correct user action
112
- */
113
129
  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)) {
114
130
  var _api$taskDecision2;
115
131
  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;
@@ -120,6 +136,11 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
120
136
  editorView.dispatch(tr);
121
137
  }
122
138
  };
139
+ var onHandleClick = function onHandleClick() {
140
+ if ((0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
141
+ setIsOpen(true);
142
+ }
143
+ };
123
144
  if (!(0, _platformFeatureFlags.fg)('editor_request_to_edit_task')) {
124
145
  return /*#__PURE__*/_react.default.createElement(_Task.default, {
125
146
  taskId: localId,
@@ -137,6 +158,7 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
137
158
  return setIsOpen(false);
138
159
  },
139
160
  content: function content() {
161
+ var _api$editorViewMode;
140
162
  return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
141
163
  xcss: wrapperStyles
142
164
  }, /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
@@ -145,9 +167,9 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
145
167
  size: "xsmall"
146
168
  }, formatMessage(_messages.tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/_react.default.createElement("div", null, formatMessage(_messages.tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
147
169
  xcss: wrapperBoxStyles
148
- }, /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
149
- xcss: pressableStyles
150
- }, formatMessage(_messages.tasksAndDecisionsMessages.requestToEdit))), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
170
+ }, requested ? /*#__PURE__*/_react.default.createElement(RequestedMessage, null) : /*#__PURE__*/_react.default.createElement(RequestToEditButton, {
171
+ onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? onHandleEdit : undefined
172
+ }), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
151
173
  xcss: dotStyles
152
174
  }), /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
153
175
  onClick: function onClick() {
@@ -157,18 +179,18 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
157
179
  }, formatMessage(_messages.tasksAndDecisionsMessages.dismiss))))));
158
180
  },
159
181
  trigger: function trigger(triggerProps) {
160
- var _api$editorViewMode, _api$taskDecision3;
182
+ var _api$taskDecision3;
161
183
  return /*#__PURE__*/_react.default.createElement(_Task.default, {
162
184
  taskId: localId,
163
185
  contentRef: forwardRef,
164
186
  inputRef: triggerProps.ref,
165
187
  isDone: isDone,
166
188
  onChange: onChange,
167
- onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? onHandleClick : undefined,
189
+ onClick: onHandleClick,
168
190
  isFocused: isFocused,
169
191
  showPlaceholder: showPlaceholder,
170
192
  providers: providerFactory,
171
- disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3 = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3 !== void 0 && _api$taskDecision3.hasEditPermission) && true
193
+ disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3 = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3 !== void 0 && _api$taskDecision3.hasEditPermission)
172
194
  });
173
195
  },
174
196
  placement: 'bottom-start'
@@ -7,6 +7,7 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
7
  import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
8
8
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
9
9
  import Heading from '@atlaskit/heading';
10
+ import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
10
11
  import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import Popup from '@atlaskit/popup';
12
13
  import { Box, Pressable, Stack, xcss } from '@atlaskit/primitives';
@@ -23,7 +24,8 @@ const wrapperStyles = xcss({
23
24
  });
24
25
  const wrapperBoxStyles = xcss({
25
26
  display: 'flex',
26
- gap: 'space.050'
27
+ gap: 'space.050',
28
+ color: 'color.text.disabled'
27
29
  });
28
30
  const dotStyles = xcss({
29
31
  margin: 'space.100',
@@ -43,8 +45,29 @@ const pressableStyles = xcss({
43
45
  ':active': {
44
46
  color: 'color.text.information'
45
47
  },
46
- padding: 'space.0'
48
+ padding: 'space.0',
49
+ fontSize: '14px'
47
50
  });
51
+ const RequestedMessage = () => {
52
+ const {
53
+ formatMessage
54
+ } = useIntl();
55
+ return /*#__PURE__*/React.createElement(React.Fragment, null, formatMessage(tasksAndDecisionsMessages.requestToEdit), /*#__PURE__*/React.createElement(EditorDoneIcon, {
56
+ label: "requested-to-edit",
57
+ primaryColor: "var(--ds-icon-disabled, #091E424F)"
58
+ }));
59
+ };
60
+ const RequestToEditButton = ({
61
+ onClick
62
+ }) => {
63
+ const {
64
+ formatMessage
65
+ } = useIntl();
66
+ return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
67
+ onClick: onClick,
68
+ xcss: pressableStyles
69
+ }, formatMessage(tasksAndDecisionsMessages.requestToEdit)));
70
+ };
48
71
  const TaskItemWrapper = ({
49
72
  localId,
50
73
  forwardRef,
@@ -61,6 +84,7 @@ const TaskItemWrapper = ({
61
84
  } = useSharedPluginState(api, ['taskDecision']);
62
85
  const isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
63
86
  const [isOpen, setIsOpen] = useState(false);
87
+ const [requested, setRequested] = useState(false);
64
88
  const {
65
89
  formatMessage
66
90
  } = useIntl();
@@ -70,10 +94,10 @@ const TaskItemWrapper = ({
70
94
  getPos,
71
95
  api
72
96
  });
73
- const onHandleClick = () => {
97
+ const onHandleEdit = () => {
74
98
  if (fg('editor_request_to_edit_task')) {
75
99
  var _api$taskDecision, _api$taskDecision$sha;
76
- setIsOpen(true);
100
+ setRequested(true);
77
101
  const {
78
102
  tr
79
103
  } = editorView.state;
@@ -82,14 +106,6 @@ const TaskItemWrapper = ({
82
106
  return;
83
107
  }
84
108
  tr.setMeta('scrollIntoView', false);
85
-
86
- /**
87
- * This is a test implementation to call the request to edit mutation
88
- * from within editor when toggling a task where a user has no edit access.
89
- *
90
- * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
91
- * to connect up the correct user action
92
- */
93
109
  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)) {
94
110
  var _api$taskDecision2, _api$taskDecision2$sh;
95
111
  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;
@@ -100,6 +116,11 @@ const TaskItemWrapper = ({
100
116
  editorView.dispatch(tr);
101
117
  }
102
118
  };
119
+ const onHandleClick = () => {
120
+ if (fg('editor_request_to_edit_task')) {
121
+ setIsOpen(true);
122
+ }
123
+ };
103
124
  if (!fg('editor_request_to_edit_task')) {
104
125
  return /*#__PURE__*/React.createElement(TaskItem, {
105
126
  taskId: localId,
@@ -114,35 +135,38 @@ const TaskItemWrapper = ({
114
135
  return /*#__PURE__*/React.createElement(Popup, {
115
136
  isOpen: isOpen,
116
137
  onClose: () => setIsOpen(false),
117
- content: () => /*#__PURE__*/React.createElement(Box, {
118
- xcss: wrapperStyles
119
- }, /*#__PURE__*/React.createElement(Stack, {
120
- space: "space.150"
121
- }, /*#__PURE__*/React.createElement(Heading, {
122
- size: "xsmall"
123
- }, formatMessage(tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/React.createElement("div", null, formatMessage(tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/React.createElement(Box, {
124
- xcss: wrapperBoxStyles
125
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
126
- xcss: pressableStyles
127
- }, formatMessage(tasksAndDecisionsMessages.requestToEdit))), /*#__PURE__*/React.createElement(Box, {
128
- xcss: dotStyles
129
- }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
130
- onClick: () => setIsOpen(false),
131
- xcss: pressableStyles
132
- }, formatMessage(tasksAndDecisionsMessages.dismiss)))))),
138
+ content: () => {
139
+ var _api$editorViewMode, _api$editorViewMode$s;
140
+ return /*#__PURE__*/React.createElement(Box, {
141
+ xcss: wrapperStyles
142
+ }, /*#__PURE__*/React.createElement(Stack, {
143
+ space: "space.150"
144
+ }, /*#__PURE__*/React.createElement(Heading, {
145
+ size: "xsmall"
146
+ }, formatMessage(tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/React.createElement("div", null, formatMessage(tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/React.createElement(Box, {
147
+ xcss: wrapperBoxStyles
148
+ }, requested ? /*#__PURE__*/React.createElement(RequestedMessage, null) : /*#__PURE__*/React.createElement(RequestToEditButton, {
149
+ onClick: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view' ? onHandleEdit : undefined
150
+ }), /*#__PURE__*/React.createElement(Box, {
151
+ xcss: dotStyles
152
+ }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
153
+ onClick: () => setIsOpen(false),
154
+ xcss: pressableStyles
155
+ }, formatMessage(tasksAndDecisionsMessages.dismiss))))));
156
+ },
133
157
  trigger: triggerProps => {
134
- var _api$editorViewMode, _api$editorViewMode$s, _api$taskDecision3, _api$taskDecision3$sh;
158
+ var _api$taskDecision3, _api$taskDecision3$sh;
135
159
  return /*#__PURE__*/React.createElement(TaskItem, {
136
160
  taskId: localId,
137
161
  contentRef: forwardRef,
138
162
  inputRef: triggerProps.ref,
139
163
  isDone: isDone,
140
164
  onChange: onChange,
141
- onClick: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view' ? onHandleClick : undefined,
165
+ onClick: onHandleClick,
142
166
  isFocused: isFocused,
143
167
  showPlaceholder: showPlaceholder,
144
168
  providers: providerFactory,
145
- disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3$sh = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3$sh !== void 0 && _api$taskDecision3$sh.hasEditPermission) && true
169
+ disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3$sh = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3$sh !== void 0 && _api$taskDecision3$sh.hasEditPermission)
146
170
  });
147
171
  },
148
172
  placement: 'bottom-start'
@@ -19,6 +19,7 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
19
19
  import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
20
20
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
21
21
  import Heading from '@atlaskit/heading';
22
+ import EditorDoneIcon from '@atlaskit/icon/glyph/editor/done';
22
23
  import { fg } from '@atlaskit/platform-feature-flags';
23
24
  import Popup from '@atlaskit/popup';
24
25
  import { Box, Pressable, Stack, xcss } from '@atlaskit/primitives';
@@ -35,7 +36,8 @@ var wrapperStyles = xcss({
35
36
  });
36
37
  var wrapperBoxStyles = xcss({
37
38
  display: 'flex',
38
- gap: 'space.050'
39
+ gap: 'space.050',
40
+ color: 'color.text.disabled'
39
41
  });
40
42
  var dotStyles = xcss({
41
43
  margin: 'space.100',
@@ -55,18 +57,36 @@ var pressableStyles = xcss({
55
57
  ':active': {
56
58
  color: 'color.text.information'
57
59
  },
58
- padding: 'space.0'
60
+ padding: 'space.0',
61
+ fontSize: '14px'
59
62
  });
60
- var TaskItemWrapper = function TaskItemWrapper(_ref) {
61
- var localId = _ref.localId,
62
- forwardRef = _ref.forwardRef,
63
- isDone = _ref.isDone,
64
- onChange = _ref.onChange,
65
- providerFactory = _ref.providerFactory,
66
- isContentNodeEmpty = _ref.isContentNodeEmpty,
67
- api = _ref.api,
68
- getPos = _ref.getPos,
69
- editorView = _ref.editorView;
63
+ var RequestedMessage = function RequestedMessage() {
64
+ var _useIntl = useIntl(),
65
+ formatMessage = _useIntl.formatMessage;
66
+ return /*#__PURE__*/React.createElement(React.Fragment, null, formatMessage(tasksAndDecisionsMessages.requestToEdit), /*#__PURE__*/React.createElement(EditorDoneIcon, {
67
+ label: "requested-to-edit",
68
+ primaryColor: "var(--ds-icon-disabled, #091E424F)"
69
+ }));
70
+ };
71
+ var RequestToEditButton = function RequestToEditButton(_ref) {
72
+ var onClick = _ref.onClick;
73
+ var _useIntl2 = useIntl(),
74
+ formatMessage = _useIntl2.formatMessage;
75
+ return /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
76
+ onClick: onClick,
77
+ xcss: pressableStyles
78
+ }, formatMessage(tasksAndDecisionsMessages.requestToEdit)));
79
+ };
80
+ var TaskItemWrapper = function TaskItemWrapper(_ref2) {
81
+ var localId = _ref2.localId,
82
+ forwardRef = _ref2.forwardRef,
83
+ isDone = _ref2.isDone,
84
+ onChange = _ref2.onChange,
85
+ providerFactory = _ref2.providerFactory,
86
+ isContentNodeEmpty = _ref2.isContentNodeEmpty,
87
+ api = _ref2.api,
88
+ getPos = _ref2.getPos,
89
+ editorView = _ref2.editorView;
70
90
  var _useSharedPluginState = useSharedPluginState(api, ['taskDecision']),
71
91
  taskDecisionState = _useSharedPluginState.taskDecisionState;
72
92
  var isFocused = Boolean((taskDecisionState === null || taskDecisionState === void 0 ? void 0 : taskDecisionState.focusedTaskItemLocalId) === localId);
@@ -74,32 +94,28 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
74
94
  _useState2 = _slicedToArray(_useState, 2),
75
95
  isOpen = _useState2[0],
76
96
  setIsOpen = _useState2[1];
77
- var _useIntl = useIntl(),
78
- formatMessage = _useIntl.formatMessage;
97
+ var _useState3 = useState(false),
98
+ _useState4 = _slicedToArray(_useState3, 2),
99
+ requested = _useState4[0],
100
+ setRequested = _useState4[1];
101
+ var _useIntl3 = useIntl(),
102
+ formatMessage = _useIntl3.formatMessage;
79
103
  var showPlaceholder = useShowPlaceholder({
80
104
  editorView: editorView,
81
105
  isContentNodeEmpty: isContentNodeEmpty,
82
106
  getPos: getPos,
83
107
  api: api
84
108
  });
85
- var onHandleClick = function onHandleClick() {
109
+ var onHandleEdit = function onHandleEdit() {
86
110
  if (fg('editor_request_to_edit_task')) {
87
111
  var _api$taskDecision;
88
- setIsOpen(true);
112
+ setRequested(true);
89
113
  var tr = editorView.state.tr;
90
114
  var nodePos = getPos();
91
115
  if (typeof nodePos !== 'number') {
92
116
  return;
93
117
  }
94
118
  tr.setMeta('scrollIntoView', false);
95
-
96
- /**
97
- * This is a test implementation to call the request to edit mutation
98
- * from within editor when toggling a task where a user has no edit access.
99
- *
100
- * This will eventially be handled by https://product-fabric.atlassian.net/browse/ED-24773
101
- * to connect up the correct user action
102
- */
103
119
  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)) {
104
120
  var _api$taskDecision2;
105
121
  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;
@@ -110,6 +126,11 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
110
126
  editorView.dispatch(tr);
111
127
  }
112
128
  };
129
+ var onHandleClick = function onHandleClick() {
130
+ if (fg('editor_request_to_edit_task')) {
131
+ setIsOpen(true);
132
+ }
133
+ };
113
134
  if (!fg('editor_request_to_edit_task')) {
114
135
  return /*#__PURE__*/React.createElement(TaskItem, {
115
136
  taskId: localId,
@@ -127,6 +148,7 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
127
148
  return setIsOpen(false);
128
149
  },
129
150
  content: function content() {
151
+ var _api$editorViewMode;
130
152
  return /*#__PURE__*/React.createElement(Box, {
131
153
  xcss: wrapperStyles
132
154
  }, /*#__PURE__*/React.createElement(Stack, {
@@ -135,9 +157,9 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
135
157
  size: "xsmall"
136
158
  }, formatMessage(tasksAndDecisionsMessages.editAccessTitle)), /*#__PURE__*/React.createElement("div", null, formatMessage(tasksAndDecisionsMessages.requestToEditDescription)), /*#__PURE__*/React.createElement(Box, {
137
159
  xcss: wrapperBoxStyles
138
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
139
- xcss: pressableStyles
140
- }, formatMessage(tasksAndDecisionsMessages.requestToEdit))), /*#__PURE__*/React.createElement(Box, {
160
+ }, requested ? /*#__PURE__*/React.createElement(RequestedMessage, null) : /*#__PURE__*/React.createElement(RequestToEditButton, {
161
+ onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? onHandleEdit : undefined
162
+ }), /*#__PURE__*/React.createElement(Box, {
141
163
  xcss: dotStyles
142
164
  }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
143
165
  onClick: function onClick() {
@@ -147,18 +169,18 @@ var TaskItemWrapper = function TaskItemWrapper(_ref) {
147
169
  }, formatMessage(tasksAndDecisionsMessages.dismiss))))));
148
170
  },
149
171
  trigger: function trigger(triggerProps) {
150
- var _api$editorViewMode, _api$taskDecision3;
172
+ var _api$taskDecision3;
151
173
  return /*#__PURE__*/React.createElement(TaskItem, {
152
174
  taskId: localId,
153
175
  contentRef: forwardRef,
154
176
  inputRef: triggerProps.ref,
155
177
  isDone: isDone,
156
178
  onChange: onChange,
157
- onClick: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' ? onHandleClick : undefined,
179
+ onClick: onHandleClick,
158
180
  isFocused: isFocused,
159
181
  showPlaceholder: showPlaceholder,
160
182
  providers: providerFactory,
161
- disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3 = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3 !== void 0 && _api$taskDecision3.hasEditPermission) && true
183
+ disableOnChange: !(api !== null && api !== void 0 && (_api$taskDecision3 = api.taskDecision) !== null && _api$taskDecision3 !== void 0 && (_api$taskDecision3 = _api$taskDecision3.sharedState.currentState()) !== null && _api$taskDecision3 !== void 0 && _api$taskDecision3.hasEditPermission)
162
184
  });
163
185
  },
164
186
  placement: 'bottom-start'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "2.6.5",
3
+ "version": "2.6.7",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,14 +41,14 @@
41
41
  "@atlaskit/editor-plugin-type-ahead": "^1.8.0",
42
42
  "@atlaskit/editor-prosemirror": "6.0.0",
43
43
  "@atlaskit/heading": "2.4.5",
44
- "@atlaskit/icon": "^22.18.0",
44
+ "@atlaskit/icon": "22.18.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
- "@atlaskit/popup": "1.27.0",
46
+ "@atlaskit/popup": "1.27.1",
47
47
  "@atlaskit/primitives": "12.2.0",
48
48
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
49
49
  "@atlaskit/task-decision": "^17.11.0",
50
50
  "@atlaskit/tmp-editor-statsig": "^2.1.8",
51
- "@atlaskit/tokens": "^1.61.0",
51
+ "@atlaskit/tokens": "1.61.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1"
54
54
  },